/* Paper, slate, and redaction marks give the teaching archive its own identity. */
:root {
  --accent: #374151;
  --accent-soft: #e8e7e1;
  --bg: #f3f0e8;
  --surface: #fffdf7;
  --surface-2: #e8e5dc;
  --ink: #252b32;
  --ink-2: #62656a;
  --bad: #994940;
  --radius: 4px;
  --radius-sm: 4px;
  --font-display: ui-serif, Georgia, serif;
  --max: 1120px;
  --shadow: 0 2px 0 rgb(37 43 50 / 5%);
  color-scheme: light;
}

/* Shell and navigation. */
.app-header {
  justify-content: space-between;
  border-bottom: 2px solid var(--ink);
}

.header-note {
  color: var(--ink-2);
  font-size: .7rem;
  letter-spacing: .14em;
}

.app-main {
  padding-bottom: 36px;
}

.app-footer {
  padding: 20px 20px calc(90px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--ink-2);
  font-size: .8rem;
}

.tabbar button {
  font-size: .8rem;
}

/* Editorial headings and case cards. */
.hero {
  padding: 8px 0 18px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.hero h1 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 500;
  letter-spacing: -.025em;
}

.hero p {
  margin: 0;
  color: var(--ink-2);
}

.eyebrow {
  color: var(--bad);
  font: .75rem var(--font-mono);
  letter-spacing: .13em;
  margin-bottom: 18px;
}

.stamp {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid var(--ink-2);
  font: .8rem var(--font-mono);
}

.filters {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 640px;
  align-items: end;
}

.search-field {
  grid-column: 1 / -1;
}

.clear-filters {
  justify-self: start;
  font-size: .85rem;
}

.field {
  margin: 0;
  font-size: .85rem;
}

.file-card {
  border: 1px solid var(--line);
  border-top: 3px solid var(--ink);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-card h3 {
  font-size: 1.5rem;
}

.file-card p {
  margin: 0;
}

.file-card .btn {
  margin-top: auto;
}

.file-meta {
  justify-content: space-between;
  padding-bottom: 16px;
  font-size: .7rem;
}

.page-heading,
.case-heading {
  padding: 28px 0;
}

.privacy {
  padding: clamp(20px, 4vw, 44px);
  margin-top: 24px;
}

/* Timeline: placeholders preserve the sequence while retained counts change. */
.view-controls {
  margin: 0 0 24px;
}

.btn[aria-pressed="true"] {
  background: var(--accent);
  color: white;
}

.timeline {
  list-style: none;
  padding: 0 0 0 18px;
  border-left: 1px solid var(--line);
}

.timeline-item {
  position: relative;
  padding: 0 0 24px 6px;
  margin-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--ink);
  left: -22.5px;
  top: 6px;
  border-radius: 50%;
  outline: 4px solid var(--surface);
}

.removed {
  color: var(--bad);
  background: #f1e1dc;
  margin: 8px 6px 8px 0;
}

.redaction {
  width: 85%;
  height: 18px;
  margin: 14px 0 20px;
  background: repeating-linear-gradient(90deg, #24282e 0 80px, #33373c 80px 84px);
}

summary {
  min-height: 44px;
  padding-top: 10px;
  cursor: pointer;
  font-weight: 600;
}

.comparison {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.timeline-panel {
  min-width: 0;
}

.answer-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
}

.quiz {
  margin: 20px 0;
}

/* Narrow screens stack comparisons and keep every control within reach. */
@media (max-width: 700px) {
  .comparison {
    grid-template-columns: minmax(0, 1fr);
  }

  .header-note {
    display: none;
  }

  .btn {
    white-space: normal;
  }
}

/* A pinned file summary beside the document history. */
.grid > .card + .card {
  margin-top: 0;
}

.app-main[data-view="case"] {
  max-width: 912px;
}

.case-paper {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 8px 30px rgb(37 43 50 / 5%);
  padding: clamp(16px, 3vw, 32px);
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  font-size: .75rem;
  color: var(--ink-2);
}

.breadcrumb .btn {
  padding: 0;
  font-size: .85rem;
}

.case-heading {
  padding: 24px 0 12px;
}

.case-heading h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 500;
}

.case-heading .eyebrow {
  margin-bottom: 8px;
}

.case-layout {
  display: grid;
  grid-template-columns: minmax(0, 210px) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.case-summary {
  position: sticky;
  top: 80px;
  border: 1px solid var(--line);
  background: #f7f5ef;
  box-shadow: none;
}

.case-summary h2 {
  font: .85rem var(--font-mono);
  overflow-wrap: anywhere;
}

.case-summary h3 {
  font: 600 .8rem var(--font);
}

.case-summary .eyebrow {
  font-size: .65rem;
  margin-bottom: 12px;
}

.case-summary dt,
.entry-meta {
  color: var(--ink-2);
  font-size: .75rem;
}

.case-summary dd {
  margin: 2px 0 12px;
  font-size: .875rem;
}

.summary-reasons {
  list-style: none;
  padding: 0;
  font-size: .8rem;
}

.summary-reasons li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.case-history {
  min-width: 0;
}

.view-controls {
  gap: 4px;
}

.view-controls .btn {
  padding: 0 10px;
  border-radius: 4px;
  font-size: .8rem;
}

.timeline-panel > h3 {
  font-size: 1.25rem;
}

.timeline-panel > .muted {
  font-size: .8rem;
}

.timeline-item h4 {
  font: 600 .95rem var(--font);
}

.timeline-item > p:not(.entry-meta),
.timeline-item details {
  font-size: .875rem;
}

.entry-meta {
  margin-bottom: 6px;
}

.comparison {
  gap: 20px;
}

@media (max-width: 700px) {
  .case-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .case-summary {
    position: static;
  }

  .filters {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .tabbar button {
    font-size: .65rem;
  }
}
