/* Nicaea Library — web edition.
   Same design language as the desktop app: Scriptorium (dark) and
   Parchment (light), a single gold accent, serif display type. */

:root,
:root[data-theme="dark"] {
  --canvas: #100f0c;
  --surface: #171511;
  --raised: #1d1b16;
  --raised-alt: #23201a;
  --hover: #2b2821;
  --border: #2f2b23;
  --border-strong: #46402f;
  --text: #efe7d4;
  --muted: #a29b89;
  --faint: #8c8674;
  --accent: #d9b366;
  --accent-hover: #ebc880;
  --accent-soft: #332a18;
  --on-accent: #1a1509;
  --success: #7fbf8e;
  --highlight: #4c3d19;
  --map-land: #282419;
  --shadow: rgba(0, 0, 0, 0.45);
}

:root[data-theme="light"] {
  --canvas: #efe8d8;
  --surface: #f7f1e4;
  --raised: #fdfaf3;
  --raised-alt: #f4eee0;
  --hover: #eae2ce;
  --border: #dcd2ba;
  --border-strong: #c2b597;
  --text: #2c2720;
  --muted: #6b6353;
  --faint: #736c5b;
  --accent: #7a5d18;
  --accent-hover: #8e6d21;
  --accent-soft: #f0e4c6;
  --on-accent: #fff9ec;
  --success: #276e45;
  --highlight: #f2dfa4;
  --map-land: #f1e9d4;
  --shadow: rgba(90, 80, 55, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--canvas);
  color: var(--text);
  font: 16px/1.65 "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.serif { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ------------------------------------------------------------------ layout */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 0 8px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.brand svg { flex: 0 0 26px; margin-top: 3px; }

.brand .name {
  font-family: Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.brand .tag { color: var(--faint); font-size: 12px; line-height: 1.4; }

.nav-group {
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  padding: 12px 10px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
}

.nav-link svg { flex: 0 0 17px; opacity: 0.9; }

.nav-link:hover { background: var(--hover); color: var(--text); }

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.sidebar .foot {
  margin-top: 18px;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 12px;
}

.sidebar .foot a { display: block; padding: 2px 0; }

.main {
  flex: 1;
  min-width: 0;
  padding: 30px 34px 56px;
  max-width: 1180px;
}

/* Mobile top bar */
.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  align-items: center;
  gap: 12px;
}

.topbar .name { font-family: Georgia, serif; font-weight: 600; font-size: 17px; }
.topbar button {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 15px;
}

@media (max-width: 880px) {
  .shell { display: block; }
  .topbar { display: flex; }
  .sidebar {
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-105%);
    transition: transform 0.18s ease;
    box-shadow: 0 0 40px var(--shadow);
  }
  .sidebar.open { transform: none; }
  .main { padding: 18px 16px 48px; }
}

/* -------------------------------------------------------------- typography */

.page-title {
  font-family: Georgia, serif;
  font-size: 32px;
  font-weight: 600;
  margin: 0 0 6px;
}

.page-sub { color: var(--muted); margin: 0 0 22px; max-width: 70ch; }

.section-title {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  margin: 26px 0 10px;
}

/* ------------------------------------------------------------------- cards */

.card {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}

.card:hover { border-color: var(--border-strong); }

.card h3 {
  font-family: Georgia, serif;
  font-size: 18px;
  margin: 0 0 6px;
  font-weight: 600;
}

.card .meta { color: var(--faint); font-size: 13px; }
.card p { color: var(--muted); margin: 8px 0 0; font-size: 14.5px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

.hero {
  background: var(--raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 26px 28px;
  margin-bottom: 22px;
}

.hero h1 { font-family: Georgia, serif; font-size: 34px; margin: 0 0 8px; }
.hero p { color: var(--muted); max-width: 75ch; margin: 0 0 4px; }

.badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 9px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 6px;
}

.badge.neutral { background: var(--raised-alt); color: var(--muted); }

/* ---------------------------------------------------------------- controls */

button.btn, .btn {
  display: inline-block;
  background: var(--raised);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 16px;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
}

.btn:hover { background: var(--hover); border-color: var(--accent); color: var(--text); }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.btn.primary:hover { background: var(--accent-hover); }

.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }

