/* Westminster Standards — Reformed aesthetic, high readability */

:root {
  --ink: #2c2419;
  --ink-muted: #5c4f42;
  --parchment: #f7f2e8;
  --parchment-deep: #ebe3d4;
  --crimson: #6b1f2a;
  --crimson-deep: #4a1520;
  --navy: #1e3a5f;
  --navy-soft: #2d4f7a;
  --gold: #8b7355;
  --border: #d4c9b5;
  --shadow: rgba(44, 36, 25, 0.08);
  --serif: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, sans-serif;
  --content-width: 42rem;
  --sidebar-width: 17rem;
}

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

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--serif);
  color: var(--ink);
  background: var(--parchment);
  line-height: 1.65;
  min-height: 100vh;
}

/* Subtle open-Bible motif */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, var(--navy) 0%, transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath fill='%236b1f2a' d='M40 8c-12 0-22 6-22 14v36c0 4 4 8 10 10l12 4 12-4c6-2 10-6 10-10V22C62 14 52 8 40 8zm0 6c7 0 14 4 14 8v32c0 2-3 5-8 6l-6 2-6-2c-5-1-8-4-8-6V22c0-4 7-8 14-8z'/%3E%3C/svg%3E");
  background-size: auto, 80px 80px;
  z-index: -1;
}

a {
  color: var(--navy);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover { color: var(--crimson); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--crimson);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}

.skip-link:focus { left: 0; }

/* Header */
.site-header {
  background: linear-gradient(180deg, var(--crimson-deep) 0%, var(--crimson) 100%);
  color: #f7f2e8;
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px var(--shadow);
}

.header-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-title {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f7f2e8;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-mark {
  font-size: 1.1rem;
  opacity: 0.85;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.site-nav a {
  color: #f0e8dc;
  font-family: var(--sans);
  font-size: 0.85rem;
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: #fff;
  border-bottom-color: var(--gold);
}

.header-search {
  position: relative;
  flex: 1 1 12rem;
  max-width: 18rem;
  min-width: 10rem;
}

.header-search #search-input {
  width: 100%;
  font-family: var(--sans);
  font-size: 0.85rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 3px;
  background: rgba(0,0,0,0.2);
  color: #f7f2e8;
}

.header-search #search-input::placeholder {
  color: rgba(247,242,232,0.6);
}

.header-search #search-input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  background: rgba(0,0,0,0.35);
}

.search-results-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  max-height: 20rem;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 6px 20px var(--shadow);
  z-index: 60;
  padding: 0.5rem;
}

.search-results-dropdown.open {
  display: block;
}

.search-results-dropdown .search-hint,
.search-results-dropdown .search-empty {
  padding: 0.5rem;
  margin: 0;
}

.sidebar-toggle {
  display: none;
  font-family: var(--sans);
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 3px;
  cursor: pointer;
  margin-bottom: 0.75rem;
  width: 100%;
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid #f0e8dc;
  color: #f0e8dc;
  padding: 0.35rem 0.75rem;
  font-family: var(--sans);
  cursor: pointer;
  border-radius: 3px;
}

/* Layout */
.layout {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 2rem;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  box-shadow: 0 2px 8px var(--shadow);
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--crimson);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--sans);
}

.toc-toggle {
  font-family: var(--sans);
  font-size: 0.75rem;
  background: var(--parchment-deep);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  border-radius: 3px;
}

.toc.collapsed { display: none; }

.toc-item {
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
}

.toc-item summary {
  cursor: pointer;
  list-style: none;
}

.toc-item summary::-webkit-details-marker { display: none; }

.toc a {
  color: var(--ink-muted);
  text-decoration: none;
  display: block;
  padding: 0.15rem 0;
}

.toc a:hover { color: var(--crimson); }

.toc ul {
  margin: 0.25rem 0 0.5rem 1rem;
  padding: 0;
  list-style: none;
}

.quick-links {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.quick-links label {
  display: block;
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-bottom: 0.35rem;
}

.quick-links select {
  width: 100%;
  font-family: var(--sans);
  font-size: 0.8rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  background: var(--parchment);
  border-radius: 3px;
}

/* Main content */
.main-content {
  min-width: 0;
}

.doc-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.doc-header h1 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  color: var(--crimson-deep);
  font-weight: 600;
}

.doc-meta {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.document-body h2 {
  font-size: 1.35rem;
  color: var(--navy);
  margin: 2rem 0 1rem;
  padding-top: 0.5rem;
}

.document-body h3 {
  font-size: 1rem;
  color: var(--crimson);
  margin: 1.25rem 0 0.5rem;
  font-family: var(--sans);
  font-weight: 600;
}

.document-body p {
  margin: 0 0 1rem;
  max-width: var(--content-width);
  text-align: justify;
  hyphens: auto;
}

.q-text, .a-text { text-align: left; }

.proofs {
  margin: 1rem 0 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--parchment-deep);
  border-left: 3px solid var(--gold);
  font-size: 0.88rem;
}

