:root {
  --navy-950: #091b28;
  --navy-900: #102a3c;
  --navy-800: #17384e;
  --navy-700: #28536b;
  --gold-600: #a8792d;
  --gold-500: #c29a52;
  --gold-300: #dfc797;
  --cream-100: #f8f5ed;
  --cream-200: #eee8dc;
  --paper: #fffdf8;
  --ink: #17212a;
  --muted: #66737c;
  --line: rgba(16, 42, 60, 0.14);
  --shadow: 0 24px 70px rgba(18, 42, 60, 0.12);
  --radius: 18px;
  --scripture-scale: 1;
  color-scheme: light;
}

[data-theme="dark"] {
  --cream-100: #0b1821;
  --cream-200: #10222d;
  --paper: #122936;
  --ink: #edf0eb;
  --muted: #a9b7bd;
  --line: rgba(223, 199, 151, 0.18);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 86px; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--cream-100);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.6;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }

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

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  padding: .75rem 1rem;
  background: var(--paper);
  color: var(--navy-900);
  border-radius: 10px;
}
.skip-link:focus { top: 1rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 74px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2rem;
  padding: .8rem clamp(1rem, 5vw, 5rem);
  color: #fff;
  background: rgba(9, 27, 40, .96);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 44px;
  text-decoration: none;
  letter-spacing: .13em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--gold-500);
  color: var(--gold-300);
  transform: rotate(45deg);
}
.brand-mark::first-letter { transform: rotate(-45deg); }
.brand strong, .brand small { display: block; line-height: 1.1; }
.brand strong { font: 700 1rem "Palatino Linotype", "Book Antiqua", "Times New Roman", serif; }
.brand small { margin-top: .25rem; color: var(--gold-300); font-size: .58rem; }

.primary-nav {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.primary-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: .4rem .85rem;
  color: rgba(255,255,255,.78);
  text-decoration: none;
  border-radius: 8px;
  font-size: .9rem;
}
.primary-nav a:hover,
.primary-nav a:focus-visible,
.primary-nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.08); }
.nav-count {
  display: inline-grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.35rem;
  margin-left: .35rem;
  border-radius: 999px;
  color: var(--navy-950);
  background: var(--gold-300);
  font-size: .72rem;
  font-weight: 700;
}

.header-actions { display: flex; align-items: center; gap: .35rem; }
.icon-button, .text-button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 10px;
  color: inherit;
  background: transparent;
}
.text-button { padding: .45rem .7rem; }
.header-actions button:hover,
.header-actions button:focus-visible { background: rgba(255,255,255,.1); border-color: var(--gold-500); }
.mobile-menu-toggle { display: none; }

.hero {
  min-height: 610px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 7rem);
  padding: clamp(4rem, 8vw, 7rem) clamp(1.2rem, 8vw, 9rem);
  overflow: hidden;
  position: relative;
  color: #fff;
  background:
    radial-gradient(circle at 88% 20%, rgba(194,154,82,.16), transparent 25%),
    linear-gradient(135deg, #0b2232 0%, #173b50 58%, #0c2638 100%);
}
.hero::after {
  content: "✦";
  position: absolute;
  right: -4rem;
  bottom: -12rem;
  color: rgba(223,199,151,.055);
  font: 34rem "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
  line-height: 1;
  pointer-events: none;
}
.hero-copy, .daily-card { position: relative; z-index: 1; min-width: 0; }
.eyebrow {
  margin: 0 0 .7rem;
  color: var(--gold-500);
  letter-spacing: .18em;
  font-size: .72rem;
  font-weight: 800;
}
.hero h1, .section-intro h2, .reader h2, .bookmarks-section h2, .about-section h2, .search-results h2 {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
  font-weight: 400;
  line-height: 1.06;
  text-wrap: pretty;
}
.hero h1 { max-width: 760px; font-size: clamp(3rem, 6vw, 6rem); letter-spacing: -.04em; }
.hero h1 em { color: var(--gold-300); font-weight: 400; }
.hero-lead { max-width: 650px; margin: 1.5rem 0 2rem; color: rgba(255,255,255,.76); font-size: 1.08rem; }