input[type="search"], input[type="text"], select {
  background: var(--raised);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14.5px;
  outline: none;
  font-family: inherit;
}

input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--faint); }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-bottom: 16px;
}

.controls .grow { flex: 1; min-width: 160px; }

.pills { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }

.pill {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 15px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}

.pill:hover { color: var(--text); border-color: var(--accent); }
.pill.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); font-weight: 600; }

/* ---------------------------------------------------------------- readers */

.reader-layout { display: flex; gap: 18px; align-items: flex-start; }

.toc {
  flex: 0 0 280px;
  max-height: 76vh;
  overflow-y: auto;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  position: sticky;
  top: 18px;
}

.toc input { width: 100%; margin-bottom: 8px; }

.toc a {
  display: block;
  color: var(--muted);
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 13.5px;
  line-height: 1.4;
}

.toc a:hover { background: var(--hover); color: var(--text); }
.toc a.active { background: var(--accent-soft); color: var(--accent); }

.reading {
  flex: 1;
  min-width: 0;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 30px 38px;
}

.reading h2 { font-family: Georgia, serif; margin-top: 0; }

.prose {
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 17px;
  line-height: 1.8;
  max-width: 72ch;
}

.prose p { margin: 0 0 1em; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
}

@media (max-width: 880px) {
  .reader-layout { display: block; }
  .toc { position: static; max-height: 300px; margin-bottom: 14px; flex: none; }
  .reading { padding: 20px 18px; }
}

/* Bible verses */
.verse { margin: 0 0 0.35em; }
.verse .v {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  vertical-align: super;
  margin-right: 6px;
}

mark { background: var(--highlight); color: var(--text); border-radius: 3px; padding: 0 2px; }

.chapter-grid { display: flex; flex-wrap: wrap; gap: 6px; }

.chapter-grid a {
  min-width: 40px;
  text-align: center;
  padding: 7px 6px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

.chapter-grid a:hover { border-color: var(--accent); color: var(--text); }
.chapter-grid a.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }

/* ---------------------------------------------------------------- list/detail */

.split { display: flex; gap: 16px; align-items: flex-start; }

.split .list {
  flex: 0 0 320px;
  max-height: 72vh;
  overflow-y: auto;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
}

.split .list a {
  display: block;
  padding: 8px 11px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.split .list a:hover { background: var(--hover); color: var(--text); }
.split .list a.active { background: var(--accent-soft); color: var(--accent); }

.split .detail {
  flex: 1;
  min-width: 0;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
}

@media (max-width: 880px) {
  .split { display: block; }
  .split .list { max-height: 260px; margin-bottom: 14px; flex: none; }
}

/* ---------------------------------------------------------------- timeline */

.timeline { position: relative; margin: 10px 0 0 8px; padding-left: 26px; }

.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border-strong);
}

.tl-item { position: relative; margin-bottom: 18px; }

.tl-item::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--canvas);
}

.tl-item .year { color: var(--accent); font-weight: 700; font-size: 14px; }
.tl-item .what { font-weight: 600; }
.tl-item .desc { color: var(--muted); font-size: 14px; max-width: 70ch; }

/* --------------------------------------------------------------- flashcards */

.flashcard {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 44px 36px;
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}

.flashcard .front { font-family: Georgia, serif; font-size: 23px; font-weight: 600; }
.flashcard .hint { color: var(--faint); font-size: 13.5px; margin-top: 8px; }
.flashcard .back { color: var(--muted); font-size: 16.5px; margin-top: 18px; white-space: pre-line; }
.flashcard .actions { margin-top: 26px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* ------------------------------------------------------------------- misc */

.footer {
  margin-top: 44px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 13px;
}

.footer a { margin-right: 14px; }

.notice {
  background: var(--raised-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  padding: 12px 16px;
  font-size: 14px;
  margin: 14px 0;
}

.loading { color: var(--faint); padding: 30px 0; text-align: center; }

.kbd {
  background: var(--raised-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: Consolas, monospace;
  font-size: 12px;
  padding: 1px 6px;
  color: var(--muted);
}

::selection { background: var(--accent); color: var(--on-accent); }

/* Scrollbars (WebKit) */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--canvas); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
