/* =============================================================================
   استقالة من نفسك - "The listening room". The structure and motion of the author's
   «المدير الأعمى» audiobook page, in Istiqala's palette: abyss, deep teal, pearl, blush.
   Display: El Messiri. Text: IBM Plex Sans Arabic. No letter-spacing on Arabic.
   ========================================================================== */

:root {
  --bg: #05090d;
  --bg-raise: #0f1d27;
  --panel: #0a151d;
  --tide: #17303c;
  --mist: #7f98a3;
  --fog: #b4c6cc;
  --pearl: #e9f1ef;
  --halo: #f6faf8;
  --blush: #efc9bf;
  --blush-2: #f6dcd4;
  --blush-deep: #c98f86;
  --line: rgba(233, 241, 239, 0.12);
  --line-2: rgba(233, 241, 239, 0.2);

  --f-display: 'El Messiri', 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --f-text: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);

  --header-h: 76px;
  --gutter: clamp(16px, 4vw, 56px);
  color-scheme: dark;
}
@media (max-width: 899px) {
  :root { --header-h: 60px; }
}

*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-block-size: 100vh;
  background: var(--bg);
  color: var(--pearl);
  font-family: var(--f-text);
  font-size: 1.0625rem;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
/* Film grain: a fixed, static noise tile - the texture of a dim room. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

[hidden] { display: none !important; }
img, svg, canvas { display: block; }
button { font: inherit; color: inherit; }
a { color: inherit; }
p { margin: 0; }
:focus-visible {
  outline: 2px solid var(--blush);
  outline-offset: 3px;
  border-radius: 8px;
}
.visually-hidden {
  position: absolute !important;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  inset-block-start: -80px;
  inset-inline-start: 12px;
  z-index: 100;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--blush);
  color: #1a0d0a;
  font-weight: 600;
  text-decoration: none;
  transition: inset-block-start 0.3s var(--ease-out);
}
.skip-link:focus { inset-block-start: 12px; }

/* ================================ HEADER ================================== */
.site-header {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 50;
  block-size: var(--header-h);
  border-block-end: 1px solid transparent;
  transition: background-color 0.5s var(--ease-soft), border-color 0.5s var(--ease-soft);
}
.site-header.is-scrolled {
  background: rgba(5, 9, 13, 0.76);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border-block-end-color: var(--line);
}
.site-header__row {
  block-size: 100%;
  max-inline-size: 1680px;
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}
.site-header__brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.12rem;
  line-height: 1.4;
  color: var(--halo);
  white-space: nowrap;
}
.site-header .btn { justify-self: end; }
.brand-mark {
  inline-size: 26px;
  block-size: 26px;
  flex: none;
  fill: none;
  stroke: var(--blush);
  stroke-width: 2;
}
.brand-mark__dot { fill: var(--blush); stroke: none; }

/* ================================ BUTTONS ================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-block-size: 48px;
  padding-inline: 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--f-text);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.45;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.35s var(--ease-out), background-color 0.35s, box-shadow 0.35s, border-color 0.35s;
}
.btn--sm { min-block-size: 42px; padding-inline: 18px; font-size: 0.9rem; }
.btn--blush {
  background: var(--blush);
  color: #1a0d0a;
  box-shadow: 0 10px 28px -12px rgba(239, 201, 191, 0.6);
}
.btn--blush:hover { background: var(--blush-2); transform: translateY(-1px); box-shadow: 0 14px 34px -12px rgba(239, 201, 191, 0.75); }
.btn--ghost { background: rgba(233, 241, 239, 0.06); color: var(--pearl); border-color: var(--line-2); }
.btn--ghost:hover { background: rgba(233, 241, 239, 0.11); }
.btn__icon {
  inline-size: 16px;
  block-size: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============================ edition switch ============================== */
