:root {
  --bg: #f8f6f3;
  --surface: #ffffff;
  --surface-alt: #f1ece6;
  --line: #d8ccc0;
  --text: #1f1716;
  --muted: #5f504d;
  --accent: #5d1a22;
  --accent-strong: #431218;
  --accent-soft: #efe2e4;
  --gold: #8f6a1f;
  --shadow: 0 12px 30px rgba(30, 15, 15, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --max: 1180px;
  --focus: 0 0 0 4px rgba(93, 26, 34, 0.16);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 8rem;
}

[id] {
  scroll-margin-top: 8rem;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  background: linear-gradient(180deg, #faf8f5 0%, #f7f1eb 100%);
  color: var(--text);
  line-height: 1.65;
}

body.menu-open {
  overflow: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.16em;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 8px;
}

.container {
  width: min(var(--max), calc(100% - 2rem));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 1rem;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 1000;
}

.skip-link:focus {
  left: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(248, 246, 243, 0.96);
  border-bottom: 1px solid rgba(216, 204, 192, 0.9);
}

.header-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "brand search";
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 0;
}

.brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
  color: inherit;
}

.brand:hover {
  color: inherit;
}

.brand-mark {
  width: 3.2rem;
  flex: 0 0 3.2rem;
  display: block;
  line-height: 0;
}

.brand-mark picture,
.brand-mark img {
  display: block;
  width: 100%;
  height: auto;
}

.brand-mark img {
  filter: drop-shadow(0 0.35rem 0.8rem rgba(35, 23, 24, 0.16));
}

.brand-copy {
  display: grid;
  gap: 0.2rem;
}

.brand-copy strong {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.brand-copy span:last-child {
  color: var(--muted);
  font-size: 0.9rem;
}

.primary-nav ul,
.branch-nav ul,
.breadcrumbs ol,
.site-footer ul,
.sidebar-links ul,
.toc-card ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.header-nav-shell {
  border-top: 1px solid rgba(216, 204, 192, 0.8);
  background: rgba(255, 255, 255, 0.78);
}

.primary-nav {
  padding: 0.75rem 0 0.85rem;
}

.primary-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-start;
}

.primary-nav li,
.branch-nav li {
  display: flex;
}

.primary-nav a,
.branch-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.primary-nav a:hover,
.branch-nav a:hover,
.primary-nav a.is-active,
.branch-nav a.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(215, 176, 182, 0.9);
}

.site-search-form {
  grid-area: search;
  justify-self: end;
  display: grid;
  grid-template-columns: minmax(14rem, 19rem) auto;
  gap: 0.6rem;
  align-items: center;
}

.site-search-panel {
  display: grid;
  grid-template-columns: minmax(14rem, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
}

.site-search-form input,
.site-search-panel input {
  width: 100%;
  min-width: 0;
  padding: 0.72rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
}

.site-search-panel input {
  width: min(32rem, 100%);
}

.menu-toggle {
  display: none;
  grid-area: menu;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  font: 600 0.95rem Arial, Helvetica, sans-serif;
  color: var(--accent);
}

.branch-strip {
  border-top: 1px solid rgba(216, 204, 192, 0.8);
  background: rgba(255, 255, 255, 0.75);
}

.branch-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 0 0.85rem;
}

.branch-nav-label {
  font: 700 0.82rem Arial, Helvetica, sans-serif;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
}

.branch-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.breadcrumbs {
  border-bottom: 1px solid rgba(216, 204, 192, 0.72);
  background: rgba(255, 255, 255, 0.72);
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 0;
  color: var(--muted);
  font: 0.9rem Arial, Helvetica, sans-serif;
}

.breadcrumbs li + li::before {
  content: "›";
  margin-right: 0.45rem;
  color: #9f8f88;
}

.breadcrumbs a {
  text-decoration: none;
  color: var(--muted);
}

.page-main {
  padding: 1.25rem 0 4rem;
}

