/* The Complete Optometry Companion — site styles.
   Layout and motion modelled on Apple product pages: centred oversized headlines, product imagery
   floating on soft grey and white bands, borderless rounded tiles, a slim frosted nav, and
   scroll-driven reveals. Brand colours and typefaces (Archivo + Cormorant Garamond) as the original. */

:root {
  --navy: #102b52;
  --navy-deep: #0b1d38;
  --navy-soft: #1d3b68;
  --gold: #b8862f;
  --gold-ink: #8a6418;
  --gold-soft: #f3e8cf;
  --ivory: #f5f5f7;          /* Apple-style soft grey band */
  --paper: #ffffff;
  --ink: #1d1d1f;
  --text: #333a48;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --line-strong: #d2d2d7;
  --ok: #15803d;
  --ok-bg: #e9f6ee;
  --warn: #b45309;
  --warn-bg: #fdf3e2;
  --danger: #b91c1c;
  --danger-bg: #fdecec;
  --focus: #2563eb;

  /* Same faces as the original site: Archivo for headings and text, Cormorant Garamond for serif subtitles. */
  --font-display: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'Cormorant Garamond', ui-serif, Georgia, 'Times New Roman', serif;

  --r-sm: 10px;
  --r: 18px;
  --r-lg: 28px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow: 0 4px 24px -8px rgba(16, 43, 82, .18);
  --shadow-lg: 0 40px 80px -30px rgba(16, 43, 82, .45);
  --header-h: 52px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; background: var(--paper); color: var(--text);
  font: 400 16px/1.6 var(--font-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--gold-soft); color: var(--ink); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -48px; z-index: 100; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: var(--r-sm); text-decoration: none; transition: top .2s; }
