/* ========================================
   COLD WAR TECH — PRODUCTION STYLESHEET
   Consolidated from homepage and content pages
   ======================================== */

/* --- FONTS: self-hosted via fonts.css (loaded before this sheet) --- */

/* --- RESET & BASE --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #A84B24;
  --primary-decorative: #C45A2D;
  --primary-dark: #8B3A1A;
  --primary-light: #F5E6DA;
  --primary-text: #9B4420;
  --bg: #F5EDE4;
  --surface: #FDF8F3;
  --grid-line: #D4846A;
  --text: #1A1410;
  --text-secondary: #5C4A3A;
  --stamp-red: #B83230;
  --stamp-blue: #2B4A7C;
  --ink: #2C2420;
  --font-body: 'Atkinson Hyperlegible Next', system-ui, sans-serif;
  --font-mono: 'Courier Prime', 'Courier New', monospace;
  /* Hand-lettered voices: marker title-block (headlines, stamps) and
     pencil draftsman annotations (file numbers, bylines, fig labels) */
  --font-drawn: 'Parts List', 'Courier Prime', 'Courier New', monospace;
  --font-draft: 'DRAFT PAPER', 'Courier Prime', 'Courier New', monospace;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 17px;
}

/* --- ACCESSIBILITY: keyboard focus --- */
:focus-visible {
  outline: 3px solid var(--stamp-blue);
  outline-offset: 2px;
}

/* On rust/dark surfaces the blue outline vanishes — use white there */
.top-strip :focus-visible,
.navbar :focus-visible,
.mobile-nav :focus-visible,
.file-header :focus-visible,
.byline :focus-visible,
.footer :focus-visible,
.lightbox-overlay :focus-visible {
  outline-color: #fff;
}

/* --- ACCESSIBILITY: skip link --- */
.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 200;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1rem;
  text-decoration: none;
}

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

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

  html {
    scroll-behavior: auto;
  }
}

/* --- TOP STRIP (Classification Strip) --- */
.top-strip {
  background: var(--ink);
  color: var(--primary-light);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 0;
  text-align: center;
}

/* --- NAVBAR --- */
.navbar {
  background: var(--primary);
  border-bottom: 3px solid var(--primary-dark);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  text-decoration: none;
}

.navbar-brand .navbar-title {
  display: block;
  font-family: var(--font-drawn);
  font-size: 1.5rem;
  font-weight: 400;
  color: #fff;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;
}

.navbar-brand .file-no {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary-light);
  letter-spacing: 1px;
  opacity: 0.8;
}

.navbar-nav {
  display: flex;
  list-style: none;
  gap: 0;
}

.navbar-nav a {
  display: block;
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 400;
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border-left: 1px solid rgba(255,255,255,0.15);
  transition: background 0.15s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  background: var(--primary-dark);
}

.navbar-search {
  display: flex;
  align-items: center;
}

.navbar-search input {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-radius: 2px;
  width: 180px;
  -webkit-appearance: none;
  appearance: none;
}

.navbar-search input::placeholder {
  color: rgba(255,255,255,0.5);
}

/* --- BREADCRUMB --- */
.breadcrumb {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 2rem 0.75rem 3.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--grid-line);
  background: var(--surface);
}

.breadcrumb ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
}

.breadcrumb li + li::before {
  content: "/";
  margin: 0 0.5rem;
  color: var(--grid-line);
}

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

.breadcrumb a:hover {
  text-decoration: underline;
}

/* epub-reader plugin chapter view still renders .sep separators */
.breadcrumb .sep {
  margin: 0 0.5rem;
  color: var(--grid-line);
}

/* --- VERTICAL SPINE (left edge) --- */
.spine {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-lr;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #fff;
  background: var(--primary-dark);
  padding: 2rem 0.4rem;
  z-index: 50;
}

/* --- HERO / FILE HEADER --- */
.hero {
  background: var(--primary);
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 28px,
      rgba(139, 58, 26, 0.3) 28px,
      rgba(139, 58, 26, 0.3) 29px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 28px,
      rgba(139, 58, 26, 0.15) 28px,
      rgba(139, 58, 26, 0.15) 29px
    );
  padding: 4rem 2rem 3rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: 'DECLASSIFIED';
  position: absolute;
  top: 2.5rem;
  right: 3rem;
  font-family: var(--font-drawn);
  font-size: 2.5rem;
  font-weight: 400;
  color: rgba(255,255,255,0.08);
  text-transform: uppercase;
  letter-spacing: 8px;
  transform: rotate(-5deg);
  pointer-events: none;
}

.hero-inner {
  max-width: 900px;
  margin: 0 auto;
}

.hero h1 {
  font-family: var(--font-drawn);
  font-size: 3rem;
  font-weight: 400;
  color: #fff;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.hero .subtitle {
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: #fff;
  margin-bottom: 2rem;
  max-width: 600px;
}

.hero-search {
  display: flex;
  gap: 0;
  max-width: 550px;
}

.hero-search input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 0.85rem 1.25rem;
  border: 2px solid var(--primary-dark);
  background: var(--surface);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.hero-search button {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.85rem 1.5rem;
  background: var(--ink);
  color: #fff;
  border: 2px solid var(--ink);
  text-transform: uppercase;
  letter-spacing: 2px;
  cursor: pointer;
}

/* --- FILE HEADER (Content Pages) --- */
.file-header {
  background: var(--primary);
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 28px,
      rgba(139, 58, 26, 0.3) 28px,
      rgba(139, 58, 26, 0.3) 29px
    );
  padding: 2.5rem 2.5rem 2rem 3.5rem;
  grid-column: 1 / -1;
  position: relative;
  overflow: hidden;
}

