/* ==========================================================================
   LHC Midday Word — design system
   Ivory paper, deep ink-navy, quiet gold.  Built for comfortable reading.
   ========================================================================== */

:root {
  --step: 1;                         /* text size step, 0 – 5 */

  --bg: #F6F1E7;
  --bg-2: #EFE8DA;
  --paper: #FFFCF6;
  --ink: #18202F;
  --ink-2: #3B4356;
  --muted: #646B7B;
  --line: #E2D9C7;
  --line-2: #D6CAB2;
  --gold: #A9813A;
  --gold-ink: #85631F;               /* gold safe for small text on ivory */
  --gold-soft: #F1E5C9;
  --navy: #142036;
  --navy-2: #1E2D4A;
  --on-navy: #F7F0E1;
  --on-navy-2: #C9C0AE;
  --mark-bg: #142036;
  --zoom: #2D5BE3;
  --focus: #2D5BE3;
  --highlight: rgba(214, 170, 79, .22);
  --shadow-1: 0 1px 2px rgba(28, 24, 14, .06), 0 2px 8px rgba(28, 24, 14, .05);
  --shadow-2: 0 2px 6px rgba(28, 24, 14, .06), 0 14px 40px -12px rgba(28, 24, 14, .22);
  --shadow-3: 0 30px 80px -30px rgba(10, 16, 30, .55);

  --f-display: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --f-read: "Source Serif 4", "Iowan Old Style", Charter, Georgia, serif;
  --f-ui: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

  --ui: calc(16.5px + var(--step) * 1.5px);
  --read: calc(19px + var(--step) * 3px);
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 26px;
  --pad: clamp(16px, 5vw, 28px);
  --maxw: 720px;
  --tabbar-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C111C; --bg-2: #111827; --paper: #141B2A; --ink: #F1EADB; --ink-2: #D8D0BF;
    --muted: #A49D8F; --line: #243049; --line-2: #2E3B57; --gold: #D9B46A; --gold-ink: #E0BE79;
    --gold-soft: #2A2617; --navy: #0A0F19; --navy-2: #172238; --on-navy: #F4ECDC; --on-navy-2: #B7AE9C;
    --mark-bg: #172238; --zoom: #6E93FF; --focus: #8FB0FF; --highlight: rgba(217, 180, 106, .18);
    --shadow-1: 0 1px 2px rgba(0,0,0,.35); --shadow-2: 0 2px 6px rgba(0,0,0,.3), 0 18px 40px -14px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C111C; --bg-2: #111827; --paper: #141B2A; --ink: #F1EADB; --ink-2: #D8D0BF;
  --muted: #A49D8F; --line: #243049; --line-2: #2E3B57; --gold: #D9B46A; --gold-ink: #E0BE79;
  --gold-soft: #2A2617; --navy: #0A0F19; --navy-2: #172238; --on-navy: #F4ECDC; --on-navy-2: #B7AE9C;
  --mark-bg: #172238; --zoom: #6E93FF; --focus: #8FB0FF; --highlight: rgba(217, 180, 106, .18);
  --shadow-1: 0 1px 2px rgba(0,0,0,.35); --shadow-2: 0 2px 6px rgba(0,0,0,.3), 0 18px 40px -14px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* --- base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
#nl-badge-frame { display: none !important; } /* host's floating badge covers the tab bar */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--ui)/1.5 var(--f-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b));
  overflow-x: hidden;
}
body::before { /* paper grain */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.38 0 0 0 0 0.25 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main { position: relative; z-index: 1; outline: none; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 12px 16px; z-index: 99; border-radius: 10px; }
.skip:focus { left: 8px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- top bar --------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--safe-t)) var(--pad) 10px;
  background: var(--bg); /* fallback for older iPhones without color-mix */
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(18px); backdrop-filter: saturate(1.4) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-height: 48px; }
.brand-mark { width: 42px; height: 42px; flex: none; filter: drop-shadow(0 4px 10px rgba(20, 32, 54, .25)); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font: 600 25px/1 var(--f-display); letter-spacing: .005em; }
.brand-church { font: 600 11px/1.4 var(--f-ui); letter-spacing: .16em; text-transform: uppercase; color: var(--gold-ink); margin-top: 3px; }
.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
  min-width: 52px; height: 52px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--paper); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-1);
  padding: 0 14px;
}
.aa { font: 600 17px/1 var(--f-display); letter-spacing: -.02em; }
.aa span { font-size: 25px; }