.hero {
  margin: 1rem 0 1.6rem;
  padding: 2.1rem;
  background:
    radial-gradient(circle at top right, rgba(143, 106, 31, 0.08), transparent 35%),
    linear-gradient(145deg, #fff 0%, #f7f0eb 100%);
  border: 1px solid rgba(216, 204, 192, 0.8);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0 0 0.7rem;
  line-height: 1.15;
  font-size: clamp(2rem, 3vw, 3rem);
}

.hero-intro {
  margin: 0;
  max-width: 70ch;
  font-size: 1.08rem;
  color: #3f3533;
}

.hero-eyebrow {
  margin: 0 0 0.55rem;
  font: 700 0.84rem Arial, Helvetica, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-top: 1rem;
  color: var(--muted);
  font: 0.92rem Arial, Helvetica, sans-serif;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 1.5rem;
  align-items: start;
}

.content-layout-single {
  grid-template-columns: minmax(0, 1fr);
}

.article-shell,
.sidebar-card,
.source-panel {
  background: var(--surface);
  border: 1px solid rgba(216, 204, 192, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.article-shell {
  padding: 1.4rem;
}

.page-sidebar {
  display: grid;
  gap: 1rem;
  position: sticky;
  top: 7.5rem;
}

.sidebar-card,
.source-panel {
  padding: 1.15rem;
}

.sidebar-card h2,
.source-panel h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
}

.sidebar-links li + li,
.toc-card li + li {
  margin-top: 0.5rem;
}

.toc-card a,
.sidebar-links a {
  text-decoration: none;
}

.content-section {
  padding: 1.05rem 0 0.3rem;
  scroll-margin-top: 9rem;
}

.content-section:first-child {
  padding-top: 0;
}

.content-section h2,
.content-section h3 {
  line-height: 1.25;
}

.content-section h2 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.4rem, 2vw, 1.85rem);
}

.content-section h3 {
  margin: 1rem 0 0.55rem;
  font-size: 1.16rem;
}

.content-section p,
.content-section li {
  max-width: 72ch;
}

.callout {
  margin: 1.1rem 0;
  padding: 1rem 1rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.callout h3 {
  margin-top: 0;
}

.callout-note {
  background: #fcfaf6;
}

.callout-accent {
  background: #f8eef0;
  border-color: #d7b0b6;
}

.callout-warning {
  background: #fff6eb;
  border-color: #efd0a6;
}

.callout-warm {
  background: #fff6eb;
  border-color: #efd0a6;
}

.cards {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.cards.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cards.two-up,
.cards.resource-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cards.compact {
  gap: 0.85rem;
}

.card,
.resource-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fff 0%, #fbf7f3 100%);
  overflow: clip;
}

.card {
  padding: 1rem;
}

.card h3,
.resource-card h3 {
  margin: 0 0 0.4rem;
  line-height: 1.3;
}

.card-kicker,
.resource-meta {
  margin: 0 0 0.4rem;
  font: 700 0.8rem Arial, Helvetica, sans-serif;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--gold);
}

.card-thumb {
  border-radius: 10px;
  margin: 0.75rem 0;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.65rem 0.95rem;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
  font: 600 0.95rem Arial, Helvetica, sans-serif;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-strong);
  color: #fff;
}

.btn-secondary {
  background: var(--gold);
  color: #fff;
}

.btn-secondary:hover {
  background: #7a5a16;
  color: #fff;
}

.btn-subtle {
  background: #fff;
  border-color: var(--line);
  color: var(--accent);
}

.btn-subtle:hover {
  background: #faf2f3;
  color: var(--accent-strong);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--accent);
}

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

.resource-card {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 0;
}

.resource-image {
  display: block;
  background: #f2ece6;
  height: 100%;
}

.resource-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.resource-body {
  padding: 1rem;
}

.table-scroll {
  overflow-x: auto;
  margin: 1rem 0 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.comparison-table caption {
  text-align: left;
  padding: 1rem 1rem 0;
  font-weight: 700;
}

.comparison-table th,
.comparison-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #eadfd6;
  vertical-align: top;
}

.comparison-table thead th {
  background: #f8f2ed;
  text-align: left;
}

.list-check {
  padding-left: 1.2rem;
}

.list-check li + li {
  margin-top: 0.45rem;
}

.faq-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 0.2rem 0.9rem;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 700;
  padding: 0.85rem 0;
}

.faq-answer {
  padding-bottom: 0.9rem;
}

.search-panel .search-state {
  margin-top: 0.85rem;
  color: var(--muted);
}


.section-nav-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.section-nav-card li + li {
  margin-top: 0.45rem;
}