.search-box {
  width: 100%;
  min-width: 0;
  max-width: 720px;
  min-height: 62px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .8rem;
  padding: .45rem .45rem .45rem 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 14px;
  box-shadow: 0 22px 50px rgba(0,0,0,.22);
}
.search-box:focus-within { outline: 3px solid rgba(223,199,151,.35); outline-offset: 2px; }
.search-box input { width: 100%; min-width: 0; min-height: 44px; border: 0; outline: 0; color: #142633; background: transparent; }
.search-box button, .primary-button {
  min-height: 44px;
  padding: .65rem 1.15rem;
  border: 1px solid var(--gold-500);
  border-radius: 10px;
  color: #fff;
  background: var(--navy-900);
  font-weight: 700;
}
.search-hint { color: rgba(255,255,255,.56); font-size: .82rem; }
.inline-query { min-height: 44px; padding: .1rem .25rem; border: 0; color: var(--gold-300); background: transparent; text-decoration: underline; text-underline-offset: 3px; }

.daily-card {
  padding: clamp(1.6rem, 4vw, 3rem);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid rgba(223,199,151,.55);
  border-radius: 4px 34px 4px 34px;
  box-shadow: 0 30px 90px rgba(0,0,0,.28);
}
.daily-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid var(--line);
  border-radius: 2px 25px 2px 25px;
  pointer-events: none;
}
.daily-card-topline { display: flex; justify-content: space-between; gap: 1rem; color: var(--gold-600); font-size: .67rem; font-weight: 800; letter-spacing: .12em; }
.ornament { margin: 1.3rem 0 .6rem; color: var(--gold-500); }
.daily-card blockquote { margin: 0; font: calc(1.35rem * var(--scripture-scale))/1.75 "Palatino Linotype", "Book Antiqua", "Times New Roman", serif; }
.scripture-reference { color: var(--gold-600); font-weight: 700; }
.daily-actions { display: flex; gap: .7rem; margin-top: 1.5rem; }
.secondary-button {
  min-height: 44px;
  padding: .65rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: transparent;
}

.section-shell { padding: clamp(4rem, 7vw, 7rem) clamp(1.2rem, 7vw, 8rem); }
.section-intro { max-width: 760px; margin-bottom: 2.3rem; }
.section-intro h2, .bookmarks-section h2, .search-results h2 { font-size: clamp(2.1rem, 4vw, 4rem); }
.section-intro > p:last-child { color: var(--muted); }