.eds {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(15, 29, 39, 0.66);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.eds__btn {
  display: grid;
  gap: 0;
  align-content: center;
  min-block-size: 46px;
  padding: 3px 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fog);
  text-align: center;
  line-height: 1.3;
  cursor: pointer;
  transition: background-color 0.35s, color 0.35s, box-shadow 0.35s;
}
.eds__btn b { font-weight: 600; font-size: 0.98rem; }
.eds__btn small { font-size: 0.72rem; font-weight: 500; color: var(--mist); transition: color 0.35s; }
button.eds__btn:not([aria-pressed='true']):hover { background: rgba(233, 241, 239, 0.07); color: var(--halo); }
.eds__btn[aria-pressed='true'] {
  background: linear-gradient(160deg, var(--halo), var(--pearl));
  color: #07131a;
  box-shadow: 0 6px 18px -8px rgba(239, 201, 191, 0.55);
}
.eds__btn[aria-pressed='true'] small { color: #46606b; }
.eds__btn--soon { cursor: default; opacity: 0.6; }
.eds__btn--soon small { color: var(--blush); }
.eds--head { justify-self: center; }
.eds--hero { display: none; }

/* ============================= HERO · LISTEN ============================== */
.hero {
  --stage: clamp(300px, min(62vh, 34vw), 640px);
  --play: clamp(88px, 6.2vw, 116px);
  --word: min(5.9vw, 8.4rem);
  --word-h: calc(var(--word) * 1.3);
  position: relative;
  isolation: isolate;
  overflow: clip;
  min-block-size: 100svh;
  display: flex;
  flex-direction: column;
  padding-block: calc(var(--header-h) + clamp(6px, 1.4vh, 22px)) clamp(18px, 3.4vh, 40px);
}

/* The room: a soft blush lamp behind the stage, a faint beam from above. */
.hero__atmos { position: absolute; inset: 0; z-index: -1; pointer-events: none; animation: fade-in 2.2s ease-out backwards; }
.hero__glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(closest-side at 50% 44%, rgba(239, 201, 191, 0.16), rgba(239, 201, 191, 0) 100%) 50% 44% / min(92vh, 96%) min(92vh, 96%) no-repeat,
    radial-gradient(58% 55% at 50% 44%, rgba(23, 48, 60, 0.95), rgba(23, 48, 60, 0) 78%);
  -webkit-mask: linear-gradient(to bottom, #000 70%, transparent 100%);
  mask: linear-gradient(to bottom, #000 70%, transparent 100%);
}
.hero__beam {
  position: absolute;
  inset: 0;
  background: conic-gradient(at 50% -6%, transparent 0deg 163deg, rgba(233, 241, 239, 0.04) 171deg, rgba(246, 250, 248, 0.08) 180deg, rgba(233, 241, 239, 0.04) 189deg, transparent 197deg 360deg);
  -webkit-mask: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.7) 45%, transparent 80%);
  mask: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.7) 45%, transparent 80%);
}

.hero__player {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  inline-size: 100%;
  max-inline-size: 1680px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Desktop composition: the two words of the title flank the stage, which spans the
   first three rows (they add up to exactly --stage). The eyebrow sits over the first
   word, the facts under the second, the transport clasps the ring from below. */
.hero__grid {
  transition: opacity 0.45s var(--ease-soft);
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--stage) minmax(0, 1fr);
  grid-template-rows:
    calc((var(--stage) - var(--word-h)) / 2)
    var(--word-h)
    calc((var(--stage) - var(--word-h)) / 2)
    auto;
  column-gap: clamp(12px, 1.6vw, 34px);
}

.hero__eyebrow {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  justify-self: end;
  margin-block-end: clamp(6px, 1.2vh, 14px);
  position: relative;
  z-index: 3;
  translate: calc(var(--exit, 0) * 5vw) 0;
  opacity: calc(1 - var(--exit, 0));
}
.hero__eyebrow-in {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-block: 7px;
  padding-inline: 12px 16px;
  border-radius: 999px;
  background: rgba(239, 201, 191, 0.09);
  border: 1px solid rgba(239, 201, 191, 0.3);
  color: var(--blush-2);
  font-size: clamp(0.84rem, 0.86vw, 1rem);
  font-weight: 600;
  line-height: 1.5;
  animation: rise 1s var(--ease-out) 0.85s backwards;
}
.hero__eyebrow-in svg {
  inline-size: 18px;
  block-size: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero__title {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--stage) minmax(0, 1fr);
  column-gap: clamp(12px, 1.6vw, 34px);
  align-items: center;
  margin: 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: var(--word);
  line-height: 1.3;
  position: relative;
  z-index: 3;
  pointer-events: none;
}
.hero__word { display: block; opacity: calc(1 - var(--exit, 0) * 0.9); }
.hero__word--a { grid-column: 1; justify-self: end; color: var(--halo); translate: calc(var(--exit, 0) * 6vw) 0; }
.hero__word--b {
  grid-column: 3;
  justify-self: start;
  color: var(--blush);
  filter: drop-shadow(0 12px 40px rgba(239, 201, 191, 0.2));
  translate: calc(var(--exit, 0) * -6vw) 0;
}
.hero__word-in {
  display: inline-block;
  white-space: nowrap;
  text-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}
