/* ==========================================================================
   UECF.NET Bible in One Year
   Reading-app stylesheet for the day-based reading-plan navigator. Follows
   UECF.NET's site palette (navy / gold / cream / maroon / teal, Fraunces +
   Source Sans 3) and the reading-app conventions already established by
   /study-bible/ and /kjv-study-bible/ (sticky header + toolbar, dark/light
   theme via [data-theme], font-size stepping, printable, mobile app-shell
   chrome) -- adapted here for Day 1-365 navigation instead of Book/Chapter.
   ========================================================================== */

:root {
  /* UECF.NET brand tokens (matches /study-bible/ and /kjv-study-bible/) */
  --ink: #101B31;
  --ink-soft: #2C3E60;
  --gold: #C79A3D;
  --gold-soft: #E4C685;
  --maroon: #8B3A42;
  --teal: #2F5D62;

  /* Reading surface (light) */
  --paper: #FAF6EC;
  --paper-2: #F0E7D5;
  --paper-3: #E9DFC8;
  --text: #201A10;
  --text-2: #4A4239;
  --text-3: #7A6F61;
  --line: #E2D8C0;
  --line-2: #CFC2A0;
  --note-bg: #F3ECDA;
  --note-border: var(--teal);
  --focus: #1d4ed8;
  --shadow: 0 1px 2px rgba(16,27,49,.08), 0 8px 24px rgba(16,27,49,.10);
  --shadow-lg: 0 4px 12px rgba(16,27,49,.14), 0 24px 56px rgba(16,27,49,.20);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-scripture: 'Merriweather', 'Noto Serif', Georgia, 'Times New Roman', serif;
  --fs: 1.0625rem;
  --wrap: 1280px;
  --radius: 10px;
  color-scheme: light;
}

[data-theme="dark"] {
  --paper: #12100C;
  --paper-2: #1A1712;
  --paper-3: #241F17;
  --text: #EFE8D8;
  --text-2: #C9BFA9;
  --text-3: #978C77;
  --line: #35301F;
  --line-2: #443C28;
  --note-bg: #1D2620;
  --gold-soft: #E8C765;
  --ink: #0B1220;
  --ink-soft: #182238;
  --focus: #93c5fd;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.55), 0 24px 56px rgba(0,0,0,.55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 7.5rem; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs);
  line-height: 1.6;
}

img { max-width: 100%; height: auto; }
a { color: var(--maroon); }
[data-theme="dark"] a { color: var(--gold-soft); }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--gold); color: var(--ink); padding: 10px 18px; z-index: 300; font-weight: 700; border-radius: 0 0 6px 0; }
.skip-link:focus { left: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0 0 .4em; line-height: 1.2; color: var(--text); }
button { font: inherit; }

