/* ---------- Fonts (SIL Open Font License; see /fonts/OFL-*.txt) ---------- */
@font-face {
  font-family: 'Cinzel'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('/fonts/cinzel-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Cinzel'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('/fonts/cinzel-latin-ext-500-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'EB Garamond'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/eb-garamond-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'EB Garamond'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/eb-garamond-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'EB Garamond'; font-style: italic; font-weight: 400; font-display: swap;
  src: url('/fonts/eb-garamond-latin-400-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'EB Garamond'; font-style: italic; font-weight: 400; font-display: swap;
  src: url('/fonts/eb-garamond-latin-ext-400-italic.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'EB Garamond'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/eb-garamond-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'EB Garamond'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/eb-garamond-latin-ext-600-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Colors (Hillsdale College palette) ---------- */
:root {
  --navy: #102D51;
  --crimson: #A91D39;
  --gray: #DFE3E8;

  --bg: #FFFFFF;
  --bg-soft: #F5F7F9;
  --text: #1B2430;
  --text-muted: #55606E;
  --heading: var(--navy);
  --accent: var(--crimson);
  --rule: var(--gray);
  --header-bg: var(--navy);
  --header-text: #FFFFFF;
  --tip-bg: var(--navy);
  --tip-text: #FFFFFF;
  --tip-sub: #C9D3DF;
  --input-bg: #FFFFFF;
  --focus: #2F6FB3;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1626;
    --bg-soft: #102035;
    --text: #E4E9EF;
    --text-muted: #9EABBB;
    --heading: #E9EEF4;
    --accent: #E0607A;
    --rule: #22344D;
    --header-bg: #081221;
    --header-text: #FFFFFF;
    --tip-bg: #E9EEF4;
    --tip-text: #102D51;
    --tip-sub: #3E5068;
    --input-bg: #0F1E33;
    --focus: #7FB2EA;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1626;
  --bg-soft: #102035;
  --text: #E4E9EF;
  --text-muted: #9EABBB;
  --heading: #E9EEF4;
  --accent: #E0607A;
  --rule: #22344D;
  --header-bg: #081221;
  --header-text: #FFFFFF;
  --tip-bg: #E9EEF4;
  --tip-text: #102D51;
  --tip-sub: #3E5068;
  --input-bg: #0F1E33;
  --focus: #7FB2EA;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
  font-size: 1.1875rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; outline: none; }
a { color: var(--accent); text-underline-offset: 0.15em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 10;
  background: var(--bg); color: var(--heading); padding: 0.5rem 0.75rem;
}
.skip-link:focus { top: 0.5rem; }
.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;
}

/* ---------- Header / footer ---------- */
.site-header { background: var(--header-bg); color: var(--header-text); }
.site-header-inner {
  max-width: 64rem; margin: 0 auto; padding: 0.75rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.brand {
  font-family: 'Cinzel', serif; font-weight: 500; letter-spacing: 0.08em;
  color: inherit; text-decoration: none; font-size: 1rem; text-transform: uppercase;
}
.site-nav { display: flex; gap: 1.25rem; }
.site-nav a {
  color: inherit; text-decoration: none; font-size: 1.0625rem;
  padding: 0.25rem 0; border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: rgba(255, 255, 255, 0.5); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--crimson); }

.site-footer {
  border-top: 1px solid var(--rule); color: var(--text-muted);
  text-align: center; padding: 2rem 1rem 2.5rem; font-size: 1rem;
}
.site-footer p { margin: 0.25rem 0; }
.footer-verse { font-style: italic; }
.ref { font-style: normal; font-variant: small-caps; letter-spacing: 0.03em; white-space: nowrap; }

/* ---------- Home: title ---------- */
.hero {
  text-align: center;
  padding: clamp(2rem, 7vw, 4.5rem) 1rem clamp(1.5rem, 4vw, 2.5rem);
}
.motto {
  margin: 0;
  font-family: 'Cinzel', serif; font-weight: 500;
  color: var(--heading);
  font-size: clamp(1.9rem, 8.2vw, 4.25rem);
  letter-spacing: 0.1em;
  line-height: 1.2;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline;
  column-gap: 0.15em;
}
.interpunct { color: var(--accent); }
.word { position: relative; display: inline-block; }
.word-btn {
  font: inherit; color: inherit; letter-spacing: inherit;
  background: none; border: 0; padding: 0 0.04em; margin: 0; cursor: default;
  -webkit-appearance: none; appearance: none;
  -webkit-tap-highlight-color: transparent;
}
.word-btn:hover, .word.open .word-btn { color: var(--accent); }
.tip {
  position: absolute; left: 50%; top: calc(100% + 0.6rem); z-index: 5;
  transform: translate(-50%, -0.25rem);
  min-width: max-content;
  background: var(--tip-bg); color: var(--tip-text);
  border-radius: 6px; padding: 0.55rem 0.9rem 0.6rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  font-family: 'EB Garamond', Georgia, serif; letter-spacing: normal; line-height: 1.25;
  text-align: center;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.tip::before {
  content: ''; position: absolute; left: 50%; top: -6px; margin-left: -6px;
  border: 6px solid transparent; border-top: 0; border-bottom-color: var(--tip-bg);
}
.tip-latin { display: block; font-size: 1.5rem; font-style: italic; }
.tip-english { display: block; font-size: 1.0625rem; color: var(--tip-sub); }
@media (hover: hover) {
  .word:hover .tip { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
}
.word.open .tip, .word-btn:focus-visible + .tip {
  opacity: 1; visibility: visible; transform: translate(-50%, 0);
}

/* ---------- Home: sections ---------- */
.section { max-width: 40rem; margin: 0 auto; padding: 0 1rem; }
.divider {
  display: flex; align-items: center; gap: 0.75rem;
  max-width: 14rem; margin: 0 auto 2.5rem; color: var(--accent);
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
.divider svg { display: block; }

.mission h2, .search-section h2 {
  font-family: 'EB Garamond', Georgia, serif; font-weight: 600;
  color: var(--heading); font-size: 1.75rem; line-height: 1.25;
  margin: 0 0 1rem; text-align: center;
}
.mission p { margin: 0 0 1.1rem; }
.scripture {
  margin: 1.5rem 0; padding: 0 0 0 1.1rem;
  border-left: 3px solid var(--accent);
  font-style: italic; font-size: 1.25rem; color: var(--heading);
}
.scripture .ref { color: var(--text-muted); font-size: 1rem; }
.ref-link {
  font: inherit; color: var(--accent); background: none; border: 0; padding: 0;
  cursor: pointer; text-decoration: underline; text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
}

/* ---------- Search ---------- */
.search-section { padding-bottom: 3rem; scroll-margin-top: 1rem; }
.mission { padding-bottom: 3rem; }
.search-intro { text-align: center; color: var(--text-muted); margin: -0.5rem 0 1.25rem; }
.search-form { display: flex; flex-direction: column; gap: 0.75rem; }
.search-row { display: flex; gap: 0.5rem; }
.search-input, .translation-select {
  font: inherit; color: var(--text); background: var(--input-bg);
  border: 1px solid var(--rule); border-radius: 6px;
  padding: 0.6rem 0.8rem; min-width: 0;
}
.search-input { flex: 1; font-size: 1.1875rem; }
.search-input:focus, .translation-select:focus { border-color: var(--navy); outline: 2px solid var(--focus); outline-offset: 0; }
.translation-select { width: 100%; font-size: 1.0625rem; }
.search-btn {
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--navy); color: #fff; border: 0; border-radius: 6px;
  padding: 0.6rem 1.2rem;
}
.search-btn:hover { background: #0B2140; }
:root[data-theme="dark"] .search-btn { background: #2A4C78; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .search-btn { background: #2A4C78; } }
.search-hint { font-size: 0.95rem; color: var(--text-muted); margin: 0; }
.search-hint button { font-size: inherit; }

.results { margin-top: 2rem; }
.result-error { color: var(--accent); text-align: center; }
.passage { padding: 1.25rem 0; border-top: 1px solid var(--rule); }
.passage:first-child { border-top: 0; padding-top: 0; }
.passage-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.passage-title { margin: 0; font-size: 1.25rem; font-weight: 600; color: var(--heading); }
.passage-version { color: var(--text-muted); font-size: 1rem; }
.passage-text p { margin: 0 0 0.35rem; }
.vnum {
  color: var(--accent); font-size: 0.7em; font-weight: 600;
  vertical-align: 0.35em; margin-inline-end: 0.25em; font-variant-numeric: lining-nums;
}
.chapter-label {
  display: block; font-size: 0.95rem; font-variant: small-caps; letter-spacing: 0.04em;
  color: var(--text-muted); margin: 0.75rem 0 0.25rem;
}
.passage-text[dir="rtl"] { font-family: 'Noto Naskh Arabic', 'Geeza Pro', 'Times New Roman', serif; font-size: 1.3rem; line-height: 1.9; }
.passage-missing { color: var(--text-muted); font-style: italic; }

/* Toggle switch */
.compare {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin: 1.5rem 0 1rem; padding: 0.75rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.switch { position: relative; display: inline-flex; align-items: center; gap: 0.75rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  width: 2.75rem; height: 1.5rem; border-radius: 999px; flex: none;
  background: var(--rule); position: relative; transition: background 0.15s;
}
.switch-track::after {
  content: ''; position: absolute; top: 0.1875rem; left: 0.1875rem;
  width: 1.125rem; height: 1.125rem; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3); transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: var(--navy); }
:root[data-theme="dark"] .switch input:checked + .switch-track { background: #3D6597; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .switch input:checked + .switch-track { background: #3D6597; } }
.switch input:checked + .switch-track::after { transform: translateX(1.25rem); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.compare-status { color: var(--text-muted); font-size: 0.95rem; }

/* ---------- Placeholder pages ---------- */
.placeholder { max-width: 40rem; margin: 0 auto; padding: 4rem 1rem; text-align: center; }
.placeholder h1 { font-family: 'Cinzel', serif; font-weight: 500; color: var(--heading); letter-spacing: 0.06em; }

@media (max-width: 30rem) {
  body { font-size: 1.125rem; }
  .site-header-inner { justify-content: center; }
  .search-row { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .tip, .switch-track, .switch-track::after { transition: none; }
}
