:root {
  --bg: #f4efe5;
  --surface: #fbf7ef;
  --surface-alt: #ece3d5;
  --text: #201c18;
  --muted: #675e55;
  --faint: #8b8075;
  --border: #cfc3b3;
  --border-soft: rgba(64, 53, 43, 0.16);
  --accent: #86661b;
  --accent-hover: #6b5012;
  --accent-ink: #fffaf0;
  --danger: #9e3d34;
  --header: rgba(244, 239, 229, 0.88);
  --display: "Cormorant Garamond", Georgia, serif;
  --body: "Work Sans", system-ui, sans-serif;
  --shell: min(1180px, calc(100% - 40px));
  --reading: 68ch;
}

[data-theme="dark"] {
  --bg: #1a1714;
  --surface: #211d19;
  --surface-alt: #2b251f;
  --text: #f5ebdd;
  --muted: #b8ab9c;
  --faint: #8c8074;
  --border: #4d443a;
  --border-soft: rgba(245, 235, 221, 0.14);
  --accent: #d2a73c;
  --accent-hover: #e7be55;
  --accent-ink: #18130b;
  --danger: #ef9186;
  --header: rgba(26, 23, 20, 0.88);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #1a1714;
    --surface: #211d19;
    --surface-alt: #2b251f;
    --text: #f5ebdd;
    --muted: #b8ab9c;
    --faint: #8c8074;
    --border: #4d443a;
    --border-soft: rgba(245, 235, 221, 0.14);
    --accent: #d2a73c;
    --accent-hover: #e7be55;
    --accent-ink: #18130b;
    --danger: #ef9186;
    --header: rgba(26, 23, 20, 0.88);
  }
}

body {
  color: var(--text);
  background: var(--bg);
}

.shell {
  width: var(--shell);
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 3px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 76px;
  padding-inline: max(20px, calc((100vw - 1180px) / 2));
  background: var(--header);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  color: var(--accent);
}

