/* ==========================================================================
   THE ARCHIVE — screen register layer
   --------------------------------------------------------------------------
   Screen adaptations of the Never Fear print design system's component
   vocabulary (never-fear-print.css, canonical in
   NeverFearGameDesignBible/docs/print-system/). Additive layer, loaded
   after components.css — the same pattern the print system's
   lab-notebook.css uses to extend the base.

   RULES (see docs/archive-theme.md):
   · Every class here is NEW — never reuse a class name defined in
     never-fear-print.css (that vocabulary belongs to print surfaces,
     which render only inside export/preview iframes).
   · Sizes are rem/px (responsive), never mm/pt.
   · Cream (--nf-surface-well) is material — wells and callouts only.
   Each component notes its print source.
   ========================================================================== */

/* ── Sheet — a paper page surface for reading/detail views ─────────────────
   Print source: .nf-page (crown-quarto page on the desk) */
.nf-sheet {
  background: var(--nf-bg-elevated);
  border: 1px solid var(--nf-border);
  border-radius: var(--nf-radius-sm);
  box-shadow: var(--nf-shadow-md);
  padding: clamp(24px, 4.5vw, 56px);
  max-width: 860px;
  margin: 0 auto;
}

.nf-sheet--tint {
  background: var(--nf-bg-surface);
}

.nf-sheet--full {
  max-width: none;
  margin: 0;
}

/* Running head: label · hairline · folio (print source: .nf-runhead) */
.nf-sheet__runhead {
  display: flex;
  align-items: center;
  gap: var(--nf-space-md);
  margin-bottom: var(--nf-space-lg);
}

.nf-sheet__runlabel {
  font-family: var(--nf-font);
  font-weight: 600;
  font-size: var(--nf-text-xs);
  letter-spacing: var(--nf-tracking-label);
  text-transform: uppercase;
  color: var(--nf-text-muted);
  white-space: nowrap;
}

.nf-sheet__runhead::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--nf-border);
}

.nf-sheet__folio {
  font-family: var(--nf-font-mono);
  font-size: var(--nf-text-xs);
  color: var(--nf-text-secondary);
  white-space: nowrap;
  order: 1;
}

/* Display headline (print source: .nf-display / .nf-title) */
.nf-sheet__display {
  font-family: var(--nf-font-heading);
  font-weight: 500;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  line-height: 1.05;
  color: var(--nf-heading);
  margin: var(--nf-space-xs) 0 var(--nf-space-sm);
}

/* Italic subtitle (print source: .nf-sub) */
.nf-sheet__sub {
  font-family: var(--nf-font-heading);
  font-style: italic;
  font-weight: 500;
  font-size: var(--nf-text-xl);
  color: var(--nf-text-secondary);
  margin-bottom: var(--nf-space-md);
}

/* Standfirst lead paragraph (print source: .nf-lead / .nf-leadband) */
.nf-sheet__lead {
  font-family: var(--nf-font-reading);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--nf-text);
  border-top: 2px solid var(--nf-heading);
  border-bottom: 1px solid var(--nf-border);
  padding: var(--nf-space-md) 0;
  margin: var(--nf-space-md) 0 var(--nf-space-lg);
}

/* Reading body (print source: .nf-body).
   .nf-markdown is the markdown-renderer's wrapper — rendered prose speaks
   the same register wherever it appears. */
.nf-sheet__body,
.nf-markdown {
  font-family: var(--nf-font-reading);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--nf-text);
}

.nf-sheet__body p,
.nf-markdown p {
  margin: 0 0 0.9em;
}

.nf-sheet__body h1,
.nf-sheet__body h2,
.nf-markdown h1,
.nf-markdown h2 {
  font-family: var(--nf-font-heading);
  font-weight: 600;
  color: var(--nf-heading);
  line-height: 1.15;
  margin: 1.4em 0 0.5em;
}

.nf-sheet__body h1,
.nf-markdown h1 { font-size: 1.5rem; }
.nf-sheet__body h2,
.nf-markdown h2 { font-size: 1.25rem; }

.nf-sheet__body h3,
.nf-sheet__body h4,
.nf-markdown h3,
.nf-markdown h4 {
  font-family: var(--nf-font);
  font-weight: 600;
  color: var(--nf-heading);
  font-size: 1rem;
  margin: 1.3em 0 0.4em;
}

.nf-sheet__body ul,
.nf-sheet__body ol,
.nf-markdown ul,
.nf-markdown ol {
  padding-left: 1.4em;
  margin: 0 0 0.9em;
}

.nf-sheet__body ul,
.nf-markdown ul { list-style: disc; }
.nf-sheet__body ol,
.nf-markdown ol { list-style: decimal; }

.nf-markdown ul ul,
.nf-markdown ol ol,
.nf-markdown ul ol,
.nf-markdown ol ul { margin-bottom: 0; }

.nf-sheet__body li,
.nf-markdown li { margin-bottom: 0.3em; }
.nf-sheet__body li::marker,
.nf-markdown li::marker { color: var(--nf-text-muted); }