.hero__word--a .hero__word-in { animation: word-in-a 1.6s var(--ease-out) 0.45s backwards; }
.hero__word--b .hero__word-in {
  background: linear-gradient(100deg, var(--blush-2), var(--blush) 55%, #d9a69b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  animation: word-in-b 1.6s var(--ease-out) 0.6s backwards;
}

.hero__meta {
  grid-column: 3;
  grid-row: 3;
  align-self: start;
  justify-self: start;
  list-style: none;
  margin: clamp(8px, 1.4vh, 18px) 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-size: clamp(0.9rem, 0.92vw, 1.05rem);
  font-weight: 500;
  line-height: 1.6;
  color: var(--fog);
  position: relative;
  z-index: 3;
  opacity: calc(1 - var(--exit, 0));
}
.hero__meta li { display: flex; align-items: center; gap: 10px; animation: rise 1s var(--ease-out) backwards; }
.hero__meta li:nth-child(1) { animation-delay: 0.95s; }
.hero__meta li:nth-child(2) { animation-delay: 1.03s; }
.hero__meta li:nth-child(3) { animation-delay: 1.11s; }
.hero__meta li::before {
  content: '';
  inline-size: 6px;
  block-size: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--blush);
  box-shadow: 0 0 10px rgba(239, 201, 191, 0.8);
}

/* ------------------------------- the stage -------------------------------- */
.stage {
  grid-column: 2;
  grid-row: 1 / 4;
  position: relative;
  inline-size: var(--stage);
  block-size: var(--stage);
  z-index: 2;
  opacity: calc(1 - var(--exit, 0) * 0.8);
}
.stage__ring {
  position: absolute;
  left: -15%;
  top: -15%;
  width: 130%;
  height: 130%;
  pointer-events: none;
}
html:not(.js) .stage::before {
  content: '';
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  border: 2px dotted rgba(239, 201, 191, 0.4);
}
.stage__book {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  perspective: 1700px;
  perspective-origin: 50% 42%;
  animation: fade-in 1s ease-out 0.15s backwards;
  scale: calc(1 - var(--exit, 0) * 0.14);
}
/* The book's aura lives on a flat layer behind it, never as a blurred shadow on a 3D face. */
.stage__book::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  inline-size: calc(var(--stage) * 0.66);
  block-size: calc(var(--stage) * 0.96);
  translate: -50% -50%;
  border-radius: 40%;
  background: radial-gradient(closest-side, rgba(239, 201, 191, 0.26), rgba(239, 201, 191, 0.08) 55%, rgba(239, 201, 191, 0));
  pointer-events: none;
}

/* A real 3D book: the cover is the front face; spine, fore-edge, head and tail give it
   thickness when it tilts toward the pointer. */
