/* ==========================================================================
   Nauka.Bible — Stylesheet
   Academic redesign: ink-navy + antique-gold on warm cream.
   ========================================================================== */

:root {
  /* Surfaces */
  --bg:            #FBF9F4;
  --surface:       #FFFFFF;
  --surface-alt:   #F5F1E8;
  --tint:          #F0EADB;

  /* Typography */
  --text-primary:   #1A1D29;
  --text-secondary: #5C6275;
  --text-muted:     #8A8F9E;

  /* Brand */
  --accent:       #0F2E5C;    /* deep ink */
  --accent-2:     #1A4A8C;    /* hover */
  --accent-soft:  #E6ECF5;    /* surface tint of accent */

  --gold:         #B8862F;    /* antique */
  --gold-2:       #D4A847;    /* hover / highlight */
  --gold-soft:    #F5EBCF;    /* surface tint */

  /* Borders / shadow */
  --border:       #E8E2D2;
  --border-strong:#D4CCB8;
  --shadow-sm:    0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-md:    0 4px 6px -2px rgba(15, 23, 42, .04), 0 10px 20px -6px rgba(15, 23, 42, .08);
  --shadow-lg:    0 10px 15px -3px rgba(15, 23, 42, .06), 0 20px 40px -12px rgba(15, 23, 42, .10);

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;

  /* Typography scales */
  --font-sans:  'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-serif: 'Merriweather', 'Source Serif Pro', Georgia, serif;
  --font-read:  'Literata', Georgia, 'Times New Roman', serif;

  --header-bg:  rgba(251, 249, 244, .85);
  --on-accent:  #FFFFFF;
  --mark-bg:    #F9DC6B;

  /* Reader (overridden by settings panel, see main.js) */
  --reader-size:  18px;
  --reader-font:  var(--font-read);
  --reader-width: 760px;

  color-scheme: light;
}

[data-font="sans"]   { --reader-font: var(--font-sans); }
[data-width="narrow"] { --reader-width: 640px; }
[data-width="wide"]   { --reader-width: 940px; }

[data-theme="sepia"] {
  --bg:            #F4ECD8;
  --surface:       #FBF4E2;
  --surface-alt:   #EFE4C9;
  --tint:          #E9DCBC;
  --text-primary:  #3B2F20;
  --text-secondary:#6B5B45;
  --text-muted:    #8E7D63;
  --border:        #E2D4B3;
  --border-strong: #CFBD95;
  --accent-soft:   #EADFC4;
  --header-bg:     rgba(244, 236, 216, .88);
}

[data-theme="dark"] {
  --bg:            #11141B;
  --surface:       #181C25;
  --surface-alt:   #20252F;
  --tint:          #262C38;
  --text-primary:  #E6E3DC;
  --text-secondary:#A9ADB8;
  --text-muted:    #7D8290;
  --accent:        #9DBDF2;
  --accent-2:      #B9D0F6;
  --accent-soft:   #1E2A40;
  --gold:          #D4A847;
  --gold-soft:     #3A3120;
  --border:        #2A303B;
  --border-strong: #3A414E;
  --header-bg:     rgba(17, 20, 27, .85);
  --on-accent:     #0E1626;
  --mark-bg:       #5A4A16;
  --shadow-sm:     0 1px 2px rgba(0,0,0,.3);
  --shadow-md:     0 6px 18px rgba(0,0,0,.35);
  --shadow-lg:     0 16px 40px rgba(0,0,0,.45);
  color-scheme: dark;
}
[data-theme="dark"] .article img { filter: brightness(.9); }

/* --------------------------------------------------------------------------
   Base Reset
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

img, svg { max-width: 100%; height: auto; }

/* Inline icon sizing */
.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke-width: 1.75;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Selection */
::selection { background: var(--gold-soft); color: var(--accent); }

