/* ---- Fonts (self-hosted, offline-safe) ---- */
@font-face { font-family: 'Lora'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/lora-400.woff2') format('woff2'); }
@font-face { font-family: 'Lora'; font-weight: 500; font-style: normal; font-display: swap; src: url('../fonts/lora-500.woff2') format('woff2'); }
@font-face { font-family: 'Lora'; font-weight: 600; font-style: normal; font-display: swap; src: url('../fonts/lora-600.woff2') format('woff2'); }

/* ---- Design tokens ---- */
/* Default = dark (house style). Attribute absent => @media follows the OS. */
:root {
  --bg:#0f172a; --surface:#1e293b; --surface-2:#253350;
  --border:rgba(99,130,180,.25); --text:#f1f5f9; --muted:#94a3b8;
  --accent:#f59e0b; --accent-text:#fbbf24; --on-accent:#1a1206;
  --ink:#f1f5f9; --ink-dim:#5b6678; --radius:12px;
  --sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;
}
:root[data-theme="dark"] {
  --bg:#0f172a; --surface:#1e293b; --surface-2:#253350;
  --border:rgba(99,130,180,.25); --text:#f1f5f9; --muted:#94a3b8;
  --accent:#f59e0b; --accent-text:#fbbf24; --on-accent:#1a1206;
  --ink:#f1f5f9; --ink-dim:#5b6678;
}
:root[data-theme="light"] {
  --bg:#f8fafc; --surface:#ffffff; --surface-2:#f1f5f9;
  --border:#e2e8f0; --text:#0f172a; --muted:#64748b;
  --accent:#f59e0b; --accent-text:#b45309; --on-accent:#1a1206;
  --ink:#0f172a; --ink-dim:#aab4c2;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg:#f8fafc; --surface:#ffffff; --surface-2:#f1f5f9;
    --border:#e2e8f0; --text:#0f172a; --muted:#64748b;
    --accent:#f59e0b; --accent-text:#b45309; --on-accent:#1a1206;
    --ink:#0f172a; --ink-dim:#aab4c2;
  }
}

/* ---- Base ---- */
* { box-sizing: border-box; }
html, body { margin:0; min-height:100dvh; background:var(--bg); color:var(--text); font-family:var(--sans); }
body { display:flex; flex-direction:column; }
@media (prefers-reduced-motion: no-preference) {
  a, button, .tab { transition: color .18s ease, background-color .18s ease, border-color .18s ease; }
}

/* ---- App layout: view area + tab bar ---- */
#view { flex:1 1 auto; overflow-y:auto; }
.view-pad { max-width:1100px; margin:0 auto; padding:1.5rem 1.25rem 2rem; }
.view-title { font-family:var(--sans); font-size:1.05rem; font-weight:600; letter-spacing:.02em; margin:0 0 1rem; }
.muted { color:var(--muted); }

/* Tab bar: bottom on phone, left rail on wide screens (spec §4.0) */
.tabbar { display:flex; background:var(--surface); border-top:1px solid var(--border);
  padding:.25rem; gap:.25rem; flex:0 0 auto; }
.tab { flex:1; display:flex; flex-direction:column; align-items:center; gap:.15rem;
  padding:.5rem .25rem; min-height:48px; border:0; background:none; color:var(--muted);
  font:500 .7rem/1 var(--sans); text-decoration:none; border-radius:10px; cursor:pointer; }
.tab svg { width:22px; height:22px; }
.tab[aria-current="page"] { color:var(--accent-text); background:var(--surface-2); }
.tab:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }

@media (min-width:900px) {
  body { flex-direction:row-reverse; }            /* view left, rail right-reading-order safe */
  .tabbar { flex-direction:column; width:96px; border-top:0; border-right:1px solid var(--border);
    justify-content:flex-start; gap:.25rem; padding:.75rem .4rem; }
  .tab { flex:0 0 auto; }
}

/* ---- Reader (carried from M1) ---- */
.reader { font-family:var(--serif); font-size:19px; line-height:1.75; color:var(--ink); }
.chapter-title { font-family:var(--sans); font-size:.95rem; letter-spacing:.04em; text-transform:uppercase;
  color:var(--muted); margin:0 0 1rem; }
.verse .vnum { font-family:var(--sans); font-size:.62em; color:var(--accent-text); vertical-align:super; margin-right:.25em; }
.verse.dim { color:var(--ink-dim); }              /* plan-mode greying (used in 2B) */
@media (min-width:900px) {
  .reader { column-count:2; column-gap:3rem; column-rule:1px solid var(--border); }
  .chapter-title { column-span:all; }
}

/* ---- Controls ---- */
.btn { font:500 .9rem var(--sans); padding:.55rem .9rem; border-radius:10px; border:1px solid var(--border);
  background:var(--surface); color:var(--text); cursor:pointer; min-height:44px; }
.btn[aria-pressed="true"] { background:var(--accent); color:var(--on-accent); border-color:var(--accent); }
.seg { display:inline-flex; gap:.4rem; }

/* ---- Plans ---- */
.card { display:block; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:1rem 1.1rem; margin-bottom:.85rem; text-decoration:none; color:var(--text); }
.plan-row { display:flex; justify-content:space-between; align-items:center; }
.day-card .day-head { font-family:var(--sans); font-size:1rem; margin:0 0 .6rem; }
.passage-row { display:flex; align-items:center; gap:.6rem; min-height:44px; }
.passage-row input { width:20px; height:20px; accent-color:var(--accent); }
.passage-link { color:var(--accent-text); text-decoration:none; font-family:var(--serif); font-size:1.05rem; }
.day-commentary { border-top:1px solid var(--border); margin-top:.7rem; padding-top:.6rem; font-size:.9rem; }
.back-link { display:inline-block; margin-bottom:.4rem; text-decoration:none; }
.import { margin-top:1.2rem; }
.import summary { cursor:pointer; color:var(--accent-text); }
.import textarea { width:100%; margin:.6rem 0; background:var(--surface-2); color:var(--text);
  border:1px solid var(--border); border-radius:10px; padding:.6rem; font-family:ui-monospace,monospace; font-size:.85rem; }

/* ---- Plan-mode bar (Bible tab) ---- */
.plan-bar { display:flex; align-items:center; gap:.6rem; padding:.6rem 1.25rem;
  background:var(--surface); border-bottom:1px solid var(--border); position:sticky; top:0; z-index:10; }
.plan-bar .grow { flex:1; font-family:var(--sans); font-size:.9rem; }
.iconbtn { min-width:44px; min-height:44px; display:inline-flex; align-items:center; justify-content:center;
  border:1px solid var(--border); background:var(--surface-2); color:var(--text); border-radius:10px; cursor:pointer; font-size:1rem; }