.file-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}

.file-header .file-number {
  /* Thin draftsman hand needs a touch more size than Courier did */
  font-family: var(--font-draft);
  font-size: 0.8rem;
  color: var(--primary-light);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  display: block;
  font-weight: 400;
}

.file-header h1 {
  font-family: var(--font-drawn);
  font-size: 2.25rem;
  font-weight: 400;
  color: #fff;
  letter-spacing: 2px;
  text-transform: uppercase;
  line-height: 1.15;
  margin-bottom: 0.25rem;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.file-header .designation {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--primary-light);
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
  display: block;
}

.file-header .intro {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: #fff;
  max-width: 600px;
  line-height: 1.5;
}

.file-header .header-stamp {
  flex-shrink: 0;
  text-align: center;
}

/* --- BYLINE --- */
.byline {
  font-family: var(--font-draft);
  font-size: 0.78rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0.4rem 2.5rem 0.4rem 3.5rem;
  background: var(--ink);
  color: rgba(255,255,255,0.45);
  border-top: 1px solid rgba(255,255,255,0.08);
  grid-column: 1 / -1;
}

.byline-label {
  color: rgba(255,255,255,0.35);
}

.byline-author {
  color: var(--primary-light);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.byline-author:hover {
  border-bottom-color: var(--primary-light);
}

/* Journal byline variant */
.journal-post-header .byline {
  background: none;
  padding: 0.5rem 0 0 0;
  border-top: none;
  color: var(--text-secondary);
}

.journal-post-header .byline-label {
  color: var(--text-secondary);
}

.journal-post-header .byline-author {
  color: var(--primary);
}

.journal-post-header .byline-author:hover {
  border-bottom-color: var(--primary);
}

/* --- DOMAIN TAGS --- */
.domain-tags {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.domain-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: rgba(255,255,255,0.15);
  color: #fff;
  padding: 0.3em 0.7em;
  text-decoration: none;
}

.domain-tag:hover {
  background: rgba(255,255,255,0.25);
}

/* --- PAGE LAYOUT --- */
.page-layout {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 0;
  min-height: 80vh;
}

/* --- MAIN CONTENT --- */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.content-area {
  padding: 2.5rem 2.5rem 2.5rem 3.5rem;
  border-right: 1px solid var(--grid-line);
  background: var(--surface);
  min-width: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.content-area img {
  max-width: 100%;
  height: auto;
}

.content-area figure {
  max-width: 100%;
  margin: 1.5rem 0;
}

.content-area figure img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Photo captions — monospace with date/source, per the archival spec */
.content-area figure figcaption {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text-secondary);
  padding: 0.5rem 0.25rem 0;
  border-top: 1px solid var(--grid-line);
  margin-top: 0.5rem;
}

/* --- SECTION HEADINGS --- */
.section-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--grid-line);
  padding-bottom: 0.75rem;
}

.section-heading h3 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-text);
  text-transform: uppercase;
  letter-spacing: 3px;
}

.section-heading .line {
  flex: 1;
  height: 1px;
  background: var(--grid-line);
}

/* --- METADATA PANEL (routing table style) --- */
.metadata-panel {
  background: var(--bg);
  border: 1px solid var(--grid-line);
  margin-top: 2rem;
  margin-bottom: 2.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.metadata-panel .panel-header {
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
}

.metadata-row {
  display: flex;
  border-bottom: 1px solid var(--grid-line);
}

.metadata-row:last-child {
  border-bottom: none;
}

.metadata-label {
  width: 160px;
  padding: 0.6rem 1rem;
  color: var(--text-secondary);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  flex-shrink: 0;
  border-right: 1px solid var(--grid-line);
  background: rgba(196, 90, 45, 0.04);
}

.metadata-value {
  padding: 0.6rem 1rem;
  color: var(--ink);
  flex: 1;
  margin: 0; /* reset default <dd> indent */
  min-width: 0; /* allow the flex cell to shrink; long values wrap inside the border */
  overflow-wrap: break-word;
}

.metadata-value a {
  color: var(--stamp-blue);
  text-decoration: none;
}

.metadata-value a:hover {
  text-decoration: underline;
}

/* Original classification marking on document pages */
.classification-display {
  margin: 1.5rem 0 1rem;
}

/* --- COVER PHOTO ("attached photograph") --- */
.cover-photo {
  position: relative;
  max-width: 700px;
  margin: 2.5rem 0 2rem;
  background: #fff;
  padding: 10px 10px 8px;
  border: 1px solid var(--grid-line);
  box-shadow: 2px 3px 10px rgba(44, 36, 32, 0.22);
  transform: rotate(-0.4deg);
}

.cover-photo img {
  display: block;
  width: 100%;
  height: auto;
}

.cover-photo-clip {
  position: absolute;
  top: -13px;
  left: 26px;
  width: 15px;
  height: 34px;
  border: 3px solid #8a8578;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.cover-photo figcaption {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text-secondary);
  padding: 8px 4px 2px;
}

.cover-photo .fig-label {
  font-family: var(--font-draft);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--primary-text);
}

/* --- BODY CONTENT --- */
.body-content {
  max-width: 700px;
}

.body-content h3 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-text);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--grid-line);
}

.body-content h3:first-child {
  margin-top: 0;
}

.body-content p {
  margin-bottom: 1.25rem;
  line-height: 1.7;
}