.book {
  --bh: calc(var(--stage) * 0.74);
  --bw: calc(var(--bh) * 0.6667);
  --bd: calc(var(--bw) * 0.085);
  position: relative;
  inline-size: var(--bw);
  block-size: var(--bh);
  transform-style: preserve-3d;
  animation: book-in 2.1s var(--ease-out) 0.15s backwards;
}
.book__float,
.book__tilt,
.book__body {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}
.book__float { animation: book-float 3.2s ease-in-out infinite alternate, book-turn 5.6s ease-in-out infinite alternate; }
.book__tilt { transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.book__front {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 2px 7px 7px 2px;
  transform: translateZ(calc(var(--bd) / 2));
  backface-visibility: hidden;
  background: #cdbfaa;
}
.book__img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}
.book__face { position: absolute; backface-visibility: hidden; }
.book__face--back {
  inset: 0;
  border-radius: 7px 2px 2px 7px;
  background: linear-gradient(90deg, #c9bca8, #ddd0bc);
  transform: rotateY(180deg) translateZ(calc(var(--bd) / 2));
}
.book__face--pages {
  top: 0.9%;
  bottom: 0.9%;
  left: calc(50% - var(--bd) / 2);
  width: var(--bd);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.12)),
    repeating-linear-gradient(90deg, #f1e9da 0 1px, #d3c6b0 1px 2px);
  transform: rotateY(90deg) translateZ(calc(var(--bw) / 2 - 2px));
}
.book__face--spine {
  top: 0;
  bottom: 0;
  left: calc(50% - var(--bd) / 2);
  width: var(--bd);
  border-radius: 2px;
  background: linear-gradient(90deg, #b3a58f, #e3d7c3 45%, #c4b69f);
  transform: rotateY(-90deg) translateZ(calc(var(--bw) / 2));
}
.book__face--top,
.book__face--bottom {
  left: 1%;
  right: 1.4%;
  top: calc(50% - var(--bd) / 2);
  height: var(--bd);
  background: repeating-linear-gradient(0deg, #f1e9da 0 1px, #d3c6b0 1px 2px);
}
.book__face--top { transform: rotateX(90deg) translateZ(calc(var(--bh) / 2 - 2px)); }
.book__face--bottom { transform: rotateX(-90deg) translateZ(calc(var(--bh) / 2 - 2px)); }
.book__glare {
  --gx: 28%;
  --gy: 18%;
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(65% 50% at var(--gx) var(--gy), rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 70%),
    radial-gradient(120% 90% at calc(100% - var(--gx)) calc(100% - var(--gy)), rgba(5, 9, 13, 0.18), rgba(5, 9, 13, 0) 62%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.14), rgba(0, 0, 0, 0) 6%);
}
.book__shadow {
  position: absolute;
  left: 50%;
  top: calc(50% + var(--stage) * 0.39 + 6px);
  inline-size: calc(var(--stage) * 0.34);
  block-size: calc(var(--stage) * 0.05);
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0));
  filter: blur(5px);
  animation: shadow-breathe 3.2s ease-in-out infinite alternate;
}

/* ------------------------------- transport -------------------------------- */
.transport {
  grid-column: 1 / -1;
  grid-row: 4;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.2vw, 30px);
  margin-block-start: calc(var(--play) * -0.5);
  position: relative;
  z-index: 4;
  opacity: calc(1 - var(--exit, 0));
}
.skip-btn {
  display: grid;
  place-items: center;
  inline-size: max(46px, calc(var(--play) * 0.46));
  block-size: max(46px, calc(var(--play) * 0.46));
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: rgba(15, 29, 39, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--pearl);
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
  animation: pop 1s var(--ease-out) 1.1s backwards;
}
.skip-btn + .play-ring + .skip-btn { animation-delay: 1.18s; }
.skip-btn svg {
  inline-size: 46%;
  block-size: 46%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
  transition: transform 0.45s var(--ease-out);
}
.skip-btn text {
  fill: currentColor;
  stroke: none;
  font-family: var(--f-text);
  font-size: 7.4px;
  font-weight: 700;
}
.skip-btn:hover { background: rgba(239, 201, 191, 0.14); border-color: rgba(239, 201, 191, 0.5); color: var(--blush-2); }
.skip-btn[data-seek-back]:hover svg { transform: rotate(-24deg); }
.skip-btn[data-seek-fwd]:hover svg { transform: rotate(24deg); }

/* The big play button: states (paused / loading / playing) and the --progress ring are
   driven by listen.js. The blush disc and its idle halo are pseudo-elements. */
