/* ==========================================================================
   Kate Lorén — the online reader (everything around the book text).
   The text itself is styled by book.css, shared with the EPUB files.
   ========================================================================== */

:root {
  --font-display: 'Cormorant Garamond', 'Cormorant', 'Times New Roman', serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --accent: #d8b07a;
  --accent-ink: #8a6532;
  --accent-rgb: 216, 176, 122;
  --ease: cubic-bezier(0.22, 0.61, 0.21, 1);
  --top-h: 52px;
  --bar-h: 34px;
  --pad-x: 22px;
  /* reading settings (overwritten by the inline script before first paint) */
  --bk-size: 19px;
  --bk-lh: 1.6;
  --bk-align: justify;
  --bk-font: 'Literata', Georgia, 'Times New Roman', serif;
  --bk-display: var(--font-display);
  --measure: 34em;
}

/* ---------- themes ---------- */
:root, :root[data-theme='paper'] {
  --bg: #f6f1e7;
  --bg-rgb: 246, 241, 231;
  --fg: #2a2521;
  --muted: #857b6e;
  --rule: rgba(42, 37, 33, 0.13);
  --panel: #fffaf1;
  --panel-2: #efe8da;
  --bk-accent: var(--accent-ink);
  --shadow: 0 24px 60px -20px rgba(60, 40, 10, 0.35);
  color-scheme: light;
}
:root[data-theme='sepia'] {
  --bg: #ecdcc0;
  --bg-rgb: 236, 220, 192;
  --fg: #3a2c1c;
  --muted: #84705a;
  --rule: rgba(58, 44, 28, 0.16);
  --panel: #f5e8cf;
  --panel-2: #e2d0b0;
  --bk-accent: var(--accent-ink);
  --shadow: 0 24px 60px -20px rgba(60, 40, 10, 0.4);
  color-scheme: light;
}
:root[data-theme='night'] {
  --bg: #100f0e;
  --bg-rgb: 16, 15, 14;
  --fg: #d5ccbe;
  --muted: #8b8376;
  --rule: rgba(236, 219, 190, 0.14);
  --panel: #1b1917;
  --panel-2: #262320;
  --bk-accent: var(--accent);
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.9);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.35s, color 0.35s;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--bk-accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(var(--accent-rgb), 0.34); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.rd-top {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 6px 0;
  display: grid;
  grid-template-columns: 96px 1fr 96px;
  align-items: center;
  background: rgba(var(--bg-rgb), 0.9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
  transition: transform 0.4s var(--ease), background-color 0.35s;
}
.rd-top .l { display: flex; justify-content: flex-start; }
.rd-top .r { display: flex; justify-content: flex-end; }
.rd-title {
  text-align: center;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
  padding: 0 4px;
}
.ib {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--fg);
  transition: background-color 0.2s, color 0.2s;
}
.ib:hover { background: var(--rule); }
.ib svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ib .aa { font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: 0.01em; line-height: 1; }
.ib .aa small { font-size: 0.7em; }

/* ---------- bottom bar: progress ---------- */
.rd-bar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  height: calc(var(--bar-h) + env(safe-area-inset-bottom));
  padding: 0 16px env(safe-area-inset-bottom);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: rgba(var(--bg-rgb), 0.9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--rule);
  transition: transform 0.4s var(--ease), background-color 0.35s;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rd-bar span { overflow: hidden; text-overflow: ellipsis; }
.rd-prog { position: fixed; inset: auto 0 0 0; z-index: 31; height: 2px; background: transparent; pointer-events: none; }
.rd-prog i { display: block; height: 100%; width: 0; background: var(--bk-accent); transition: width 0.4s var(--ease); }
.chrome-off .rd-top { transform: translateY(-101%); }
.chrome-off .rd-bar { transform: translateY(101%); }

/* ---------- the page ---------- */
.stage {
  min-height: 100svh;
  padding: calc(var(--top-h) + env(safe-area-inset-top) + 8px) 0 calc(var(--bar-h) + env(safe-area-inset-bottom) + 40px);
}
.book {
  font-size: var(--bk-size);
  max-width: calc(var(--measure) + var(--pad-x) * 2);
  margin: 0 auto;
  padding: 0 var(--pad-x);
  outline: none;
}
.book > :first-child { margin-top: 1.2em; }
.resuming .book, .gated .book { visibility: hidden; }
.gated .rd-end { display: none; }