.section-nav-card a,
.section-nav-parent a {
  text-decoration: none;
}

.section-nav-parent {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font: 0.92rem Arial, Helvetica, sans-serif;
}

.section-nav-card a.is-active {
  color: var(--accent);
  font-weight: 700;
}

.filter-chip-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.filter-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  font: 600 0.9rem Arial, Helvetica, sans-serif;
  cursor: pointer;
}

.filter-chip:hover,
.filter-chip.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #d7b0b6;
}

.media-frame {
  margin: 1rem 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: clip;
  background: #fff;
}

.media-frame img {
  width: 100%;
  height: auto;
}

.media-frame figcaption {
  padding: 0.8rem 0.95rem;
  color: var(--muted);
  font: 0.92rem Arial, Helvetica, sans-serif;
}

.inline-link-list {
  padding-left: 1.1rem;
}

.inline-link-list li + li {
  margin-top: 0.45rem;
}

.search-results {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.search-result {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 1rem;
}

.search-result h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.search-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.7rem;
  color: var(--muted);
  font: 0.9rem Arial, Helvetica, sans-serif;
}

.search-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 0.74rem Arial, Helvetica, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.search-snippet {
  margin: 0.6rem 0 0;
}

.search-empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem;
  background: #fff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.site-footer {
  margin-top: 4rem;
  border-top: 1px solid rgba(216, 204, 192, 0.9);
  background: #f7f1eb;
  padding: 2rem 0 2.4rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr));
  gap: 1.3rem;
}

.site-footer h2 {
  margin-top: 0;
  font-size: 1rem;
  font-family: Arial, Helvetica, sans-serif;
}

.site-footer p,
.site-footer li {
  color: var(--muted);
}

.site-footer li + li {
  margin-top: 0.42rem;
}

.site-footer a {
  text-decoration: none;
}


.footer-legal {
  margin-top: 1.45rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(216, 204, 192, 0.95);
  text-align: center;
}

.footer-legal p {
  margin: 0.2rem 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-family: Arial, Helvetica, sans-serif;
}

@media (max-width: 1040px) {
  .header-top {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand menu"
      "search search";
  }

  .menu-toggle {
    display: inline-flex;
    justify-self: end;
  }

  .site-search-form {
    justify-self: stretch;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .primary-nav {
    display: none;
    padding: 0 0 0.85rem;
  }

  .primary-nav.is-open {
    display: block;
  }

  .primary-nav ul {
    flex-direction: column;
    gap: 0.45rem;
    padding-top: 0.45rem;
  }

  .primary-nav a {
    width: 100%;
    justify-content: flex-start;
    background: #fff;
    border-color: rgba(216, 204, 192, 0.95);
  }

  .content-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .container {
    width: min(var(--max), calc(100% - 1rem));
  }

  .hero,
  .article-shell,
  .sidebar-card,
  .source-panel {
    padding: 1rem;
  }

  .cards.three-up,
  .cards.two-up,
  .cards.resource-grid,
  .page-sidebar,
  .footer-grid,
  .resource-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .header-top {
    gap: 0.8rem;
  }

  .site-search-form,
  .site-search-panel {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .branch-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .site-search-form input,
  .site-search-panel input {
    width: 100%;
  }

  .branch-nav-label {
    margin-bottom: -0.1rem;
  }
}


/* Phase 9 authority expansion */
.verse-book-groups {
  display: grid;
  gap: 1rem;
}

.verse-book-group {
  border: 1px solid rgba(93, 26, 34, 0.12);
  border-radius: 0.9rem;
  background: #fff;
  overflow: hidden;
}

.verse-book-group summary {
  cursor: pointer;
  list-style: none;
  padding: 0.9rem 1rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  background: rgba(93, 26, 34, 0.05);
}

.verse-book-group summary::-webkit-details-marker {
  display: none;
}

.verse-entry-list {
  margin: 0;
  padding: 1rem 1rem 1rem 2rem;
  display: grid;
  gap: 1rem;
}

.verse-entry {
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(93, 26, 34, 0.08);
}

.verse-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.verse-entry-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
}

.verse-entry-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.verse-entry-label {
  font-size: 0.85rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(93, 26, 34, 0.08);
  color: var(--accent-dark);
}

.verse-quote {
  margin: 0.75rem 0 0;
  padding: 0.85rem 1rem;
  border-left: 4px solid var(--accent);
  background: #faf7f2;
}

.verse-quote p {
  margin: 0;
}

.verse-entry-meta {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.small-note {
  font-size: 0.95rem;
  color: var(--muted);
}


.key-answer-list {
  margin: 0;
  padding-left: 1.15rem;
}

.key-answer-list li + li {
  margin-top: 0.55rem;
}


@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}


/* Phase 18 light/dark mode */

.header-top {
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: "brand theme search";
}

.theme-toggle {
  grid-area: theme;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
  font: 600 0.95rem Arial, Helvetica, sans-serif;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
}

.theme-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: rgba(215, 176, 182, 0.9);
  transform: translateY(-1px);
}