.play-ring {
  position: relative;
  inline-size: var(--play);
  block-size: var(--play);
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #1c0e0a;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: pop-big 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) 0.95s backwards;
}
.play-ring::before {
  content: '';
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: radial-gradient(120% 120% at 32% 18%, #fbe9e3 0%, var(--blush) 46%, var(--blush-deep) 100%);
  box-shadow:
    0 18px 44px -10px rgba(239, 201, 191, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -8px 16px rgba(110, 50, 40, 0.22);
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s;
}
.play-ring::after {
  content: '';
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: 1.5px solid rgba(239, 201, 191, 0.7);
  animation: play-halo 2.8s var(--ease-soft) infinite;
  pointer-events: none;
}
.play-ring:hover::before { transform: scale(1.06); box-shadow: 0 22px 54px -10px rgba(239, 201, 191, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -8px 16px rgba(110, 50, 40, 0.22); }
.play-ring:active::before { transform: scale(0.96); }
.play-ring[data-state='playing']::after,
.play-ring[data-state='loading']::after { animation: none; opacity: 0; }
.play-ring__ring {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  /* counter-clockwise from the top, the way the RTL seek bar fills */
  transform: rotate(-90deg) scaleY(-1);
  overflow: visible;
}
.play-ring circle { fill: none; stroke-width: 2.2; }
.play-ring circle.play-ring__track { stroke: rgba(233, 241, 239, 0.16); }
.play-ring circle.play-ring__fill {
  stroke: var(--pearl);
  stroke-linecap: round;
  stroke-dasharray: 251.33 262;
  stroke-dashoffset: calc(251.33 * (1 - var(--progress, 0)));
  transition: stroke-dashoffset 0.3s linear;
}
.play-ring__icon { position: relative; z-index: 1; display: grid; place-items: center; }
.play-ring__icon svg {
  grid-area: 1 / 1;
  inline-size: calc(var(--play) * 0.3);
  block-size: calc(var(--play) * 0.3);
  fill: currentColor;
}
.icon-play { transform: translateX(6%); }
.play-ring__icon .icon-pause,
.play-ring__icon .play-ring__spinner { display: none; }
.play-ring[data-state='playing'] .icon-play { display: none; }
.play-ring[data-state='playing'] .icon-pause { display: block; }
.play-ring[data-state='loading'] .icon-play,
.play-ring[data-state='loading'] .icon-pause { display: none; }
.play-ring[data-state='loading'] .play-ring__spinner {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  animation: play-spin 0.9s linear infinite;
}
@keyframes play-halo {
  0% { transform: scale(1); opacity: 0.8; }
  80%, 100% { transform: scale(1.75); opacity: 0; }
}
@keyframes play-spin { to { transform: rotate(360deg); } }

/* --------------------------------- dock ----------------------------------- */
.dock {
  position: relative;
  z-index: 6;
  margin-block-start: clamp(14px, 2.6vh, 30px);
  margin-inline: auto;
  inline-size: min(100%, 1080px);
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.3vw, 20px);
  padding: 7px;
  padding-inline-end: 14px;
  border-radius: 999px;
  background: rgba(15, 29, 39, 0.6);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  box-shadow: 0 24px 60px -26px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: rise-big 1.2s var(--ease-out) 1.05s backwards;
}

.chapters { flex: 0 1 340px; min-inline-size: 0; }
.chapters__toggle {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-block-size: 50px;
  padding-block: 5px;
  padding-inline: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.chapters__toggle::-webkit-details-marker { display: none; }
.chapters__toggle::marker { content: ''; }
.chapters__toggle:hover,
.chapters[open] .chapters__toggle { background: rgba(233, 241, 239, 0.07); }
.chapters__icon {
  flex: none;
  inline-size: 38px;
  block-size: 38px;
  padding: 9px;
  border-radius: 50%;
  background: rgba(239, 201, 191, 0.14);
  fill: none;
  stroke: var(--blush);
  stroke-width: 2;
  stroke-linecap: round;
}
.chapters__icon circle { fill: var(--blush); stroke: none; }
.chapters__text { display: grid; min-inline-size: 0; line-height: 1.45; }
.chapters__label { font-size: 0.76rem; font-weight: 500; color: var(--mist); white-space: nowrap; }
.chapters__count { color: var(--blush-2); font-variant-numeric: tabular-nums; margin-inline-start: 4px; }
.chapters__now {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--halo);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chapters__chev {
  flex: none;
  inline-size: 16px;
  block-size: 16px;
  margin-inline-start: auto;
  fill: none;
  stroke: var(--mist);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.35s var(--ease-out);
}
.chapters[open] .chapters__chev { transform: rotate(180deg); }

.chapters__panel {
  position: absolute;
  inset-block-end: calc(100% + 12px);
  inset-inline-start: 0;
  z-index: 10;
  inline-size: min(580px, 100%);
  max-block-size: min(62vh, 560px);
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  transform-origin: right bottom;
}
.chapters[open] .chapters__panel { animation: panel-in 0.45s var(--ease-out); }
.player__chapters { display: flex; flex-direction: column; min-block-size: 0; }
.player__list-title {
  margin: 0;
  padding: 16px 22px 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.06rem;
  line-height: 1.5;
  color: var(--halo);
  border-block-end: 1px solid var(--line);
}
.player__list-title span { font-family: var(--f-text); font-weight: 500; font-size: 0.8rem; color: var(--mist); }
.player__chapter-list {
  position: relative;
  min-block-size: 0;
  overflow-y: auto;
  padding: 6px 10px 14px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(233, 241, 239, 0.22) transparent;
}
.player__group-heading {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 14px 12px 6px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--blush-2);
}
.player__chapter-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  inline-size: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--fog);
  text-align: start;
  font-size: 0.92rem;
  line-height: 1.6;
  cursor: pointer;
  transition: background-color 0.25s, color 0.25s;
}
.player__chapter-row:hover { background: rgba(233, 241, 239, 0.05); color: var(--halo); }
.player__chapter-n,
.player__chapter-start { font-variant-numeric: tabular-nums; font-size: 0.8rem; color: var(--mist); }
.player__chapter-n { text-align: center; }
.player__chapter-row[aria-current='true'] { color: var(--halo); font-weight: 600; }
.player__chapter-row[aria-current='true'] .player__chapter-n { color: var(--blush); }
.player__chapter-pill {
  position: absolute;
  inset-inline: 10px;
  inset-block-start: 0;
  block-size: 44px;
  border-radius: 14px;
  background: rgba(239, 201, 191, 0.12);
  border: 1px solid rgba(239, 201, 191, 0.32);
  transition: transform 0.45s var(--ease-out), block-size 0.3s var(--ease-out);
  pointer-events: none;
  z-index: 0;
}