/* --------------------------------------------------------------------------
   Container
   -------------------------------------------------------------------------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0F2E5C 0%, #1A4A8C 100%);
  color: var(--gold-2);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(255, 255, 255, .08);
  position: relative;
}
.mark::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 13px;
  border: 1px solid var(--gold-soft);
  opacity: .4;
  pointer-events: none;
}
.mark svg { width: 22px; height: 22px; stroke-width: 1.5; }

.logo {
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: -0.2px;
  font-size: 17px;
  color: var(--text-primary);
}

.logo small {
  display: block;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 1px;
}

nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

nav a {
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 9px 14px;
  border-radius: 10px;
  transition: background .15s ease, color .15s ease;
}

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

.pill {
  font-size: 12px;
  color: var(--accent);
  background: rgba(30,58,138,.08);
  border: 1px solid rgba(30,58,138,.12);
  padding: 6px 10px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
main { padding-bottom: 80px; }
section { padding: 84px 0; }

/* --------------------------------------------------------------------------
   Hero Section
   -------------------------------------------------------------------------- */
.hero {
  padding: 96px 0 80px;
  background:
    radial-gradient(60% 50% at 80% 0%, rgba(184, 134, 47, .10), transparent 60%),
    radial-gradient(60% 60% at 10% 100%, rgba(15, 46, 92, .08), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--surface-alt) 100%);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(15, 46, 92, .06) 1px, transparent 0);
  background-size: 28px 28px;
  opacity: .5;
  pointer-events: none;
}
.hero > .container { position: relative; z-index: 1; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 36px;
  align-items: center;
}

.hero h1 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 52px;
  line-height: 1.12;
  letter-spacing: -0.6px;
  color: var(--text-primary);
  margin-bottom: 20px;
  max-width: 780px;
}

.hero h1 .gold-accent {
  color: var(--gold);
  font-style: italic;
}

.hero p {
  font-size: 18px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 28px;
  max-width: 620px;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

.hero-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  max-width: 520px;
}

/* Listing hero (books, lectures) — compact variant */
.listing-hero {
  padding: 72px 0 56px;
}
.listing-hero h1 {
  font-size: 46px;
  margin-bottom: 14px;
}
.listing-hero p {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 620px;
  margin: 0;
}

.lectures-search {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  flex: 1;
  min-width: 240px;
  max-width: 420px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.lectures-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.lectures-search .icon { color: var(--text-muted); }
.lectures-search input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
}

.lectures-toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 20px;
}
.eyebrow::before {
  content: "";
  width: 32px;
  height: 1px;
  background: var(--gold);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .2px;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  will-change: transform;
}
.btn .icon { width: 18px; height: 18px; }

.btn-primary {
  background: linear-gradient(180deg, var(--accent-2) 0%, var(--accent) 100%);
  color: var(--on-accent);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.12);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.12);
}

.btn-secondary {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--border-strong);
}

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


/* --------------------------------------------------------------------------
   Author Section
   -------------------------------------------------------------------------- */
.author-section {
  padding: 96px 0;
  background: var(--bg);
  position: relative;
}
.author-block {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 56px;
  align-items: center;
  background: var(--surface);
  border-radius: 24px;
  padding: 48px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  position: relative;
}

.author-image {
  position: relative;
  background: linear-gradient(160deg, var(--accent-soft) 0%, var(--surface-alt) 100%);
  border-radius: 20px;
  padding: 16px 20px 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  aspect-ratio: 1;
  overflow: hidden;
}
.author-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 100%, rgba(15, 46, 92, .15), transparent 60%);
  pointer-events: none;
}
.author-image::after {
  content: "";
  position: absolute;
  top: 16px;
  left: 16px;
  width: 28px;
  height: 28px;
  border-top: 2px solid var(--gold);
  border-left: 2px solid var(--gold);
  border-radius: 4px 0 0 0;
  opacity: .6;
}

.author-image img {
  width: 100%;
  height: auto;
  display: block;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 20px 40px rgba(15, 46, 92, .25));
}

.author-content {
  display: flex;
  flex-direction: column;
}

.author-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--gold);
  padding: 0;
  margin-bottom: 18px;
  width: fit-content;
}
.author-badge::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--gold);
}

