/* The reading card of an online magazine, alone on white. GSAP moves only whole elements (the faces, the quote card,
   the toolbar, the lines of text); colours, edges and states live in CSS on classes. A GSAP element never has a
   transform in the CSS. */
:root {
  --page: #ffffff;          /* the page */
  --card: #fdfcfa;          /* the reading card */
  --edge: rgba(24, 22, 18, 0.08);  /* the card edge */
  --ink: #1b1915;           /* the main text */
  --muted: #8a857c;         /* labels and notes */
  --faint: #ece8e1;         /* lines and quiet fills */
  --tide: #2c6b66;          /* the one accent: the highlight, the selected chip, the button */
  --tide-deep: #173f3c;     /* the accent in shadow */
  --mark: rgba(44, 107, 102, 0.17);  /* the highlighter on the sentence */
  --paper: #f3ede2;         /* the paper background of the quote card */
  --ember: #b4532f;         /* the warm background of the quote card */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 14px;
}

/* ---- the card ---- */
.reader {
  position: relative;
  width: min(360px, 92vw);
  border-radius: 22px;
  background: var(--card);
  border: 1px solid var(--edge);
  box-shadow:
    0 1px 1px rgba(30, 24, 14, 0.04),
    0 4px 10px -4px rgba(30, 24, 14, 0.07),
    0 26px 50px -24px rgba(30, 24, 14, 0.22),
    inset 0 1px 0 #ffffff;
}
.reader__light {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 70% at 12% -10%, rgba(44, 107, 102, 0.06), transparent 60%);
}
.faces { display: grid; }
.face {
  grid-area: 1 / 1;
  padding: clamp(14px, 3.6vh, 22px) clamp(15px, 4.4vw, 22px) clamp(13px, 3.2vh, 19px);
  display: grid;
  align-content: start;
  gap: clamp(8px, 2.2vh, 13px);
  position: relative;
}