.player__seek-row {
  flex: 1 1 auto;
  min-inline-size: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.player__time {
  flex: none;
  min-inline-size: 6.2ch;
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--fog);
  text-align: center;
}
.seek-track {
  --thumb: 16px;
  position: relative;
  flex: 1;
  min-inline-size: 0;
  block-size: 30px;
}
.seek-track__base,
.seek-track__buffered,
.seek-track__played {
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 50%;
  block-size: 4px;
  margin-block-start: -2px;
  border-radius: 999px;
  pointer-events: none;
}
.seek-track__base { inline-size: 100%; background: rgba(233, 241, 239, 0.13); }
.seek-track__buffered { inline-size: 0; background: rgba(233, 241, 239, 0.22); }
.seek-track__played {
  inline-size: calc(var(--seek-fraction, 0) * 100%);
  background: linear-gradient(to left, var(--blush), var(--blush-deep));
  box-shadow: 0 0 14px rgba(239, 201, 191, 0.45);
}
/* chapter starts as notches in the track; the five parts as taller pearl marks */
.seek-track__ticks { position: absolute; inset: 0; pointer-events: none; }
.seek-track__ticks .tick {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: calc(var(--at) * 100%);
  inline-size: 2px;
  block-size: 4px;
  margin-block-start: -2px;
  margin-inline-start: -1px;
  background: rgba(5, 9, 13, 0.95);
}
.seek-track__ticks .tick.is-part {
  block-size: 12px;
  margin-block-start: -6px;
  border-radius: 2px;
  background: rgba(233, 241, 239, 0.42);
}
.seek-track input[type='range'] {
  position: absolute;
  inset: 0;
  z-index: 2;
  inline-size: 100%;
  block-size: 100%;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.seek-track input[type='range']::-webkit-slider-runnable-track { block-size: 100%; background: transparent; }
.seek-track input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  inline-size: var(--thumb);
  block-size: var(--thumb);
  margin-block-start: calc((30px - var(--thumb)) / 2);
  border-radius: 50%;
  border: 0;
  background: var(--pearl);
  box-shadow: 0 0 0 4px rgba(239, 201, 191, 0.34), 0 4px 10px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s var(--ease-out);
}
.seek-track:hover input[type='range']::-webkit-slider-thumb { transform: scale(1.18); }
.seek-track input[type='range']::-moz-range-track { background: transparent; border: 0; }
.seek-track input[type='range']::-moz-range-thumb {
  inline-size: var(--thumb);
  block-size: var(--thumb);
  border-radius: 50%;
  border: 0;
  background: var(--pearl);
  box-shadow: 0 0 0 4px rgba(239, 201, 191, 0.34);
}