.author-content h2 {
  font-family: var(--font-serif);
  font-size: 40px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 10px 0;
  line-height: 1.15;
  letter-spacing: -0.4px;
}

.author-degree {
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  margin: 0 0 24px 0;
  padding-left: 16px;
  border-left: 2px solid var(--gold);
}

.author-description {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin: 0 0 32px 0;
  max-width: 580px;
}

.author-achievements {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.achievement {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.achievement strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.achievement span {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

@media (max-width: 980px) {
  .author-section { padding: 60px 0; }

  .author-block {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 32px;
    text-align: center;
  }

  .author-image { max-width: 240px; margin: 0 auto; }

  .author-content { align-items: center; }

  .author-badge { margin-left: auto; margin-right: auto; }
  .author-content h2 { font-size: 32px; }
  .author-degree { border-left: none; border-top: 2px solid var(--gold); padding: 8px 0 0; }

  .author-achievements { justify-content: center; }
}

@media (max-width: 768px) {
  .author-section {
    padding: 48px 0;
  }

  .author-block {
    padding: 24px;
    border-radius: 20px;
  }

  .author-image {
    max-width: 220px;
  }

  .author-content h2 {
    font-size: 26px;
  }

  .author-degree {
    font-size: 16px;
  }

  .author-description {
    font-size: 15px;
    margin-bottom: 24px;
  }

  .author-achievements {
    gap: 20px;
  }

  .achievement {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
  }
}

/* --------------------------------------------------------------------------
   Section Headings
   -------------------------------------------------------------------------- */
.section-head {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 56px;
}
.section-head .eyebrow { margin-bottom: 14px; }
.section-head .eyebrow::before,
.section-head .eyebrow::after {
  content: "";
  width: 32px;
  height: 1px;
  background: var(--gold);
}

h2 {
  font-family: var(--font-serif);
  font-size: 36px;
  line-height: 1.2;
  letter-spacing: -0.4px;
  margin-bottom: 14px;
  color: var(--text-primary);
}

.subtitle {
  color: var(--text-secondary);
  max-width: 760px;
  margin: 0 auto 40px;
  font-size: 16px;
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   Feature Cards (directions)
   -------------------------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--gold) 0%, transparent 100%);
  opacity: 0;
  transition: opacity .18s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.card:hover::before { opacity: 1; }

.card-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--accent-soft) 0%, var(--gold-soft) 100%);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.card-icon .icon { width: 26px; height: 26px; stroke-width: 1.5; }

.card h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.1px;
}
.card p {
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.6;
  margin: 0;
}

.card .more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding-top: 6px;
  transition: gap .15s ease;
}
.card .more:hover { gap: 10px; }
.card .more .icon { width: 14px; height: 14px; stroke-width: 2; }

/* --------------------------------------------------------------------------
   Article List
   -------------------------------------------------------------------------- */
.list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-width: 920px;
}

.list a {
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  transition: border-color 0.15s ease;
}

.list a:hover { border-color: rgba(30,58,138,.22); }

.meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.tag {
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(201,162,77,.28);
  background: rgba(201,162,77,.12);
  color: #6B4E16;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Article Page
   -------------------------------------------------------------------------- */
.article-wrap { padding: 34px 0 80px; }

.breadcrumb {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
}

.breadcrumb a { text-decoration: none; color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--text-primary); }

.article-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 22px;
  align-items: start;
}

/* Table of Contents */
.toc {
  position: sticky;
  top: 96px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 12px 26px rgba(0,0,0,.04);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.toc h4 {
  font-size: 12px;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.toc a {
  display: block;
  padding: 10px 10px;
  border-radius: 12px;
  text-decoration: none;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.1s ease;
}

.toc a:hover { background: var(--surface-alt); color: var(--text-primary); }
.toc a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; position: relative; }
.toc a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--gold);
  border-radius: 2px;
}

/* Article Content */
.article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  padding: 34px 34px;
  box-shadow: var(--shadow-sm);
  max-width: var(--reader-width);
  width: 100%;
  min-width: 0;
}

