@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@500;600;700&display=swap');

:root {
  color-scheme: light;
  --night: #172538;
  --night-soft: #21344a;
  --paper: #f6f2e9;
  --paper-deep: #eee8dc;
  --ink: #253246;
  --muted: #727a82;
  --frost: #a8c8d6;
  --amber: #c38a50;
  --line: rgba(54, 67, 76, .15);
  font-family: 'DM Sans', sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--night); }
body {
  min-height: 100vh;
  margin: 0;
  padding: 30px clamp(18px, 4vw, 62px) 28px;
  color: #edf3f5;
  background:
    radial-gradient(ellipse at 50% 43%, rgba(72, 111, 137, .25), transparent 53%),
    radial-gradient(circle at 8% 90%, rgba(195, 138, 80, .08), transparent 26%),
    linear-gradient(150deg, #172538 0%, #1b2c40 58%, #142132 100%);
}
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid #e6b676; outline-offset: 4px; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 12px;
  transform: translateY(-150%);
  padding: 10px 14px;
  color: var(--night);
  background: #fff;
  border-radius: 8px;
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, 100%);
  margin: 0 auto;
  min-height: 37px;
  padding-right: 142px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #f4f2eb;
  text-decoration: none;
}
.brand-mark { color: #c8dae0; font-size: 22px; line-height: 1; }
.brand-name { font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.brand-name span { color: #9db2bd; font-weight: 500; }
.header-note { margin: 0; color: #a8b8c1; font-size: 12px; letter-spacing: .02em; }

.listen-button, .stop-button {
  position: fixed;
  z-index: 10;
  top: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border: 1px solid rgba(240, 245, 244, .22);
  border-radius: 999px;
  color: #fff;
  background: rgba(35, 54, 73, .92);
  box-shadow: 0 8px 25px rgba(5, 14, 25, .19);
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
  backdrop-filter: blur(12px);
}
.listen-button { right: clamp(18px, 4vw, 62px); gap: 9px; padding: 0 16px 0 13px; font: 600 13px 'DM Sans', sans-serif; }
.listen-button:hover, .stop-button:hover { transform: translateY(-1px); background: #314a62; border-color: rgba(240, 245, 244, .45); }
.listen-button[aria-pressed="true"] { color: #fff5e9; border-color: rgba(230, 182, 118, .62); background: #34485a; }
.listen-icon { display: inline-flex; width: 18px; height: 18px; }
.listen-icon svg { width: 100%; height: 100%; fill: currentColor; }
.stop-button { right: clamp(112px, 10vw, 162px); width: 44px; padding: 0; }
.stop-button[hidden] { display: none; }
.stop-button svg { width: 19px; height: 19px; fill: currentColor; }

.storybook { width: min(1120px, 100%); margin: 36px auto 0; }
.story-intro { margin-bottom: 19px; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: #a9c0ca; font-size: 10px; font-weight: 700; letter-spacing: .18em; }
.eyebrow-rule { width: 25px; height: 1px; background: #c38a50; }
.intro-copy { margin: 7px 0 0 35px; color: rgba(225, 235, 238, .7); font-size: 13px; }

.book {
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, .52);
  border-radius: 14px;
  box-shadow: 0 28px 75px rgba(4, 12, 23, .34), 0 3px 8px rgba(4, 12, 23, .16);
}
.page {
  display: flex;
  min-height: 530px;
  opacity: 1;
  transform: translateX(0);
  transition: opacity .24s ease, transform .24s ease;
}
.page.is-turning { opacity: 0; transform: translateX(9px); }
.artwork-wrap {
  position: relative;
  flex: 1.04 1 52%;
  min-width: 0;
  min-height: 530px;
  overflow: hidden;
  background: #24364a;
}
.artwork {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 530px;
  object-fit: cover;
  object-position: center;
}
.artwork-caption {
  position: absolute;
  bottom: 17px;
  left: 20px;
  color: rgba(255, 255, 255, .84);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .16em;
  text-shadow: 0 1px 9px rgba(0, 0, 0, .7);
}
.page-copy {
  position: relative;
  display: flex;
  flex: .96 1 48%;
  flex-direction: column;
  justify-content: center;
  padding: clamp(36px, 5.2vw, 72px) clamp(30px, 5.2vw, 68px);
  background:
    radial-gradient(ellipse at 100% 0%, rgba(206, 185, 147, .12), transparent 42%),
    var(--paper);
}
.page-copy::before {
  position: absolute;
  top: 32px;
  bottom: 32px;
  left: 0;
  width: 1px;
  background: linear-gradient(transparent, rgba(129, 111, 84, .18) 18%, rgba(129, 111, 84, .18) 82%, transparent);
  content: '';
}
.page-kicker { margin: 0 0 18px; color: #9b7146; font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.page-title {
  margin: 0;
  color: #263345;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(31px, 3.5vw, 46px);
  font-weight: 500;
  letter-spacing: -.035em;
  line-height: 1.13;
  text-wrap: balance;
}
.page-body { margin-top: 21px; color: #4e5962; font-family: 'Playfair Display', Georgia, serif; font-size: clamp(15px, 1.45vw, 17px); line-height: 1.75; }
.page-body p { margin: 0 0 15px; }
.page-body p:last-child { margin-bottom: 0; }
.page-signoff { margin: 24px 0 0; color: #8b8174; font-size: 11px; letter-spacing: .04em; line-height: 1.6; }
.page[data-cover="true"] .page-copy { justify-content: center; }
.page[data-cover="true"] .page-title { font-size: clamp(40px, 5vw, 62px); }
.page[data-cover="true"] .page-body { max-width: 315px; color: #687078; font-size: 18px; line-height: 1.6; }
.page[data-cover="true"] .page-signoff { max-width: 265px; }

.book-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 0 clamp(20px, 3.3vw, 40px);
  background: #fbf9f3;
  border-top: 1px solid var(--line);
}
.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 105px;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #364452;
  background: transparent;
  font: 600 12px 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, opacity .18s ease;
}
.nav-button:hover:not(:disabled) { background: #f0ece3; border-color: rgba(45, 60, 73, .12); }
.nav-button:disabled { color: #a2a6a6; cursor: not-allowed; }
.nav-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.progress-group { display: flex; flex: 1; flex-direction: column; align-items: center; gap: 10px; max-width: 240px; }
.page-count { color: #717b80; font-size: 9px; font-weight: 700; letter-spacing: .14em; white-space: nowrap; }
.count-divider { padding: 0 6px; color: #b2a99a; }
.progress-track { width: min(100%, 180px); height: 2px; overflow: hidden; background: #ded8cc; border-radius: 4px; }
.progress-fill { display: block; width: 20%; height: 100%; background: #b17d4a; transition: width .3s ease; }
.keyboard-hint { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 17px 0 0; color: #879aa4; font-size: 10px; letter-spacing: .05em; }
.keyboard-hint span { color: #bdcbd1; font-size: 14px; }
.listen-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.site-footer { width: min(1120px, 100%); margin: 34px auto 0; padding-top: 18px; border-top: 1px solid rgba(212, 226, 231, .14); text-align: center; }
.site-footer p { margin: 0; color: #a9b7bd; font-size: 11px; line-height: 1.7; }
.site-footer a { color: #d9e6e8; text-decoration-color: rgba(217, 230, 232, .42); text-underline-offset: 3px; }
.site-footer a:hover { color: #fff; text-decoration-color: currentColor; }
.footer-note { margin-top: 5px !important; color: #83969f !important; font-family: 'Playfair Display', Georgia, serif; font-size: 13px !important; font-style: italic; }

@media (max-width: 760px) {
  body { padding: 22px 16px 24px; }
  .site-header { align-items: flex-start; padding-right: 114px; }
  .header-note { display: none; }
  .brand { padding-top: 7px; }
  .listen-button { top: 16px; right: 16px; height: 42px; }
  .stop-button { top: 16px; right: 116px; width: 42px; height: 42px; }
  .storybook { margin-top: 36px; }
  .story-intro { margin-bottom: 15px; }
  .intro-copy { font-size: 12px; }
  .page { flex-direction: column; min-height: 0; }
  .artwork-wrap { flex: auto; width: 100%; min-height: 0; aspect-ratio: 4 / 3; }
  .artwork { min-height: 0; height: 100%; aspect-ratio: 4 / 3; }
  .page-copy { flex: auto; min-height: 310px; padding: 30px clamp(25px, 7vw, 44px) 34px; }
  .page-copy::before { display: none; }
  .page-kicker { margin-bottom: 12px; }
  .page-title { font-size: clamp(32px, 9vw, 42px); }
  .page-body { margin-top: 16px; font-size: 16px; }
  .page-signoff { margin-top: 18px; }
  .page[data-cover="true"] .page-copy { min-height: 270px; }
  .page[data-cover="true"] .page-title { font-size: clamp(42px, 12vw, 56px); }
  .page[data-cover="true"] .page-body { margin-top: 14px; font-size: 17px; }
  .book-controls { min-height: 70px; gap: 8px; padding: 0 12px; }
  .nav-button { min-width: 78px; gap: 5px; padding: 0 7px; }
  .progress-group { gap: 9px; }
  .progress-track { width: min(100%, 125px); }
  .page-count { font-size: 8px; letter-spacing: .1em; }
  .keyboard-hint { font-size: 9px; }
  .site-footer { margin-top: 25px; }
}

@media (max-width: 380px) {
  .brand-name { font-size: 9px; }
  .book-controls { padding: 0 7px; }
  .nav-button { min-width: 68px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