.skip-link:focus { top: 12px; }
main { outline: none; overflow-x: clip; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
@media (min-width: 768px) { .container { padding-left: 40px; padding-right: 40px; } }
.narrow { max-width: 720px; }
.narrow-lg { max-width: 860px; }
.section { padding: 80px 0; position: relative; }
.section.compact { padding: 64px 0; }
@media (min-width: 1024px) { .section { padding: 112px 0; } .section.compact { padding: 80px 0; } }
.band-white { background: var(--ivory); }
.band-navy { background: radial-gradient(1200px 600px at 50% 0%, #17325c, var(--navy-deep) 70%); color: #e8edf5; overflow: hidden; }
.band-watermark { position: absolute; right: -96px; top: -96px; color: var(--gold); opacity: .07; pointer-events: none; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 20px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }
.split { display: grid; gap: 56px; align-items: center; }
@media (min-width: 1024px) {
  .split { grid-template-columns: 1fr 1fr; gap: 80px; }
  .split-5-7 { grid-template-columns: 5fr 7fr; }
  .split-8-4 { grid-template-columns: 8fr 4fr; }
}
.center { text-align: center; }
.center .btn-row, .btn-row.center { justify-content: center; }
.end { display: flex; justify-content: flex-start; }
@media (min-width: 1024px) { .end { justify-content: flex-end; } }
.grow { flex: 1; min-width: 0; }
.block { display: block; }
.stack-4 > * + * { margin-top: 16px; }
.stack-8 > * + * { margin-top: 24px; }
.stack-16 > * + * { margin-top: 120px; }
.mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 36px; } .mt-10 { margin-top: 48px; }
.pad { padding: 32px 0; }

/* ---------- type ---------- */
.display { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; color: var(--navy); line-height: 1.05; letter-spacing: -.01em; font-size: clamp(1.875rem, 1.45rem + 1.4vw, 2.75rem); text-wrap: balance; }
.display.xl { font-size: clamp(2.25rem, 1.7rem + 1.8vw, 3rem); margin-top: 24px; }
.display.sm { font-size: 1.5rem; }
.display.light, .light { color: #fff; }
.serif { font-family: var(--font-serif); }
.lede { font-family: var(--font-serif); font-size: clamp(1.125rem, 1.05rem + .3vw, 1.25rem); line-height: 1.55; color: var(--muted); margin-top: 16px; max-width: 42rem; text-wrap: pretty; }
.center .lede, .sec-head.center .lede { margin-inline: auto; }
.lede.light, .light-text { color: rgba(232, 237, 245, .8); }
.light-text { margin-top: 18px; line-height: 1.7; }
.big { font-size: 1.5rem; color: var(--navy); line-height: 1.3; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.cap { text-transform: capitalize; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; }
.gold { color: var(--gold); }
.strong-label { font-weight: 600; color: var(--navy); }
.eyebrow { font: 600 .72rem/1.4 var(--font-body); letter-spacing: .26em; text-transform: uppercase; color: var(--gold-ink); }
.eyebrow.muted { color: var(--muted); margin-top: 28px; }
.band-navy .eyebrow, .eyebrow.gold { color: #e3c486; }
.eyebrow.with-rule { display: inline-flex; align-items: center; gap: 12px; }
.eyebrow.with-rule::before { content: ''; width: 32px; height: 1px; background: var(--gold); }
.with-icon { display: inline-flex; align-items: center; gap: 10px; }
.link-gold { color: var(--gold-ink); font-weight: 600; text-decoration: none; background: none; border: 0; padding: 0; }
.link-gold:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-muted { color: var(--muted); font-size: .9rem; text-decoration: none; }
.link-muted:hover { color: var(--gold-ink); }
.icon { flex-shrink: 0; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Gold sheen on headlines in dark bands. */
.band-navy .display { background: linear-gradient(180deg, #fff 30%, #e3c486 130%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* section heading with eye-mark divider */
.sec-head { display: flex; flex-direction: column; margin-bottom: 52px; }
.sec-head.center { align-items: center; text-align: center; }
.sec-head.left { align-items: flex-start; margin-bottom: 36px; }
.sec-head .divider { display: flex; align-items: center; gap: 14px; margin: 14px 0 20px; color: var(--gold); }
.sec-head .divider span { width: 40px; height: 1px; background: rgba(184, 134, 47, .5); }
.sec-head.dark .lede { color: rgba(232, 237, 245, .8); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 26px;
  border-radius: 980px; border: 1.5px solid transparent; font: 600 .8rem/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease), transform .35s var(--ease), box-shadow .35s var(--ease);
}
.btn:hover:not(:disabled) { transform: translateY(-2px) scale(1.02); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; box-shadow: 0 10px 24px -12px rgba(16, 43, 82, .7); }
.btn-primary:hover:not(:disabled) { background: var(--navy-soft); box-shadow: 0 16px 30px -14px rgba(16, 43, 82, .8); }
.btn-gold { background: var(--gold); color: var(--navy-deep); }
.btn-gold:hover:not(:disabled) { background: #cb9c45; }
.btn-outline { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-outline:hover:not(:disabled) { background: var(--navy); color: #fff; }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .55); }
.btn-outline-light:hover { background: #fff; color: var(--navy-deep); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--danger); }
.btn-sm { min-height: 40px; padding: 0 18px; font-size: .72rem; }
.btn-lg { min-height: 54px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 36px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 12px; background: transparent; color: var(--navy); text-decoration: none; transition: background-color .15s, color .15s; }
.icon-btn:hover:not(:disabled) { background: rgba(16, 43, 82, .07); color: var(--gold-ink); }
.icon-btn:disabled { opacity: .3; cursor: not-allowed; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-bg); }
.icon-btn[aria-pressed="true"] { background: var(--gold-soft); color: var(--gold-ink); }

/* ---------- header (slim frosted bar) ---------- */
.site-header { position: fixed; inset: 0 0 auto 0; z-index: 50; background: rgba(251, 251, 253, .72); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); transition: background-color .3s, box-shadow .3s; }
.site-header.scrolled { background: rgba(251, 251, 253, .88); box-shadow: 0 1px 0 rgba(0, 0, 0, .08); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: var(--header-h); padding: 0 20px; max-width: 1280px; margin: 0 auto; }
.brand { flex-shrink: 0; display: block; }
.brand img { height: 34px; width: 68px; object-fit: contain; border-radius: 3px; }
.main-nav, .header-actions { display: none; align-items: center; }
.main-nav { gap: 2px; }
.nav-link { position: relative; padding: 8px 10px; font: 500 .72rem/1 var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: rgba(29, 29, 31, .82); text-decoration: none; white-space: nowrap; border-radius: 8px; transition: color .2s; }
.nav-link:hover { color: var(--ink); }
.nav-link[aria-current="page"] { color: var(--gold-ink); }
.nav-link[aria-current="page"]::after { content: ''; position: absolute; left: 50%; bottom: 1px; width: 4px; height: 4px; margin-left: -2px; background: var(--gold); border-radius: 50%; }
.nav-admin { color: var(--gold-ink); }
.nav-icon { display: inline-flex; align-items: center; gap: 6px; }
.header-actions { gap: 6px; }
.header-actions .btn-sm { min-height: 32px; padding: 0 14px; font-size: .68rem; }
.header-mobile { display: flex; align-items: center; gap: 4px; }
.basket { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; color: rgba(29, 29, 31, .82); border-radius: 10px; }
.basket:hover { color: var(--ink); }
.badge { position: absolute; top: 3px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--gold); color: var(--navy-deep); font: 700 .62rem/17px var(--font-body); text-align: center; }
.mobile-menu { background: rgba(251, 251, 253, .97); max-height: calc(100dvh - var(--header-h)); overflow-y: auto; animation: menuIn .4s var(--ease); }
@keyframes menuIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.mobile-menu nav { display: flex; flex-direction: column; padding-block: 12px 28px; }
.m-link { display: flex; align-items: center; gap: 8px; min-height: 50px; font: 600 .85rem/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.m-link[aria-current="page"], .m-admin { color: var(--gold-ink); }
.mobile-menu .btn { margin-top: 24px; }
@media (min-width: 1340px) {
  .main-nav, .header-actions { display: flex; }
  .header-mobile, .mobile-menu { display: none !important; }
  .header-row { padding: 0 28px; }
}
/* Between 1340 and 1560px the signed-in links show as icons; the label stays for screen readers. */
@media (max-width: 1559px) { .nav-icon .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } .nav-icon { min-width: 40px; min-height: 40px; justify-content: center; } }
@media (min-width: 1560px) { .main-nav { gap: 8px; } .nav-link { letter-spacing: .08em; } }
main { padding-top: var(--header-h); }
body[data-page="login"] main, body[data-page="register"] main, body[data-page="forgot"] main, body[data-page="reset"] main, body[data-page="reader"] main, body[data-page="notFound"] main { padding-top: 0; }

/* ---------- footer ---------- */
.site-footer { position: relative; overflow: hidden; background: var(--navy-deep); color: rgba(232, 237, 245, .72); padding: 72px 0 32px; font-size: .875rem; }
.footer-watermark { position: absolute; right: -80px; bottom: -160px; color: var(--gold); opacity: .045; pointer-events: none; }
.footer-grid { position: relative; display: grid; gap: 40px; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 3fr 2fr 2fr 2fr 3fr; } }
.f-brand img { width: 200px; border-radius: 4px; }
.f-brand p { margin-top: 18px; font-size: 1.125rem; line-height: 1.45; }
.socials { display: flex; gap: 10px; margin-top: 22px; }
.socials a { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255, 255, 255, .08); color: #fff; transition: background-color .25s, color .25s, transform .35s var(--ease); }
.socials a:hover { background: var(--gold); color: var(--navy-deep); transform: translateY(-3px); }
.f-col .eyebrow { margin-bottom: 16px; color: #e3c486; font-size: .7rem; }
.f-col a { display: inline-block; padding: 5px 0; color: rgba(232, 237, 245, .72); text-decoration: none; }
.f-col a:hover { color: #fff; }
.f-mail p { margin-bottom: 14px; }
.footer-form input { width: 100%; min-height: 48px; padding: 0 16px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); color: #fff; }
.footer-form input::placeholder { color: rgba(255, 255, 255, .5); }
.footer-form input:focus { border-color: var(--gold); outline: none; }
.footer-form .btn { margin-top: 10px; }
.form-msg { min-height: 1.2em; font-size: .8rem; margin-top: 8px; }
.form-msg.ok { color: #e3c486; } .form-msg.err { color: #fca5a5; }
.footer-base { position: relative; display: flex; flex-direction: column; gap: 8px; margin-top: 56px; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: .78rem; color: rgba(232, 237, 245, .55); }
@media (min-width: 768px) { .footer-base { flex-direction: row; justify-content: space-between; } }

/* ---------- hero: headline on the left, the book standing in the right-hand space ---------- */
.hero { position: relative; overflow: hidden; display: flex; align-items: center; min-height: min(calc(100vh - var(--header-h)), 820px); padding: 56px 0 72px;
  background: radial-gradient(640px 560px at 74% 52%, #ffffff 0%, rgba(255, 255, 255, 0) 70%), linear-gradient(180deg, #fbfbfd 0%, var(--ivory) 100%); }
.hero-grid { position: relative; width: 100%; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); gap: 40px; align-items: center; }
.hero-copy { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; text-align: left; max-width: 620px; }
.hero-title { margin-top: 20px; font-family: var(--font-display); font-weight: 700; text-transform: uppercase; line-height: .95; letter-spacing: -.01em; font-size: clamp(2.75rem, 2.2rem + 2vw, 3.75rem); }
.hero-title span { display: block; }
.t-navy { color: var(--navy); } .t-gold { color: var(--gold); }
.hero-sub { margin-top: 22px; font-family: var(--font-serif); font-size: clamp(1.25rem, 1.1rem + .5vw, 1.5rem); line-height: 1.35; color: var(--navy); max-width: 32rem; }
.hero-text { margin-top: 16px; max-width: 30rem; color: var(--muted); font-size: 1rem; }
.hero .btn-row { justify-content: flex-start; }
/* The book: whole, centred in its column, on a soft pool of light with a contact shadow below. */
.hero-art { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; height: min(68vh, 600px); min-height: 420px; pointer-events: none; }
.hero-art .book-cover { position: relative; z-index: 1; height: 100%; }
.hero-art .book-cover img { height: 100%; width: auto; max-width: none; filter: drop-shadow(0 26px 34px rgba(16, 43, 82, .2)) drop-shadow(0 4px 8px rgba(16, 43, 82, .1)); }
.hero-art::after { content: ''; position: absolute; z-index: 0; left: 50%; bottom: -2%; width: 62%; height: 7%; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(closest-side, rgba(16, 43, 82, .22), rgba(16, 43, 82, 0)); filter: blur(6px); }
.hero-glow { position: absolute; z-index: 0; inset: -6% -14%; border-radius: 50%; background: radial-gradient(closest-side, rgba(184, 134, 47, .16), rgba(184, 134, 47, 0) 100%); }
.hero-mark { display: none; }
@media (max-width: 899px) {
  .hero { min-height: 0; padding: 48px 0 64px; text-align: center; }
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }
  .hero-copy { align-items: center; text-align: center; margin: 0 auto; }
  .hero .btn-row { justify-content: center; }
  .hero-art { height: 440px; min-height: 0; }
}

/* Product photos: cut out, no frame, soft natural shadow. */
.book-cover { position: relative; }
.book-cover img { width: 100%; height: auto; }
.book-cover.shadow img { filter: drop-shadow(0 34px 40px rgba(16, 43, 82, .2)); }
.center-art { display: flex; justify-content: center; }
.center-art .book-cover { max-width: 330px; width: 100%; }

/* ---------- scroll motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * { animation: rise 1.1s var(--ease) both; }
  .hero-copy > :nth-child(1) { animation-delay: .05s; }
  .hero-title .t-navy:nth-child(1) { animation: rise 1.1s var(--ease) .12s both; }
  .hero-title .t-navy:nth-child(2) { animation: rise 1.1s var(--ease) .22s both; }
  .hero-title .t-gold { animation: rise 1.1s var(--ease) .32s both, sheen 3.5s ease-in-out 1.4s 1; background: linear-gradient(100deg, var(--gold) 40%, #f1d28f 50%, var(--gold) 60%) 0 0 / 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; }
  .hero-title { animation: none !important; }
  .hero-copy > :nth-child(3) { animation-delay: .42s; } .hero-copy > :nth-child(4) { animation-delay: .52s; }
  .hero-copy > :nth-child(5) { animation-delay: .62s; } .hero-copy > :nth-child(6) { animation-delay: .7s; }
  .hero-art .book-cover { animation: bookIn 1.6s var(--ease) .3s both; }
  .hero-art img { will-change: transform; transform: translateY(calc(var(--scroll, 0) * -0.06px)) rotate(calc(var(--scroll, 0) * 0.003deg)); }
  .hero-glow { animation: glow 6s ease-in-out 1.2s infinite alternate; }

  .reveal.pre { opacity: 0; transform: translateY(56px) scale(.97); filter: blur(8px); transition: opacity 1s var(--ease), transform 1.2s var(--ease), filter 1s var(--ease); transition-delay: calc(var(--i, 0) * 110ms); }
  .reveal.pre.in { opacity: 1; transform: none; filter: none; }
  .zoom-in.pre { opacity: .2; transform: scale(.86); transition: opacity 1.2s var(--ease), transform 1.6s var(--ease); }
  .zoom-in.pre.in { opacity: 1; transform: none; }
  .sec-head.pre .display, .sec-head.pre .lede, .sec-head.pre .eyebrow, .sec-head.pre .divider { opacity: 0; transform: translateY(36px); transition: opacity .9s var(--ease), transform 1.1s var(--ease); }
  .sec-head.pre .divider { transition-delay: .08s; } .sec-head.pre .display { transition-delay: .14s; } .sec-head.pre .lede { transition-delay: .26s; }
  .sec-head.pre.in .display, .sec-head.pre.in .lede, .sec-head.pre.in .eyebrow, .sec-head.pre.in .divider { opacity: 1; transform: none; }
  .sec-head.pre .divider span { transform: scaleX(0); transition: transform 1s var(--ease) .3s; }
  .sec-head.pre.in .divider span { transform: none; }
}
@keyframes rise { from { opacity: 0; transform: translateY(48px); filter: blur(10px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes bookIn { from { opacity: 0; transform: translateX(80px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes glow { from { opacity: .6; transform: scale(.96); } to { opacity: 1; transform: scale(1.04); } }
@keyframes sheen { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- tiles (borderless, rounded) ---------- */
.card { background: var(--paper); border: 0; border-radius: var(--r-lg); padding: 32px; box-shadow: none; }
.section:not(.band-white) .card { background: var(--ivory); }
.card-title { margin: 16px 0 8px; font: 700 .875rem/1.35 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--navy); }
.feature { padding: 36px 30px 40px; transition: transform .6s var(--ease), box-shadow .6s var(--ease); }
.feature:hover { transform: translateY(-6px) scale(1.015); box-shadow: 0 30px 60px -30px rgba(16, 43, 82, .35); }
.feature .icon { width: 40px; height: 40px; padding: 8px; border-radius: 12px; background: var(--gold-soft); color: var(--gold-ink); box-sizing: content-box; }
.feature p, .promise-item p { font-size: .875rem; line-height: 1.6; color: var(--muted); }
.promise-item { text-align: center; padding: 8px 12px; }
.promise-item .ring { display: inline-flex; width: 76px; height: 76px; align-items: center; justify-content: center; border-radius: 50%; background: var(--ivory); color: var(--navy); margin-bottom: 22px; transition: transform .6s var(--ease), background-color .4s; }
.promise-item:hover .ring { transform: scale(1.1) rotate(-6deg); background: var(--gold-soft); }
.promise-item .eyebrow { margin-bottom: 12px; }
.promise-item p { max-width: 20rem; margin: 0 auto; }
.check-list { display: grid; gap: 14px; margin-bottom: 36px; }
.check-list li { display: flex; align-items: flex-start; gap: 10px; color: var(--text); font-size: .875rem; }
.check-list .icon { margin-top: 3px; }
@media (min-width: 640px) { .check-list.cols-2 { grid-template-columns: 1fr 1fr; column-gap: 28px; } }
.inside-card { background: var(--paper) !important; }
.inside-card .eyebrow { margin-bottom: 22px; }
.inside-card .check-list { margin: 0; }
.icon-list { display: grid; gap: 16px; margin-bottom: 36px; }
.icon-list li { display: flex; align-items: center; gap: 12px; font-size: 1rem; }
/* Interior spread: floats on the band, no box. */
.spread { position: relative; }
.spread img { width: 100%; height: auto; filter: drop-shadow(0 30px 40px rgba(16, 43, 82, .18)); }
.spread-cta { position: absolute; bottom: 4%; left: 50%; transform: translateX(-50%); }
.spread-cta:hover:not(:disabled) { transform: translateX(-50%) translateY(-2px) scale(1.02); }
.spread.wide { max-width: 860px; margin: 0 auto; }
.motto-card { text-align: center; padding: 52px 32px; background: linear-gradient(160deg, var(--navy-deep), #17325c) !important; color: #fff; overflow: hidden; position: relative; }
.motto-card .big { color: #fff; }
.motto-icons { display: flex; align-items: center; justify-content: center; gap: 22px; margin-bottom: 28px; color: #e3c486; }
.motto-card .muted { margin-top: 12px; font-size: .875rem; color: rgba(232, 237, 245, .7); }
.form-card { padding: 32px; }
@media (min-width: 768px) { .form-card { padding: 44px; } }
.testimonial blockquote { margin-top: 14px; font-family: var(--font-serif); font-size: 1.125rem; line-height: 1.5; color: var(--text); }
.testimonial figcaption { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.testimonial figcaption strong { color: var(--navy); }
.testimonial figcaption span { font-size: .8rem; color: var(--muted); }
.closing { background: var(--ivory); }
.closing .eye-mark { margin: 0 auto; }
.prose-cols p, .prose p { color: var(--text); line-height: 1.75; font-size: 1rem; }
.prose p + p { margin-top: 18px; }
.facts > div { padding: 28px; border-radius: var(--r-lg); background: var(--ivory); }
.facts .eyebrow { margin-bottom: 10px; }

/* page header: big centred title, like a product page intro */
.page-header { padding: 80px 0 60px; background: linear-gradient(180deg, var(--paper), var(--ivory)); }
.page-header .sec-head { margin-bottom: 0; }
.page-header .display { font-size: clamp(2.25rem, 1.6rem + 2.2vw, 3.75rem); }
@media (min-width: 1024px) { .page-header { padding: 112px 0 80px; } }
.page-header + .section:not(.band-white):not(.band-navy) { padding-top: 64px; }

/* authors */
.author { display: grid; gap: 48px; align-items: center; }
@media (min-width: 1024px) { .author { grid-template-columns: 4fr 8fr; } .author:nth-child(even) > :first-child { order: 2; } }
.author-card { aspect-ratio: 4 / 5; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; max-width: 380px; width: 100%; background: linear-gradient(160deg, var(--navy-deep), #1d3b68) !important; color: #fff; }
.author-card .eye-mark { color: var(--gold); }
.author-card .eyebrow { color: #e3c486; }
.author-name { margin: 24px 0 8px; font: 700 1.5rem/1.15 var(--font-display); text-transform: uppercase; letter-spacing: -.01em; color: #fff; }

/* steps, forum */
.steps .eyebrow { margin-bottom: 16px; }
.steps ol { list-style: decimal; padding-left: 22px; display: grid; gap: 10px; color: var(--text); }
.steps .icon { display: inline; vertical-align: -2px; }
.cats .cat { display: flex; align-items: center; justify-content: space-between; min-height: 64px; padding: 18px 22px; font: 700 .875rem/1.3 var(--font-body); letter-spacing: .05em; text-transform: uppercase; color: var(--navy); text-decoration: none; transition: transform .5s var(--ease), background-color .3s; }
.cats .cat:hover { transform: translateY(-4px); background: var(--gold-soft); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field legend { font: 600 .8rem/1.3 var(--font-body); color: var(--navy); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.card legend { float: left; width: 100%; margin-bottom: 18px; }
fieldset.card > :not(legend) { clear: both; }
fieldset .field + .field, fieldset .grid-2 + .field, fieldset .field + .grid-2, fieldset .grid-2 + .grid-2, .form-card > * + *, .mail-form > * + * { margin-top: 16px; }
.form-card > .form-error:empty, .mail-form > .form-error:empty { margin: 0; }
.grid-2 > .field + .field { margin-top: 0; }
input:not([type=checkbox]):not([type=range]):not([type=file]), select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 120px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #8b95a7; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184, 134, 47, .2); }
input:disabled { background: #f3f1ec; color: var(--muted); }
input.upper { text-transform: uppercase; }
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: .9rem; color: var(--muted); cursor: pointer; }
.consent input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--gold); flex-shrink: 0; }
.form-error { color: var(--danger); font-size: .875rem; min-height: 0; }
.form-error:not(:empty) { margin-top: 12px; }
.form-error .ok, .ok { color: var(--ok); }
.err { color: var(--danger); }
.hint { font-size: .8rem; color: var(--muted); margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; color: var(--navy); font: 600 .72rem/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; transition: all .15s; }
.chip:hover { border-color: var(--gold); }
.chip[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.chips.filter { margin: 0 0 28px; }
.search-box { position: relative; display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.search-box > .icon { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 42px !important; }
.mail-done { text-align: center; padding: 24px 0; }
.mail-done .big { margin-top: 12px; }
.state-icon { display: inline-flex; width: 56px; height: 56px; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--gold); color: var(--gold); margin-bottom: 18px; }
.state-icon.lg { width: 68px; height: 68px; }

/* accordion */
.accordion { border-block: 1px solid var(--line); }
.acc-item + .acc-item { border-top: 1px solid var(--line); }
.acc-btn { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 18px 4px; border: 0; background: none; text-align: left; font: 600 .875rem/1.45 var(--font-body); letter-spacing: .05em; text-transform: uppercase; color: var(--navy); }
.acc-btn:hover { color: var(--gold-ink); }
.acc-chevron { transition: transform .25s var(--ease); }
.acc-btn[aria-expanded="true"] .acc-chevron { transform: rotate(180deg); }
.acc-panel { padding: 0 4px 22px; color: var(--muted); line-height: 1.7; max-width: 46rem; }

/* states */
.state-page { min-height: 70vh; display: flex; align-items: center; padding: 64px 0; }
.state-page.tall { min-height: 80vh; }
.state-page.full { min-height: 100vh; }
.state-page .display { margin-top: 8px; }
.state-page .eye-mark, .state-page > .container > .icon { margin: 0 auto 18px; }
.huge-num { font: 700 6rem/1 var(--font-display); color: var(--gold-soft); }
.loading { display: flex; justify-content: center; padding: 48px 0; }
.spinner { display: inline-block; width: 32px; height: 32px; border: 3px solid var(--line); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; }
.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.empty { text-align: center; display: grid; justify-items: center; gap: 8px; padding: 48px 24px; }
.empty .eye-mark { margin-bottom: 8px; }

/* legal */
.legal { padding: 64px 0 96px; }
.legal .display { margin-top: 18px; font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem); }
.updated { margin-top: 14px; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding-bottom: 32px; border-bottom: 1px solid rgba(184, 134, 47, .3); }
.legal-prose { margin-top: 40px; color: var(--text); line-height: 1.75; }
.legal-prose > * + * { margin-top: 28px; }
.legal-prose h2 { font: 700 1rem/1.4 var(--font-body); letter-spacing: .07em; text-transform: uppercase; color: var(--navy); margin-bottom: 12px; }
.legal-prose section > * + * { margin-top: 12px; }
.legal-prose ul { list-style: disc; padding-left: 22px; display: grid; gap: 8px; }
.legal-prose li::marker { color: var(--gold); }
.legal-prose a { color: var(--gold-ink); font-weight: 600; }
.legal-prose strong { color: var(--ink); }
.legal-foot { margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.brand-line { display: inline-flex; align-items: center; gap: 12px; font-size: 1.1rem; color: var(--navy); }

/* ---------- shop & checkout ---------- */
.products { display: grid; gap: 28px; max-width: 900px; margin: 0 auto; }
@media (min-width: 768px) { .products { grid-template-columns: 1fr 1fr; } }
.product { display: flex; flex-direction: column; }
.product-art { display: flex; justify-content: center; margin-bottom: 24px; }
.product-art { padding: 12px 0 8px; }
.product-art img { width: auto; max-width: 100%; height: 320px; object-fit: contain; filter: drop-shadow(0 30px 34px rgba(16, 43, 82, .25)); transition: transform .8s var(--ease); }
.product:hover .product-art img { transform: translateY(-8px) rotate(-1.5deg) scale(1.03); }
.product-art .no-image { width: 100%; max-width: 240px; aspect-ratio: 4 / 5; border-radius: var(--r); }
.no-image { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--ivory); color: var(--muted); font-size: .8rem; text-align: center; padding: 16px; }
.product .eyebrow { margin-bottom: 6px; }
.product-name { font: 700 1.15rem/1.35 var(--font-body); letter-spacing: .02em; text-transform: uppercase; color: var(--navy); }
.product-desc { margin-top: 12px; color: var(--muted); font-size: .95rem; flex: 1; }
.product .check-list { margin: 16px 0 0; }
.product-buy { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 18px; }
.price { font: 700 1.5rem/1 var(--font-display); color: var(--navy); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; }
.qty output { min-width: 28px; text-align: center; font-weight: 600; color: var(--navy); }
.assurances { text-align: center; }
.assurances .icon { margin: 0 auto; }
.checkout-grid { display: grid; gap: 32px; }
@media (min-width: 1024px) { .checkout-grid { grid-template-columns: 2fr 1fr; gap: 40px; align-items: start; } }
.summary { position: sticky; top: calc(var(--header-h) + 24px); }
.summary .eyebrow { margin-bottom: 14px; }
.summary .row, .order-card .row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: .95rem; color: var(--muted); }
.summary .row strong { color: var(--navy); }
.summary .row.sep { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 14px; }
.summary .row.ok, .summary .row.ok strong { color: var(--ok); }
.row.total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 14px; font: 700 1.1rem/1.3 var(--font-body); color: var(--navy) !important; }
.basket-list { border-block: 1px solid var(--line); }
.basket-item { display: flex; align-items: center; gap: 16px; padding: 22px 0; flex-wrap: wrap; }
.basket-item + .basket-item { border-top: 1px solid var(--line); }
.thumb { width: 64px; height: 80px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; font: 700 .6rem/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.item-name { font: 700 .9rem/1.35 var(--font-body); letter-spacing: .03em; text-transform: uppercase; color: var(--navy); margin-top: 2px; }
.item-price { color: var(--gold-ink); font-weight: 700; margin-top: 4px; }
.promo-row { display: flex; gap: 10px; align-items: stretch; }
.field.with-icon { position: relative; }
.field.with-icon > .icon { position: absolute; left: 14px; top: 16px; color: var(--muted); }
.field.with-icon input { padding-left: 42px !important; }
.promo-msg { font-size: .8rem; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.promo-msg.ok { color: var(--ok); } .promo-msg.err { color: var(--danger); }
.pay-methods { display: flex; justify-content: center; align-items: center; gap: 18px; font-size: .8rem; color: var(--muted); }
.pay-methods span, .pay-methods { display: inline-flex; align-items: center; gap: 6px; }
.pay-methods { display: flex; }
.order-card { text-align: left; margin-top: 32px; }
.order-card .row.head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 6px; align-items: center; }
.order-card .row strong { color: var(--navy); }
.block-sep { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.block-sep p + p { margin-top: 8px; color: var(--muted); font-size: .95rem; }

/* ---------- auth ---------- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 16px; background: radial-gradient(1200px 600px at 50% -10%, #fff, var(--ivory)); }
.auth-card { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 36px 28px; box-shadow: var(--shadow); }
@media (min-width: 480px) { .auth-card { padding: 44px 40px; } }
.auth-head { text-align: center; margin-bottom: 28px; }
.auth-mark { display: inline-flex; color: var(--navy); margin-bottom: 12px; }
.eyebrow.ruled { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: .65rem; }
.eyebrow.ruled span { width: 24px; height: 1px; background: var(--gold); }
.auth-head .display { font-size: 1.9rem; margin-top: 14px; }
.auth-head .muted { margin-top: 6px; }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 44px !important; }
.label-row { display: flex; justify-content: space-between; align-items: center; }
.auth-foot { margin-top: 24px; text-align: center; font-size: .9rem; color: var(--muted); }
.otp { text-align: center; letter-spacing: .6em; font-size: 1.4rem !important; font-weight: 600; }

/* ---------- account ---------- */
.account .display { margin-top: 10px; }
.account-grid { display: grid; gap: 28px; margin-top: 36px; }
@media (min-width: 960px) { .account-grid { grid-template-columns: 240px 1fr; gap: 40px; align-items: start; } }
.side-nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
@media (min-width: 960px) { .side-nav { flex-direction: column; position: sticky; top: calc(var(--header-h) + 24px); } }
.side-nav button { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--navy); font-weight: 600; font-size: .9rem; white-space: nowrap; text-align: left; }
.side-nav button:hover { background: rgba(16, 43, 82, .06); }
.side-nav button[aria-current="page"] { background: var(--navy); color: #fff; }
.side-nav button[data-logout] { color: var(--muted); }
.stats .stat { text-align: center; }
.stat-v { font: 700 2rem/1.1 var(--font-display); color: var(--navy); margin-bottom: 6px; }
.order { margin-top: 16px; padding: 0; overflow: hidden; }
.order-head { display: flex; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); background: #fbf9f5; }
.order-head .end { flex-direction: column; align-items: flex-end; gap: 6px; }
.order-head .price { font-size: 1.2rem; }
.order-body { display: grid; gap: 24px; padding: 24px; }
@media (min-width: 720px) { .order-body { grid-template-columns: 1fr 1fr; } }
.order-body .eyebrow { margin-bottom: 8px; }
.status-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px; background: #eef0f4; color: var(--muted); font: 600 .7rem/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase; }
.status-chip.ok { background: var(--ok-bg); color: var(--ok); }
.status-chip.warn { background: var(--warn-bg); color: var(--warn); }
.status-chip.danger { background: var(--danger-bg); color: var(--danger); }
.status-chip.gold { background: var(--gold-soft); color: var(--gold-ink); }
.timeline { display: grid; gap: 0; }
.timeline li { display: flex; align-items: center; gap: 12px; position: relative; padding: 5px 0; font-size: .875rem; color: #9aa3b2; }
.timeline li + li::before { content: ''; position: absolute; left: 13px; top: -10px; height: 16px; width: 2px; background: var(--line); }
.timeline li.done + li.done::before { background: var(--navy); }
.timeline .dot { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--line-strong); background: #fff; font-size: .7rem; font-weight: 700; color: #9aa3b2; }
.timeline .done { color: var(--navy); font-weight: 600; }
.timeline .done .dot { background: var(--navy); border-color: var(--navy); color: #fff; }
.timeline .current .dot { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--gold); }
.dl { display: grid; gap: 8px; margin-top: 12px; }
.dl div { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; }
.dl dt { color: var(--muted); }
.dl dd { color: var(--navy); font-weight: 600; text-align: right; }
.digital-card { display: grid; gap: 10px; justify-items: start; }
.digital-card p:not(.eyebrow) { color: var(--muted); }

/* library */
.library .display { margin-top: 10px; }
.rule { height: 1px; background: rgba(184, 134, 47, .35); margin: 28px 0 32px; }
.continue { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; border-color: rgba(184, 134, 47, .4); background: linear-gradient(120deg, #fff, #fbf6ea); }
.book-row { display: flex; gap: 24px; margin-top: 18px; flex-wrap: wrap; }
.book-thumb { width: 120px; flex-shrink: 0; aspect-ratio: 4 / 5; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; background: var(--ivory); }
.book-thumb img { width: 100%; height: 100%; object-fit: cover; }
.book-title { font: 600 1.25rem/1.3 var(--font-display); color: var(--navy); margin: 4px 0 14px; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-bottom: 8px; max-width: 360px; }
.progress span { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
.book-links { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 16px; }
.book-links a { font-size: .85rem; font-weight: 600; color: var(--gold-ink); }

/* ---------- reader ---------- */
body[data-page="reader"] { background: #1a2438; overflow: hidden; }
.reader { position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); background: #1a2438; color: #e8edf5; }
/* Phones: size to the visible screen (Safari's toolbars included) and keep clear of the notch and home bar. */
@supports (height: 100dvh) { .reader { bottom: auto; height: 100dvh; } }
.reader .icon-btn { color: #e8edf5; }
.reader .icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .1); color: #fff; }
.reader .icon-btn[aria-pressed="true"] { background: var(--gold); color: var(--navy-deep); }
.reader-state { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; background: var(--ivory); color: var(--navy); }
.reader-state .display { max-width: 30rem; }
.reader-bar { display: flex; align-items: center; gap: 6px; min-height: 56px; padding: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left)); background: var(--navy-deep); border-bottom: 1px solid rgba(255, 255, 255, .08); transition: transform .25s var(--ease); z-index: 3; }
.r-back { font: 600 .75rem/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase; }
.reader-title { flex: 1; min-width: 0; text-align: center; }
.reader-title p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 .85rem/1.2 var(--font-display); letter-spacing: .06em; text-transform: uppercase; }
.reader-tools { display: flex; align-items: center; gap: 2px; }
.r-sep { width: 1px; height: 20px; margin: 0 6px; background: rgba(255, 255, 255, .16); }
.r-fit { min-width: 52px; min-height: 36px; padding: 0 8px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 8px; background: transparent; color: #fff; font: 600 .72rem/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; }
.r-fit:hover { border-color: var(--gold); }
.reader-stage { position: relative; overflow: auto; display: flex; outline: none; overscroll-behavior: contain; min-width: 0; min-height: 0; }
.reader-bar > *, .reader-foot > * { flex-shrink: 0; }
.reader-bar > .reader-title, .reader-foot > #scrub { flex-shrink: 1; }
@media (max-width: 520px) {
  .r-back span { display: none; }
  .reader-foot { gap: 6px; }
  .r-pageno { padding: 0 8px; font-size: .8rem; }
  .r-pct { display: none; }
  #scrub { min-width: 0; }
}
.reader-stage.panning { cursor: grab; }
.pages { margin: auto; display: flex; align-items: flex-start; padding: 32px; }
@media (max-width: 767px) { .pages { padding: 10px; } }
.page { position: relative; flex-shrink: 0; background: #fff; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .5); overflow: hidden; user-select: none; -webkit-user-select: none; }
.page.left { border-right: 1px solid var(--line); }
.page img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-touch-callout: none; }
.page-load, .page-err { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text); font-size: .9rem; text-align: center; padding: 16px; }
.text-layer { position: absolute; inset: 0; line-height: 1; user-select: text; -webkit-user-select: text; }
.text-layer span { position: absolute; color: transparent; white-space: pre; transform-origin: 0 0; font-family: sans-serif; cursor: text; }
.text-layer span::selection { background: rgba(37, 99, 235, .28); color: transparent; }
.hl-rect { position: absolute; background: rgba(240, 196, 80, .42); mix-blend-mode: multiply; pointer-events: none; border-radius: 2px; }
.wm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; overflow: hidden; }
.wm span { transform: rotate(-32deg); white-space: nowrap; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .3em; color: rgba(16, 43, 82, .05); }
.wm-foot { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; pointer-events: none; color: rgba(16, 43, 82, .25); }
.reader-foot { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); background: var(--navy-deep); border-top: 1px solid rgba(255, 255, 255, .08); transition: transform .25s var(--ease); z-index: 3; }
.r-pageno { min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .06); color: #fff; font: 600 .85rem/1 var(--font-body); white-space: nowrap; }
.r-pageno .muted, .r-pct { color: #aeb9cc; }
.r-pct { font-size: .8rem; min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.goto input { width: 84px !important; min-height: 40px !important; padding: 6px 8px !important; text-align: center; background: rgba(255, 255, 255, .08) !important; border-color: rgba(255, 255, 255, .25) !important; color: #fff !important; }
#scrub { flex: 1; accent-color: var(--gold); min-width: 60px; }
.reader.chrome-hidden .reader-bar { transform: translateY(-100%); }
.reader.chrome-hidden .reader-foot { transform: translateY(100%); }
.reader-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100%); overflow-y: auto; background: #fff; color: var(--text); padding: 18px 20px 24px; box-shadow: -20px 0 40px -20px rgba(0, 0, 0, .5); z-index: 10; }
.reader-panel .icon-btn { color: var(--navy); }
.reader-panel .icon-btn:hover { background: rgba(16, 43, 82, .07); color: var(--gold-ink); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.panel-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.panel-tabs button { flex: 1; min-height: 44px; border: 0; border-bottom: 2px solid transparent; background: none; color: rgba(16, 43, 82, .4); }
.panel-tabs button:hover { color: var(--navy); }
.panel-tabs button[aria-selected="true"] { border-bottom-color: var(--gold); color: var(--navy); }
.toc li button, .mark-list button:first-child, .hl-list button:first-child { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; color: var(--navy); }
.toc li button:hover, .mark-list button:first-child:hover, .hl-list button:first-child:hover { background: var(--ivory); }
.toc li button.on { color: var(--gold-ink); }
.toc .toc-top { font-size: 1.15rem; }
.toc .lvl-1 { padding-left: 16px; } .toc .lvl-2 { padding-left: 32px; } .toc .lvl-3 { padding-left: 44px; }
.mark-list li, .hl-list li { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.hl-list li { flex-direction: column; align-items: stretch; padding-bottom: 6px; }
.hl-list button:first-child { flex-direction: column; align-items: flex-start; gap: 4px; }
.hl-list mark { background: #f6e3a8; color: inherit; border-radius: 2px; }
.a-unhl { align-self: flex-start; margin-left: 10px; display: inline-flex; align-items: center; gap: 4px; min-height: 30px; border: 0; background: none; color: var(--muted); font-size: .75rem; }
.a-unhl:hover { color: var(--danger); }
.r-menu { position: fixed; top: 56px; right: 8px; z-index: 12; display: grid; min-width: 220px; padding: 6px; border-radius: 12px; background: #fff; box-shadow: var(--shadow-lg); }
.r-menu button { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--navy); font: 600 .75rem/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase; text-align: left; }
.r-menu button:hover { background: var(--ivory); }
.r-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.hl-pop { position: fixed; z-index: 20; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--navy); color: #fff; font-weight: 600; box-shadow: var(--shadow); }
.reader-panel .search-box { margin-bottom: 14px; }

/* toasts */
#toasts { position: fixed; z-index: 200; right: 16px; bottom: 16px; display: grid; gap: 10px; max-width: calc(100vw - 32px); }
.toast { display: grid; gap: 2px; min-width: 260px; padding: 14px 18px; border-radius: var(--r); background: var(--navy-deep); color: #fff; box-shadow: var(--shadow); font-size: .9rem; animation: fadeUp .25s var(--ease); transition: opacity .3s; }
.toast span { color: rgba(255, 255, 255, .75); font-size: .85rem; }
.toast-err { background: var(--danger); }
.toast.out { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print { .site-header, .site-footer, .skip-link { display: none; } main { padding: 0; } }