.nf-sheet__body blockquote,
.nf-markdown blockquote {
  font-family: var(--nf-font-heading);
  font-style: italic;
  color: var(--nf-heading);
  border-left: 2px solid var(--nf-accent-amber);
  padding-left: var(--nf-space-md);
  margin: 1em 0;
}

.nf-sheet__body code,
.nf-markdown code {
  font-family: var(--nf-font-mono);
  font-size: 0.85em;
  background: var(--nf-bg-surface);
  padding: 1px 5px;
  border-radius: var(--nf-radius-sm);
}

.nf-sheet__body a,
.nf-markdown a {
  color: var(--nf-accent-deep);
  border-bottom: 1px dotted var(--nf-border-light);
}

.nf-sheet__body a:hover,
.nf-markdown a:hover {
  border-bottom-color: var(--nf-accent-deep);
}

/* Markdown-only blocks (emitted by the renderer) */
.nf-markdown pre {
  background: var(--nf-bg-surface);
  border: 1px solid var(--nf-border-soft);
  border-radius: var(--nf-radius-sm);
  padding: var(--nf-space-sm) var(--nf-space-md);
  overflow: auto;
  margin: 0 0 0.9em;
}

.nf-markdown pre code {
  background: none;
  padding: 0;
}

.nf-markdown hr {
  height: 1px;
  background: var(--nf-border);
  border: 0;
  margin: var(--nf-space-md) 0;
}

.nf-markdown img {
  max-width: 100%;
  border-radius: var(--nf-radius-sm);
  border: 1px solid var(--nf-border);
  margin: 6px 0;
}

.nf-markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-family: var(--nf-font);
}

.nf-markdown th {
  font-family: var(--nf-font-mono);
  font-size: var(--nf-text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--nf-text-muted);
  text-align: left;
  font-weight: 500;
  padding: 6px 10px;
  border-bottom: 2px solid var(--nf-heading);
}

.nf-markdown td {
  font-size: var(--nf-text-sm);
  padding: 6px 10px;
  border-bottom: 1px solid var(--nf-border);
  vertical-align: top;
}

.nf-markdown tbody tr:nth-child(even) {
  background: var(--nf-bg-surface);
}

/* Optional dropcap opener (print source: .nf-dropcap) */
.nf-sheet__body--dropcap > p:first-of-type::first-letter {
  font-family: var(--nf-font-heading);
  font-weight: 500;
  color: var(--nf-accent);
  float: left;
  font-size: 3.2em;
  line-height: 0.82;
  padding: 0.04em 0.08em 0 0;
}

/* ── Kicker — small red caps line above a headline ──────────────────────────
   Print source: .nf-eyebrow */
.nf-kicker {
  display: block;
  font-family: var(--nf-font);
  font-weight: 600;
  font-size: var(--nf-text-xs);
  letter-spacing: var(--nf-tracking-kicker);
  text-transform: uppercase;
  color: var(--nf-accent);
}

.nf-kicker--muted {
  color: var(--nf-text-muted);
}

/* ── Hairline rules ─────────────────────────────────────────────────────────
   Print source: .nf-hr / .nf-hr--navy */
.nf-rule-hair {
  height: 1px;
  background: var(--nf-border);
  border: 0;
  margin: var(--nf-space-lg) 0;
}

.nf-rule-navy {
  height: 2px;
  background: var(--nf-heading);
  border: 0;
  margin: var(--nf-space-lg) 0;
}

/* ── Stamp chip — status chip with a canon dot ──────────────────────────────
   Print source: .nf-chip (+ .nf-dot) */
.nf-stamp-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--nf-font-mono);
  font-size: var(--nf-text-xs);
  letter-spacing: var(--nf-tracking-label);
  text-transform: uppercase;
  color: var(--nf-heading);
  border: 1px solid var(--nf-border);
  border-radius: var(--nf-radius-full);
  padding: 3px 12px;
  background: var(--nf-bg-elevated);
}

.nf-stamp-chip::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--nf-accent-amber);
}

.nf-stamp-chip--red::before { background: var(--nf-accent); }
.nf-stamp-chip--green::before { background: var(--nf-success); }
.nf-stamp-chip--navy::before { background: var(--nf-heading); }
.nf-stamp-chip--hollow::before {
  background: transparent;
  border: 1.3px solid var(--nf-border-light);
}

/* ── Well — cream material box with a signal edge ───────────────────────────
   Print source: .nf-callout (cream is MATERIAL) */
.nf-well {
  background: var(--nf-surface-well);
  border-left: 3px solid var(--nf-accent);
  border-radius: var(--nf-radius-sm);
  padding: var(--nf-space-md) var(--nf-space-lg);
}

.nf-well__label {
  display: block;
  font-family: var(--nf-font-mono);
  font-size: var(--nf-text-xs);
  letter-spacing: var(--nf-tracking-label);
  text-transform: uppercase;
  color: var(--nf-accent-deep);
  margin-bottom: var(--nf-space-xs);
}