/* ---------------------------------------------------------------- header */
.sb-header { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 200; border-bottom: 3px solid var(--gold); }
.sb-header-inner { display: flex; align-items: center; gap: 16px; justify-content: space-between; max-width: var(--wrap); margin: 0 auto; padding: 8px 16px; }
.sb-brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.sb-brand:hover { text-decoration: none; }
.sb-brand img { width: 38px; height: 38px; flex: none; }
.sb-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.sb-brand-text strong { font-family: var(--font-display); font-size: 1.05rem; }
.sb-brand-text small { color: var(--gold-soft); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.sb-header-nav { display: flex; align-items: center; gap: 4px; font-size: .88rem; }
.sb-header-nav a { color: #fff; padding: 8px 10px; border-radius: 5px; }
.sb-header-nav a:hover { background: rgba(228,198,133,.15); color: var(--gold-soft); text-decoration: none; }

/* "Other Bibles" dropdown, desktop header only */
.sb-other-bibles-menu { position: relative; }
.sb-other-bibles-trigger { background: none; border: none; color: #fff; font: inherit; font-size: .88rem; padding: 8px 10px; border-radius: 5px; cursor: pointer; }
.sb-other-bibles-trigger:hover, .sb-other-bibles-trigger[aria-expanded="true"] { background: rgba(228,198,133,.15); color: var(--gold-soft); }
.sb-other-bibles-drop { position: absolute; right: 0; top: calc(100% + 6px); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; display: none; z-index: 210; }
.sb-other-bibles-drop.show { display: block; }
.sb-other-bibles-drop a { display: block; color: var(--text); padding: 8px 10px; border-radius: 6px; font-size: .9rem; }
.sb-other-bibles-drop a:hover { background: var(--paper-2); text-decoration: none; color: var(--maroon); }

/* ---------------------------------------------------------- mobile top bar
   Replaces .sb-header on narrow viewports (see the 760px breakpoint below):
   a single Home icon instead of the full brand row, the current day title,
   and a "More" menu for the sister Bible editions -- app-shell chrome
   instead of a website header, so the reading area gets the space. */
.sb-mtop { display: none; }
.sb-mtop-home {
  flex: none; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: #fff; border-radius: 8px; text-decoration: none;
}
.sb-mtop-home:hover { background: rgba(228,198,133,.15); text-decoration: none; }
.sb-mtop-title {
  flex: 1; min-width: 0; text-align: center; font-family: var(--font-display); font-weight: 600;
  font-size: 1rem; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sb-mtop-more {
  flex: none; width: 36px; height: 36px; border-radius: 8px; border: none; background: none;
  color: #fff; font-size: 1.35rem; line-height: 1; cursor: pointer;
}
.sb-mtop-more:hover, .sb-mtop-more[aria-expanded="true"] { background: rgba(228,198,133,.15); color: var(--gold-soft); }

/* --------------------------------------------------------------- toolbar */
.sb-toolbar { background: var(--paper-2); border-bottom: 1px solid var(--line); position: sticky; top: 55px; z-index: 190; }
.sb-toolbar-inner { max-width: var(--wrap); margin: 0 auto; padding: 8px 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sb-select, .sb-input {
  font-family: var(--font-body); font-size: .9rem; color: var(--text);
  background: var(--paper); border: 1px solid var(--line-2); border-radius: 7px;
  padding: 8px 10px; min-height: 40px;
}
.sb-select:focus, .sb-input:focus { border-color: var(--gold); }
.sb-nav-btns { display: flex; gap: 4px; }
.sb-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2);
  background: var(--paper); color: var(--text); border-radius: 7px; padding: 8px 12px;
  cursor: pointer; min-height: 40px; min-width: 40px; justify-content: center;
}
.sb-btn:hover { border-color: var(--gold); color: var(--maroon); }
.sb-btn:disabled { opacity: .45; cursor: not-allowed; }
.sb-btn:disabled:hover { border-color: var(--line-2); color: var(--text); }
.sb-btn[aria-pressed="true"] { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.sb-btn-quiet { background: none; }
.sb-search-wrap { position: relative; flex: 1 1 220px; min-width: 180px; }
.sb-search-wrap input, .sb-search-btn { width: 100%; text-align: left; }
.sb-search-btn kbd { margin-left: auto; font-size: .72rem; background: var(--paper-3); border-radius: 4px; padding: 1px 5px; color: var(--text-3); }
.sb-tool-group { display: flex; gap: 4px; margin-left: auto; }

/* ----------------------------------------------------------------- layout */
.sb-layout { max-width: var(--wrap); margin: 0 auto; padding: 20px 16px 80px; display: grid; grid-template-columns: 280px minmax(0,1fr); gap: 24px; align-items: start; }
.sb-side { position: sticky; top: 116px; max-height: calc(100vh - 132px); overflow-y: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.sb-side h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--teal); margin-bottom: 10px; }

.sb-progress-block { padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.sb-progress-bar { height: 8px; background: var(--paper-3); border-radius: 5px; overflow: hidden; }
.sb-progress-bar span { display: block; height: 100%; width: 0%; background: var(--gold); transition: width .25s ease; }
.sb-progress-text { margin: 6px 0 0; font-size: .82rem; color: var(--text-2); }

.sb-day-list { display: grid; gap: 10px; }
.sb-day-month-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--maroon); margin: 10px 0 2px; }
.sb-day-month-label:first-child { margin-top: 0; }
.sb-day-month-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px,1fr)); gap: 4px; }
.sb-day-month-grid a { position: relative; display: flex; align-items: center; justify-content: center; height: 36px; border-radius: 6px; background: var(--paper-2); color: var(--text-2); font-size: .82rem; border: 1px solid var(--line); }
.sb-day-month-grid a:hover { border-color: var(--gold); color: var(--maroon); text-decoration: none; }
.sb-day-month-grid a[aria-current="true"] { background: var(--gold); color: var(--ink); border-color: var(--gold); font-weight: 700; }
.sb-day-month-grid a[data-read="true"]::after { content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
[data-theme="dark"] .sb-day-month-grid a[data-read="true"]::after { background: var(--gold-soft); }

.sb-main { min-width: 0; }
.sb-day-head { text-align: center; padding-bottom: 12px; border-bottom: 2px solid var(--line); margin-bottom: 14px; }
.sb-day-head .kicker { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--teal); font-weight: 700; }
.sb-day-head h1 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); margin: .2em 0; }
.sb-day-refs { color: var(--text-2); font-size: .95rem; margin: 0; }
.sb-day-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 10px; flex-wrap: wrap; }
.sb-day-nav .sb-btn { flex: none; }