.player__secondary-row { flex: none; display: flex; align-items: center; gap: 8px; }
.speed-btn {
  min-inline-size: 66px;
  min-block-size: 44px;
  padding-inline: 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(233, 241, 239, 0.04);
  color: var(--pearl);
  font-family: var(--f-text);
  font-weight: 600;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s;
}
.speed-btn:hover { background: rgba(239, 201, 191, 0.13); border-color: rgba(239, 201, 191, 0.5); }
.volume-control { display: flex; align-items: center; gap: 8px; padding-inline: 6px 4px; color: var(--fog); }
.volume-control svg {
  inline-size: 20px;
  block-size: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.volume-control input[type='range'] {
  inline-size: 92px;
  block-size: 22px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.volume-control input[type='range']::-webkit-slider-runnable-track {
  block-size: 4px;
  border-radius: 999px;
  background: linear-gradient(to left,
    var(--pearl) 0 calc(var(--volume-fraction, 1) * 100%),
    rgba(233, 241, 239, 0.16) calc(var(--volume-fraction, 1) * 100%) 100%);
}
.volume-control input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  inline-size: 14px;
  block-size: 14px;
  margin-block-start: -5px;
  border-radius: 50%;
  border: 0;
  background: var(--pearl);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.volume-control input[type='range']::-moz-range-track { block-size: 4px; border-radius: 999px; background: rgba(233, 241, 239, 0.16); }
.volume-control input[type='range']::-moz-range-progress { block-size: 4px; border-radius: 999px; background: var(--pearl); }
.volume-control input[type='range']::-moz-range-thumb { inline-size: 14px; block-size: 14px; border-radius: 50%; border: 0; background: var(--pearl); }
@media (pointer: coarse) {
  .volume-control { display: none; }
}

/* Resume / error messages sit in the flow between the play clasp and the dock. */
.toast {
  position: relative;
  z-index: 5;
  margin: clamp(12px, 2vh, 20px) auto 0;
  inline-size: fit-content;
  max-inline-size: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 12px;
  padding: 12px 16px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid rgba(239, 201, 191, 0.3);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.9);
  font-size: 0.92rem;
  line-height: 1.7;
  animation: rise 0.5s var(--ease-out);
}
.toast b { font-weight: 600; color: var(--halo); }
.toast p { min-inline-size: 0; max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast span { font-variant-numeric: tabular-nums; color: var(--blush-2); }
.no-js-notice {
  margin: 16px auto 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--fog);
}
.hero__player.is-listing .hero__grid { opacity: 0.22; }

/* ------------------------------ hero · phones ----------------------------- */
@media (max-width: 899px) {
  .hero {
    --stage: min(84vw, 38svh, 420px);
    --play: 80px;
    padding-block-start: calc(var(--header-h) + 8px);
    padding-block-end: 16px;
  }
  .site-header__row { grid-template-columns: 1fr auto; }
  .eds--head { display: none; }
  .eds--hero { display: inline-flex; align-self: center; margin-block-end: 8px; }
  .eds__btn { min-block-size: 42px; padding-inline: 18px; }
  .eds__btn b { font-size: 0.92rem; }
  .hero__player { justify-content: center; }
  .hero__grid { display: flex; flex-direction: column; align-items: center; }
  .hero__eyebrow { order: 1; align-self: center; margin: 0 0 2px; translate: none; }
  .hero__eyebrow-in { font-size: 0.8rem; padding-block: 4px; padding-inline: 10px 14px; gap: 8px; }
  .hero__eyebrow-in svg { inline-size: 16px; block-size: 16px; }
  .hero__title {
    order: 2;
    display: flex;
    justify-content: center;
    gap: 0.26em;
    font-size: clamp(2.2rem, 10.4vw, 4rem);
    line-height: 1.3;
  }
  .hero__word--a, .hero__word--b { translate: none; }
  .hero__word--a .hero__word-in { animation-name: word-in-up; }
  .hero__word--b .hero__word-in { animation-name: word-in-up; }
  .stage { order: 3; margin-block-start: 0; }
  .transport { order: 4; margin-block-start: calc(var(--play) * -0.36); }
  .hero__meta {
    order: 5;
    margin-block-start: 8px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 16px;
    font-size: 0.84rem;
    line-height: 1.55;
  }
  .hero__meta li::before { inline-size: 5px; block-size: 5px; }
  .dock {
    margin-block-start: 10px;
    flex-wrap: wrap;
    row-gap: 2px;
    column-gap: 8px;
    padding: 8px 12px 6px;
    border-radius: 24px;
  }
  .player__seek-row { order: -1; flex: 1 1 100%; gap: 8px; }
  .player__time { font-size: 0.8rem; min-inline-size: 5.6ch; }
  .chapters { flex: 1 1 0; }
  .chapters__toggle { min-block-size: 46px; padding-inline: 2px 10px; }
  .chapters__icon { inline-size: 34px; block-size: 34px; padding: 8px; }
  .chapters__panel { inline-size: 100%; max-block-size: min(58svh, 520px); }
  .speed-btn { min-block-size: 42px; min-inline-size: 60px; }
}
/* while the resume prompt is up on a phone, give the room back to the dock */
@media (max-width: 899px) {
  .toast { margin-block-start: 8px; padding: 10px 14px; inline-size: 100%; }
  .toast p { flex: 1 1 100%; text-align: center; font-size: 0.88rem; }
  .hero:has([data-resume-prompt]:not([hidden])) { --stage: min(74vw, 31svh, 340px); }
  .hero:has([data-resume-prompt]:not([hidden])) .hero__meta { display: none; }
}
@media (max-width: 380px) {
  .hero__meta { font-size: 0.8rem; gap: 0 12px; }
  .chapters__now { font-size: 0.86rem; }
}

/* ================================= ABOUT =================================== */
.about {
  position: relative;
  overflow: clip;
  isolation: isolate;
  padding-block: clamp(72px, 12vh, 140px) clamp(64px, 10vh, 120px);
}
.about::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  inset-block-start: 0;
  block-size: 100%;
  z-index: -1;
  background: radial-gradient(48% 52% at 50% 30%, rgba(23, 48, 60, 0.7), rgba(23, 48, 60, 0) 72%);
  pointer-events: none;
}
.about__mark {
  inline-size: 64px;
  block-size: 64px;
  margin-block-end: 22px;
  fill: none;
  stroke: var(--blush);
  stroke-width: 1.4;
  opacity: 0.85;
}
.about__mark circle:nth-child(1) { stroke-opacity: 0.35; }
.about__mark circle:nth-child(2) { stroke-opacity: 0.6; }
.about__mark .dot { fill: var(--blush); stroke: none; }
.about::before {
  content: '';
  position: absolute;
  inset-inline: 0;
  inset-block-start: 0;
  block-size: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}