.nf-well p {
  margin: 0 0 var(--nf-space-xs);
  font-size: var(--nf-text-sm);
  line-height: 1.6;
  color: var(--nf-text);
}

.nf-well p:last-child { margin-bottom: 0; }

.nf-well--amber {
  border-left-color: var(--nf-accent-amber);
}

.nf-well--amber .nf-well__label {
  color: var(--nf-accent-amber-deep);
}

.nf-well--sink {
  background: var(--nf-surface-well-sink);
}

.nf-well--navy {
  background: var(--nf-sidebar-bg);
  border-left-color: var(--nf-accent-amber);
}

.nf-well--navy .nf-well__label {
  color: var(--nf-accent-amber);
}

.nf-well--navy p {
  color: var(--nf-sidebar-text-bright);
}

/* ── Margin note — amber-ruled aside ────────────────────────────────────────
   Print source: .nf-marginalia / .nf-note */
.nf-margin-note {
  font-family: var(--nf-font);
  font-size: var(--nf-text-xs);
  line-height: 1.5;
  color: var(--nf-text-muted);
  border-top: 1px solid var(--nf-accent-amber);
  padding-top: var(--nf-space-xs);
}

.nf-margin-note b,
.nf-margin-note strong {
  color: var(--nf-heading);
  font-weight: 600;
}

.nf-margin-note--canon {
  border-top-color: var(--nf-accent);
}

.nf-margin-note--canon b,
.nf-margin-note--canon strong {
  color: var(--nf-accent-deep);
}

/* ── Facts — dossier attribute grid (dl) ────────────────────────────────────
   Print source: .nf-attr */
.nf-facts {
  display: grid;
  grid-template-columns: minmax(110px, 160px) 1fr;
  gap: var(--nf-space-xs) var(--nf-space-md);
}

.nf-facts dt {
  font-family: var(--nf-font-mono);
  font-size: var(--nf-text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nf-text-muted);
  padding-top: 2px;
}

.nf-facts dd {
  margin: 0;
  font-size: var(--nf-text-sm);
  line-height: 1.5;
  color: var(--nf-text);
}

/* ── Leader row — dotted-leader index/list line ─────────────────────────────
   Print source: .nf-tocrow */
.nf-leader-row {
  display: flex;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--nf-border-soft);
}

.nf-leader-row__title {
  font-family: var(--nf-font-heading);
  font-weight: 600;
  font-size: var(--nf-text-base);
  color: var(--nf-heading);
}

.nf-leader-row__desc {
  font-size: var(--nf-text-xs);
  color: var(--nf-text-muted);
  margin-left: var(--nf-space-sm);
}

.nf-leader-row__dots {
  flex: 1;
  border-bottom: 1px dotted var(--nf-border-light);
  margin: 0 var(--nf-space-sm);
  transform: translateY(-3px);
  min-width: 24px;
}

.nf-leader-row__ref {
  font-family: var(--nf-font-mono);
  font-size: var(--nf-text-xs);
  color: var(--nf-text-secondary);
  white-space: nowrap;
}

/* ── Archive table — spec-table register for data views ─────────────────────
   Print source: .nf-table */
.nf-archive-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--nf-font);
}

.nf-archive-table thead th {
  font-family: var(--nf-font-mono);
  font-size: var(--nf-text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--nf-text-muted);
  text-align: left;
  font-weight: 500;
  padding: var(--nf-space-sm) var(--nf-space-md);
  border-bottom: 2px solid var(--nf-heading);
}

.nf-archive-table tbody td {
  font-size: var(--nf-text-sm);
  line-height: 1.45;
  color: var(--nf-text);
  padding: var(--nf-space-sm) var(--nf-space-md);
  border-bottom: 1px solid var(--nf-border);
  vertical-align: top;
}

.nf-archive-table tbody tr:nth-child(even) {
  background: var(--nf-bg-surface);
}

.nf-archive-table tbody tr:hover {
  background: var(--nf-bg-hover);
}

/* ── Chapter tile — navy plate opener for dashboards/pillar cards ───────────
   Print source: .nf-page--dark chapter openers + .nf-pillar */
.nf-chapter-tile {
  background: var(--nf-sidebar-bg);
  color: var(--nf-sidebar-text-bright);
  border-radius: var(--nf-radius-md);
  padding: var(--nf-space-lg);
  box-shadow: var(--nf-shadow-md);
}

.nf-chapter-tile .nf-kicker {
  color: var(--nf-accent-amber);
}

.nf-chapter-tile__title {
  font-family: var(--nf-font-heading);
  font-weight: 500;
  font-size: var(--nf-text-2xl);
  line-height: 1.1;
  margin: var(--nf-space-xs) 0 var(--nf-space-sm);
}

.nf-chapter-tile__desc {
  font-size: var(--nf-text-sm);
  line-height: 1.55;
  color: var(--nf-sidebar-text);
}

.nf-chapter-tile__num {
  font-family: var(--nf-font-heading);
  font-weight: 500;
  font-style: italic;
  font-size: var(--nf-text-2xl);
  color: var(--nf-accent);
}