/* --------------------------------------------------------------- reading */
.sb-scripture { font-family: var(--font-scripture); font-size: 1.06em; line-height: 1.85; color: var(--text); max-width: 46rem; margin: 0 auto; }
.sb-section { margin-bottom: 2.2em; padding-bottom: 1.6em; border-bottom: 1px solid var(--line); }
.sb-section:last-of-type { border-bottom: none; }
.sb-track-badge { display: inline-block; font-family: var(--font-body); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: #fff; background: var(--teal); padding: 3px 9px; border-radius: 10px; margin-bottom: 6px; }
.sb-track-badge.sb-track-ot { background: var(--ink-soft); }
.sb-track-badge.sb-track-nt { background: var(--maroon); }
.sb-track-badge.sb-track-psalms { background: var(--teal); }
.sb-track-badge.sb-track-proverbs { background: var(--gold); color: var(--ink); }
.sb-section-title { font-family: var(--font-display); font-weight: 600; font-size: 1.3em; margin: 0 0 .6em; color: var(--text); }
.sb-verse { display: block; margin-bottom: .15em; scroll-margin-top: 8rem; border-radius: 6px; }
.sb-verse.sb-verse-highlight { background: var(--gold-soft); animation: sb-flash 2.4s ease-out; }
[data-theme="dark"] .sb-verse.sb-verse-highlight { background: #4a3a12; }
@keyframes sb-flash { from { background: var(--gold-soft); } to { background: transparent; } }
.sb-vnum { font-family: var(--font-body); font-weight: 700; color: var(--maroon); font-size: .78em; vertical-align: super; margin-right: .15em; }
[data-theme="dark"] .sb-vnum { color: var(--gold-soft); }
.sb-section-heading { font-family: var(--font-display); font-weight: 600; font-style: italic; color: var(--teal); font-size: 1em; margin: 1.2em 0 .4em; }
.sb-section-heading:first-child { margin-top: 0; }

/* study notes, distinctly styled from Scripture text */
.sb-note {
  font-family: var(--font-body); font-size: .88em; line-height: 1.55; color: var(--text-2);
  background: var(--note-bg); border-left: 4px solid var(--note-border);
  border-radius: 0 8px 8px 0; padding: 10px 14px; margin: .5em 0 1em;
}
.sb-note-label { display: inline-block; font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--teal); background: rgba(47,93,98,.12); padding: 1px 7px; border-radius: 10px; margin-bottom: 4px; }
[data-theme="dark"] .sb-note-label { color: var(--gold-soft); background: rgba(232,199,101,.14); }
.sb-note-term { font-weight: 700; color: var(--maroon); margin-right: .35em; }
[data-theme="dark"] .sb-note-term { color: var(--gold-soft); }

/* reflection Q&A */
.sb-reflection { font-family: var(--font-body); background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-top: 1em; }
.sb-reflection h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--maroon); margin-bottom: 8px; }
.sb-reflection-q { font-weight: 700; color: var(--text); margin: 0 0 .5em; }
.sb-reflection-a { color: var(--text-2); line-height: 1.65; margin: 0; }