.body-content a {
  color: var(--stamp-blue);
  text-decoration: underline;
  text-decoration-color: rgba(43, 74, 124, 0.3);
  text-underline-offset: 2px;
}

.body-content a:hover {
  text-decoration-color: var(--stamp-blue);
}

/* --- SPECS TABLE --- */
.specs-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin: 1.5rem 0 2rem;
  border: 1px solid var(--grid-line);
}

.specs-table th {
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  text-align: left;
}

.specs-table td {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--grid-line);
  color: var(--ink);
}

.specs-table tr:nth-child(even) td {
  background: rgba(196, 90, 45, 0.03);
}

.specs-table .spec-label {
  color: var(--text-secondary);
  width: 200px;
  font-size: 0.75rem;
}

/* --- FOOTNOTES --- */
/* Inline footnote superscripts — classified reference markers */
.footnote-ref,
sup.footnote a {
  font-family: var(--font-mono);
  font-size: 0.6em;
  color: var(--stamp-red);
  text-decoration: none;
  vertical-align: super;
  font-weight: 700;
  padding: 0.05em 0.3em;
  margin: 0 0.1em;
  border: 1px solid var(--stamp-red);
  border-radius: 2px;
  background: rgba(184, 50, 48, 0.06);
  letter-spacing: 0.5px;
  transition: background 0.15s ease, color 0.15s ease;
}

.footnote-ref:hover,
sup.footnote a:hover {
  color: #fff;
  background: var(--stamp-red);
  text-decoration: none;
}

/* --- IMAGE FIGURE --- */
.figure {
  margin: 2rem 0;
  max-width: 700px;
}

.figure .figure-img {
  width: 100%;
  height: 320px;
  background: var(--primary-light);
  border: 1px solid var(--grid-line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.figure figcaption {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--grid-line);
  line-height: 1.5;
}

.figure figcaption .source {
  color: var(--primary-text);
}

/* --- GALLERY --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 1.5rem 0 2rem;
}

.gallery-thumb {
  aspect-ratio: 1;
  background: var(--primary-light);
  border: 1px solid var(--grid-line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  color: var(--primary-dark);
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.15s;
  /* button reset — thumbs are <button>s for keyboard access */
  padding: 0;
  margin: 0;
  appearance: none;
}

.gallery-thumb:hover {
  opacity: 0.8;
}

/* --- SPECS TABLE (z-table block) — classified routing table --- */
.specs-table-wrap {
  margin: 1.5rem 0 2rem;
  border: 2px solid var(--stamp-red);
  background: var(--surface);
  position: relative;
}

.specs-table-header {
  background: var(--stamp-red);
  padding: 0.4rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.specs-table-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #fff;
}

.specs-table-footer {
  padding: 0.35rem 1rem;
  border-top: 1px solid var(--grid-line);
  text-align: right;
}

.specs-table-classification {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--stamp-red);
  opacity: 0.5;
}

/* Table inside the wrap inherits border from parent */
.specs-table-wrap .specs-table {
  margin: 0;
  border: none;
  border-radius: 0;
}

/* --- EVIDENCE GALLERY (z-gallery block) — photo evidence grid --- */
.evidence-gallery {
  margin: 1.5rem 0 2rem;
  border: 2px solid var(--grid-line);
  background: var(--surface);
}

.evidence-gallery-header {
  background: var(--primary);
  padding: 0.4rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.evidence-gallery-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #fff;
}

.evidence-gallery-count {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.evidence-grid {
  display: grid;
  gap: 3px;
  padding: 3px;
  background: var(--grid-line);
}

.evidence-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--primary-light);
  /* button reset — thumbs are <button>s for keyboard access */
  padding: 0;
  margin: 0;
  border: none;
  appearance: none;
}

.evidence-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.15s;
  filter: saturate(0.85) contrast(1.05);
}

.evidence-thumb:hover img {
  opacity: 0.8;
}

.evidence-number {
  position: absolute;
  bottom: 0;
  left: 0;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.15rem 0.35rem;
  line-height: 1;
}

.evidence-gallery-footer {
  padding: 0.35rem 1rem;
  border-top: 2px solid var(--grid-line);
  text-align: right;
}

.evidence-gallery-classification {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-secondary);
  opacity: 0.5;
}

/* Evidence gallery responsive */
@media (max-width: 600px) {
  .evidence-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* --- SOURCES / FOOTNOTES SECTION --- */
.sources-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--grid-line);
}

.sources-section h3 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-text);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 1.25rem;
}

/* Footnotes — message form footer style
   Sits inside .content-area, uses negative margins to span edge-to-edge */
.content-area > .footnotes-container {
  margin: 3rem -2.5rem 0 -3.5rem;
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  padding: 0;
}

/* Fallback for footnotes not in .content-area */
.footnotes-container {
  margin-top: 3rem;
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  padding: 0;
}

.footnotes-container::before {
  content: 'REFERENCES';
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg);
  border-bottom: 1px solid rgba(44, 36, 32, 0.25);
  padding: 0.5rem 1rem;
}

.footnotes-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: fn-counter;
}

.footnotes-list li {
  display: block;
  padding: 0.6rem 1rem 0.6rem 3.5rem;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text);
  counter-increment: fn-counter;
  border-bottom: 1px solid rgba(44, 36, 32, 0.12);
  position: relative;
}

.footnotes-list li:last-child {
  border-bottom: none;
}

.footnotes-list li::before {
  content: counter(fn-counter) '.';
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
  position: absolute;
  left: 1rem;
  top: 0.6rem;
  width: 1.75rem;
  text-align: right;
}

