@import url("https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&family=DM+Sans:wght@400;500;600&family=Libre+Baskerville:wght@400;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&display=swap");

:root {
  color-scheme: light;
  --background: #f8f7f3;
  --surface: #fff;
  --ink: #262624;
  --muted: #77756f;
  --line: #dfddd6;
  --accent: #c64f35;
  --soft: #efece5;
  --sans: "DM Sans", sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --reader-font: "Source Serif 4", Georgia, serif;
  --reader-size: 1.12rem;
}
[data-theme="dark"] { color-scheme: dark; --background: #181817; --surface: #222220; --ink: #eeeae2; --muted: #aaa69d; --line: #3d3b37; --soft: #2c2a27; --accent: #e58067; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--background); color: var(--ink); font-family: var(--sans); }
button { color: inherit; font: inherit; }
svg { width: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.site-header { position: sticky; z-index: 20; top: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 74px; padding: 0 40px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--background) 92%, transparent); backdrop-filter: blur(18px); }
.wordmark { color: inherit; font: 600 1.2rem var(--serif); text-decoration: none; }
.primary-tabs { align-self: stretch; display: flex; gap: 42px; }
.primary-tabs a, .mobile-tabs a { position: relative; display: grid; place-items: center; color: var(--muted); font-size: .84rem; font-weight: 500; text-decoration: none; }
.primary-tabs a.active { color: var(--ink); }
.primary-tabs a.active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--ink); content: ""; }
.header-actions { justify-self: end; display: flex; gap: 4px; }
.icon-button { display: grid; width: 42px; height: 42px; place-items: center; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.icon-button:hover { background: var(--soft); }
.view { width: min(100% - 40px, 820px); margin: 0 auto; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: .65rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.daily-hero { padding: 90px 0 50px; text-align: center; }
.daily-hero h1, .chapter-header h1 { margin: 0; font: 600 clamp(2.8rem, 8vw, 5.5rem)/1 var(--serif); letter-spacing: -.045em; }
.daily-intro { max-width: 480px; margin: 22px auto 0; color: var(--muted); line-height: 1.6; }
.daily-card { margin-bottom: 80px; padding: clamp(26px, 6vw, 54px); border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.daily-card h2 { margin: 0 0 28px; font: 600 1.45rem var(--serif); }
.scripture { font: 400 var(--reader-size)/1.9 var(--reader-font); }
.daily-passage p, .verse { display: inline; margin: 0; }
.daily-passage p:not(:last-child)::after, .verse:not(:last-child)::after { content: " "; }
.line-by-line .daily-passage p, .line-by-line .verse { display: block; margin: 0 0 1em; }
.line-by-line .daily-passage p::after, .line-by-line .verse::after { content: none; }
.verse-number { margin-right: .65em; color: var(--accent); font: 600 .63em var(--sans); text-decoration: none; vertical-align: super; }
.daily-actions { display: flex; justify-content: center; gap: 10px; margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); }
.button { padding: 12px 16px; border: 1px solid var(--line); border-radius: 3px; background: transparent; cursor: pointer; font-size: .78rem; font-weight: 600; }
.button:hover { border-color: var(--ink); }
.button.primary { border-color: var(--ink); background: var(--ink); color: var(--background); }
.reader-toolbar { position: sticky; z-index: 10; top: 74px; display: grid; grid-template-columns: 1fr 1fr 1fr; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--background) 92%, transparent); backdrop-filter: blur(18px); transition: transform .22s ease, opacity .18s ease; }
.selector, .translation { min-width: 0; padding: 20px 18px; border: 0; border-right: 1px solid var(--line); background: transparent; text-align: left; }
.selector, .translation { cursor: pointer; }
.selector:hover, .translation:hover { background: var(--soft); }
.selector strong, .translation strong { display: block; overflow: hidden; font: 600 .95rem var(--serif); text-overflow: ellipsis; white-space: nowrap; }
.chapter-header { padding: 85px 0 54px; text-align: center; }
.chapter-header h2 { margin: 18px 0 0; font: 600 1.25rem/1.35 var(--serif); }
.chapter-introduction { max-width: 620px; margin: 14px auto 0; color: var(--muted); font-size: .8rem; line-height: 1.7; }
.chapter-header p:last-child { margin: 18px 0 0; color: var(--muted); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
.verse { scroll-margin-top: 170px; }
.verse:target { background: var(--soft); outline: 4px solid var(--soft); }
.chapter-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 70px 0 90px; padding-top: 20px; border-top: 1px solid var(--line); }
.chapter-nav button { display: flex; flex-direction: column; gap: 5px; padding: 18px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; }
.chapter-nav button:last-child { text-align: right; }
.chapter-nav button:hover { border-color: var(--ink); }
.chapter-nav span { color: var(--muted); font-size: .65rem; letter-spacing: .1em; text-transform: uppercase; }
.chapter-nav strong { font-family: var(--serif); }
.chapter-nav button:disabled { visibility: hidden; }
.home-footer { display: flex; justify-content: center; margin: -48px 0 0; padding: 28px 0 90px; font-size: .7rem; }
.home-footer a { color: #555; text-underline-offset: 3px; }
[data-theme="dark"] .home-footer a { color: #aaa49a; }
.back-link { color: inherit; text-underline-offset: 3px; }
.home-footer a:hover, .back-link:hover { color: var(--ink); }
.mobile-tabs { display: none; }
dialog { width: min(680px, calc(100vw - 32px)); max-height: min(760px, calc(100dvh - 32px)); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 80px #0005; }
dialog::backdrop { background: #111b; backdrop-filter: blur(3px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 25px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font: 600 1.55rem var(--serif); }
.book-picker { max-height: 600px; overflow-y: auto; }
.book-picker h3 { margin: 0; padding: 18px 25px 8px; color: var(--muted); font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; }
.book-picker button { display: flex; width: 100%; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 13px 25px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; }
.book-picker button:hover { background: var(--soft); }
.book-picker strong { font-family: var(--serif); }
.book-details { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.book-details small, .book-chapters { color: var(--muted); font-size: .72rem; line-height: 1.45; }
.book-chapters { flex: 0 0 auto; white-space: nowrap; }
.translation-info { padding: 30px 25px; }
.translation-info h3 { margin: 0 0 12px; font: 600 1.25rem var(--serif); }
.translation-info p { margin: 0 0 12px; color: var(--muted); font-size: .82rem; line-height: 1.7; }
.translation-info p:last-child { margin-bottom: 0; }
.chapter-picker { max-height: 600px; padding: 25px; overflow-y: auto; }
.picker-introduction { margin: 0 0 20px; color: var(--muted); font-size: .8rem; line-height: 1.65; }
.chapter-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.chapter-grid button { aspect-ratio: 1; border: 1px solid var(--line); background: var(--background); cursor: pointer; }
.chapter-grid button:hover, .chapter-grid button.active { border-color: var(--ink); background: var(--ink); color: var(--background); }
.settings-dialog { width: min(540px, calc(100vw - 32px)); }
.settings-dialog[open] { display: flex; max-height: min(760px, calc(100dvh - 32px)); flex-direction: column; }
.settings-dialog .dialog-header { flex: 0 0 auto; }
.settings-content { flex: 1 1 auto; min-height: 0; padding: 0 25px 25px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.setting-section { padding: 25px 0; border-bottom: 1px solid var(--line); }
.setting-section:last-child { padding-bottom: 0; border-bottom: 0; }
.setting-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.setting-heading h3 { margin: 0 0 4px; font-size: .86rem; }
.setting-heading p { margin: 0; color: var(--muted); font-size: .72rem; line-height: 1.5; }
.setting-heading > strong { color: var(--accent); font-size: .8rem; }
.size-controls { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; min-height: 62px; border: 1px solid var(--line); }
.size-controls button { width: 48px; height: 48px; border: 0; background: var(--soft); cursor: pointer; font-size: 1.35rem; }
.size-controls button:hover:not(:disabled) { background: var(--ink); color: var(--background); }
.size-controls button:disabled { color: var(--muted); cursor: not-allowed; opacity: .45; }
.size-preview { display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 14px 12px; border-right: 1px solid var(--line); border-left: 1px solid var(--line); line-height: 1.5; text-align: center; overflow-wrap: anywhere; }
.preview-reference { color: var(--accent); font: 600 .55rem var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.font-options { display: grid; gap: 8px; }
.font-options button { display: grid; grid-template-columns: 48px 1fr 18px; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; }
.font-options button:hover, .font-options button.active { border-color: var(--ink); background: var(--soft); }
.font-options button > span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; }
.font-options small { color: var(--muted); font-size: .67rem; }
.font-options i { width: 13px; height: 13px; border: 1px solid var(--muted); border-radius: 50%; }
.font-options button.active i { border: 4px solid var(--accent); }
.font-sample { font-size: 1.35rem; }
.source-font { font-family: "Source Serif 4", Georgia, serif; }
.baskerville-font { font-family: "Libre Baskerville", Georgia, serif; }
.atkinson-font { font-family: "Atkinson Hyperlegible", sans-serif; }
.setting-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.setting-toggle-row .setting-heading { margin-bottom: 0; }
.switch { position: relative; flex: 0 0 auto; width: 44px; height: 25px; padding: 2px; border: 0; border-radius: 20px; background: var(--muted); cursor: pointer; transition: background .2s ease; }
.switch span { display: block; width: 21px; height: 21px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px #0004; transition: transform .2s ease; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] span { transform: translateX(19px); }
.hide-verse-numbers .verse-number, .hide-verse-numbers .preview-reference { display: none; }
.toast { position: fixed; z-index: 50; bottom: 25px; left: 50%; padding: 10px 16px; border-radius: 24px; background: var(--ink); color: var(--background); font-size: .78rem; opacity: 0; transform: translate(-50%, 10px); transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.loading, .fatal { color: var(--muted); text-align: center; }
.fatal { margin: 80px 20px; }
.policy-header { grid-template-columns: 1fr auto; }
.back-link { justify-self: end; font-size: .78rem; }
.policy-page { width: min(100% - 40px, 820px); margin: 0 auto; }
.policy-hero h1 { margin: 0; font: 600 clamp(2.8rem, 8vw, 5.5rem)/1 var(--serif); letter-spacing: -.045em; }
.policy-content { padding: clamp(26px, 6vw, 54px); }
.policy-content section { padding: 28px 0; border-bottom: 1px solid var(--line); }
.policy-content section:first-child { padding-top: 0; }
.policy-content section:last-child { padding-bottom: 0; border-bottom: 0; }
.policy-content h2 { margin: 0 0 14px; font: 600 1.35rem var(--serif); }
.policy-content p { margin: 0 0 14px; color: var(--muted); line-height: 1.75; }
.policy-content p:last-child { margin-bottom: 0; }
.bible-reading:not(.mobile-controls-visible) .reader-toolbar { opacity: 0; pointer-events: none; transform: translateY(-100%); }

@media (max-width: 700px) {
  body { padding-bottom: 60px; }
  body.bible-reading { padding-bottom: 0; }
  .site-header { grid-template-columns: 1fr auto; height: 60px; padding: 0 14px 0 20px; transition: transform .22s ease, opacity .18s ease; }
  .primary-tabs { display: none; }
  .view { width: min(100% - 32px, 820px); }
  .daily-hero { position: sticky; z-index: 9; top: 0; padding: 24px 0 20px; background: var(--background); transition: top .22s ease; }
  .mobile-controls-visible .daily-hero { top: 60px; }
  .daily-card { margin-bottom: 30px; }
  .daily-actions { flex-direction: column; }
  .reader-toolbar { top: 60px; margin: 0 -16px; grid-template-columns: minmax(0, 1.35fr) minmax(70px, .75fr) minmax(76px, .8fr); transition: top .22s ease, transform .22s ease, opacity .18s ease; }
  .selector, .translation { padding: 15px 12px; }
  .chapter-header { padding: 55px 0 38px; }
  .scripture { line-height: 1.82; }
  .chapter-nav { margin: 52px 0 25px; }
  .chapter-nav button { padding: 14px 10px; }
  .home-footer { margin-top: 0; padding: 0 0 30px; }
  .mobile-tabs { position: fixed; z-index: 25; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: 1fr 1fr; height: 60px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--background) 94%, transparent); backdrop-filter: blur(18px); transition: transform .22s ease, opacity .18s ease; }
  .mobile-tabs a.active { color: var(--ink); background: var(--soft); }
  .reader-body:not(.mobile-controls-visible) > .site-header { opacity: 0; pointer-events: none; transform: translateY(-100%); }
  .reader-body:not(.mobile-controls-visible) > .mobile-tabs { opacity: 0; pointer-events: none; transform: translateY(100%); }
  .chapter-picker { padding: 18px; }
  .chapter-grid { grid-template-columns: repeat(5, 1fr); }
  .policy-header { display: flex; justify-content: space-between; }
  .policy-body { padding-bottom: 0; }
  .policy-page { width: min(100% - 32px, 820px); }
}

@media (max-width: 700px) and (prefers-reduced-motion: reduce) {
  .site-header, .reader-toolbar, .mobile-tabs { transition: none; }
}

@media (min-width: 701px) and (prefers-reduced-motion: reduce) {
  .reader-toolbar { transition: none; }
}