.article h1 {
  font-family: 'Merriweather', serif;
  font-size: 38px;
  letter-spacing: -0.35px;
  margin-bottom: 8px;
}

.article .kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 18px;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  letter-spacing: .2px;
  transition: border-color .15s ease, color .15s ease;
}
.chip:hover { border-color: var(--gold); color: var(--accent); }
.chip .icon { width: 13px; height: 13px; }
.chip-gold { background: var(--gold-soft); border-color: var(--gold); color: var(--accent); }

/* Article Typography */
.article h2 {
  font-size: 22px;
  margin-top: 26px;
  margin-bottom: 10px;
  font-family: 'Merriweather', serif;
}

.article h3 {
  font-size: 18px;
  margin-top: 20px;
  margin-bottom: 8px;
}

.article-content {
  font-family: var(--reader-font);
  font-size: var(--reader-size);
  line-height: 1.75;
  hyphens: auto;
  overflow-wrap: break-word;
}

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

.article ul, .article ol {
  margin: 12px 0;
  padding-left: 24px;
}

.article li {
  margin-bottom: 6px;
}

.article img {
  border-radius: 12px;
  margin: 16px 0;
  max-width: 100%;
  height: auto;
}

/* Images with text wrap - old site used tables for this */
.article table img {
  border-radius: 8px;
  margin: 4px;
}

.article table {
  border-collapse: collapse;
}

.article table td {
  vertical-align: top;
  padding: 8px;
}

/* Float images that are small */
.article img[width],
.article img[align] {
  max-width: 200px;
  margin: 8px 16px 8px 0;
}

.article img[align="left"] {
  float: left;
  margin: 8px 16px 8px 0;
}

.article img[align="right"] {
  float: right;
  margin: 8px 0 8px 16px;
}

.article a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(30,58,138,.3);
  text-underline-offset: 2px;
}

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

/* Quote Block */
.quote {
  position: relative;
  padding: 20px 24px;
  margin: 24px 0;
  background: linear-gradient(135deg, rgba(30,58,138,.04) 0%, rgba(59,130,246,.06) 100%);
  border-radius: 16px;
  color: #26324A;
  font-size: 15px;
  line-height: 1.7;
  font-style: italic;
  overflow: hidden;
  border: 1px solid rgba(30,58,138,.08);
}


.quote img {
  float: left;
  margin: 0 20px 12px 0;
  max-width: 120px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.quote::after {
  content: "";
  display: table;
  clear: both;
}

/* Note Block */
.note {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(201,162,77,.25);
  background: rgba(201,162,77,.10);
  color: #5D4718;
  font-size: 14px;
}

/* Chapter Navigation */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.chapter-nav a {
  text-decoration: none;
}

.chapter-nav .btn-primary {
  background: var(--accent);
  color: var(--on-accent) !important;
}

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

/* --------------------------------------------------------------------------
   Book Index Page
   -------------------------------------------------------------------------- */
.book-header {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  margin-bottom: 32px;
  align-items: start;
}

.book-cover {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,.15);
}