.footnotes-list li a {
  color: var(--stamp-blue);
  text-decoration: none;
}

.footnotes-list li a:hover {
  text-decoration: underline;
}

.footnotereverse {
  padding-left: 0.5rem;
  flex-shrink: 0;
}

.footnotereverse a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
}

.footnotereverse a:hover {
  color: var(--primary-text);
}

/* --- SOURCES & RESOURCES --- */
.resources-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--grid-line);
}

.resources-section h2 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--primary-text);
  margin-bottom: 1.5rem;
}

.resources-group {
  margin-bottom: 1.5rem;
}

.resources-group h3 {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--primary);
  border-bottom: 1.5px solid var(--grid-line);
  padding-bottom: 0.3rem;
  margin-bottom: 0.75rem;
}

.resources-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.resource-item {
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  line-height: 1.5;
}

.resource-item:last-child {
  border-bottom: none;
}

.resource-item a {
  color: var(--primary-text);
  text-decoration: none;
  border-bottom: 1px solid rgba(168,75,36,0.25);
  transition: border-color 0.2s;
}

.resource-item a:hover {
  border-bottom-color: var(--primary);
}

.cited-pages {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1.5rem;
}

.cited-pages li {
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.95rem;
}

.cited-pages li:last-child {
  border-bottom: none;
}

.cited-pages a {
  color: var(--stamp-blue);
  text-decoration: underline;
  text-decoration-color: rgba(43, 74, 124, 0.3);
  text-underline-offset: 2px;
}

.cited-pages a:hover {
  text-decoration-color: var(--stamp-blue);
}

.resource-meta {
  display: inline;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-left: 0.5em;
}

.resource-meta::before {
  content: '— ';
}

.resource-context {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--grid-line);
}

.resource-title {
  font-style: italic;
}

/* --- CHANGELOG --- */
.changelog {
  margin-top: 2rem;
  padding: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--grid-line);
  font-size: 0.85rem;
}

.changelog summary {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary-text);
  text-transform: uppercase;
  letter-spacing: 2px;
  cursor: pointer;
  list-style: none;
}

.changelog summary::before {
  content: '▸ ';
}

.changelog[open] summary::before {
  content: '▾ ';
}

.changelog-entry {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(212, 132, 106, 0.3);
}

.changelog-entry .cl-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 90px;
  flex-shrink: 0;
}

.changelog-entry .cl-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* --- SIDEBAR --- */
.sidebar {
  padding: 2rem 1.5rem;
  background: var(--bg);
  border-left: none;
  font-size: 0.88rem;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section h2 {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--primary-text);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--grid-line);
}

.sidebar-tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.5rem;
  row-gap: 0.3rem;
}

.sidebar-tags li {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.sidebar-tags li::before {
  content: "• ";
}

/* Table of Contents */
.toc-list {
  list-style: none;
}

.toc-list li {
  margin-bottom: 0.4rem;
}

.toc-list a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  display: block;
  padding: 0.2rem 0;
  transition: color 0.15s;
}

.toc-list a:hover {
  color: var(--primary-text);
}

.toc-list a.toc-active {
  color: var(--primary-text);
  font-weight: 700;
}

.toc-list .toc-level-3 {
  padding-left: 1rem;
}

.toc-list .toc-level-3 a {
  font-size: 0.7rem;
}

/* Make the sidebar column sticky so TOC follows scroll, below the sticky navbar */
.page-layout > .sidebar {
  position: sticky;
  top: 4.5rem;
  align-self: start;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
}

html {
  scroll-behavior: smooth;
}

/* Offset anchors so they clear the sticky navbar */
.body-content h2[id],
.body-content h3[id] {
  scroll-margin-top: 5rem;
}

/* Related links */
.related-list {
  list-style: none;
}

.related-list li {
  margin-bottom: 0.5rem;
}

.related-list a {
  color: var(--stamp-blue);
  text-decoration: none;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.related-list a:hover {
  text-decoration: underline;
}

.related-list .rel-type {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--primary-text);
  text-transform: uppercase;
  letter-spacing: 1px;
  background: rgba(196, 90, 45, 0.08);
  padding: 0.15em 0.4em;
  flex-shrink: 0;
}

/* Last modified */
.last-modified {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  padding: 0.75rem 0;
  border-top: 1px solid var(--grid-line);
  margin-top: 1rem;
}

/* --- RESOURCES SECTION --- */
.resources-section {
  margin-top: 2rem;
}

.resources-section h3 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-text);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--grid-line);
}

.resources-section h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 1.25rem 0 0.5rem;
}

.resource-link {
  display: block;
  font-size: 0.85rem;
  color: var(--stamp-blue);
  text-decoration: none;
  padding: 0.3rem 0;
  line-height: 1.4;
}

.resource-link:hover {
  text-decoration: underline;
}

.resource-type {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* --- DOMAIN GRID --- */
.domain-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--grid-line);
  border: 1px solid var(--grid-line);
  margin-bottom: 4rem;
}

.domain-card {
  background: var(--surface);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s;
  position: relative;
}

.domain-card:hover {
  background: #fff;
}

.domain-card .domain-icon {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--primary-text);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
  display: block;
}

.domain-card h4 {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

.domain-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.domain-card .count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
  display: block;
}

/* --- PAGE HEADER & LISTING --- */
.page-header {
  max-width: 1200px;
  margin: 0 auto 2rem;
  padding: 2rem 2rem 0;
}

.page-header h1 {
  font-family: var(--font-drawn);
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.page-header .intro-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 700px;
}