.theme-toggle svg {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle-icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle-icon-sun {
  display: inline-flex;
}

.theme-toggle-label {
  white-space: nowrap;
}

:root[data-theme="dark"] {
  --bg: #141010;
  --surface: #1f1818;
  --surface-alt: #171212;
  --line: #4c3f3d;
  --text: #f6eee6;
  --muted: #ccbcb4;
  --accent: #d29ca5;
  --accent-strong: #f0c2ca;
  --accent-soft: #3a2528;
  --gold: #e1c274;
  --shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
  --focus: 0 0 0 4px rgba(210, 156, 165, 0.28);
}

:root[data-theme="dark"] body {
  background: linear-gradient(180deg, #141010 0%, #181212 100%);
  color: var(--text);
}

:root[data-theme="dark"] .site-header,
:root[data-theme="dark"] .header-nav-shell,
:root[data-theme="dark"] .branch-strip,
:root[data-theme="dark"] .breadcrumbs {
  background: rgba(23, 18, 18, 0.94);
  border-color: rgba(76, 63, 61, 0.9);
}

:root[data-theme="dark"] .site-header {
  border-bottom-color: rgba(76, 63, 61, 0.95);
}

:root[data-theme="dark"] .brand-mark img {
  filter: drop-shadow(0 0.45rem 0.95rem rgba(0, 0, 0, 0.42));
}

:root[data-theme="dark"] .brand-copy span:last-child,
:root[data-theme="dark"] .hero-intro,
:root[data-theme="dark"] .hero-meta,
:root[data-theme="dark"] .breadcrumbs ol,
:root[data-theme="dark"] .breadcrumbs a,
:root[data-theme="dark"] .search-panel .search-state,
:root[data-theme="dark"] .section-nav-parent,
:root[data-theme="dark"] .media-frame figcaption,
:root[data-theme="dark"] .small-note,
:root[data-theme="dark"] .site-footer p,
:root[data-theme="dark"] .site-footer li,
:root[data-theme="dark"] .footer-legal p,
:root[data-theme="dark"] .search-result-meta {
  color: var(--muted);
}

:root[data-theme="dark"] a {
  color: var(--accent);
}

:root[data-theme="dark"] a:hover {
  color: var(--accent-strong);
}

:root[data-theme="dark"] .hero {
  background:
    radial-gradient(circle at top right, rgba(225, 194, 116, 0.12), transparent 35%),
    linear-gradient(145deg, #231b1b 0%, #191313 100%);
  border-color: rgba(76, 63, 61, 0.9);
}

:root[data-theme="dark"] .article-shell,
:root[data-theme="dark"] .sidebar-card,
:root[data-theme="dark"] .source-panel,
:root[data-theme="dark"] .faq-item,
:root[data-theme="dark"] .search-result,
:root[data-theme="dark"] .search-empty-state,
:root[data-theme="dark"] .media-frame,
:root[data-theme="dark"] .table-scroll,
:root[data-theme="dark"] .verse-book-group,
:root[data-theme="dark"] .site-search-form input,
:root[data-theme="dark"] .site-search-panel input,
:root[data-theme="dark"] .menu-toggle,
:root[data-theme="dark"] .theme-toggle,
:root[data-theme="dark"] .filter-chip,
:root[data-theme="dark"] .btn-subtle,
:root[data-theme="dark"] .btn-ghost:hover,
:root[data-theme="dark"] .resource-image,
:root[data-theme="dark"] .resource-card,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .search-empty-state,
:root[data-theme="dark"] .search-result,
:root[data-theme="dark"] .verse-book-group {
  background: var(--surface);
  border-color: var(--line);
}

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .resource-card {
  background: linear-gradient(180deg, #251d1d 0%, #191313 100%);
}

:root[data-theme="dark"] .callout-note {
  background: #1f1816;
  border-color: #574a46;
}

:root[data-theme="dark"] .callout-accent {
  background: #27181b;
  border-color: #6c444b;
}

:root[data-theme="dark"] .callout-warning,
:root[data-theme="dark"] .callout-warm {
  background: #241b13;
  border-color: #7a5f36;
}

:root[data-theme="dark"] .primary-nav a,
:root[data-theme="dark"] .branch-nav a {
  color: var(--muted);
}

:root[data-theme="dark"] .primary-nav a:hover,
:root[data-theme="dark"] .branch-nav a:hover,
:root[data-theme="dark"] .primary-nav a.is-active,
:root[data-theme="dark"] .branch-nav a.is-active,
:root[data-theme="dark"] .filter-chip:hover,
:root[data-theme="dark"] .filter-chip.is-active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: #7c545b;
}

:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .btn-secondary {
  color: #170f10;
}

:root[data-theme="dark"] .btn-subtle:hover {
  background: #2c2121;
  color: var(--accent-strong);
}

:root[data-theme="dark"] .comparison-table thead th,
:root[data-theme="dark"] .verse-book-group summary {
  background: #281f1f;
}

:root[data-theme="dark"] .comparison-table th,
:root[data-theme="dark"] .comparison-table td,
:root[data-theme="dark"] .verse-entry {
  border-bottom-color: #443837;
}

:root[data-theme="dark"] .table-scroll,
:root[data-theme="dark"] .comparison-table,
:root[data-theme="dark"] .comparison-table caption,
:root[data-theme="dark"] .faq-item,
:root[data-theme="dark"] .search-result,
:root[data-theme="dark"] .search-empty-state,
:root[data-theme="dark"] .site-search-form input,
:root[data-theme="dark"] .site-search-panel input,
:root[data-theme="dark"] .menu-toggle,
:root[data-theme="dark"] .theme-toggle,
:root[data-theme="dark"] .filter-chip {
  color: var(--text);
}

:root[data-theme="dark"] .search-badge,
:root[data-theme="dark"] .verse-entry-label {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

:root[data-theme="dark"] .resource-image,
:root[data-theme="dark"] .resource-image img,
:root[data-theme="dark"] .media-frame {
  background: #171212;
}

:root[data-theme="dark"] .verse-quote {
  background: #1d1716;
  border-left-color: var(--accent);
}

:root[data-theme="dark"] .site-footer {
  background: #171212;
  border-top-color: rgba(76, 63, 61, 0.92);
}

:root[data-theme="dark"] .footer-legal {
  border-top-color: rgba(76, 63, 61, 0.95);
}

:root[data-theme="dark"] ::selection {
  background: rgba(210, 156, 165, 0.32);
}

@media (max-width: 1040px) {
  .header-top {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "brand theme menu"
      "search search search";
  }
}

@media (max-width: 760px) {
  .theme-toggle {
    min-width: 2.75rem;
    padding-inline: 0.75rem;
  }

  .theme-toggle-label {
    display: none;
  }
}

/* Phase 19 responsive refinement */
.brand,
.brand-copy {
  min-width: 0;
}

.theme-toggle-icon {
  width: 1.125rem;
  height: 1.125rem;
  flex: 0 0 1.125rem;
}

.theme-toggle-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.site-search-form input,
.site-search-panel input {
  min-height: 2.85rem;
}

@media (max-width: 980px) {
  .cards.three-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .brand-copy span:last-child {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: 10rem;
  }

  [id] {
    scroll-margin-top: 10rem;
  }

  .container {
    width: min(var(--max), calc(100% - 2rem));
  }

  .cards.three-up {
    grid-template-columns: minmax(0, 1fr);
  }

  .header-top {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "brand theme menu"
      "search search search";
    gap: 0.7rem;
    padding: 0.75rem 0;
    align-items: center;
  }

  .brand {
    gap: 0.65rem;
  }

  .brand-mark {
    width: 2.55rem;
    flex-basis: 2.55rem;
  }

  .brand-copy {
    gap: 0.1rem;
  }

  .brand-copy strong {
    font-size: 1rem;
    line-height: 1.1;
  }

  .brand-copy span:last-child {
    display: none;
  }

  .theme-toggle,
  .menu-toggle {
    min-height: 3rem;
  }

  .theme-toggle {
    gap: 0;
    padding-inline: 0.75rem;
  }

  .menu-toggle {
    padding-inline: 0.85rem;
  }

  .site-search-form,
  .site-search-panel {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
    align-items: center;
  }

  .site-search-form input,
  .site-search-panel input {
    min-height: 2.85rem;
    font-size: 16px;
  }

  .site-search-form .btn,
  .site-search-panel .btn,
  .primary-nav a,
  .branch-nav a,
  .filter-chip {
    min-height: 3rem;
  }

  .branch-nav {
    gap: 0.55rem;
    padding: 0.65rem 0 0.75rem;
  }

  .branch-nav ul,
  .filter-chip-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.2rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .branch-nav li,
  .filter-chip {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .hero {
    margin: 0.85rem 0 1.25rem;
    padding: 1.15rem;
  }

  .hero h1 {
    font-size: clamp(1.75rem, 7.2vw, 2.25rem);
  }

  .hero-intro {
    font-size: 1rem;
  }

  .hero-meta {
    gap: 0.5rem 0.75rem;
  }

  .page-main {
    padding: 1rem 0 3.5rem;
  }
}

@media (max-width: 420px) {
  .header-top {
    gap: 0.6rem;
  }

  .brand-mark {
    width: 2.35rem;
    flex-basis: 2.35rem;
  }

  .brand-copy strong {
    font-size: 0.96rem;
  }

  .site-search-form .btn,
  .site-search-panel .btn {
    padding-inline: 0.9rem;
  }

  .menu-toggle {
    padding-inline: 0.75rem;
  }
}


/* Phase 20 shared banner refinement */
:root {
  --header-logo-size: clamp(2.65rem, 2.2rem + 1vw, 3.35rem);
  --header-action-size: 3rem;
  --header-search-width: clamp(18rem, 27vw, 24rem);
  --header-title-size: clamp(1rem, 0.95rem + 0.28vw, 1.15rem);
}

.site-header {
  box-shadow: 0 10px 28px rgba(31, 23, 22, 0.06);
}

.header-top.is-shared-banner {
  grid-template-columns: minmax(0, 1fr) minmax(17rem, var(--header-search-width)) auto;
  grid-template-areas: "brand search actions";
  gap: 0.85rem 1rem;
  align-items: center;
  padding: 0.8rem 0 0.9rem;
}

.header-top.is-shared-banner .brand {
  min-width: 0;
  gap: 0.85rem;
}

.header-top.is-shared-banner .brand-mark {
  width: var(--header-logo-size);
  flex: 0 0 var(--header-logo-size);
}

.header-top.is-shared-banner .brand-copy {
  min-width: 0;
  gap: 0.22rem;
}

.header-top.is-shared-banner .brand-copy strong {
  font-size: var(--header-title-size);
  line-height: 1.08;
}

.header-top.is-shared-banner .brand-copy span:last-child {
  max-width: 52ch;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.header-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 0.55rem;
}

.header-top.is-shared-banner .theme-toggle,
.header-top.is-shared-banner .menu-toggle {
  min-width: var(--header-action-size);
  min-height: var(--header-action-size);
  height: var(--header-action-size);
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font: 600 0.95rem Arial, Helvetica, sans-serif;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease, transform 0.12s ease, box-shadow 0.14s ease;
  box-shadow: 0 6px 14px rgba(31, 23, 22, 0.05);
}

.header-top.is-shared-banner .menu-toggle {
  display: none;
  padding-inline: 0.95rem;
  min-width: auto;
}

.header-top.is-shared-banner .theme-toggle:hover,
.header-top.is-shared-banner .menu-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: rgba(215, 176, 182, 0.9);
  transform: translateY(-1px);
}

.theme-toggle-icon,
.menu-toggle-icon,
.site-search-icon,
.search-submit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.theme-toggle-icon {
  width: 1.2rem;
  height: 1.2rem;
}

.theme-toggle-svg,
.icon-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.theme-toggle-icon--sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle-icon--moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle-icon--sun {
  display: inline-flex;
}

.menu-toggle-icon,
.search-submit-icon {
  width: 1.05rem;
  height: 1.05rem;
}

.site-search-form {
  grid-area: search;
  justify-self: end;
  width: min(100%, var(--header-search-width));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
}

.site-search-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 3rem;
  padding-inline: 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.site-search-field:focus-within {
  box-shadow: var(--focus);
  border-color: rgba(93, 26, 34, 0.32);
}

.site-search-icon {
  width: 1rem;
  height: 1rem;
  color: var(--muted);
}

.site-search-form input,
.site-search-panel input {
  min-height: 0;
}

.site-search-field input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: 500 0.98rem Arial, Helvetica, sans-serif;
  box-shadow: none;
  border-radius: 0;
}

.site-search-field input:focus-visible {
  box-shadow: none;
}

.search-submit {
  min-width: 3rem;
  min-height: 3rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding-inline: 1rem;
}

.search-submit-label {
  white-space: nowrap;
}

@media (max-width: 1040px) {
  .header-top.is-shared-banner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand actions"
      "search search";
    gap: 0.75rem 0.85rem;
  }

  .header-top.is-shared-banner .menu-toggle {
    display: inline-flex;
  }

  .header-top.is-shared-banner .site-search-form {
    justify-self: stretch;
    width: 100%;
  }

  .header-top.is-shared-banner .brand-copy span:last-child {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: 10.4rem;
  }

  [id] {
    scroll-margin-top: 10.4rem;
  }

  .header-top.is-shared-banner {
    padding: 0.72rem 0 0.82rem;
  }

  .header-top.is-shared-banner .brand {
    gap: 0.65rem;
    align-items: center;
  }

  .header-top.is-shared-banner .brand-mark {
    width: 2.6rem;
    flex-basis: 2.6rem;
  }

  .header-top.is-shared-banner .brand-copy strong {
    font-size: clamp(0.98rem, 0.86rem + 0.7vw, 1.08rem);
  }

  .header-top.is-shared-banner .brand-copy span:last-child {
    display: none;
  }

  .header-actions {
    gap: 0.45rem;
  }

  .header-top.is-shared-banner .theme-toggle,
  .header-top.is-shared-banner .menu-toggle {
    min-width: 2.75rem;
    min-height: 3rem;
    height: 2.75rem;
  }

  .header-top.is-shared-banner .menu-toggle {
    padding-inline: 0.82rem;
  }

  .header-top.is-shared-banner .site-search-form {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
    align-items: center;
  }

  .site-search-field {
    min-height: 3rem;
    padding-inline: 0.9rem;
  }

  .site-search-field input {
    font-size: 16px;
  }

  .search-submit {
    min-width: 3rem;
    min-height: 3rem;
    padding-inline: 0.95rem;
  }

  .site-search-form .btn,
  .site-search-panel .btn,
  .primary-nav a,
  .branch-nav a,
  .filter-chip {
    min-height: 3rem;
  }
}

@media (max-width: 540px) {
  .menu-toggle-label,
  .search-submit-label {
    display: none;
  }

  .header-top.is-shared-banner .menu-toggle,
  .search-submit {
    min-width: 3rem;
    padding-inline: 0;
  }
}

@media (max-width: 420px) {
  .header-top.is-shared-banner {
    gap: 0.6rem 0.7rem;
  }

  .header-top.is-shared-banner .brand-mark {
    width: 2.35rem;
    flex-basis: 2.35rem;
  }

  .header-top.is-shared-banner .brand-copy strong {
    font-size: 0.95rem;
  }

  .site-search-field {
    padding-inline: 0.8rem;
  }
}


/* Phase 21 SEO/mobile tap-target refinements */
@media (max-width: 760px) {
  .breadcrumbs a,
  .toc-card a,
  .sidebar-links a,
  .section-nav-card a,
  .section-nav-parent a,
  .inline-link-list a,
  .site-footer a {
    display: inline-flex;
    align-items: center;
    min-height: 3rem;
    padding-block: 0.2rem;
  }

  .site-footer li + li,
  .inline-link-list li + li,
  .sidebar-links li + li,
  .toc-card li + li,
  .section-nav-card li + li {
    margin-top: 0.1rem;
  }
}