.about__inner {
  max-inline-size: 46rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.about__kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--blush);
}
.about__kicker::before,
.about__kicker-line {
  content: '';
  flex: 0 0 clamp(32px, 6vw, 72px);
  block-size: 1px;
  background: linear-gradient(to left, var(--blush), rgba(239, 201, 191, 0));
}
.about__kicker::before { background: linear-gradient(to right, var(--blush), rgba(239, 201, 191, 0)); }
.about__lead {
  margin-block-start: 22px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 3.4vw, 3rem);
  line-height: 1.45;
  color: var(--halo);
  text-wrap: balance;
}
.about__body {
  margin-block-start: 18px;
  max-inline-size: 34em;
  font-size: clamp(1.05rem, 1.15vw, 1.2rem);
  line-height: 2;
  color: var(--fog);
  text-wrap: pretty;
}
.about__author {
  margin-block-start: 16px;
  font-weight: 600;
  font-size: 1rem;
  color: var(--blush-2);
}
.about__cta { margin-block-start: 30px; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.about__note { margin-block-start: 34px; font-size: 0.9rem; color: var(--mist); max-inline-size: 30em; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  padding: 22px var(--gutter) 34px;
  border-block-start: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--mist);
}
.site-footer a { text-decoration: none; padding-block: 6px; }
.site-footer a:hover { color: var(--halo); }

/* =============================== keyframes ================================= */
@keyframes fade-in { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; translate: 0 14px; } }
@keyframes rise-big { from { opacity: 0; translate: 0 26px; } }
@keyframes pop { from { opacity: 0; scale: 0.6; } }
@keyframes pop-big { from { opacity: 0; scale: 0.45; } }
@keyframes word-in-a { from { opacity: 0; transform: translateX(26%); filter: blur(18px); } }
@keyframes word-in-b { from { opacity: 0; transform: translateX(-26%); filter: blur(18px); } }
@keyframes word-in-up { from { opacity: 0; transform: translateY(40%); filter: blur(14px); } }
@keyframes book-in { from { opacity: 0; transform: translateY(110px) rotateX(26deg) rotateY(-28deg) scale(0.8); } }
@keyframes book-float { from { translate: 0 0; } to { translate: 0 -14px; } }
@keyframes book-turn { from { transform: rotateY(-6deg) rotateX(2deg); } to { transform: rotateY(6deg) rotateX(-2deg); } }
@keyframes shadow-breathe { from { scale: 1 1; opacity: 0.95; } to { scale: 0.82 1; opacity: 0.55; } }
@keyframes panel-in { from { opacity: 0; translate: 0 14px; scale: 0.98; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
  .hero { --exit: 0 !important; }
}