.listing-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

/* --- FEATURED CONTENT --- */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 4rem;
}

.featured-card {
  background: var(--surface);
  border: 1px solid var(--grid-line);
  display: flex;
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: border-color 0.15s;
}

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

.featured-card .card-image {
  width: 180px;
  min-height: 160px;
  background: var(--primary-light);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 1px;
  overflow: hidden;
}

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

.featured-card .card-image .card-image-placeholder {
  padding: 1rem;
  text-align: center;
}

.featured-card .card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.featured-card .card-type {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--primary-text);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.4rem;
}

.featured-card .card-title {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

.featured-card .card-excerpt {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

.featured-card .card-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
}

/* --- STAMP --- */
.stamp {
  display: inline-block;
  /* Single weight — no bold; faux-bolding smears the hand lettering */
  font-family: var(--font-drawn);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 0.2em 0.6em;
  border: 3px solid;
  border-radius: 3px;
  transform: rotate(-3deg);
  opacity: 0.85;
  font-size: 0.7rem;
  line-height: 1;
}

.stamp-large {
  font-size: 1.1rem;
  letter-spacing: 3px;
  padding: 0.35em 0.75em;
  border-width: 4px;
  border-radius: 4px;
  opacity: 0.9;
}

.stamp-small {
  font-size: 0.6rem;
  letter-spacing: 2px;
  padding: 0.25em 0.5em;
  border-width: 2px;
}

.stamp-red {
  color: var(--stamp-red);
  border-color: var(--stamp-red);
}

.stamp-blue {
  color: var(--stamp-blue);
  border-color: var(--stamp-blue);
}

.stamp-white {
  color: rgba(255,255,255,0.88);
  border-color: rgba(255,255,255,0.72);
}

/* --- JOURNAL ENTRIES --- */
.journal-list {
  margin-bottom: 4rem;
}

.journal-entry {
  display: flex;
  gap: 1.5rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--grid-line);
  text-decoration: none;
  color: var(--text);
}

.journal-entry:first-child {
  border-top: 1px solid var(--grid-line);
}

.journal-entry:hover .journal-title {
  color: var(--primary-text);
}

.journal-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-width: 110px;
  padding-top: 0.15rem;
}

.journal-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  transition: color 0.15s;
}

.journal-excerpt {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.journal-tags {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--primary-text);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 0.3rem;
}

.journal-post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0 0.75rem;
}

/* --- RESEARCH MEMORANDUM header (journal entries) --- */
.memo-header {
  border: 2px solid var(--ink);
  background: var(--surface);
  padding: 0;
  margin-bottom: 1rem;
}

.memo-header .memo-kicker {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--surface);
  background: var(--ink);
  padding: 0.45rem 1rem;
  margin: 0;
}

.memo-header .memo-subject,
.memo-header .memo-row {
  font-family: var(--font-mono);
  margin: 0;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--grid-line);
  line-height: 1.4;
}

.memo-header .memo-subject {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink);
}

.memo-header .memo-row {
  font-size: 0.85rem;
  color: var(--ink);
}

.memo-header .memo-row:last-child {
  border-bottom: none;
}

.memo-header .memo-label {
  display: inline-block;
  min-width: 5.5em;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.memo-header .memo-subject .memo-label {
  font-size: 0.7rem;
  vertical-align: 0.35em;
}

.memo-header a {
  color: var(--stamp-blue);
  text-decoration: none;
}

.memo-header a:hover {
  text-decoration: underline;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--grid-line);
  padding: 0.2em 0.6em;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}

.tag:hover {
  color: var(--primary-text);
  border-color: var(--primary);
}

/* --- STATS BAR --- */
.stats-bar {
  display: flex;
  gap: 0;
  background: var(--ink);
  border: 1px solid var(--ink);
  margin-bottom: 4rem;
}

.stat {
  flex: 1;
  padding: 1.25rem;
  text-align: center;
  border-right: 1px solid rgba(255,255,255,0.1);
}

a.stat {
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease;
}

a.stat:hover {
  background: rgba(255,255,255,0.08);
}

.stat:last-child {
  border-right: none;
}

.stat-number {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-light);
  display: block;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 0.25rem;
  display: block;
}

/* --- FOOTER --- */
.footer {
  background: var(--ink);
  color: rgba(255,255,255,0.4);
  padding: 2rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 1px;
  border-top: 3px solid var(--primary);
  grid-column: 1 / -1;
}

.footer a {
  color: var(--primary-light);
  text-decoration: none;
}

.footer .footer-classification {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-top: 0.75rem;
  color: rgba(255,255,255,0.2);
}

/* --- ABOUT / DOSSIER PAGE --- */
.dossier-wrapper {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 2rem 3rem;
  position: relative;
}

.dossier-folder {
  position: relative;
  height: 2.2rem;
  margin-bottom: -2px;
}

.dossier-tab {
  position: absolute;
  left: 2rem;
  bottom: 0;
  background: #C9A96E;
  color: #3B2E1E;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  padding: 0.35rem 1.5rem 0.25rem;
  border-radius: 6px 6px 0 0;
  border: 2px solid #A8884E;
  border-bottom: none;
}

.dossier-page {
  position: relative;
  z-index: 2;
  background: #FDF8F0;
  border: 2px solid #A8884E;
  padding: 3rem 3rem 2rem;
  box-shadow:
    2px 3px 8px rgba(0,0,0,0.10),
    inset 0 0 40px rgba(160,130,80,0.06);
  transform: rotate(-0.4deg);
  overflow: visible;
}