.proofs h4 {
  margin: 0 0 0.5rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.proofs pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--serif);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.chapter, .question, .dpw-section, .paragraph {
  scroll-margin-top: 5rem;
}

/* Home page */
.hero {
  text-align: center;
  padding: 2rem 1rem 2.5rem;
  background: linear-gradient(180deg, #fff 0%, var(--parchment) 100%);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 2.25rem;
  color: var(--crimson-deep);
  margin: 0 0 0.75rem;
}

.hero .subtitle {
  font-size: 1.1rem;
  color: var(--ink-muted);
  max-width: 36rem;
  margin: 0 auto 1.5rem;
}

.hero-mark {
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.doc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.doc-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.doc-card:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 12px var(--shadow);
}

.doc-card h3 {
  margin: 0 0 0.5rem;
  color: var(--navy);
  font-size: 1.05rem;
}

.doc-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-muted);
  font-family: var(--sans);
}

.search-panel,
.daily-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.search-panel h2,
.daily-panel h2 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
  color: var(--navy);
}

#search-input {
  width: 100%;
  max-width: 32rem;
  font-family: var(--serif);
  font-size: 1rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--parchment);
}

#search-input:focus {
  outline: 2px solid var(--navy-soft);
  outline-offset: 1px;
}

.search-hint,
.search-empty {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.search-results-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.search-results-list li {
  border-bottom: 1px solid var(--border);
}

.search-results-list a {
  display: block;
  padding: 0.65rem 0;
  text-decoration: none;
}

.result-doc {
  display: block;
  font-family: var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold);
}

.result-title {
  color: var(--ink);
}

#daily-reading-btn {
  font-family: var(--sans);
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

#daily-reading-btn:hover { background: var(--navy-soft); }

.daily-label {
  font-family: var(--sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin: 0 0 0.25rem;
}

#daily-reading h3 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.daily-excerpt {
  color: var(--ink-muted);
  font-style: italic;
}

.daily-link {
  font-family: var(--sans);
  font-size: 0.9rem;
}

/* About page */
.about-content {
  max-width: var(--content-width);
}

.about-content h2 {
  color: var(--navy);
  margin: 2rem 0 0.75rem;
}

.about-content ul {
  padding-left: 1.25rem;
}

.about-content li { margin-bottom: 0.5rem; }

.about-content ul.resource-list,
.resource-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 2rem;
}

.resource-list li {
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
}

.resource-link {
  display: block;
  font-weight: 600;
  color: var(--navy);
  text-decoration: none;
  margin-bottom: 0.35rem;
}

.resource-link:hover {
  color: var(--crimson);
  text-decoration: underline;
}

.resource-desc {
  display: block;
  font-size: 0.92rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

.source-note {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--parchment-deep);
  border: 1px solid var(--border);
  font-size: 0.9rem;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--ink-muted);
  border-top: 1px solid var(--border);
  background: var(--parchment-deep);
}

.site-footer a { color: var(--navy); }

/* Responsive */
@media (max-width: 768px) {
  html { font-size: 16px; }

  .header-inner {
    flex-wrap: wrap;
  }

  .header-search {
    order: 10;
    flex: 1 1 100%;
    max-width: none;
  }

  .nav-toggle { display: block; }

  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    padding-top: 0.5rem;
  }

  .site-nav.open { display: flex; }

  .layout {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  /* Collapsible sidebar only when JS enabled; no-JS users see full TOC */
  html.js .sidebar-toggle { display: block; }

  html.js .sidebar:not(.mobile-open) .sidebar-header,
  html.js .sidebar:not(.mobile-open) .toc,
  html.js .sidebar:not(.mobile-open) .quick-links {
    display: none;
  }

  .doc-header h1 { font-size: 1.6rem; }

  .hero h1 { font-size: 1.75rem; }
}

@media (min-width: 769px) {
  .home-layout .sidebar { display: none; }
  .home-layout .layout { grid-template-columns: 1fr; }
}
/* KJV proof tooltip */
.kjv-tooltip {
  position: absolute;
  max-width: 420px;
  padding: 0.75rem 1rem;
  background: #fffaf0;
  color: #2c2419;
  border: 1px solid #d4c9b5;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(44, 36, 25, 0.15);
  font-size: 0.9rem;
  line-height: 1.4;
  z-index: 9999;
  pointer-events: none;
}

.kjv-tooltip strong {
  display: block;
  margin-bottom: 0.35rem;
  color: #6b1f2a;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.kjv-tooltip p {
  margin: 0;
  font-family: "Palatino Linotype", Palatino, Georgia, serif;
}

/* Highlighted proof references */
.proof-ref {
  color: #6b1f2a;
  border-bottom: 1px dotted #6b1f2a;
  cursor: help;
  transition: background-color 0.1s ease;
}

.proof-ref:hover,
.proof-ref:focus {
  background-color: rgba(107, 31, 42, 0.08);
  border-bottom-style: solid;
}
