/* Manuscript Witness: scholarly research library styles */
:root {
  --ink: #1c1917;
  --ink-soft: #44403c;
  --muted: #78716c;
  --line: #e7e5e4;
  --line-strong: #d6d3d1;
  --paper: #faf8f5;
  --paper-deep: #f3efe8;
  --parchment: #f7f3eb;
  --card: #ffffff;
  --accent: #5b4636;
  --accent-hover: #3f2f24;
  --accent-soft: #8b7355;
  --link: #3d5a4c;
  --link-hover: #2a4036;
  --callout-ms: #eef4f0;
  --callout-tv: #f4f0ea;
  --callout-tr: #f0f2f5;
  --callout-hi: #f5f1e8;
  --callout-si: #f2eef5;
  --callout-th: #f5efef;
  --placeholder-bg: #f8f4e8;
  --placeholder-border: #c4a574;
  --focus: #2563eb;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 8px 24px rgba(28, 25, 23, 0.04);
  --max: 72rem;
  --prose: 42rem;
  --font-sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", monospace;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
}

img { max-width: 100%; height: auto; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--link-hover); }
a:focus-visible, button:focus-visible, .skip-link:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  background: var(--ink);
  color: #fff;
  padding: 0.5rem 0.75rem;
  z-index: 1000;
  border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; }

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.brand-name {
  font-family: var(--font-serif);
  font-weight: 650;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--accent);
}
.brand-tagline {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.3;
}

.nav-toggle {
  display: none;
  background: var(--paper-deep);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.45rem 0.7rem;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.85rem;
  justify-content: flex-end;
}
.site-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.25rem 0;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent);
}
.site-nav a[aria-current="page"] {
  border-bottom: 2px solid var(--accent-soft);
}

.site-main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.25rem 3.5rem;
}

.hero {
  background: linear-gradient(165deg, var(--parchment) 0%, var(--paper) 70%);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2.25rem 1.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 2.25rem;
}
.hero h1 {
  font-family: var(--font-serif);
  font-weight: 650;
  font-size: clamp(1.85rem, 4vw, 2.55rem);
  line-height: 1.2;
  margin: 0 0 0.65rem;
  color: var(--accent);
}
.hero .tagline {
  font-size: 1.2rem;
  color: var(--ink-soft);
  margin: 0 0 0.75rem;
}
.hero .guiding {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--accent-soft);
  margin: 0 0 1.25rem;
}
.hero-prose {
  max-width: 48rem;
  color: var(--ink-soft);
}
.hero-prose p { margin: 0 0 0.9rem; }
.hero-prose p:last-child { margin-bottom: 0; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.35rem;
}
.button {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  text-decoration: none !important;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
}
.button:hover { background: var(--accent-hover); }
.button-secondary {
  background: transparent;
  color: var(--accent) !important;
  border: 1px solid var(--line-strong);
}
.button-secondary:hover {
  background: var(--paper-deep);
  color: var(--accent-hover) !important;
}

.section-block { margin-bottom: 2.5rem; }
.section-block h2,
.page-header h1 {
  font-family: var(--font-serif);
  font-weight: 650;
  color: var(--accent);
  margin: 0 0 0.75rem;
  line-height: 1.25;
}
.page-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.page-header .lede {
  max-width: 44rem;
  color: var(--ink-soft);
  margin: 0;
  font-size: 1.1rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
  gap: 1rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.card h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  margin: 0;
  color: var(--accent);
}
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { color: var(--link); text-decoration: underline; }
.card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  flex: 1;
}
.card .card-link {
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.card .card-link:hover { text-decoration: underline; }

.study-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
}
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--accent);
  border: 1px solid var(--line-strong);
}
.badge-placeholder {
  background: var(--placeholder-bg);
  border-color: var(--placeholder-border);
  color: #6b4f24;
}

.placeholder-banner {
  background: var(--placeholder-bg);
  border: 1px solid var(--placeholder-border);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 0 0 1.5rem;
  color: #5c4520;
}
.placeholder-banner strong { display: block; margin-bottom: 0.25rem; }

.prose {
  max-width: var(--prose);
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.75;
}
.prose h2, .prose h3, .prose h4 {
  font-family: var(--font-serif);
  color: var(--accent);
  line-height: 1.3;
  margin: 1.75rem 0 0.65rem;
}
.prose h2 { font-size: 1.45rem; }
.prose h3 { font-size: 1.2rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1rem; color: var(--ink); }
.prose ul, .prose ol { padding-left: 1.35rem; }
.prose li { margin-bottom: 0.35rem; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--paper-deep);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.prose strong { font-weight: 650; }

.callout {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  border-left-width: 4px;
  padding: 0.85rem 1rem;
  margin: 1.15rem 0;
  font-family: var(--font-sans);
  font-size: 0.98rem;
  line-height: 1.55;
}
.callout-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  color: var(--accent);
}
.callout-manuscript { background: var(--callout-ms); border-left-color: #5a7d6a; }
.callout-variant { background: var(--callout-tv); border-left-color: #8b7355; }
.callout-translation { background: var(--callout-tr); border-left-color: #5c6b7a; }
.callout-historical { background: var(--callout-hi); border-left-color: #9a7b4f; }
.callout-scholarly { background: var(--callout-si); border-left-color: #6f5a84; }
.callout-theological { background: var(--callout-th); border-left-color: #8a5a5a; }

.study-aside {
  margin: 1.75rem 0;
  padding: 1rem 1.15rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: var(--prose);
}
.study-aside h2 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  margin: 0 0 0.65rem;
  color: var(--accent);
}
.study-aside dl {
  margin: 0;
  display: grid;
  gap: 0.55rem;
}
.study-aside dt {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.study-aside dd {
  margin: 0.15rem 0 0;
  color: var(--ink-soft);
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.tag-list li {
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.85rem;
}

.toc {
  max-width: var(--prose);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.15rem;
  margin: 0 0 1.5rem;
}
.toc h2 {
  font-family: var(--font-serif);
  font-size: 1rem;
  margin: 0 0 0.5rem;
  color: var(--accent);
}
.toc ol {
  margin: 0;
  padding-left: 1.2rem;
}
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

.empty-state {
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 1.25rem 1.35rem;
  color: var(--ink-soft);
  max-width: 40rem;
}
.empty-state p { margin: 0 0 0.6rem; }
.empty-state p:last-child { margin-bottom: 0; }

.integrity-legend {
  display: grid;
  gap: 0.65rem;
  margin: 1rem 0 0;
}
.integrity-legend .callout { margin: 0; }

.breadcrumbs {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
}
.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
}
.breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin-left: 0.35rem;
  color: var(--line-strong);
}
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--link); text-decoration: underline; }

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 2rem 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  gap: 1.25rem;
}
.footer-brand {
  font-family: var(--font-serif);
  color: var(--accent);
  font-weight: 650;
  font-size: 1.05rem;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}
.footer-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
}
.footer-nav a:hover { text-decoration: underline; color: var(--link); }
.footer-note { margin: 0; max-width: 40rem; line-height: 1.5; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

@media (max-width: 900px) {
  .nav-toggle { display: inline-block; }
  .site-nav {
    display: none;
    width: 100%;
  }
  .site-nav.is-open { display: block; }
  .header-inner {
    flex-wrap: wrap;
  }
  .site-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.5rem 0 0.75rem;
  }
}

@media (max-width: 600px) {
  .site-main { padding: 1.35rem 1rem 2.5rem; }
  .hero { padding: 1.5rem 1.15rem; }
  .brand-tagline { display: none; }
}

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