.dossier-page > * {
  position: relative;
  z-index: 1;
}

/* --- Taped Photo --- */

.dossier-photo-taped {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  z-index: 5;
  transform: rotate(2.5deg);
  width: 120px;
}

.dossier-photo {
  position: relative;
  width: 120px;
  height: 140px;
  overflow: hidden;
  border: 3px solid #FFF;
  box-shadow: 1px 2px 6px rgba(0,0,0,0.18);
  background: #E8E0D4;
}

.dossier-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.05) saturate(0.85);
}

/* Tape strips — semi-transparent angled rectangles */
.tape {
  position: absolute;
  width: 60px;
  height: 18px;
  background: rgba(222, 210, 180, 0.55);
  border: 1px solid rgba(180, 165, 130, 0.3);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  pointer-events: none;
  z-index: 10;
}

.tape-top-right {
  top: 10px;
  right: -20px;
  transform: rotate(58deg);
}

.tape-bottom-left {
  bottom: -6px;
  left: -14px;
  transform: rotate(58deg);
}

/* --- Dossier Header --- */
.dossier-header {
  margin-bottom: 2rem;
  padding-right: 160px; /* space for photo */
}

.dossier-stamp {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--stamp-blue);
  border: 2.5px solid var(--stamp-blue);
  padding: 0.2em 0.8em;
  transform: rotate(-2deg);
  margin-bottom: 1.2rem;
  opacity: 0.75;
}

.dossier-meta {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.dossier-meta tr {
  border-bottom: 1px solid rgba(160,130,80,0.2);
}

.dossier-meta td {
  padding: 0.4rem 0;
  vertical-align: top;
}

.dossier-label {
  width: 7rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  padding-right: 1rem;
}

.dossier-value {
  color: var(--ink);
  font-weight: 600;
}

/* --- Dossier Body --- */
/* Lined-paper technique: background-size === line-height locks rules to text grid.
   The gradient draws a 1px line at the bottom of each line-height unit,
   which sits just below the text baseline. */
.dossier-body {
  --ruled-lh: 1.6625rem;
  margin-top: var(--ruled-lh);
  font-size: 0.95rem;
  line-height: var(--ruled-lh);
  color: var(--ink);
  background-image: linear-gradient(
    to bottom,
    transparent calc(var(--ruled-lh) - 1px),
    rgba(160,130,80,0.13) calc(var(--ruled-lh) - 1px)
  );
  background-size: 100% var(--ruled-lh);
  background-position: 0 0;
  padding-bottom: 0.5rem;
}

.dossier-body p {
  margin-bottom: var(--ruled-lh);
}

.dossier-body a {
  color: var(--stamp-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dossier-body a:hover {
  color: var(--primary);
}

/* --- Footer mark --- */
.dossier-footer-mark {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(160,130,80,0.25);
  text-align: center;
}

.dossier-footer-mark span {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 3px;
  color: var(--text-secondary);
  opacity: 0.5;
  text-transform: uppercase;
}

/* Responsive: stack photo above on small screens */
@media (max-width: 640px) {
  .dossier-page {
    padding: 2rem 1.5rem 1.5rem;
    transform: none;
  }

  .dossier-photo-taped {
    position: relative;
    top: 0;
    right: 0;
    float: none;
    margin: 0 auto 1.5rem;
    transform: rotate(2deg);
    width: fit-content;
  }

  .dossier-header {
    padding-right: 0;
  }
}

/* --- SEARCH RESULTS --- */
.search-results {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
}

.search-query {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--grid-line);
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-result {
  display: block;
  padding: 1rem 1.25rem;
  text-decoration: none;
  border-bottom: 1px solid var(--grid-line);
  transition: background 0.12s;
}

.search-result:hover {
  background: var(--surface);
}

.result-type {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--grid-line);
  padding: 0.15em 0.5em;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.result-title {
  display: inline;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.result-excerpt {
  display: block;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-top: 0.35rem;
}

.no-results,
.no-query {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.no-results a {
  color: var(--stamp-blue);
  text-decoration: none;
}

.no-results a:hover {
  text-decoration: underline;
}

/* --- ARCHIVE DOCKET --- */
.archive-sections {
  max-width: 960px;
  margin: 0 auto;
}

.archive-section {
  margin-bottom: 3rem;
}

.docket-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 3px double var(--ink);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.docket-title {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--ink);
}

.docket-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: rgba(44,36,32,0.45);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.docket-group {
  margin-bottom: 2rem;
}

.docket-group-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--primary);
  padding: 0.4rem 0;
  margin-bottom: 0;
  border-bottom: 1px solid var(--grid-line);
}

.docket-table {
  width: 100%;
}

.docket-row {
  display: grid;
  grid-template-columns: 1fr 4.5rem 1fr 5.5rem;
  gap: 0;
  padding: 0;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px dotted rgba(44,36,32,0.2);
  transition: background 0.1s;
}

.docket-row:last-child {
  border-bottom: 1px solid var(--grid-line);
}

a.docket-row:hover {
  background: rgba(183,105,57,0.06);
}

.docket-row-head {
  border-bottom: 1px solid var(--grid-line);
  background: none;
}

.docket-row-head span {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(44,36,32,0.45);
  padding: 0.5rem 0.6rem;
}

.docket-col-title,
.docket-col-year,
.docket-col-author,
.docket-col-class {
  padding: 0.55rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.35;
  border-right: 1px solid rgba(44,36,32,0.08);
  overflow: hidden;
  text-overflow: ellipsis;
}

.docket-col-class {
  border-right: none;
  text-align: center;
}

.docket-col-year {
  color: rgba(44,36,32,0.55);
  text-align: center;
}

.docket-col-author {
  font-size: 0.72rem;
  color: rgba(44,36,32,0.6);
}

.docket-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 0.15em 0.4em;
  border: 1.5px solid;
  border-radius: 2px;
  line-height: 1;
  white-space: nowrap;
}

.docket-badge-primary {
  color: var(--stamp-red);
  border-color: var(--stamp-red);
}

.docket-badge-secondary {
  color: rgba(44,36,32,0.4);
  border-color: rgba(44,36,32,0.25);
}

.docket-badge-reference {
  color: var(--stamp-blue);
  border-color: var(--stamp-blue);
}

.docket-badge-personal-account {
  color: rgba(44,36,32,0.4);
  border-color: rgba(44,36,32,0.25);
}

.docket-badge-unverified {
  color: rgba(44,36,32,0.35);
  border-color: rgba(44,36,32,0.2);
  font-style: italic;
}

.docket-badge-secret {
  color: var(--stamp-red);
  border-color: var(--stamp-red);
}

.docket-badge-confidential {
  color: var(--stamp-red);
  border-color: var(--stamp-red);
  opacity: 0.75;
}

.docket-badge-unclassified {
  color: rgba(44,36,32,0.4);
  border-color: rgba(44,36,32,0.25);
}

.docket-footer {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: rgba(44,36,32,0.35);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding-top: 1rem;
  border-top: 1px solid var(--grid-line);
  margin-top: 1rem;
}

/* Docket responsive */
@media (max-width: 768px) {
  .docket-row {
    grid-template-columns: 1fr 3.5rem 4.5rem;
  }

  .docket-col-author {
    display: none;
  }

  .docket-col-title {
    font-size: 0.72rem;
  }

  .docket-col-year {
    font-size: 0.65rem;
  }

  .docket-badge {
    font-size: 0.5rem;
  }

  .docket-footer {
    flex-direction: column;
    gap: 0.25rem;
    text-align: center;
  }
}

/* --- EPUB READER --- */
.epub-reader {
  clear: both;
  margin-top: 2rem;
}

.epub-chapter {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--grid-line);
}