/* Book cover placeholder on book index page */
.book-cover.book-cover-placeholder {
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-cover.book-cover-placeholder .placeholder-icon {
  width: 80px;
  height: auto;
  opacity: 0.85;
  filter: brightness(0) invert(1);
}

.book-meta h1 {
  font-family: 'Merriweather', serif;
  font-size: 36px;
  margin-bottom: 8px;
}

.book-meta .author {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.book-meta .subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-style: italic;
}

.book-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.book-tags .tag {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(30,58,138,.08);
  color: var(--accent);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.book-description {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Book Card Tags */
.book-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.mini-tag {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(30,58,138,.06);
  color: var(--accent);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

/* Chapters List */
.chapters-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.chapters-list h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.part-title {
  font-weight: 600;
  font-size: 15px;
  padding: 12px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-top: 16px;
  color: var(--text-primary);
}

.part-title:first-child {
  margin-top: 0;
}

.chapter-link {
  display: block;
  padding: 12px 14px;
  margin: 4px 0;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  transition: all 0.1s ease;
}

.chapter-link:hover {
  background: var(--surface-alt);
  color: var(--text-primary);
}

.chapter-link .num {
  color: var(--accent);
  font-weight: 500;
  margin-right: 8px;
}

/* --------------------------------------------------------------------------
   Books Catalog
   -------------------------------------------------------------------------- */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 50px rgba(0,0,0,.1);
}

.book-card-cover {
  height: 180px;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-alt);
}

/* Book placeholder with icon */
.book-card-cover.book-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-card-cover.book-placeholder .placeholder-icon {
  width: 64px;
  height: auto;
  opacity: 0.85;
  filter: brightness(0) invert(1);
}

.book-card-body {
  padding: 18px;
}

.book-card-body h3 {
  font-size: 16px;
  margin-bottom: 6px;
  font-family: 'Merriweather', serif;
}

.book-card-body .author {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.book-card-body .chapters-count {
  font-size: 12px;
  color: var(--accent);
}

.book-card-body .book-card-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 8px 0;
}

/* --------------------------------------------------------------------------
   Books Compact Grid (Home Page)
   -------------------------------------------------------------------------- */
.books-compact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.book-compact-card {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 18px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  position: relative;
  overflow: hidden;
}
.book-compact-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 3px;
  height: 0;
  background: var(--gold);
  transition: height .25s ease;
}
.book-compact-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.book-compact-card:hover::after { height: 100%; }

.book-compact-cover {
  width: 110px;
  height: 154px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-alt);
  flex-shrink: 0;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, .04),
    0 6px 18px rgba(15, 23, 42, .10),
    inset 0 0 0 1px rgba(0, 0, 0, .04);
}

.book-compact-cover.book-compact-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-compact-cover.book-compact-placeholder .placeholder-icon {
  width: 40px;
  height: auto;
  opacity: .85;
  filter: brightness(0) invert(1);
}

.book-compact-info {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
}

.book-compact-info h4 {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
  line-height: 1.28;
  letter-spacing: -0.1px;
}