/* --- tab bar --------------------------------------------------------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px max(8px, env(safe-area-inset-left)) calc(6px + var(--safe-b));
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(20px); backdrop-filter: saturate(1.5) blur(20px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 62px; text-decoration: none; color: var(--muted); border-radius: 16px;
  font: 600 13.5px/1.1 var(--f-ui); letter-spacing: .01em; position: relative;
  transition: color .2s ease;
}
.tabbar svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"]::before {
  content: ""; position: absolute; top: 2px; width: 34px; height: 3px; border-radius: 3px; background: var(--gold);
}
.tabbar a[aria-current="page"] svg { stroke: var(--gold-ink); stroke-width: 1.9; }

/* --- layout ---------------------------------------------------------------- */
.page { max-width: var(--maxw); margin: 0 auto; padding: 8px var(--pad) 40px; }
.page-enter { animation: rise .5s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.eyebrow { font: 600 12.5px/1.3 var(--f-ui); letter-spacing: .18em; text-transform: uppercase; color: var(--gold-ink); margin: 0; }
.h-display { font: 600 clamp(40px, 10vw, 58px)/1.02 var(--f-display); letter-spacing: -.01em; margin: 6px 0 0; }
.h-section {
  font: 600 clamp(27px, 6.5vw, 33px)/1.1 var(--f-display); margin: 40px 0 16px; display: flex; align-items: baseline; gap: 12px;
}
.h-section small { font: 500 calc(var(--ui) * .82) var(--f-ui); color: var(--muted); }
.lede { color: var(--ink-2); margin: 10px 0 0; font-size: calc(var(--ui) * 1.04); }
.rule { height: 1px; border: 0; margin: 28px 0; background: linear-gradient(90deg, transparent, var(--line-2) 15%, var(--gold) 50%, var(--line-2) 85%, transparent); opacity: .8; }
.muted { color: var(--muted); }

/* --- buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 62px; padding: 0 26px; border-radius: 999px; border: 0; cursor: pointer;
  font: 600 calc(var(--ui) * 1.06)/1.15 var(--f-ui); text-decoration: none; letter-spacing: .005em;
  transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease;
  -webkit-tap-highlight-color: transparent; text-align: center;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 24px; height: 24px; flex: none; }
.btn.wide { width: 100%; }
.btn-gold {
  background: linear-gradient(180deg, #E2C27D, #C59B4C 55%, #B48A3E); color: #1A1407;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 10px 24px -10px rgba(180, 138, 62, .9);
}
.btn-ink { background: var(--navy); color: var(--on-navy); box-shadow: var(--shadow-2); }
:root[data-theme="dark"] .btn-ink { background: var(--paper); color: var(--ink); border: 1px solid var(--line-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-ink { background: var(--paper); color: var(--ink); border: 1px solid var(--line-2); } }
.btn-zoom { background: var(--zoom); color: #fff; box-shadow: 0 12px 26px -12px rgba(45, 91, 227, .9); }
.btn-quiet { background: transparent; color: var(--ink); border: 1.5px solid var(--line-2); }
.btn-line { background: var(--paper); color: var(--ink); border: 1px solid var(--line-2); box-shadow: var(--shadow-1); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 200px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: default; }

/* --- Today ----------------------------------------------------------------- */
.greet { padding: 10px 0 18px; }
.greet .date { font: 500 calc(var(--ui) * 1.02) var(--f-ui); color: var(--ink-2); margin-top: 6px; }

.hero {
  position: relative; overflow: hidden; border-radius: var(--r-lg);
  background: radial-gradient(120% 80% at 80% -10%, #2C4170 0%, transparent 60%),
              radial-gradient(90% 70% at -10% 110%, #3A2E14 0%, transparent 55%), var(--navy);
  color: var(--on-navy); box-shadow: var(--shadow-3); isolation: isolate;
}
.hero::after { /* gilt edge */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(217, 180, 106, .35), inset 0 0 0 7px rgba(217, 180, 106, .05);
}
.hero-media { position: relative; aspect-ratio: 16 / 9; background: #0E1626; overflow: hidden; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; animation: fade .8s ease both; }
.hero-media::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 45%;
  background: linear-gradient(180deg, transparent, var(--navy));
}
.hero-body { position: relative; padding: 6px clamp(20px, 6vw, 34px) clamp(24px, 6vw, 34px); }
.hero .eyebrow { color: #E6C987; }
.hero-title { font: 600 clamp(46px, 13vw, 76px)/.98 var(--f-display); margin: 8px 0 6px; letter-spacing: -.012em; }
.hero-sub { font: italic 500 calc(var(--ui) * 1.12)/1.35 var(--f-display); color: var(--on-navy-2); margin: 0 0 22px; font-size: clamp(19px, 4.8vw, 23px); }
.hero .btn { width: 100%; }
.hero-meta { display: flex; justify-content: center; gap: 8px; margin-top: 14px; color: var(--on-navy-2); font-size: calc(var(--ui) * .86); }
.hero-placeholder { display: grid; place-items: center; height: 100%; color: rgba(230, 201, 135, .5); }
.hero-placeholder svg { width: 84px; height: 84px; }

.also { margin-top: 14px; }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1);
}
.zoom-card { margin-top: 18px; padding: clamp(20px, 5vw, 26px); display: grid; gap: 16px; }
.zoom-head { display: flex; gap: 16px; align-items: center; }
.zoom-icon {
  width: 58px; height: 58px; border-radius: 18px; flex: none; display: grid; place-items: center;
  background: linear-gradient(160deg, #4D7CFF, #2346C9); color: #fff; box-shadow: 0 10px 22px -10px rgba(45, 91, 227, .9);
}
.zoom-icon svg { width: 32px; height: 32px; }
.zoom-title { font: 600 clamp(25px, 6vw, 29px)/1.1 var(--f-display); margin: 0; }
.zoom-when { margin: 2px 0 0; color: var(--ink-2); }
.zoom-live { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: #1F8A4C; }
.zoom-live::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #22A35A; box-shadow: 0 0 0 0 rgba(34, 163, 90, .6); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 163, 90, .55); } 70% { box-shadow: 0 0 0 10px rgba(34, 163, 90, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 163, 90, 0); } }
.zoom-details { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.zoom-detail:only-child { grid-column: 1 / -1; }
.zoom-detail { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.zoom-detail dt { font: 600 11.5px/1.2 var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.zoom-detail dd { margin: 4px 0 0; font: 600 calc(var(--ui) * 1.12)/1.2 var(--f-ui); font-variant-numeric: tabular-nums; letter-spacing: .02em; word-break: break-word; }
.zoom-note { margin: 0; color: var(--muted); font-size: calc(var(--ui) * .9); }

.verse-card {
  margin-top: 18px; padding: clamp(22px, 6vw, 30px); position: relative; overflow: hidden;
  background: var(--paper);
  background: linear-gradient(180deg, var(--paper), color-mix(in srgb, var(--gold-soft) 45%, var(--paper)));
}
.verse-card::before {
  content: "\201C"; position: absolute; right: 14px; top: -26px; font: 700 150px/1 var(--f-display); color: var(--gold); opacity: .18;
}
.verse-card blockquote { margin: 10px 0 12px; font: 500 clamp(24px, 6vw, 29px)/1.32 var(--f-display); }
.verse-card cite { font: 600 calc(var(--ui) * .9) var(--f-ui); color: var(--gold-ink); font-style: normal; letter-spacing: .04em; }

/* list rows (recent readings, search results, months) */
.list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.row {
  display: flex; align-items: center; gap: 16px; min-height: 76px; padding: 12px 16px 12px 12px;
  text-decoration: none; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-1); transition: transform .15s ease, border-color .2s ease;
}
.row:active { transform: scale(.99); }
.row:hover { border-color: var(--line-2); }
.row-thumb {
  width: 84px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; flex: none; background: var(--navy);
  display: grid; place-items: center; color: var(--gold); font: 600 22px/1 var(--f-display);
}
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-date { width: 58px; flex: none; text-align: center; border-right: 1px solid var(--line); padding-right: 12px; }
.row-date b { display: block; font: 600 30px/1 var(--f-display); }
.row-date span { font: 600 11.5px/1.2 var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--gold-ink); }
.row-main { flex: 1; min-width: 0; }
.row-title { font: 600 calc(var(--ui) * 1.08)/1.25 var(--f-ui); display: block; }
.row-sub { color: var(--muted); font-size: calc(var(--ui) * .88); display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.row-chev { color: var(--muted); flex: none; }
.row-chev svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.row.today-row { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), var(--shadow-1); }

/* --- Reader ---------------------------------------------------------------- */
.reader-bar {
  position: sticky; top: calc(72px + var(--safe-t)); z-index: 15; margin: 0 calc(var(--pad) * -1);
  padding: 8px var(--pad);
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.back-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 52px; padding: 0 18px 0 12px; border-radius: 999px;
  text-decoration: none; font-weight: 600; background: var(--paper); border: 1px solid var(--line-2); cursor: pointer;
}
.back-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.tool-group { display: flex; gap: 8px; }
.tool {
  min-width: 52px; height: 52px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--paper); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-weight: 600;
}
.tool svg { width: 22px; height: 22px; }
.tool.on { background: var(--navy); color: var(--on-navy); border-color: var(--navy); }
.tool-size { font: 600 21px/1 var(--f-display); }

.chapter-head { text-align: center; padding: 18px 0 8px; }
.chapter-head .eyebrow { font-size: 12px; }
.chapter-book { font: 500 italic clamp(22px, 5.6vw, 28px)/1.2 var(--f-display); margin: 10px 0 0; color: var(--ink-2); }
.chapter-num {
  font: 600 clamp(96px, 30vw, 150px)/.9 var(--f-display); margin: 4px 0 0; letter-spacing: -.03em;
  background: linear-gradient(180deg, #D8B570 0%, #A9813A 70%, #8C6727 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.chapter-num.long { font-size: clamp(64px, 19vw, 104px); }
.chapter-date { color: var(--muted); font-size: calc(var(--ui) * .9); margin-top: 8px; }
.ornament { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--gold); margin: 22px 0 6px; }
.ornament::before, .ornament::after { content: ""; height: 1px; width: 70px; background: linear-gradient(90deg, transparent, var(--gold)); }
.ornament::after { transform: scaleX(-1); }
.ornament svg { width: 18px; height: 18px; }

.reader-hero { border-radius: var(--r); overflow: hidden; margin: 14px 0 6px; box-shadow: var(--shadow-2); background: var(--navy); }
.reader-hero img { width: 100%; }

.scripture {
  font: 400 var(--read)/1.72 var(--f-read); color: var(--ink);
  font-optical-sizing: auto; hyphens: manual; overflow-wrap: break-word;
  margin-top: 18px;
}
.scripture p { margin: 0 0 1em; }
.scripture .super { font-style: italic; color: var(--ink-2); text-align: center; margin-bottom: 1.4em; font-size: .92em; }
.scripture .heading { font: 600 calc(var(--read) * .82)/1.3 var(--f-ui); letter-spacing: .04em; color: var(--gold-ink); margin: 1.6em 0 .7em; }
.scripture .v {
  font: 600 .56em/1 var(--f-ui); color: var(--gold-ink); vertical-align: .62em; margin-right: .22em; margin-left: .08em;
  font-variant-numeric: lining-nums; letter-spacing: .02em; user-select: none;
}
.scripture .verse { border-radius: 6px; transition: background-color .3s ease, box-shadow .3s ease; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.scripture .verse.speaking { background: var(--highlight); box-shadow: 0 0 0 .18em var(--highlight); }
.scripture.poetry .stanza { margin: 0 0 1.05em; }
.scripture.poetry .ln { margin: 0; padding-left: 1.6em; text-indent: -1.6em; }
.scripture.poetry .ln.ind { padding-left: 2.8em; }
.scripture.poetry .v { display: inline-block; width: 1.5em; margin: 0 .1em 0 0; text-align: right; text-indent: 0; padding-right: .35em; }
.scripture .dropcap::first-letter, .scripture .dropcap .first::first-letter { }
.dc {
  float: left; font: 600 3.35em/.82 var(--f-display); color: var(--gold); margin: .08em .1em 0 0; padding-top: .02em;
}
.scripture .plain-img { margin: 1.2em 0; border-radius: var(--r-sm); overflow: hidden; }
.reader-foot-note { text-align: center; color: var(--muted); font-size: calc(var(--ui) * .82); margin: 26px 0 0; letter-spacing: .02em; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 30px; }
.pager a, .pager span.disabled {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; min-height: 86px; border-radius: var(--r);
  background: var(--paper); border: 1px solid var(--line); text-decoration: none; box-shadow: var(--shadow-1);
}
.pager .next { text-align: right; align-items: flex-end; }
.pager small { font: 600 12px/1.2 var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-ink); }
.pager b { font: 600 clamp(22px, 5.5vw, 26px)/1.15 var(--f-display); }
.pager span.disabled { opacity: .5; box-shadow: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 16px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line-2); text-decoration: none; font-weight: 500;
}

/* extras: videos, links */
.extras h3.x-head {
  font: 600 13px/1.3 var(--f-ui); letter-spacing: .18em; text-transform: uppercase; color: var(--gold-ink);
  margin: 30px 0 12px; display: flex; align-items: center; gap: 12px;
}
.extras h3.x-head::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.extras p { margin: 0 0 .6em; color: var(--ink-2); }
.extras p.x-strong { font-weight: 600; color: var(--ink); }
.extras a.x-link { color: var(--gold-ink); word-break: break-all; }
.video {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; padding: 0; cursor: pointer;
  border-radius: var(--r); overflow: hidden; background: #000; margin: 0 0 6px; box-shadow: var(--shadow-2);
}
.video img { width: 100%; height: 100%; object-fit: cover; opacity: .9; transition: transform .4s ease, opacity .3s ease; }
.video:hover img { transform: scale(1.03); opacity: 1; }
.video .play {
  position: absolute; inset: 0; margin: auto; width: 78px; height: 78px; border-radius: 50%;
  background: rgba(255, 252, 246, .94); display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.video .play svg { width: 30px; height: 30px; margin-left: 5px; fill: #142036; }
.video .vlabel {
  position: absolute; left: 12px; bottom: 12px; right: 12px; text-align: left; color: #fff; font: 600 15px/1.3 var(--f-ui);
  text-shadow: 0 1px 8px rgba(0,0,0,.7);
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-cap { color: var(--muted); font-size: calc(var(--ui) * .88); margin: 0 0 18px; }
.extras-grid { display: grid; gap: 4px; }
@media (min-width: 700px) { .extras-grid.two { grid-template-columns: 1fr 1fr; gap: 6px 16px; } }

.blog-link { display: flex; justify-content: center; margin-top: 26px; }

/* --- Archive --------------------------------------------------------------- */
.search {
  position: relative; margin: 18px 0 6px;
}
.search input {
  width: 100%; min-height: 64px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--paper);
  padding: 0 22px 0 58px; font: 500 calc(var(--ui) * 1.06) var(--f-ui); color: var(--ink); box-shadow: var(--shadow-1);
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 22%, transparent); }
.search svg { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; fill: none; stroke: var(--muted); stroke-width: 2; }
.search-hint { color: var(--muted); font-size: calc(var(--ui) * .86); margin: 8px 6px 0; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 5px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); gap: 4px; margin: 18px 0 4px; }
.seg button, .seg a {
  min-height: 52px; border-radius: 999px; border: 0; background: transparent; cursor: pointer; font-weight: 600;
  display: grid; place-items: center; text-decoration: none; color: var(--ink-2); padding: 0 10px;
}
.seg [aria-checked="true"], .seg [aria-current="page"] { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-1); }

.testament { margin-top: 28px; }
.testament-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.testament-title h2 { font: 600 clamp(27px, 6.5vw, 32px)/1.1 var(--f-display); margin: 0; }
.testament-title span { color: var(--muted); font-size: calc(var(--ui) * .86); }
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.book {
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 92px; padding: 14px 16px;
  border-radius: var(--r); background: var(--paper); border: 1px solid var(--line); text-decoration: none; box-shadow: var(--shadow-1);
  position: relative; overflow: hidden; transition: transform .15s ease, border-color .2s;
}
.book:active { transform: scale(.98); }
.book:hover { border-color: var(--gold); }
.book b { font: 600 clamp(22px, 5.4vw, 25px)/1.1 var(--f-display); }
.book span { font-size: calc(var(--ui) * .82); color: var(--muted); }
.book .bar { height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.book .bar i { display: block; height: 100%; background: linear-gradient(90deg, #D8B570, #A9813A); border-radius: 3px; }
.book.none { opacity: .45; box-shadow: none; pointer-events: none; }

.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 10px; margin-top: 18px; }
.ch {
  aspect-ratio: 1; min-height: 64px; display: grid; place-items: center; border-radius: 16px; text-decoration: none;
  background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-1); font: 600 26px/1 var(--f-display);
  position: relative; transition: transform .15s ease, border-color .2s;
}
.ch:active { transform: scale(.96); }
.ch:hover { border-color: var(--gold); }
.ch.none { background: transparent; box-shadow: none; color: var(--muted); opacity: .45; pointer-events: none; border-style: dashed; }
.ch, .row-date b, .chapter-num, .pager b, .hero-title, .h-display, .year summary { font-variant-numeric: lining-nums; }
.ch .n { position: absolute; right: 7px; top: 6px; font: 700 10.5px/1 var(--f-ui); color: var(--gold-ink); }

.year { margin-top: 12px; border-radius: var(--r); background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-1); overflow: hidden; }
.year summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; min-height: 72px; padding: 0 20px;
  font: 600 30px/1 var(--f-display);
}
.year summary::-webkit-details-marker { display: none; }
.year summary span { font: 500 calc(var(--ui) * .86) var(--f-ui); color: var(--muted); display: flex; align-items: center; gap: 10px; }
.year summary span::after { content: ""; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); transition: transform .2s; }
.year[open] summary span::after { transform: rotate(225deg) translate(-2px, -2px); }
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 8px; padding: 0 14px 16px; }
.month-link { display: flex; flex-direction: column; padding: 14px 16px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); text-decoration: none; min-height: 64px; }
.month-link b { font-weight: 600; }
.month-link span { color: var(--muted); font-size: calc(var(--ui) * .82); }