.epub-chapter:last-child {
  border-bottom: none;
}

.epub-chapter-heading {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dotted rgba(44,36,32,0.2);
}

.epub-chapter-num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(44,36,32,0.3);
  letter-spacing: 1px;
  flex-shrink: 0;
}

.epub-chapter-heading h3 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.5px;
  margin: 0;
}

.epub-chapter-body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
}

.epub-chapter-body p {
  margin-bottom: 1em;
}

.epub-chapter-body h1,
.epub-chapter-body h2,
.epub-chapter-body h3,
.epub-chapter-body h4 {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.epub-chapter-body h1 { font-size: 1.3rem; }
.epub-chapter-body h2 { font-size: 1.15rem; }
.epub-chapter-body h3 { font-size: 1rem; }

.epub-chapter-body blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 1.25rem;
  margin: 1.5em 0;
  font-style: italic;
  color: rgba(44,36,32,0.7);
}

.epub-chapter-body img {
  max-width: 100%;
  height: auto;
  margin: 1rem 0;
}

.epub-chapter-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.epub-chapter-body td,
.epub-chapter-body th {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--grid-line);
  text-align: left;
}

.epub-cover {
  float: right;
  max-width: 240px;
  margin: 0 0 1.5rem 2rem;
  border: 1px solid var(--grid-line);
  box-shadow: 2px 3px 12px rgba(44,36,32,0.12);
}

.epub-cover img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 768px) {
  .epub-cover {
    float: none;
    max-width: 200px;
    margin: 0 0 1.5rem 0;
  }
}

.epub-provenance {
  background: rgba(44,36,32,0.03);
  border: 1px solid var(--grid-line);
  border-left: 3px solid var(--primary);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}

.epub-provenance h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--primary);
  margin: 0 0 0.5rem 0;
}

.epub-provenance p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(44,36,32,0.7);
  margin: 0;
}

/* --- EPUB TABLE OF CONTENTS --- */
.epub-toc {
  margin: 1.5rem 0 2rem;
}

.epub-toc h2 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--faded);
  margin: 0 0 1rem 0;
}

.epub-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: none;
}

.epub-toc-list li {
  border-bottom: 1px solid var(--grid-line);
}

.epub-toc-list li:last-child {
  border-bottom: none;
}

.epub-toc-list a {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.6rem 0.5rem;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s, color 0.15s;
}

.epub-toc-list a:hover {
  background: rgba(44,36,32,0.03);
  color: var(--primary);
}

.epub-toc-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--faded);
  min-width: 1.5rem;
  flex-shrink: 0;
}

.epub-toc-title {
  font-size: 0.95rem;
  line-height: 1.4;
}

/* --- CHAPTER NAVIGATION --- */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 0.75rem;
  padding: 1rem 0;
  border-top: 1px solid var(--grid-line);
  border-bottom: 1px solid var(--grid-line);
}

.chapter-nav-top {
  margin-bottom: 2rem;
}

.chapter-nav-bottom {
  margin-top: 2rem;
}

.chapter-nav-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.chapter-nav-prev { text-align: left; }
.chapter-nav-next { text-align: right; }

.chapter-nav-toc {
  flex: 0 0 auto;
  align-self: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--primary);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--primary);
  border-radius: 2px;
  transition: background 0.15s, color 0.15s;
}