/* cover at the very beginning of the book */
.book .tp-cover {
  width: min(58%, 250px);
  margin: 0.4em auto 2em;
  border-radius: 7px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.book .tp-cover img { width: 100%; height: auto; }

/* gold seam under the chapter ornament (web only) */
.book .ch-orn { position: relative; }

/* loading / error */
.rd-state { max-width: 30em; margin: 22vh auto 0; padding: 0 var(--pad-x); text-align: center; color: var(--muted); font-size: 14px; }
.rd-state .spin { width: 26px; height: 26px; margin: 0 auto 16px; border-radius: 50%; border: 1.5px solid var(--rule); border-top-color: var(--bk-accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- end of chapter ---------- */
.rd-end { max-width: calc(34em * 1 + var(--pad-x) * 2); margin: 0 auto; padding: 3.4em var(--pad-x) 0; font-size: 17px; }
.next-card {
  display: block;
  width: 100%;
  text-align: center;
  padding: 26px 20px 24px;
  border: 1px solid var(--rule);
  border-radius: 20px;
  background: var(--panel);
  transition: border-color 0.25s, transform 0.25s var(--ease), background-color 0.35s;
}
.next-card:hover { border-color: var(--bk-accent); transform: translateY(-2px); }
.next-card .k { font-size: 11px; font-weight: 650; letter-spacing: 0.26em; text-transform: uppercase; color: var(--bk-accent); }
.next-card .t { font-family: var(--font-display); font-size: 27px; font-weight: 500; line-height: 1.1; margin-top: 8px; color: var(--fg); text-wrap: balance; }
.next-card .t em { display: block; font-size: 0.82em; margin-top: 3px; }
.next-card .arr { display: inline-block; margin-top: 10px; font-size: 20px; color: var(--bk-accent); }
.prev-link { display: block; margin: 16px auto 0; padding: 10px; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); text-align: center; }
.prev-link:hover { color: var(--fg); }

/* ---------- wall: paywall / amazon / end of book ---------- */
.wall {
  position: relative;
  margin-top: 0.6em;
  padding: 34px 22px 26px;
  border-radius: 26px;
  text-align: center;
  color: #f1e8da;
  background: #131110;
  overflow: hidden;
  isolation: isolate;
  box-shadow: var(--shadow);
}
.wall::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(var(--accent-rgb), 0.34), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%);
}
.wall-cover { width: 104px; margin: 0 auto 20px; border-radius: 6px; box-shadow: 0 18px 40px -14px #000, 0 0 0 1px rgba(255, 255, 255, 0.1); overflow: hidden; }
.wall .k { font-size: 11px; font-weight: 650; letter-spacing: 0.28em; text-transform: uppercase; color: var(--accent); }
.wall h3 { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.9rem, 7.6vw, 2.5rem); line-height: 1.06; margin: 12px 0 0; text-wrap: balance; }
.wall p.lead { font-family: 'Literata', Georgia, serif; font-size: 15.5px; line-height: 1.55; color: #cbc1b2; margin: 14px auto 0; max-width: 27em; text-wrap: pretty; }
.wall ul { list-style: none; margin: 20px auto 0; padding: 0; max-width: 25em; text-align: left; font-size: 14px; line-height: 1.45; color: #e2d8c8; }
.wall li { position: relative; padding: 9px 0 9px 28px; border-top: 1px solid rgba(236, 219, 190, 0.13); }
.wall li:last-child { border-bottom: 1px solid rgba(236, 219, 190, 0.13); }
.wall li::before { content: ''; position: absolute; left: 4px; top: 17px; width: 9px; border-top: 1.5px solid var(--accent); }
.wall .cta { margin-top: 24px; display: grid; gap: 12px; }
.wall .sub { font-size: 12.5px; color: #948b7e; margin: 14px 0 0; }
.wall .also { margin-top: 20px; padding-top: 16px; border-top: 1px solid rgba(236, 219, 190, 0.13); display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.wall .also .lbl { width: 100%; font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: #948b7e; margin-bottom: 4px; }
/* the printed book as real buttons (the panel that sends the reader on to Amazon): side by side, quieter than the main one */
.wall .also .btn { flex: 1 1 132px; min-height: 50px; padding: 6px 14px; font-size: 12px; letter-spacing: 0.12em; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-height: 56px;
  padding: 0 26px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  line-height: 1.25;
  text-align: center;
  transition: transform 0.25s var(--ease), box-shadow 0.25s, opacity 0.2s;
  user-select: none;
}
.btn:active { transform: scale(0.975); }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn-gold { background: linear-gradient(180deg, #f3dfb8 0%, #d8b07a 100%); color: #17120b; box-shadow: 0 12px 34px -12px rgba(216, 176, 122, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.55); }
.btn-gold:hover { transform: translateY(-1px); }
.btn-line { border: 1px solid rgba(236, 219, 190, 0.3); color: #f1e8da; }
.btn-line:hover { border-color: var(--accent); }
.btn-wide { width: 100%; }
.pill { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(236, 219, 190, 0.28); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; color: #f1e8da; }
.pill:hover { border-color: var(--accent); }
.pill.soon { opacity: 0.7; border-style: dashed; }

.more-books { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px; margin-top: 16px; }
.more-books a { display: block; border-radius: 6px; overflow: hidden; box-shadow: 0 10px 24px -10px #000; transition: transform 0.3s var(--ease); }
.more-books a:hover { transform: translateY(-3px); }

/* ---------- drawer: contents ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(8, 7, 6, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.35s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 41;
  width: min(92vw, 400px);
  background: var(--panel);
  color: var(--fg);
  box-shadow: var(--shadow);
  transform: translateX(104%);
  transition: transform 0.45s var(--ease), background-color 0.35s;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}
.drawer.on { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 14px; padding: 16px 12px 14px 20px; border-bottom: 1px solid var(--rule); }
.drawer-head img { width: 46px; border-radius: 4px; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.6); }
.drawer-head .t { flex: 1; min-width: 0; }
.drawer-head .a { font-size: 10.5px; font-weight: 650; letter-spacing: 0.24em; text-transform: uppercase; color: var(--bk-accent); }
.drawer-head .n { font-family: var(--font-display); font-size: 22px; font-weight: 600; line-height: 1.08; margin-top: 3px; }
.toc { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 6px 0 20px; }
.toc-part { padding: 20px 20px 8px; font-family: var(--font-display); font-size: 14px; font-weight: 600; letter-spacing: 0.26em; text-transform: uppercase; color: var(--bk-accent); }
.toc-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: baseline;
  text-align: left;
  padding: 12px 20px;
  font-family: 'Literata', Georgia, serif;
  font-size: 15.5px;
  line-height: 1.3;
  color: var(--fg);
  border-left: 2px solid transparent;
}
.toc-item:hover { background: var(--rule); }
.toc-item.cur { border-left-color: var(--bk-accent); color: var(--bk-accent); font-weight: 600; }
.toc-item.done .tt { color: var(--muted); }
.toc-item .st { font-family: var(--font-ui); font-size: 11px; color: var(--muted); white-space: nowrap; }
.toc-item.lock .tt { color: var(--muted); }
.toc-item .st svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.7; vertical-align: -2px; }
.toc-foot { padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); display: grid; gap: 4px; }
.toc-foot a, .toc-foot button { display: flex; align-items: center; gap: 10px; padding: 11px 0; font-size: 13px; color: var(--fg); text-align: left; }
.toc-foot a:hover, .toc-foot button:hover { color: var(--bk-accent); }
.toc-foot svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.toc-note { padding: 14px 20px 4px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.toc-note b { display: block; font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 4px; color: var(--fg); }

/* ---------- sheet: display settings / checkout ---------- */
.sheet {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 42;
  max-height: 92svh;
  overflow-y: auto;
  background: var(--panel);
  color: var(--fg);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow);
  padding: 10px 22px calc(26px + env(safe-area-inset-bottom));
  transform: translateY(104%);
  transition: transform 0.45s var(--ease), background-color 0.35s;
}
.sheet.on { transform: none; }
.sheet::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--rule); margin: 0 auto 16px; }
.sheet h2 { font-family: var(--font-display); font-weight: 600; font-size: 26px; line-height: 1.1; margin: 0 0 4px; }
.sheet p.d { font-size: 14px; line-height: 1.5; color: var(--muted); margin: 6px 0 0; }
.set { padding: 14px 0; border-top: 1px solid var(--rule); }
.set:first-of-type { border-top: 0; }
.set > .lbl { font-size: 10.5px; font-weight: 650; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: 4px; background: var(--panel-2); border-radius: 14px; }
.seg button { min-height: 42px; border-radius: 10px; font-size: 13.5px; font-weight: 550; color: var(--muted); transition: background-color 0.2s, color 0.2s, box-shadow 0.2s; }
.seg button[aria-pressed='true'] { background: var(--panel); color: var(--fg); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16); }
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.themes button { min-height: 58px; border-radius: 14px; border: 1.5px solid var(--rule); font-family: 'Literata', Georgia, serif; font-size: 15px; display: grid; place-items: center; transition: border-color 0.2s, transform 0.2s; }
.themes button[aria-pressed='true'] { border-color: var(--bk-accent); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.28); }
.themes .t-paper { background: #f6f1e7; color: #2a2521; }
.themes .t-sepia { background: #ecdcc0; color: #3a2c1c; }
.themes .t-night { background: #100f0e; color: #d5ccbe; border-color: #333; }
.size { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: 10px; }
.size button { height: 48px; border-radius: 14px; background: var(--panel-2); font-family: var(--font-display); font-weight: 600; line-height: 1; }
.size .minus { font-size: 17px; }
.size .plus { font-size: 27px; }
.size input[type='range'] { width: 100%; accent-color: var(--bk-accent); height: 32px; }
.size-preview { margin-top: 10px; font-family: var(--bk-font); font-size: var(--bk-size); line-height: 1.4; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.f-book { font-family: 'Literata', Georgia, serif; }
.f-classic { font-family: 'EB Garamond', Georgia, serif; font-size: 16px !important; }
.f-sans { font-family: var(--font-ui); }

.field { margin-top: 18px; }
.field input {
  width: 100%;
  height: 58px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1.5px solid var(--rule);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 17px;
  outline: none;
  transition: border-color 0.2s;
}
.field input:focus { border-color: var(--bk-accent); }
.sheet .consent { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; margin-top: 16px; font-size: 13px; line-height: 1.45; color: var(--muted); cursor: pointer; }
.sheet .consent input { width: 22px; height: 22px; margin: 0; accent-color: var(--bk-accent); }
.sheet .btn-gold { margin-top: 14px; }
.sheet .fine { font-size: 12px; line-height: 1.5; color: var(--muted); margin: 14px 0 0; text-align: center; }
/* "I have a promo code": a quiet second action under the payment button */
.sheet .pay-alt { display: block; width: 100%; margin: 12px 0 0; padding: 10px; font-size: 13.5px; color: var(--fg); text-align: center; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--bk-accent); }
.sheet [hidden] { display: none !important; }
/* the soundtrack sheet */
/* the soundtrack: the list of songs and the player take the colours of the reading theme (rules: player.css) */
.sheet .ost, .sheet .pl {
  --pl-fg: var(--fg);
  --pl-muted: var(--muted);
  --pl-line: var(--rule);
  --pl-hover: var(--rule);
  --pl-accent: var(--bk-accent);
  --pl-ink: var(--panel);
}
.sheet .ost { margin: 10px -6px 0; }
.sheet .ost-t { font-size: 20px; font-weight: 600; }
.sheet .pl-title { font-size: 21px; font-weight: 600; }
.sheet .pl-inline .pl-seek::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--pl-accent) var(--pl-p), rgba(128, 128, 128, 0.35) var(--pl-p)); }
.sheet .pl-inline .pl-seek::-moz-range-track { background: rgba(128, 128, 128, 0.35); }
/* music is on: the note in the top bar says so */
.ost-playing #btn-ost { color: var(--bk-accent); }
/* numbered steps inside a sheet (how "read without the internet" works) */
.sheet .steps { list-style: none; counter-reset: st; margin: 16px 0 6px; padding: 0; display: grid; gap: 12px; text-align: left; }
.sheet .steps li { counter-increment: st; position: relative; padding-left: 40px; font-size: 14.5px; line-height: 1.5; }
.sheet .steps li::before { content: counter(st); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: linear-gradient(180deg, #f3dfb8, #d8b07a); color: #17120b; }
.sheet .ok { font-size: 14px; line-height: 1.45; margin: 12px 2px 0; min-height: 1.3em; text-align: center; color: var(--fg); }
.sheet .fine a { text-decoration: underline; text-underline-offset: 2px; }
.sheet .err { font-size: 13px; color: #c2452f; margin: 10px 2px 0; min-height: 1.3em; }
:root[data-theme='night'] .sheet .err { color: #ff9c8a; }
.sheet .order { display: grid; grid-template-columns: 54px 1fr auto; gap: 14px; align-items: center; padding: 12px 0 2px; }
.sheet .order img { width: 54px; border-radius: 4px; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.5); }
.sheet .order .n { font-family: var(--font-display); font-size: 21px; font-weight: 600; line-height: 1.1; }
.sheet .order .s { font-size: 12px; color: var(--muted); margin-top: 3px; }
.sheet .order .pr { font-family: var(--font-display); font-size: 24px; font-weight: 600; white-space: nowrap; }

/* ---------- age gate ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 24px;
  background: #0b0a09;
  color: #f1e8da;
  overflow-y: auto;
  isolation: isolate;
}
.gated .gate { display: grid; }
.gate::before {
  content: '';
  position: absolute;
  inset: -8%;
  z-index: -1;
  background: var(--gate-art, none) center / cover no-repeat;
  filter: blur(34px) saturate(1.1) brightness(0.42);
  transform: scale(1.1);
}
.gate::after { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(90% 60% at 50% 30%, rgba(var(--accent-rgb), 0.16), transparent 70%), rgba(11, 10, 9, 0.55); }
.gate-card { width: 100%; max-width: 420px; text-align: center; }
.gate-age {
  width: 76px;
  height: 76px;
  margin: 0 auto 22px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.gate-card .bk { font-size: 11px; font-weight: 650; letter-spacing: 0.28em; text-transform: uppercase; color: var(--accent); }
.gate-card h1 { font-family: var(--font-display); font-weight: 500; font-size: clamp(2rem, 8.4vw, 2.6rem); line-height: 1.05; margin: 12px 0 0; text-wrap: balance; }
.gate-card .note { font-family: 'Literata', Georgia, serif; font-size: 14.5px; line-height: 1.55; color: #cbc1b2; margin: 16px 0 0; text-wrap: pretty; }
.gate-card .ask { font-size: 13.5px; color: #948b7e; margin: 16px 0 22px; }
.gate-card .cta { display: grid; gap: 10px; }
.gate-card .fine { font-size: 11.5px; line-height: 1.5; color: #7d756a; margin: 18px 0 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  margin: 0 auto;
  width: fit-content;
  bottom: calc(var(--bar-h) + env(safe-area-inset-bottom) + 18px);
  z-index: 55;
  transform: translateY(30px);
  opacity: 0;
  pointer-events: none;
  max-width: min(92vw, 420px);
  padding: 13px 20px;
  border-radius: 16px;
  background: #1b1917;
  color: #f1e8da;
  font-size: 13.5px;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.7);
  transition: transform 0.4s var(--ease), opacity 0.4s;
}
.toast.on { transform: none; opacity: 1; }

/* ---------- paged mode ---------- */
.paged body { overflow: hidden; height: 100svh; }
.paged .stage {
  position: fixed;
  inset: calc(var(--top-h) + env(safe-area-inset-top)) 0 calc(var(--bar-h) + env(safe-area-inset-bottom)) 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
}
.paged .book {
  position: absolute;
  inset: 0;
  max-width: none;
  margin: 0;
  height: 100%;
  padding: 26px var(--page-pad, 22px) 18px;
  column-width: var(--page-col, 300px);
  column-gap: var(--page-gap, 44px);
  column-fill: auto;
  transition: transform 0.38s var(--ease);
  will-change: transform;
}
.paged .book.drag { transition: none; }
.paged .book > :first-child { margin-top: 0; }
.paged .book .ch-head { margin-top: 1.6em; }
.paged .book .part { break-after: column; margin: 20vh 0 0; }
.paged .book .titlepage { break-after: column; margin-top: 1em; }
.paged .book .tp-cover { width: min(48%, 190px); margin-bottom: 1.4em; }
.paged .rd-end { display: none; }
.paged .book .rd-end-in { display: block; break-before: column; break-inside: avoid; font-size: 17px; -webkit-hyphens: none; hyphens: none; text-align: left; padding-top: 4vh; }
.book .rd-end-in { display: none; }
.paged .wall { box-shadow: none; }

/* ---------- desktop ---------- */
@media (min-width: 760px) {
  :root { --pad-x: 40px; --top-h: 58px; }
  .rd-title { font-size: 18px; }
  .sheet {
    inset: calc(var(--top-h) + 10px) 16px auto auto;
    width: 400px;
    max-height: calc(100vh - var(--top-h) - 30px);
    border-radius: 22px;
    padding: 22px 24px 24px;
    transform: translateY(-14px) scale(0.98);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s var(--ease), opacity 0.3s, background-color 0.35s;
  }
  .sheet.on { transform: none; opacity: 1; pointer-events: auto; }
  .sheet::before { display: none; }
  .sheet.center { inset: 50% auto auto 50%; transform: translate(-50%, -46%) scale(0.98); width: 440px; }
  .sheet.center.on { transform: translate(-50%, -50%); }
  .wall { padding: 44px 44px 34px; }
  .rd-end { padding-top: 4em; }
}

@media (prefers-reduced-motion: reduce) {
  .rd-top, .rd-bar, .drawer, .sheet, .paged .book, .toast, .next-card { transition: none; }
}

@media print {
  .rd-top, .rd-bar, .rd-prog, .rd-end, .drawer, .sheet, .gate, .scrim, .toast { display: none !important; }
  body::before { content: '© Kate Lorén'; }
  .book { display: none; }
}