.bible-workspace {
  min-height: 660px;
  display: grid;
  grid-template-columns: minmax(250px, 320px) 1fr;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.book-browser { padding: 1.25rem; background: color-mix(in srgb, var(--cream-200) 70%, var(--paper)); border-right: 1px solid var(--line); }
.testament-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: .25rem; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.testament-tabs button { min-height: 44px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-weight: 700; }
.testament-tabs button[aria-selected="true"] { color: #fff; background: var(--navy-800); }
.testament-note { margin: 1rem .4rem .6rem; color: var(--muted); font-size: .78rem; }
.book-list { max-height: 545px; overflow: auto; padding-right: .35rem; }
.book-button {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .65rem .75rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  text-align: left;
}
.book-button:hover, .book-button:focus-visible { color: var(--gold-600); background: var(--paper); }
.book-button[aria-current="true"] { color: var(--navy-800); background: var(--paper); font-weight: 800; box-shadow: inset 3px 0 var(--gold-500); }
.book-index { width: 1.9rem; color: var(--gold-600); font: .8rem "Palatino Linotype", "Book Antiqua", "Times New Roman", serif; }

.reader { min-width: 0; }
.reader-toolbar { min-height: 118px; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.6rem 2rem; border-bottom: 1px solid var(--line); }
.reader h2 { font-size: clamp(1.7rem, 3vw, 2.8rem); }
.chapter-list { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.chapter-button { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: transparent; }
.chapter-button[aria-current="true"] { color: #fff; background: var(--navy-800); }
.reader-edition-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 2rem; background: var(--cream-100); border-bottom: 1px solid var(--line); }
.edition-switcher { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); min-width: min(100%, 360px); padding: .25rem; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.edition-switcher button { min-height: 44px; padding: .55rem .8rem; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-weight: 700; }
.edition-switcher button[aria-pressed="true"] { color: #fff; background: var(--navy-800); }
.edition-note { max-width: 460px; margin: 0; color: var(--muted); font-size: .78rem; text-align: right; }
.reader-content { max-width: 850px; padding: clamp(1.5rem, 5vw, 4rem); }
.verse-row { position: relative; display: grid; grid-template-columns: 2.2rem 1fr auto; gap: .8rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.verse-number { padding-top: .25rem; color: var(--gold-600); font: 700 .8rem "Palatino Linotype", "Book Antiqua", "Times New Roman", serif; }
.verse-text { margin: 0; font: calc(1.2rem * var(--scripture-scale))/1.85 "Palatino Linotype", "Book Antiqua", "Times New Roman", serif; }
.parallel-text { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1rem, 3vw, 2.4rem); }
.parallel-column { min-width: 0; }
.parallel-column + .parallel-column { padding-left: clamp(1rem, 3vw, 2.4rem); border-left: 1px solid var(--line); }
.edition-label { display: block; margin-bottom: .45rem; color: var(--gold-600); font-size: .68rem; font-weight: 800; letter-spacing: .12em; }
.parallel-column.original .verse-text { color: color-mix(in srgb, var(--ink) 82%, var(--muted)); }
.bookmark-button { min-width: 44px; min-height: 44px; border: 0; color: var(--gold-600); background: transparent; font-size: 1.35rem; }
.empty-state { padding: 2.5rem; color: var(--muted); background: var(--cream-100); border: 1px dashed var(--line); border-radius: 14px; }

.search-results { background: var(--paper); }
.section-heading-row { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 2rem; }
.search-results .text-button { color: var(--ink); border-color: var(--line); }
.result-list, .bookmark-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 1rem; }
.result-card, .bookmark-card { padding: 1.4rem; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.result-card button { width: 100%; min-height: 44px; padding: 0; border: 0; color: inherit; background: transparent; text-align: left; }
.result-card p, .bookmark-card p { font: calc(1.04rem * var(--scripture-scale))/1.7 "Palatino Linotype", "Book Antiqua", "Times New Roman", serif; }
.result-card small, .bookmark-card small { color: var(--gold-600); font-weight: 700; }

.bookmarks-section { background: var(--cream-200); }
.privacy-note { color: var(--muted); font-size: .85rem; }
.about-section { display: grid; grid-template-columns: .8fr 1.2fr; gap: 3rem; padding: clamp(4rem, 7vw, 7rem) clamp(1.2rem, 10vw, 12rem); color: #fff; background: var(--navy-900); }
.about-section h2 { max-width: 520px; font-size: clamp(2.1rem, 4vw, 4rem); }
.about-section > p { max-width: 700px; color: rgba(255,255,255,.72); }

.prototype-notice { display: flex; align-items: center; justify-content: center; gap: .7rem; padding: .8rem 1rem; color: #3c2b12; background: var(--gold-300); font-size: .78rem; text-align: center; }
footer { min-height: 84px; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem clamp(1.2rem, 7vw, 8rem); color: rgba(255,255,255,.6); background: var(--navy-950); font-size: .78rem; }

:focus-visible { outline: 3px solid var(--gold-500); outline-offset: 3px; }

@media (max-width: 980px) {
  .site-header { grid-template-columns: auto auto 1fr; gap: .8rem; }
  .mobile-menu-toggle { display: inline-grid; place-items: center; }
  .primary-nav { display: none; position: absolute; top: 74px; left: 1rem; right: 1rem; padding: .7rem; flex-direction: column; align-items: stretch; background: var(--navy-950); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; box-shadow: var(--shadow); }
  .primary-nav.is-open { display: flex; }
  .primary-nav a { justify-content: space-between; }
  .header-actions { justify-self: end; }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .daily-card { max-width: 720px; }
}

@media (max-width: 760px) {
  html { scroll-padding-top: 70px; }
  .site-header { min-height: 68px; padding: .65rem 1rem; }
  .brand strong { font-size: .86rem; }
  .brand-mark { width: 34px; height: 34px; }
  .header-actions .text-button { display: none; }
  .primary-nav { top: 68px; }
  .hero { padding: 3.5rem 1.1rem 4.5rem; gap: 2.3rem; }
  .hero h1 { font-size: clamp(2.7rem, 14vw, 4.4rem); }
  .hero-lead { font-size: 1rem; }
  .search-box { grid-template-columns: auto 1fr; padding: .6rem .8rem; }
  .search-box button { grid-column: 1 / -1; width: 100%; }
  .daily-card { padding: 1.7rem; }
  .daily-card { width: 100%; min-width: 0; }
  .daily-actions { flex-direction: column; }
  .section-shell { padding: 4rem 1rem; }
  .bible-workspace { grid-template-columns: 1fr; }
  .book-browser { border-right: 0; border-bottom: 1px solid var(--line); }
  .book-list { max-height: 300px; }
  .reader-toolbar { align-items: flex-start; flex-direction: column; padding: 1.3rem; }
  .chapter-list { justify-content: flex-start; }
  .reader-edition-bar { align-items: stretch; flex-direction: column; padding: 1rem 1.25rem; }
  .edition-switcher { width: 100%; min-width: 0; }
  .edition-note { max-width: none; text-align: left; }
  .reader-content { padding: 1.25rem; }
  .verse-row { grid-template-columns: 1.8rem 1fr auto; gap: .45rem; }
  .parallel-text { grid-template-columns: 1fr; gap: 1rem; }
  .parallel-column + .parallel-column { padding-top: 1rem; padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .section-heading-row { align-items: flex-start; flex-direction: column; }
  .about-section { grid-template-columns: 1fr; gap: 1.5rem; padding: 4rem 1.2rem; }
  .prototype-notice { align-items: flex-start; flex-direction: column; }
  footer { align-items: flex-start; flex-direction: column; }
}

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