/* ---- the article face ---- */
.meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.mark {
  width: 22px; height: 22px; border-radius: 7px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #3a7d77, var(--tide-deep));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 5px -2px rgba(23, 63, 60, 0.6);
}
.mark svg { width: 15px; height: 15px; fill: none; stroke: #eaf3f1; stroke-width: 1.8; stroke-linecap: round; }
.meta__brand { font-weight: 640; letter-spacing: 0.005em; }
.meta__time { margin-left: auto; color: var(--muted); font-variation-settings: "wdth" 92; }

.title {
  font-family: "Fraunces Variable", Georgia, serif;
  font-variation-settings: "opsz" 48, "SOFT" 40, "WONK" 0;
  font-weight: 560;
  font-size: clamp(17px, 4.6vh, 20.5px);
  line-height: 1.14;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
.body {
  font-family: "Fraunces Variable", Georgia, serif;
  font-variation-settings: "opsz" 14, "SOFT" 60;
  font-weight: 380;
  font-size: clamp(13px, 3.4vh, 14.5px);
  line-height: 1.56;
  color: #3b372f;
}
.hl {
  --p: 0%;
  color: inherit;
  border-radius: 3px;
  padding: 1px 0;
  background-color: transparent;
  background-image: linear-gradient(var(--mark), var(--mark));
  background-repeat: no-repeat;
  background-size: var(--p) 100%;
  cursor: pointer;
  outline: none;
  transition: color 0.4s ease;
}
.hl.is-on { color: var(--ink); }
.hl:focus-visible { box-shadow: 0 0 0 2px var(--page), 0 0 0 3.5px var(--tide); }
.reader.is-sharing .hl { color: transparent; }

.byline { display: flex; align-items: center; gap: 10px; padding-top: clamp(6px, 1.6vh, 10px); border-top: 1px solid var(--faint); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 680; letter-spacing: 0.02em; color: #fff7ef;
  background: radial-gradient(circle at 30% 25%, #d98a5f, #8e3f22 75%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 2px 6px -2px rgba(142, 63, 34, 0.6);
}
.byline__txt { display: grid; line-height: 1.2; }
.byline__name { font-size: 12.5px; font-weight: 620; }
.byline__date { font-size: 11px; color: var(--muted); }
.shares { margin-left: auto; display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 560; }
.shares svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.shares__roll, .pick__name, .copy__roll { position: relative; display: grid; overflow: hidden; }
.shares__line, .pick__line, .copy__line { grid-area: 1 / 1; white-space: nowrap; }
.shares.is-up { color: var(--tide); }

/* ---- the selection bar ---- */
.face--article { grid-template-rows: auto auto auto auto 1fr; }
.bar {
  align-self: end;
  display: flex; align-items: center; gap: 2px;
  padding: 4px 4px 4px 12px;
  border-radius: 13px;
  background: linear-gradient(180deg, #2a2823, #181713);
  color: #f6f3ec;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 12px 26px -10px rgba(20, 16, 10, 0.55), 0 2px 5px rgba(20, 16, 10, 0.18);
  opacity: 0; visibility: hidden;
  z-index: 3;
}
.bar__info { display: flex; align-items: baseline; gap: 5px; margin-right: auto; font-size: 11.5px; }
.bar__count { font-weight: 640; }
.bar__sub { color: rgba(246, 243, 236, 0.55); }
.bar__btn {
  position: relative; z-index: 1;
  height: 30px; min-width: 30px; padding: 0 8px;
  display: flex; align-items: center; gap: 6px;
  border-radius: 9px;
  font-size: 12px; font-weight: 600;
  transition: background-color 0.2s ease;
}
.bar__btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.bar__btn--main { background: rgba(255, 255, 255, 0.08); }
.bar__btn.is-press { background: rgba(255, 255, 255, 0.16); }
.bar__btn:focus-visible { outline: 2px solid #9fd1ca; outline-offset: 1px; }
.bar__sep { width: 1px; height: 16px; background: rgba(255, 255, 255, 0.12); }

/* ---- the share face ---- */
.face--share { visibility: hidden; }
.top { display: flex; align-items: center; gap: 8px; }
.back {
  width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
  background: #f3f0ea; box-shadow: inset 0 0 0 1px var(--edge);
}
.back svg { width: 15px; height: 15px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.back:focus-visible, .chip:focus-visible, .save:focus-visible, .copy:focus-visible { outline: 2px solid var(--tide); outline-offset: 2px; }
.top__title { font-size: 13px; font-weight: 640; }
.top__size { margin-left: auto; font-size: 11px; color: var(--muted); font-variation-settings: "wdth" 92; }

.qcard {
  position: relative;
  height: clamp(132px, 37vh, 178px);
  border-radius: 16px;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 1px 1px rgba(30, 24, 14, 0.06), 0 16px 30px -16px rgba(30, 24, 14, 0.4), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  --gx: 30%; --gy: 0%;
  color: #2a241b;
  transition: color 0.5s ease;
}
.qcard.is-tide, .qcard.is-ember { color: #fbf6ee; }
.qcard__mat { position: absolute; inset: 0; z-index: -2; opacity: 0; }
.qcard__mat--paper { opacity: 1; background: radial-gradient(130% 90% at 0% 0%, #fbf7f0, var(--paper) 55%, #e9e0d0); }
.qcard__mat--tide { background: radial-gradient(120% 100% at 15% 0%, #4b928b, var(--tide) 42%, var(--tide-deep) 100%); }
.qcard__mat--ember { background: radial-gradient(120% 100% at 15% 0%, #e48a5c, var(--ember) 45%, #5b2413 100%); }
.qcard__grain { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; opacity: 0.09; mix-blend-mode: overlay; pointer-events: none; }
.qcard__glow {
  position: absolute; inset: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(60% 70% at var(--gx) var(--gy), rgba(255, 255, 255, 0.28), transparent 70%);
  mix-blend-mode: soft-light;
}
.qcard__sweep {
  position: absolute; top: -20%; bottom: -20%; left: 0; width: 40%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.42) 48%, rgba(255, 255, 255, 0.1) 56%, transparent);
  mix-blend-mode: soft-light;
  opacity: 0;
}
.qcard__flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.qcard__in {
  position: relative; height: 100%;
  padding: clamp(12px, 3vh, 16px) clamp(14px, 4vw, 17px);
  display: grid; grid-template-rows: auto 1fr auto; gap: 6px;
}
.qcard__glyph { width: 22px; height: 16px; fill: var(--tide); opacity: 0.9; transition: fill 0.5s ease; }
.qcard.is-tide .qcard__glyph { fill: #bfe3dd; }
.qcard.is-ember .qcard__glyph { fill: #ffd1b4; }
.qcard__text {
  align-self: center;
  font-family: "Fraunces Variable", Georgia, serif;
  font-style: italic;
  font-variation-settings: "opsz" 36, "SOFT" 80, "WONK" 1;
  font-weight: 440;
  font-size: clamp(15px, 4.2vh, 18.5px);
  line-height: 1.22;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.qcard__by { display: flex; align-items: flex-end; gap: 8px; }
.qcard__who { display: grid; font-size: 10.5px; line-height: 1.25; }
.qcard__who b { font-weight: 640; }
.qcard__who span { opacity: 0.62; }
.qcard__mark { width: 18px; height: 18px; margin-left: auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; opacity: 0.55; }

.pick { display: flex; align-items: center; gap: 8px; font-size: 11.5px; }
.pick__label { color: var(--muted); }
.pick__name { font-weight: 620; }
.pick__chips { margin-left: auto; display: flex; gap: 8px; }
.chip {
  position: relative; width: 24px; height: 24px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.chip::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--tide);
  opacity: 0; transition: opacity 0.25s ease;
}
.chip.is-on::after { opacity: 1; }
.chip--paper { background: radial-gradient(circle at 30% 25%, #fbf7f0, #e3d8c4); }
.chip--tide { background: radial-gradient(circle at 30% 25%, #4b928b, var(--tide-deep)); }
.chip--ember { background: radial-gradient(circle at 30% 25%, #e48a5c, #6d2c17); }

.acts { display: flex; gap: 8px; }
.copy {
  flex: 1; height: 42px; border-radius: 13px;
  background: linear-gradient(180deg, #357872, var(--tide) 45%, #235955);
  color: #f4fbf9;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 0 0 1px rgba(23, 63, 60, 0.6), 0 10px 20px -10px rgba(23, 63, 60, 0.7);
  transition: background 0.3s ease;
}
.copy__face { display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%; font-size: 13.5px; font-weight: 640; }
.copy__icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.copy__tick { stroke-width: 1.9; opacity: 0; }
.copy.is-done .copy__sheet { opacity: 0; }
.copy.is-done .copy__tick { opacity: 1; }
.copy__sheet { transition: opacity 0.2s ease; }
.save {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: #f3f0ea; box-shadow: inset 0 0 0 1px var(--edge);
}
.save svg { width: 17px; height: 17px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

@media (hover: hover) {
  .hl:not(.is-on):hover { background-color: rgba(44, 107, 102, 0.06); }
  .bar__btn:hover { background: rgba(255, 255, 255, 0.14); }
  .back:hover, .save:hover { background: #ebe7df; }
  .copy:hover { background: linear-gradient(180deg, #3b827b, #2f716b 45%, #255d58); }
}

.ghost {
  position: fixed; left: 0; top: 0;
  width: 22px; height: 22px;
  pointer-events: none;
  opacity: 0;
  z-index: 10;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
.ghost path { fill: #1b1915; stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; }

@media (max-height: 470px) {
  .byline__date { display: none; }
  .avatar { width: 24px; height: 24px; }
}