/* --- This month ------------------------------------------------------------ */
.list-sheet { margin-top: 18px; padding: 10px; border-radius: var(--r-lg); background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-2); }
.list-sheet button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: var(--r); overflow: hidden; }
.list-sheet button + button { margin-top: 10px; }
.zoom-hint { display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--muted); font-size: calc(var(--ui) * .86); margin: 12px 0 0; }

/* upcoming reading plan derived from list text */
.plan { margin-top: 18px; }

/* --- Help ------------------------------------------------------------------ */
.steps { counter-reset: s; display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 48px 1fr; gap: 14px; align-items: start; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1); }
.steps li::before {
  content: counter(s); width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: var(--navy); color: #E6C987; font: 600 26px/1 var(--f-display);
}
:root[data-theme="dark"] .steps li::before { background: var(--navy-2); }
.steps b { display: block; font-size: calc(var(--ui) * 1.04); margin-bottom: 2px; }
.steps p { margin: 0; color: var(--ink-2); }
.kbd { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line-2); font-weight: 600; white-space: nowrap; }
.kbd svg { width: 18px; height: 18px; }
.help-tabs { margin-bottom: 14px; }
.faq details { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; box-shadow: var(--shadow-1); }
.faq summary { cursor: pointer; padding: 18px 20px; font-weight: 600; min-height: 64px; display: flex; align-items: center; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq details p { margin: 0; padding: 0 20px 18px; color: var(--ink-2); }
.about { text-align: center; margin-top: 40px; color: var(--muted); font-size: calc(var(--ui) * .86); }
.about .brand-mark { width: 64px; height: 64px; margin: 0 auto 12px; }

/* --- states ---------------------------------------------------------------- */
.skeleton { background: linear-gradient(90deg, var(--bg-2), color-mix(in srgb, var(--bg-2) 50%, var(--paper)), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; border-radius: 10px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-line { height: 1.1em; margin: .7em 0; }
.notice { padding: 18px 20px; border-radius: var(--r); background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); color: var(--ink); margin: 16px 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* --- sheet & viewer -------------------------------------------------------- */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 12, 22, .5); animation: fade .25s ease both; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px;
  background: var(--paper); border-radius: 28px 28px 0 0; padding: 12px var(--pad) calc(22px + var(--safe-b));
  box-shadow: 0 -20px 60px rgba(0,0,0,.25); animation: up .35s cubic-bezier(.2, .8, .2, 1) both;
  max-height: 92vh; overflow-y: auto;
}
.steps li::before { font-variant-numeric: lining-nums; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.sheet-grip { width: 44px; height: 5px; border-radius: 5px; background: var(--line-2); margin: 0 auto 14px; }
.sheet-title { font: 600 30px/1.1 var(--f-display); margin: 0; }
.sheet-sub { color: var(--ink-2); margin: 6px 0 18px; }
.sheet-label { font: 600 12.5px/1.3 var(--f-ui); letter-spacing: .16em; text-transform: uppercase; color: var(--gold-ink); margin: 22px 0 0; }
.size-row { display: grid; grid-template-columns: 72px 1fr 72px; gap: 12px; align-items: center; }
.size-btn { height: 72px; border-radius: 22px; border: 1px solid var(--line-2); background: var(--bg); font: 600 24px/1 var(--f-display); cursor: pointer; }
.size-btn.big { font-size: 34px; }
.size-preview { text-align: center; font: 400 var(--read)/1.3 var(--f-read); min-height: 2.6em; display: grid; place-items: center; }
.size-dots { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.size-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); }
.size-dots i.on { background: var(--gold); }
.sheet .btn.wide { margin-top: 22px; }

.viewer { position: fixed; inset: 0; z-index: 70; background: #05070C; animation: fade .2s ease both; }
.viewer-scroll { position: absolute; inset: 0; overflow: auto; -webkit-overflow-scrolling: touch; display: grid; place-items: center; padding: 70px 10px 30px; }
.viewer img { max-width: none; width: min(100%, 1100px); touch-action: pinch-zoom; }
.viewer-close {
  position: fixed; top: calc(12px + var(--safe-t)); right: 12px; z-index: 2; min-height: 52px; padding: 0 20px; border-radius: 999px;
  border: 0; background: rgba(255, 255, 255, .95); color: #111; font-weight: 700; cursor: pointer;
}

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); transform: translate(-50%, 20px); z-index: 80;
  background: var(--navy); color: var(--on-navy); padding: 14px 22px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow-3);
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media (min-width: 900px) {
  .page { padding-top: 20px; }
  .hero { display: grid; grid-template-columns: 1.1fr 1fr; }
  .hero-media { aspect-ratio: auto; min-height: 100%; }
  .hero-media::after { inset: 0 0 0 auto; width: 40%; height: 100%; background: linear-gradient(90deg, transparent, var(--navy)); }
  .hero-body { padding: 40px 36px; display: flex; flex-direction: column; justify-content: center; }
  :root { --maxw: 860px; }
}
@media print {
  .topbar, .tabbar, .reader-bar, .pager, .extras, .blog-link { display: none !important; }
  body { background: #fff; padding: 0; }
  body::before { display: none; }
}