.book-compact-info .author {
  font-size: 12px;
  color: var(--gold);
  font-weight: 500;
  letter-spacing: .3px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.book-compact-info .description {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-compact-info .chapters {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.book-compact-info .chapters::before {
  content: "";
  width: 14px;
  height: 1px;
  background: var(--gold);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
footer {
  background: linear-gradient(180deg, var(--surface-alt) 0%, var(--bg) 100%);
  border-top: 1px solid var(--border);
  padding: 56px 0 36px;
  font-size: 14px;
  color: var(--text-secondary);
  position: relative;
}
footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.footer-copyright {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.footer-copyright p {
  margin: 0 0 16px 0;
  line-height: 1.7;
  font-size: 13px;
}

.footer-copyright p:last-of-type {
  margin-bottom: 24px;
}

.footer-copyright a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-copyright a:hover {
  color: var(--accent-2);
  text-decoration: underline;
}


.footer-created-by {
  font-size: 12px;
  color: var(--text-secondary);
  opacity: 0.8;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.footer-created-by a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-created-by a:hover {
  color: var(--accent);
}

footer .columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
}

footer h4 { margin-bottom: 12px; color: var(--text-primary); }

footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

footer a:hover {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .search { display: none; }

  /* Put the article first on mobile, TOC collapses to scroll-pane below */
  .article-layout {
    display: flex;
    flex-direction: column;
  }
  .article { order: 1; padding: 22px; }
  .toc {
    order: 2;
    position: static;
    max-height: 320px;
    overflow-y: auto;
    margin: 24px 0 0;
  }

  .hero h1 { font-size: 38px; }
  .brand { min-width: unset; }
  .book-header { grid-template-columns: 1fr; text-align: center; }
  .book-cover { max-width: 200px; margin: 0 auto; }
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* Container */
  .container { padding: 0 16px; }

  /* Books compact grid */
  .books-compact-grid { grid-template-columns: 1fr; gap: 16px; }
  .book-compact-card { grid-template-columns: 80px 1fr; gap: 12px; padding: 14px; }
  .book-compact-cover { width: 80px; height: 110px; }
  .book-compact-info h4 { font-size: 14px; }
  .book-compact-info .description { -webkit-line-clamp: 2; }

  /* Navigation */
  .nav { height: 64px; gap: 8px; flex-wrap: nowrap; }
  .brand { gap: 10px; min-width: 0; flex-shrink: 1; }
  .mark { width: 34px; height: 34px; }
  .mark svg { width: 18px; height: 18px; }
  .logo { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .logo small { display: none; }
  nav { gap: 2px; flex-shrink: 0; flex-wrap: nowrap; }
  nav a { padding: 7px 10px; font-size: 13px; }

  /* Hero */
  .listing-hero { padding: 48px 0 36px; }
  .listing-hero h1 { font-size: 34px; }

  /* Hero */
  .hero { padding: 48px 0; }
  .hero h1 { font-size: 32px; line-height: 1.2; }
  .hero p { font-size: 15px; }

  /* Sections */
  section { padding: 40px 0; }
  section h2 { font-size: 24px; }
  .subtitle { font-size: 14px; }

  /* Cards grid */
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .card { padding: 20px; }
  .card h3 { font-size: 17px; }

  /* Books list */
  .list a { padding: 14px 0; }
  .list strong { font-size: 15px; }
  .list .meta { font-size: 12px; }
  .list .tag { font-size: 11px; padding: 4px 10px; }

  /* Books grid */
  .books-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .book-card-cover { height: 140px; }
  .book-card-body { padding: 14px; }
  .book-card-body h3 { font-size: 14px; }

  /* Article */
  .article { padding: 18px; border-radius: 16px; }
  .article h1 { font-size: 26px; margin-bottom: 16px; }
  .article h2 { font-size: 22px; }
  .article h3 { font-size: 18px; }

  /* Quote */
  .quote { padding: 16px 18px; margin: 20px 0; font-size: 14px; }
  .quote img { max-width: 100px; margin: 0 16px 10px 0; }

  /* Chapter navigation */
  .chapter-nav {
    flex-direction: column;
    gap: 12px;
    padding-top: 20px;
  }
  .chapter-nav .btn { width: 100%; justify-content: center; }

  /* Book header */
  .book-header { gap: 20px; }
  .book-meta h1 { font-size: 24px; }
  .book-meta .author { font-size: 14px; }

  /* Chapters list */
  .chapters-list { padding: 20px; }
  .chapters-list h3 { font-size: 18px; }
  .chapter-link { padding: 12px 14px; font-size: 14px; }
  .part-title { font-size: 13px; padding: 10px 14px; }

  /* TOC */
  .toc { padding: 16px; }
  .toc h4 { font-size: 13px; }
  .toc a { font-size: 13px; padding: 8px 12px; }

  /* Breadcrumb */
  .breadcrumb { font-size: 13px; margin-bottom: 20px; flex-wrap: wrap; }

  /* Buttons */
  .btn { padding: 12px 20px; font-size: 14px; }
  .actions { flex-direction: column; gap: 10px; }
  .actions .btn { width: 100%; text-align: center; }

  /* Footer */
  footer { padding: 32px 0; }
  footer .columns { gap: 20px; }
}

/* --------------------------------------------------------------------------
   Lectures & Videos Page
   -------------------------------------------------------------------------- */
.lectures-section {
  padding: 48px 0 80px;
}

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

.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.video-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.video-card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-alt);
}

.video-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-card-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.video-card:hover .video-card-play {
  opacity: 1;
}

.video-card-title {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 36px;
}

.no-results {
  text-align: center;
  color: var(--text-secondary);
  font-size: 16px;
  padding: 48px 0;
}

/* Video Modal */
.video-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.video-modal.open {
  display: flex;
}

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
}

.video-modal-content {
  position: relative;
  width: 90%;
  max-width: 900px;
  z-index: 1;
}

.video-modal-close {
  position: absolute;
  top: -44px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.video-modal-close:hover {
  opacity: 1;
}

.video-modal-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}

.video-modal-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.video-modal-title {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  margin-top: 16px;
  text-align: center;
  opacity: 0.9;
}

@media (max-width: 768px) {
  .lectures-toolbar { flex-direction: column; align-items: stretch; }
  .lectures-search { max-width: none; }
  .videos-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
  .video-modal-content { width: 95%; }
  .video-modal-close { top: -40px; font-size: 28px; }
}

@media (max-width: 480px) {
  /* Extra small screens */
  .container { padding: 0 12px; }

  .nav { height: 60px; gap: 6px; }
  .brand { gap: 8px; }
  .mark { width: 30px; height: 30px; }
  .mark svg { width: 16px; height: 16px; }
  .logo { font-size: 13px; }
  nav { gap: 0; }
  nav a { padding: 6px 8px; font-size: 12px; }

  .hero h1 { font-size: 28px; }
  .hero p { font-size: 14.5px; }
  .listing-hero h1 { font-size: 28px; }

  section h2 { font-size: 22px; }

  .books-grid { grid-template-columns: 1fr; }
  .book-card-cover { height: 160px; }

  .article { padding: 14px; }
  .article h1 { font-size: 22px; }
  .article h2 { font-size: 20px; }

  .quote { padding: 14px; }
  .quote img {
    float: none;
    display: block;
    max-width: 100%;
    margin: 0 0 12px 0;
  }

  .book-meta h1 { font-size: 20px; }

  .chapter-link { padding: 10px 12px; }

  /* Images in article */
  .article img[align="left"],
  .article img[align="right"] {
    float: none;
    display: block;
    max-width: 100%;
    margin: 12px auto;
  }

  .article table {
    display: block;
    overflow-x: auto;
  }
}

/* --------------------------------------------------------------------------
   Performance hints — skip rendering off-screen cards & article imagery
   so slow networks don't decode everything up front.
   -------------------------------------------------------------------------- */
.book-card,
.book-compact-card,
.video-card,
.card {
  content-visibility: auto;
  contain-intrinsic-size: 420px 320px;
}

/* --------------------------------------------------------------------------
   Reader, progress, search — see assets/js/main.js
   -------------------------------------------------------------------------- */
html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 96px; }
body { transition: background-color .2s ease, color .2s ease; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 16px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); text-decoration: none;
}
.skip-link:focus { top: 12px; }

header { transition: transform .25s ease, background-color .2s ease; }
header.is-hidden { transform: translateY(-100%); }

.nav-tools { display: inline-flex; gap: 4px; margin-left: 4px; }
.nav-icon {
  display: inline-grid; place-items: center;
  min-width: 38px; height: 38px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text-secondary);
  font: 600 14px/1 var(--font-serif); cursor: pointer; text-decoration: none;
}
nav a.nav-icon { padding: 0 8px; }
.nav-icon:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.read-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 20;
  background: var(--gold); transform-origin: 0 50%; transform: scaleX(0);
  pointer-events: none;
}