.chapter-nav-toc:hover {
  background: var(--primary);
  color: #fff;
}

.chapter-nav-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--faded);
  margin-bottom: 0.2rem;
}

.chapter-nav-title {
  font-size: 0.85rem;
  color: var(--primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-nav-link:hover .chapter-nav-title {
  text-decoration: underline;
}

.chapter-nav-disabled {
  visibility: hidden;
}

/* Active chapter highlight in sidebar TOC */
.toc-active a {
  color: var(--primary) !important;
  font-weight: 700;
}

@media (max-width: 768px) {
  .chapter-nav {
    flex-direction: column;
    gap: 0.5rem;
  }
  .chapter-nav-prev,
  .chapter-nav-next {
    text-align: left;
  }
  .chapter-nav-toc {
    align-self: stretch;
    text-align: center;
  }
  .chapter-nav-title {
    white-space: normal;
  }
}

.epub-download-footer {
  margin-top: 3rem;
  margin-bottom: 3rem;
  padding-top: 2rem;
  padding-bottom: 2rem;
  border-top: 2px solid var(--grid-line);
  border-bottom: 2px solid var(--grid-line);
  text-align: center;
}

.file-download {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--primary);
  text-decoration: none;
  padding: 0.6rem 1.5rem;
  border: 2px solid var(--primary);
  border-radius: 2px;
  transition: background 0.15s, color 0.15s;
}

.file-download:hover {
  background: var(--primary);
  color: #fff;
}

/* --- PDF PREVIEW --- */
.pdf-preview {
  margin: 1.5rem 0 2rem;
  text-align: center;
}

.pdf-preview a {
  display: inline-block;
  border: 1px solid var(--grid-line);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: box-shadow 0.2s, transform 0.2s;
}

.pdf-preview a:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transform: translateY(-2px);
}

.pdf-preview img {
  display: block;
  max-width: 100%;
  max-height: 600px;
  width: auto;
}

.pdf-preview-caption {
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--faded);
}

/* --- LIGHTBOX --- */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  cursor: zoom-out;
}

.lightbox-overlay.is-active {
  display: flex;
}

.lightbox-image-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 65vh;
  cursor: default;
}

.lightbox-image-wrap img {
  display: block;
  max-width: 90vw;
  max-height: 65vh;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.lightbox-info {
  max-width: 90vw;
  width: 100%;
  padding: 1rem 0 0;
  cursor: default;
}

.lightbox-title {
  color: #eee;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.3rem;
  text-align: center;
}

.lightbox-caption {
  color: #aaa;
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: center;
  margin-bottom: 0.4rem;
}

.lightbox-caption p {
  margin: 0;
  display: inline;
}

.lightbox-credit {
  color: #666;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
}

.lightbox-credit a {
  color: #888;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lightbox-credit a:hover {
  color: #ccc;
}

.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  z-index: 10000;
  background: none;
  border: 1px solid #555;
  color: #aaa;
  font-size: 1.5rem;
  line-height: 1;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.lightbox-close:hover {
  color: #fff;
  border-color: #999;
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10000;
  background: none;
  border: 1px solid #555;
  color: #aaa;
  font-size: 1.25rem;
  width: 2.25rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.lightbox-nav:hover {
  color: #fff;
  border-color: #999;
}

.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

.lightbox-counter {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  color: #666;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  z-index: 10000;
}

.lightbox-overlay[data-count="1"] .lightbox-nav {
  display: none;
}

/* --- MOBILE NAV --- */
.mobile-nav {
  display: none;
}

@media (max-width: 900px) {
  .mobile-nav {
    display: flex;
    flex-wrap: wrap;
    background: var(--primary-dark);
    border-bottom: 2px solid rgba(0,0,0,0.15);
  }

  .mobile-nav a {
    flex: 1 1 33.333%;
    padding: 0.6rem 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 400;
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    border-right: 1px solid rgba(255,255,255,0.08);
    transition: background 0.15s;
    box-sizing: border-box;
  }

  .mobile-nav a:nth-child(3n) {
    border-right: none;
  }

  .mobile-nav a:nth-last-child(-n+3) {
    border-bottom: none;
  }

  .mobile-nav a:hover,
  .mobile-nav a.active {
    background: rgba(0,0,0,0.2);
  }
}

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
  .page-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-top: 1px solid var(--grid-line);
  }

  .spine {
    display: none;
  }

  .navbar-nav {
    display: none;
  }

  .file-header h1 {
    font-size: 1.5rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Shrink stamp in page headers on mobile */
  .file-header-inner {
    flex-direction: column;
    gap: 0.75rem;
  }

  .file-header .header-stamp {
    align-self: flex-start;
  }

  .file-header .header-stamp .stamp {
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    padding: 0.15em 0.5em;
    border-width: 2px;
  }

  .file-header .header-stamp .stamp-large {
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    padding: 0.15em 0.5em;
    border-width: 2px;
  }
}

@media (max-width: 768px) {
  .domain-grid {
    grid-template-columns: 1fr;
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 2rem;
    letter-spacing: 3px;
  }

  .navbar-nav {
    display: none;
  }

  /* Compact stats bar on mobile */
  .stats-bar {
    flex-wrap: wrap;
    margin-bottom: 2rem;
  }

  .stat {
    flex: 1 1 33.333%;
    padding: 0.6rem 0.4rem;
  }

  .stat-number {
    font-size: 1.15rem;
  }

  .stat-label {
    font-size: 0.55rem;
    letter-spacing: 1.5px;
  }
}