.loading-msg { color: var(--text-3); font-style: italic; text-align: center; padding: 2em 0; }
.sb-flag { background: #fdf6e3; border: 1px solid #e3ca8f; color: #6b551f; border-radius: 6px; padding: 8px 12px; font-size: .82rem; margin: .6em 0; }
[data-theme="dark"] .sb-flag { background: #2b2410; border-color: #6b551f; color: #e8c765; }

/* search modal */
.sb-modal { position: fixed; inset: 0; background: rgba(16,27,49,.55); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; z-index: 400; }
.sb-modal[hidden] { display: none; }
.sb-modal-panel { background: var(--paper); border-radius: var(--radius); max-width: 640px; width: 100%; max-height: 78vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.sb-modal-field { display: flex; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.sb-modal-field input { flex: 1; border: none; background: none; font-size: 1.05rem; color: var(--text); outline: none; }
.sb-modal-status { padding: 8px 14px; font-size: .82rem; color: var(--text-3); }
.sb-modal-results { overflow-y: auto; padding: 0 6px 10px; margin: 0; }
.sb-modal-results li { list-style: none; }
.sb-modal-results a { display: block; padding: 10px 10px; border-radius: 8px; color: var(--text); }
.sb-modal-results a:hover { background: var(--paper-2); text-decoration: none; }
.sb-modal-results .where { font-size: .76rem; color: var(--teal); font-weight: 700; margin-bottom: 2px; }
[data-theme="dark"] .sb-modal-results .where { color: var(--gold-soft); }
.sb-modal-results .snippet { font-size: .9rem; color: var(--text-2); }
.sb-modal-results mark { background: var(--gold-soft); color: var(--ink); border-radius: 2px; }
.sb-modal-results-group-label { padding: 8px 10px 2px; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); }

/* back to top */
.sb-to-top { position: fixed; right: 20px; bottom: 20px; width: 44px; height: 44px; border-radius: 50%; background: var(--gold); color: var(--ink); border: none; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s ease; font-size: 1.1rem; z-index: 140; cursor: pointer; }
.sb-to-top.show { opacity: 1; pointer-events: auto; }

/* footer */
.sb-footer { background: var(--ink); color: #E1E6F0; padding: 28px 16px; text-align: center; font-size: .85rem; }
.sb-footer a { color: var(--gold-soft); }

/* ------------------------------------------------ fixed bottom app tab bar
   Mobile-only, thumb-reachable navigation (Days / Prev / Search / Next /
   Today), replacing the toolbar's inline controls -- hidden on desktop,
   where the sidebar and toolbar are always visible. */
.sb-bottom-nav { display: none; }
.sb-bn-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; color: var(--text-2); padding: 7px 4px 6px;
  font-family: var(--font-body); font-size: .68rem; cursor: pointer;
}
.sb-bn-btn .ic { font-size: 1.2rem; line-height: 1; }
.sb-bn-btn:hover, .sb-bn-primary { color: var(--maroon); }
[data-theme="dark"] .sb-bn-primary { color: var(--gold-soft); }

/* "More" bottom sheet: sister Bible editions, opened from the mobile top
   bar's "..." or the bottom nav's Days button long-press area is not used --
   this sheet is reserved for editions; day list uses the side nav toggle. */
.sb-sheet-backdrop { position: fixed; inset: 0; background: rgba(16,27,49,.5); z-index: 420; }
.sb-sheet-backdrop[hidden] { display: none; }
.sb-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 430; max-width: var(--wrap); margin: 0 auto;
  background: var(--paper); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg);
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom, 0));
}
.sb-sheet[hidden] { display: none; }
.sb-sheet-handle { width: 36px; height: 4px; background: var(--line-2); border-radius: 2px; margin: 4px auto 14px; }
.sb-sheet h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--teal); margin-bottom: 8px; }
.sb-sheet-links { display: grid; gap: 2px; margin-bottom: 4px; }
.sb-sheet-links a, .sb-sheet-current {
  display: flex; align-items: center; gap: 10px; padding: 12px 10px; border-radius: 8px; font-size: .98rem;
}
.sb-sheet-links a { color: var(--text); }
.sb-sheet-links a:hover { background: var(--paper-2); text-decoration: none; }
.sb-sheet-current { color: var(--text-3); }
.sb-sheet-current small { color: var(--text-3); }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .sb-layout { grid-template-columns: 240px minmax(0,1fr); }
}
@media (max-width: 760px) {
  /* App-shell mode: swap the full church header for the compact home/title/
     more bar, and move primary navigation to a fixed bottom tab bar. Frees
     real vertical space for the actual Scripture text on a phone screen. */
  .sb-header { display: none; }
  .sb-mtop {
    display: flex; align-items: center; gap: 6px; position: sticky; top: 0; z-index: 210;
    background: var(--ink); border-bottom: 3px solid var(--gold); padding: 8px 10px;
  }
  html { scroll-padding-top: 6.5rem; }
  .sb-verse, .sb-side { scroll-margin-top: 6.5rem; }

  .sb-layout { grid-template-columns: 1fr; padding-top: 12px; padding-bottom: 84px; }
  .sb-side { position: static; max-height: none; display: none; }
  .sb-side.sb-open { display: block; margin-bottom: 16px; }

  .sb-bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 210;
    background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(16,27,49,.1);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .sb-to-top { bottom: 78px; }

  .sb-toolbar { top: 52px; }
  .sb-toolbar-inner { padding: 6px 10px; }
  .sb-select, .sb-input, .sb-btn { min-height: 38px; padding: 6px 9px; font-size: .85rem; }
}

/* ------------------------------------------------------------------ print */
@media print {
  .sb-header, .sb-mtop, .sb-toolbar, .sb-side, .sb-to-top, .sb-footer, .sb-bottom-nav, .sb-sheet, .sb-sheet-backdrop, .sb-day-nav { display: none !important; }
  .sb-layout { grid-template-columns: 1fr; padding: 0; max-width: none; }
  .sb-scripture { font-size: 12pt; max-width: none; }
  a { color: inherit; text-decoration: none; }
  body { background: #fff; color: #000; }
}

.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; }