/* Settings panel & generic dialogs */
.nb-dialog {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text-primary);
  box-shadow: var(--shadow-lg); padding: 0; margin: auto;
  width: min(420px, calc(100vw - 32px));
}
.nb-dialog::backdrop { background: rgba(10, 12, 18, .5); backdrop-filter: blur(2px); }
.nb-dialog > form { padding: 20px; display: grid; gap: 18px; }
.nb-dialog h2 { font-size: 18px; margin: 0; display: flex; justify-content: space-between; align-items: center; }
.nb-row { display: grid; gap: 8px; }
.nb-row > span { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); }
.nb-seg { display: flex; gap: 6px; }
.nb-seg button {
  flex: 1; padding: 10px 6px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-primary);
  font: 500 14px/1.2 var(--font-sans);
}
.nb-seg[data-k="size"] button { display: grid; justify-items: center; align-content: end; gap: 4px; min-height: 64px; }
.nb-seg[data-k="size"] b { font-family: var(--font-read); line-height: 1; }
.nb-seg[data-k="size"] small { font-size: 11px; color: var(--text-secondary); }
.nb-seg button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nb-seg [data-v="light"] { background: #FBF9F4; color: #1A1D29; }
.nb-seg [data-v="sepia"] { background: #F4ECD8; color: #3B2F20; }
.nb-seg [data-v="dark"]  { background: #181C25; color: #E6E3DC; }
.nb-seg button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--gold); }
.nb-close { border: 0; background: none; color: var(--text-muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.nb-link { border: 0; background: none; color: var(--text-muted); font: 13px var(--font-sans); text-decoration: underline; cursor: pointer; justify-self: start; }

/* Resume toast */
.nb-toast {
  position: fixed; left: 50%; bottom: 20px; z-index: 30;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 32px));
  display: flex; gap: 10px; align-items: center;
  padding: 12px 12px 12px 18px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  font-size: 14px; animation: nb-up .25s ease;
}
.nb-toast span { flex: 1; }
.nb-toast .btn { padding: 8px 14px; font-size: 14px; }
@keyframes nb-up { from { opacity: 0; transform: translate(-50%, 12px); } }

/* Continue reading */
.continue-section { padding: 36px 0 0; }
.continue-section h2 { font-size: 22px; margin-bottom: 14px; text-align: left; }
.continue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.continue-card {
  display: grid; gap: 6px; padding: 16px 18px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: border-color .15s ease, transform .15s ease;
}
.continue-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.continue-card small { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.continue-card strong { font-family: var(--font-serif); font-size: 15px; line-height: 1.35; color: var(--text-primary); }
.continue-card .bar { height: 4px; border-radius: 4px; background: var(--surface-alt); overflow: hidden; }
.continue-card .bar i { display: block; height: 100%; background: var(--gold); }

.toc a.is-read::after, .chapter-link.is-read::after { content: " ✓"; color: var(--gold); font-weight: 600; }
.chapter-link.is-current { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Image lightbox */
.article-content img { cursor: zoom-in; }
.nb-lightbox { width: auto; max-width: 96vw; max-height: 96vh; padding: 0; background: transparent; border: 0; }
.nb-lightbox img { display: block; max-width: 96vw; max-height: 92vh; border-radius: 8px; cursor: zoom-out; }

/* Search (Pagefind UI) */
.nb-search-dialog { width: min(760px, calc(100vw - 24px)); max-height: 86vh; overflow: auto; margin-top: 6vh; }
.nb-lightbox { margin: auto; }
.nb-search-dialog .nb-search-body { padding: 8px 20px 24px; }
.nb-search-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 12px 0 20px; font: 600 16px var(--font-serif); }
.search-page { padding: 40px 0 80px; }
.search-page h1 { font-family: var(--font-serif); font-size: 32px; margin-bottom: 18px; }
body .pagefind-ui {
  --pagefind-ui-primary: var(--accent);
  --pagefind-ui-text: var(--text-primary);
  --pagefind-ui-background: var(--surface);
  --pagefind-ui-border: var(--border-strong);
  --pagefind-ui-tag: var(--surface-alt);
  --pagefind-ui-border-radius: 12px;
  --pagefind-ui-font: var(--font-sans);
}
.pagefind-ui mark, .pagefind-highlight { background: var(--mark-bg); color: inherit; border-radius: 3px; padding: 0 2px; }
.pagefind-ui__result-link { color: var(--accent) !important; }

@media (max-width: 768px) {
  .nav-tools { margin-left: 0; }
  .nav-icon { min-width: 34px; height: 34px; }
  .article { padding: 20px 16px; border-radius: var(--radius); }
}

@media (max-width: 480px) {
  .article { padding: 16px 12px; }
  /* Logo already links home — drop "Главная" so search & settings fit */
  nav > a:first-of-type { display: none; }
}

@media print {
  header, footer, .toc, .chapter-nav, .breadcrumb, .read-progress, .nb-toast, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  .article { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .article-layout { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