.brand span {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand strong {
  font-family: var(--display);
  font-size: 1.22rem;
  font-weight: 600;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.site-header nav {
  display: none;
}

.icon-button,
.player-button,
.play-button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.icon-button:hover,
.player-button:hover {
  color: var(--accent-hover);
  border-color: var(--accent);
  background: var(--surface-alt);
}

.theme-toggle {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
}

.theme-toggle svg,
.player-button svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .moon-icon,
[data-theme="light"] .theme-toggle .sun-icon {
  display: none;
}

[data-theme="light"] .theme-toggle .moon-icon {
  display: block;
}

.hero {
  display: grid;
  gap: 36px;
  padding-block: clamp(52px, 9vw, 112px) clamp(68px, 10vw, 124px);
}

.hero-copy {
  align-self: center;
}

.eyebrow {
  margin-bottom: 16px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
blockquote {
  font-family: var(--display);
}

h1 {
  max-width: 10ch;
  margin-bottom: 24px;
  font-size: clamp(3.8rem, 13vw, 7.9rem);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 0.82;
}

.hero blockquote {
  max-width: 25ch;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: clamp(1.45rem, 5vw, 2rem);
  font-weight: 500;
  line-height: 1.25;
}

.hero-meta {
  margin-bottom: 28px;
  color: var(--faint);
  font-size: 0.85rem;
}

.hero-meta cite,
.book-section cite,
.newsletter cite {
  font-style: normal;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

.text-link svg {
  width: 20px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  transition: transform 180ms ease;
}

.text-link:hover svg {
  transform: translateX(4px);
}

.hero-art {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: #30261a;
  border: 1px solid var(--border);
}

.hero-art::after {
  position: absolute;
  inset: 10px;
  content: "";
  pointer-events: none;
  border: 1px solid rgba(245, 235, 221, 0.28);
}

.hero-art img {
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.listening-section {
  display: grid;
  gap: 32px;
  padding-block: clamp(68px, 10vw, 120px);
  border-top: 1px solid var(--border-soft);
}

.section-heading {
  max-width: 560px;
}

.section-heading h2,
.transcript-intro h2,
.book-section h2,
.conversion-section h2 {
  margin-bottom: 18px;
  font-size: clamp(2.7rem, 8vw, 4.7rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.96;
}

.section-heading > p:last-child,
.transcript-intro > p,
.book-section p,
.conversion-section > div > p {
  max-width: 55ch;
  color: var(--muted);
}

.audio-card {
  position: relative;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.js .audio-card > audio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.no-js .custom-player {
  display: none;
}

.no-js .audio-card > audio {
  width: 100%;
}

.custom-player {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 20px 18px;
}

.play-button {
  width: 66px;
  height: 66px;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
}

.play-button:hover {
  background: var(--accent-hover);
}

.play-button svg {
  width: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.play-button .pause-icon,
.is-playing .play-button .play-icon {
  display: none;
}

.is-playing .play-button .pause-icon {
  display: block;
}

.track-info p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.track-info .track-kicker {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.track-info h3 {
  margin: 2px 0 1px;
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1;
}

.timeline {
  grid-column: 1 / -1;
}

.timeline input {
  width: 100%;
  height: 24px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.time-row {
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.player-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.player-button {
  width: 44px;
  height: 44px;
}

.player-button text {
  fill: currentColor;
  stroke: none;
  font-family: var(--body);
  font-size: 6px;
  font-weight: 600;
}

.speed-button {
  width: auto;
  padding-inline: 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.muted-icon,
.is-muted .volume-icon {
  display: none;
}

.is-muted .muted-icon {
  display: block;
}

.player-status {
  grid-column: 1 / -1;
  min-height: 1.3em;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.transcript-section {
  display: grid;
  gap: 48px;
  padding-block: clamp(76px, 11vw, 140px);
  border-top: 1px solid var(--border-soft);
}

.transcript-intro {
  align-self: start;
}

.transcript-intro .text-link {
  margin-top: 16px;
}

.prose {
  max-width: var(--reading);
}

.prose > section {
  scroll-margin-top: 100px;
}

.prose > section + section {
  margin-top: 56px;
}

.prose h3 {
  margin-bottom: 16px;
  color: var(--text);
  font-size: clamp(2rem, 6vw, 2.8rem);
  font-weight: 600;
  line-height: 1;
}

.prose p,
.prose li {
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.1rem);
}

.prose p + p {
  margin-top: 18px;
}

.lesson-list {
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.lesson-list li {
  padding-block: 20px;
  border-bottom: 1px solid var(--border);
}

.lesson-list strong,
.audit-list strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-weight: 600;
}

.parable {
  padding: clamp(28px, 6vw, 48px);
  background: var(--surface);
  border-left: 3px solid var(--accent);
}

.parable blockquote {
  margin: 28px 0 0;
  color: var(--text);
  font-size: clamp(1.7rem, 5vw, 2.35rem);
  line-height: 1.15;
}

.audit-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.audit-list li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 14px;
  padding-block: 20px;
  border-top: 1px solid var(--border);
}

.audit-list li:last-child {
  border-bottom: 1px solid var(--border);
}

.audit-list > li > span {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.audit-list p {
  margin-bottom: 0;
}

.closing-line {
  color: var(--text) !important;
  font-family: var(--display);
  font-size: clamp(1.8rem, 5vw, 2.6rem) !important;
  line-height: 1.2;
}

.book-section {
  padding-block: clamp(72px, 10vw, 122px);
  background: var(--surface-alt);
  content-visibility: auto;
  contain-intrinsic-size: 760px;
}

.book-grid {
  display: grid;
  gap: 30px;
}

.volume-number {
  color: var(--accent);
  font-family: var(--display);
  font-size: clamp(7rem, 35vw, 14rem);
  line-height: 0.65;
}

.format-links {
  display: grid;
  border-top: 1px solid var(--border);
}

.format-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 180ms ease, padding 180ms ease;
}

.format-links a:hover {
  padding-left: 8px;
  color: var(--accent-hover);
}

.format-links a::after {
  content: "↗";
  color: var(--accent);
}

.format-links a span {
  font-weight: 600;
}

.format-links a small {
  margin-left: auto;
  margin-right: 16px;
  color: var(--faint);
}

.conversion-section {
  display: grid;
  gap: 1px;
  padding-block: clamp(72px, 10vw, 122px);
  content-visibility: auto;
  contain-intrinsic-size: 760px;
}

.conversion-section > div {
  padding: clamp(28px, 6vw, 56px);
  background: var(--surface);
  border: 1px solid var(--border);
}

.conversion-section > .coaching {
  color: #fff8ec;
  background: #292219;
  border-color: #292219;
}

.coaching .eyebrow {
  color: #d2a73c;
}

.coaching p {
  color: #c9baa9 !important;
}

.form-row {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}

form label {
  display: block;
  margin-top: 26px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

form .form-row {
  margin-top: 0;
}

form input {
  min-height: 50px;
  width: 100%;
  padding: 11px 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
}

form input[aria-invalid="true"] {
  border-color: var(--danger);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 20px;
  color: var(--accent-ink);
  font-size: 0.84rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  background: var(--accent);
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 180ms ease;
}

.primary-button:hover {
  background: var(--accent-hover);
}

.coaching .primary-button {
  margin-top: 24px;
  color: #18130b;
  background: #d2a73c;
}

.coaching .primary-button:hover {
  background: #e7be55;
}

.form-note,
.form-status {
  margin: 8px 0 0;
  color: var(--faint) !important;
  font-size: 0.72rem;
}

.form-status.is-error {
  color: var(--danger) !important;
}

footer {
  padding-block: 44px;
  border-top: 1px solid var(--border-soft);
}

.footer-grid {
  display: grid;
  gap: 22px;
  align-items: end;
}

.footer-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.footer-grid a:not(.brand) {
  text-underline-offset: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (min-width: 700px) {
  :root {
    --shell: min(1180px, calc(100% - 64px));
  }

  .site-header {
    grid-template-columns: 1fr auto auto;
    gap: 30px;
  }

  .site-header nav {
    display: flex;
    gap: 24px;
  }

  .site-header nav a {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
  }

  .site-header nav a:hover {
    color: var(--text);
  }

  .theme-toggle {
    grid-column: auto;
  }

  .custom-player {
    grid-template-columns: auto minmax(180px, 0.9fr) minmax(240px, 1.5fr) auto;
    gap: 18px;
  }

  .timeline,
  .player-actions {
    grid-column: auto;
  }

  .player-actions {
    justify-content: flex-end;
  }

  .player-status {
    grid-column: 3 / -1;
    text-align: right;
  }

  .form-row {
    grid-template-columns: 1fr auto;
  }

  .footer-grid {
    grid-template-columns: 1fr auto auto;
  }

  .footer-grid p:last-child {
    text-align: right;
  }
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: minmax(360px, 0.8fr) minmax(500px, 1.2fr);
    align-items: center;
    gap: clamp(48px, 7vw, 100px);
  }

  .hero-art {
    transform: translateY(28px);
  }

  .listening-section {
    grid-template-columns: minmax(240px, 0.58fr) minmax(580px, 1.42fr);
    align-items: end;
    gap: clamp(50px, 8vw, 112px);
  }

  .audio-card {
    padding: 30px;
  }

  .transcript-section {
    grid-template-columns: minmax(260px, 0.58fr) minmax(520px, 1fr);
    gap: clamp(64px, 9vw, 126px);
  }

  .transcript-intro {
    position: sticky;
    top: 112px;
  }

  .book-grid {
    grid-template-columns: 0.35fr 0.9fr 0.75fr;
    align-items: center;
    gap: clamp(40px, 7vw, 90px);
  }

  .conversion-section {
    grid-template-columns: 1fr 1fr;
  }
}

/* Pending audio state (narration in production) */
.audio-card--pending {
  opacity: 0.96;
}

.custom-player--pending .play-button {
  opacity: 0.45;
  cursor: not-allowed;
}

.custom-player--pending .play-button:hover {
  transform: none;
}

.custom-player--pending .timeline .time-row span:first-child {
  font-style: italic;
  opacity: 0.75;
  letter-spacing: 0.02em;
}

.custom-player--pending .player-actions a.player-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
