/* ============================================================================
   prism-doc.css, the reading / prose layer
   Loaded only by the long-form practice and research pages on top of
   prism.css. Everything here styles document prose and the small apparatus
   those pages share. Kept out of the chrome layer so its bare element rules
   never touch the edition or story templates.
   ========================================================================= */

h1 {
  font-size: clamp(38px, 5.2vw, 46px); line-height: 1.12; font-weight: 500; letter-spacing: -0.014em;
  margin: 64px 0 14px;
}
.dek { font-size: 21px; color: var(--ink-soft); font-style: italic; margin-bottom: 40px; }
h2 {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.14em; font-weight: 500;
  color: var(--accent); margin: 62px 0 18px;
}
p { margin-bottom: 18px; max-width: 66ch; }
em { font-style: italic; }
a {
  color: inherit; text-decoration-color: var(--accent);
  text-decoration-thickness: 1px; text-underline-offset: 3px;
}
a:hover { color: var(--accent); }
ul { margin: 0 0 18px 1.2em; }
li { margin-bottom: 8px; max-width: 62ch; }
figure { margin: 46px 0; }
figure img {
  width: 100%; display: block; border: 1px solid var(--hairline);
  box-shadow: 0 18px 50px -26px rgba(38, 34, 26, 0.4);
}
figcaption { margin-top: 10px; }
h3 {
  font-size: 20px; line-height: 1.35; font-weight: 500; margin: 30px 0 9px;
  max-width: 34ch;
}

/* research records and paper apparatus */
.doc-meta {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px;
  border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
  padding: 13px 0; margin: 28px 0 34px;
}
.doc-meta div { min-width: 0; }
.doc-meta dt {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  color: var(--apparatus); text-transform: uppercase;
}
.doc-meta dd { margin-top: 3px; font-size: 14px; line-height: 1.35; }
.status {
  display: inline-block; border: 1px solid var(--hairline); border-radius: 2px;
  padding: 2px 6px; font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  color: var(--accent); text-transform: uppercase;
}
.abstract {
  border-left: 2px solid var(--accent); padding: 2px 0 2px 20px;
  margin: 28px 0 38px; font-size: 20px; line-height: 1.62; color: var(--ink-soft);
}
.record-list { border-top: 1px solid var(--hairline); margin: 8px 0 34px; }
.record {
  display: grid; grid-template-columns: 132px 1fr; gap: 22px;
  padding: 18px 0 19px; border-bottom: 1px solid var(--hairline);
}
.record .record-meta { font-family: var(--mono); font-size: 10.5px; line-height: 1.55;
                       letter-spacing: .06em; color: var(--apparatus); }
.record h3 { margin: 0 0 5px; max-width: none; }
.record p { margin: 0 0 7px; font-size: 16px; line-height: 1.5; color: var(--ink-soft); }
.programme { border-top: 1px solid var(--hairline); padding: 18px 0 6px; }
.programme h3 { margin-top: 0; }
.programme .question { font-size: 17px; line-height: 1.55; color: var(--ink-soft); }
.essay-number {
  display: block; margin-bottom: 3px; font-family: var(--mono); font-size: 10px;
  letter-spacing: .1em; color: var(--accent); text-transform: uppercase;
}
.essay-sequence {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px;
  margin: 64px 0 34px; border: 1px solid var(--hairline); background: var(--hairline);
}
.essay-sequence a {
  display: block; min-height: 94px; padding: 16px 18px; background: var(--paper);
  color: inherit; text-decoration: none;
}
.essay-sequence a:last-child { text-align: right; }
.essay-sequence a:hover { background: rgba(255,255,255,.35); }
.essay-sequence strong { display: block; font-weight: 500; line-height: 1.35; }
.essay-sequence .mono { display: block; margin-bottom: 5px; }
.protocol-lock {
  border: 1px solid var(--hairline); padding: 20px 22px; margin: 28px 0;
  background: rgba(255,255,255,.28);
}
.protocol-lock .mono { display: block; color: var(--accent); margin-bottom: 7px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
               gap: 1px; background: var(--hairline); border: 1px solid var(--hairline);
               margin: 24px 0 32px; }
.metric { background: var(--paper); padding: 16px; }
.metric strong { display: block; font-size: 28px; line-height: 1; font-weight: 500; }
.metric span { display: block; margin-top: 7px; font-family: var(--mono);
               color: var(--apparatus); font-size: 10px; line-height: 1.45; }
.toc-shell { margin: 30px 0 44px; }
.toc-shell > summary { display: none; }
.toc { border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
       padding: 15px 0; columns: 2; column-gap: 30px; }
.toc a { display: block; break-inside: avoid; font-family: var(--mono); font-size: 11px;
         line-height: 1.7; color: var(--apparatus); text-decoration: none; }
.toc a:hover { color: var(--accent); }
.paper-section { scroll-margin-top: 20px; }
.paper-section > p:first-of-type { font-size: 20px; line-height: 1.66; }
.definition {
  margin: 24px 0; padding: 16px 18px; border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline); font-size: 17px; color: var(--ink-soft);
}

/* evidence figures inside research publications */
.research-figure {
  width: calc(100% + 96px); margin: 46px 0 48px -48px; padding: 17px 0 16px;
  border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
}
.research-figure .figure-heading {
  display: flex; justify-content: space-between; align-items: baseline; gap: 18px;
  margin-bottom: 22px;
}
.research-figure .figure-heading span,
.research-figure .reading-label,
.research-figure .case-operation {
  font-family: var(--mono); font-size: 10px; line-height: 1.4; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent);
}
.research-figure .figure-heading strong {
  font-size: 20px; line-height: 1.3; font-weight: 500; text-align: right;
}
.research-figure figcaption {
  margin: 16px 0 0; max-width: 76ch; font-family: var(--mono); font-size: 10.5px;
  line-height: 1.55; letter-spacing: .015em; color: var(--apparatus);
}

.study-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--hairline); border-left: 1px solid var(--hairline);
}
.study-stats div {
  padding: 16px; border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline); min-width: 0;
}
.study-stats dt { font-size: 34px; line-height: 1; font-weight: 500; }
.study-stats dd {
  margin-top: 8px; font-family: var(--mono); font-size: 10px; line-height: 1.45;
  color: var(--apparatus); text-transform: uppercase; letter-spacing: .045em;
}

.cut-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.cut-reading { min-width: 0; }
.event-sequence {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none;
  margin: 9px 0 0; padding: 0; border-top: 1px solid var(--hairline);
}
.event-sequence li {
  position: relative; margin: 0; padding: 18px 10px 11px 0; max-width: none;
  font-size: 14px; line-height: 1.35;
}
.event-sequence li:not(:last-child)::after {
  content: "→"; position: absolute; right: 4px; top: 27px; color: var(--ink-hedged);
}
.event-sequence li::before {
  content: ""; position: absolute; top: -4px; left: 0; width: 7px; height: 7px;
  border-radius: 50%; background: var(--ink-hedged);
}
.event-sequence li.time-zero::before { background: var(--accent); box-shadow: 0 0 0 3px var(--paper); }
.event-sequence li.outside-window { opacity: .38; }
.event-sequence li span {
  display: block; margin-bottom: 4px; font-family: var(--mono); font-size: 9px;
  line-height: 1.3; letter-spacing: .06em; color: var(--apparatus); text-transform: uppercase;
}
.event-sequence li strong { display: block; font-weight: 500; }
.reading-result { margin: 9px 0 0; font-size: 15px; line-height: 1.45; color: var(--ink-soft); }

.case-clock-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px 30px; }
.case-clock { border-top: 1px solid var(--hairline); padding-top: 14px; min-width: 0; }
.case-name { display: flex; align-items: baseline; gap: 9px; }
.case-name > span { font-family: var(--mono); font-size: 10px; color: var(--accent); }
.case-name h3 { margin: 0; max-width: none; font-size: 19px; }
.case-operation { margin: 3px 0 12px 23px; color: var(--apparatus); }
.case-reading {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; padding: 7px 0;
  border-top: 1px dotted var(--hairline); font-size: 13px; line-height: 1.35;
}
.case-reading b {
  flex: 0 0 76px; font-family: var(--mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .025em; color: var(--accent); text-transform: uppercase;
}
.case-reading span { color: var(--ink-soft); }
.case-reading i { color: var(--ink-hedged); font-style: normal; }
.case-clock > p { margin: 10px 0 0; font-size: 15px; line-height: 1.48; color: var(--ink-soft); }

.carriage-case { padding: 15px 0 16px; border-top: 1px solid var(--hairline); }
.carriage-case:last-child { border-bottom: 1px solid var(--hairline); }
.carriage-case h3 { margin: 0 0 11px; max-width: none; font-size: 17px; }
.carriage-case h3 span {
  margin-left: 6px; font-family: var(--mono); font-size: 9.5px; font-weight: 400;
  letter-spacing: .04em; color: var(--apparatus); text-transform: uppercase;
}
.bar-row {
  display: grid; grid-template-columns: minmax(190px, 1.6fr) minmax(140px, 1fr) 108px;
  align-items: center; gap: 12px; margin: 8px 0;
}
.bar-label { font-size: 13.5px; line-height: 1.35; color: var(--ink-soft); }
.bar-track { height: 9px; background: rgba(109, 103, 89, .12); }
.bar-track span { display: block; width: var(--share); min-width: 3px; height: 100%; background: var(--accent); }
.bar-value {
  font-family: var(--mono); font-size: 9.5px; line-height: 1.35;
  color: var(--apparatus); text-align: right;
}

.research-table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.42; }
.research-table th, .research-table td {
  padding: 11px 10px; border-top: 1px solid var(--hairline); text-align: left;
  vertical-align: top;
}
.research-table thead th {
  font-family: var(--mono); font-size: 9px; font-weight: 500; letter-spacing: .06em;
  color: var(--apparatus); text-transform: uppercase;
}
.research-table tbody th { width: 16%; font-weight: 500; color: var(--accent); }
.research-table tbody td:nth-child(2) { width: 29%; }
.research-table tbody td:nth-child(3) { width: 16%; font-family: var(--mono); font-size: 10px; }
.research-table tbody td:nth-child(4) { color: var(--ink-soft); }

.direction-grid, .path-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px;
}
.direction-card, .path-card {
  min-width: 0; padding: 15px 16px 16px; border: 1px solid var(--hairline);
}
.annexed-card { border-top: 2px solid var(--accent); padding-top: 14px; }
.direction-flow {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 9px; margin: 17px 0 11px;
}
.direction-node {
  min-height: 66px; display: flex; align-items: center; justify-content: center;
  padding: 10px; border: 1px solid var(--hairline); font-size: 13px; line-height: 1.35;
  text-align: center; color: var(--ink-soft);
}
.direction-node.event-node { background: rgba(255, 255, 255, .38); color: var(--ink); }
.direction-link { text-align: center; color: var(--accent); }
.direction-link span {
  display: block; max-width: 80px; font-family: var(--mono); font-size: 8.5px;
  line-height: 1.3; letter-spacing: .025em; text-transform: uppercase;
}
.direction-link b { display: block; margin-top: 2px; font-size: 18px; font-weight: 400; }
.direction-return {
  display: flex; align-items: center; gap: 8px; min-height: 43px; padding: 8px 10px;
  border-top: 1px dotted var(--hairline); border-bottom: 1px dotted var(--hairline);
  color: var(--ink-soft);
}
.direction-return b { flex: 0 0 auto; font-size: 18px; font-weight: 400; color: var(--accent); }
.direction-return span { font-family: var(--mono); font-size: 9px; line-height: 1.4; }
.direction-return.imported { color: var(--apparatus); }
.direction-card > p, .path-card > p {
  margin: 13px 0 0; font-size: 14px; line-height: 1.48; color: var(--ink-soft);
}

.narrative-event {
  padding: 15px 17px; border: 1px solid var(--hairline); background: rgba(255, 255, 255, .34);
}
.narrative-event span {
  display: block; margin-bottom: 5px; font-family: var(--mono); font-size: 9px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--accent);
}
.narrative-event strong { font-size: 15px; line-height: 1.45; font-weight: 500; }
.narrative-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px;
  margin-top: 14px; background: var(--hairline); border: 1px solid var(--hairline);
}
.narrative-card {
  display: grid; grid-template-columns: 38px 1fr; align-items: baseline; gap: 9px;
  min-height: 74px; padding: 13px; background: var(--paper);
}
.narrative-card b { font-size: 26px; line-height: 1; font-weight: 500; color: var(--accent); }
.narrative-card span { font-size: 12.5px; line-height: 1.4; color: var(--ink-soft); }
.narrative-card.primary { box-shadow: inset 0 2px 0 var(--accent); }
.narrative-card.corrective { box-shadow: inset 0 2px 0 var(--ink-hedged); }

.annexation-table tbody th { width: 14%; }
.annexation-table tbody td:nth-child(2) { width: 26%; }
.annexation-table tbody td:nth-child(3) {
  width: 28%; font-family: inherit; font-size: inherit; color: var(--ink-soft);
}
.annexation-table tbody td:nth-child(4) { width: 32%; }

.path-sequence {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none;
  margin: 15px 0 0; padding: 0; border-top: 1px solid var(--hairline);
}
.path-sequence li {
  position: relative; min-width: 0; margin: 0; padding: 14px 12px 10px 0;
  font-size: 12.5px; line-height: 1.35;
}
.path-sequence li:not(:last-child)::after {
  content: "→"; position: absolute; top: 24px; right: 3px; color: var(--accent);
}
.path-sequence span {
  display: block; margin-bottom: 4px; font-family: var(--mono); font-size: 8px;
  line-height: 1.25; letter-spacing: .05em; text-transform: uppercase; color: var(--apparatus);
}
.path-sequence strong { display: block; padding-right: 9px; font-weight: 500; }

.citation {
  white-space: pre-wrap; overflow-wrap: anywhere; background: rgba(255,255,255,.35);
  border: 1px solid var(--hairline); padding: 16px; font-family: var(--mono);
  font-size: 11px; line-height: 1.55; color: var(--apparatus); margin: 18px 0;
}
.revision { border-left: 2px solid var(--hairline); padding-left: 16px; margin: 24px 0; }
.revision h3 { font-size: 18px; margin-bottom: 4px; }
.revision .mono { display: block; margin-bottom: 7px; }

/* doctrine pull-quote */
.doctrine {
  border-left: 2px solid var(--accent); padding: 4px 0 4px 20px; margin: 26px 0;
  font-size: 20px; font-style: italic; color: var(--ink-soft); max-width: 58ch;
}

/* pipeline stage grid (method) */
.stagegrid { border-top: 1px solid var(--hairline); margin: 8px 0 26px; }
.stage {
  display: grid; grid-template-columns: 128px 1fr; gap: 18px; padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
}
.stage .s {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em;
  color: var(--accent); padding-top: 4px;
}
.stage p { font-size: 16.5px; color: var(--ink-soft); margin: 0; }

/* source roster (sources) */
.roster { margin: 10px 0 30px; }
.band {
  display: grid; grid-template-columns: 110px 1fr; gap: 18px; padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
}
.band .lab { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; padding-top: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--apparatus);
  border: 1px solid var(--hairline); border-radius: 3px; padding: 3px 9px;
  background: rgba(255, 255, 255, 0.4);
}
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }

/* empty-state note */
.empty {
  border: 1px dashed var(--hairline); border-radius: 4px; padding: 26px 28px;
  color: var(--apparatus); font-family: var(--mono); font-size: 13px; margin: 26px 0;
}

@media (max-width: 900px) {
  h1 { margin-top: 48px; }
  h2 { margin-top: 52px; }
  .doc-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record { grid-template-columns: 112px 1fr; gap: 18px; }
  .research-figure { width: 100%; margin-left: 0; }
}

@media (max-width: 620px) {
  h1 { font-size: clamp(34px, 10vw, 40px); line-height: 1.08; margin: 38px 0 10px; }
  .dek { font-size: 19px; line-height: 1.45; margin-bottom: 30px; }
  h2 { margin: 46px 0 15px; font-size: 12px; line-height: 1.45; }
  h3 { font-size: 19px; }
  p { margin-bottom: 16px; }
  figure { margin: 34px 0; }
  .doctrine { padding-left: 16px; margin: 22px 0; font-size: 18px; }
  .stage, .band { grid-template-columns: 1fr; gap: 5px; }
  .stage .s, .band .lab { padding-top: 0; }
  .stage { padding: 17px 0; }
  .stage p { font-size: 16px; line-height: 1.58; }
  .band { gap: 9px; }
  .doc-meta { gap: 12px 16px; margin: 22px 0 26px; }
  .doc-meta dd { font-size: 13px; }
  .record { grid-template-columns: 1fr; gap: 5px; }
  .record h3 { font-size: 21px; }
  .abstract { border-left-width: 2px; padding-left: 16px; font-size: 18px; margin: 24px 0 32px; }
  .essay-sequence { grid-template-columns: 1fr; }
  .essay-sequence a:last-child { text-align: left; }
  .metric-grid { grid-template-columns: 1fr; }
  .toc-shell {
    position: sticky; top: 0; z-index: 35; margin: 24px 0 34px;
    background: var(--paper); border-top: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
  }
  .toc-shell > summary {
    display: block; cursor: pointer; list-style: none; padding: 10px 0;
    font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
    color: var(--accent);
  }
  .toc-shell > summary::after { content: " +"; }
  .toc-shell[open] > summary::after { content: " −"; }
  .toc-shell > summary::-webkit-details-marker { display: none; }
  .toc { columns: 1; border: 0; padding: 0 0 12px; max-height: 34dvh; overflow-y: auto; }
  .toc a { padding: 3px 0; line-height: 1.55; }
  .paper-section { scroll-margin-top: 58px; }
  .paper-section > p:first-of-type { font-size: 19px; }
  .definition { margin-inline: -16px; padding-inline: 16px; }
  .empty { padding: 20px; }
  .research-figure { margin-block: 34px 38px; padding-top: 14px; }
  .research-figure .figure-heading { align-items: flex-start; margin-bottom: 17px; }
  .research-figure .figure-heading strong { max-width: 68%; font-size: 18px; }
  .study-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .study-stats dt { font-size: 30px; }
  .cut-comparison, .case-clock-grid, .direction-grid, .path-grid { grid-template-columns: 1fr; }
  .cut-comparison { gap: 25px; }
  .event-sequence { grid-template-columns: 1fr; border-top: 0; border-left: 1px solid var(--hairline); }
  .event-sequence li { padding: 8px 0 9px 20px; }
  .event-sequence li::before { top: 15px; left: -4px; }
  .event-sequence li:not(:last-child)::after { content: "↓"; right: auto; left: 5px; top: auto; bottom: -7px; }
  .case-clock-grid { gap: 29px; }
  .case-reading b { flex-basis: 100%; }
  .bar-row { grid-template-columns: 1fr 82px; gap: 5px 10px; margin: 12px 0; }
  .bar-label { grid-column: 1 / -1; }
  .bar-value { grid-column: 2; grid-row: 2; }
  .research-table thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
  .research-table, .research-table tbody, .research-table tr,
  .research-table th, .research-table td { display: block; width: 100% !important; }
  .research-table tr { padding: 12px 0; border-top: 1px solid var(--hairline); }
  .research-table th, .research-table td { border: 0; padding: 4px 0; }
  .research-table tbody th { margin-bottom: 5px; font-size: 17px; }
  .research-table td { display: grid; grid-template-columns: 106px 1fr; gap: 10px; }
  .research-table td::before {
    content: attr(data-label); font-family: var(--mono); font-size: 8.5px;
    letter-spacing: .05em; color: var(--apparatus); text-transform: uppercase;
  }
  .narrative-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .direction-flow { gap: 6px; }
  .direction-node { min-height: 60px; padding: 8px; font-size: 12px; }
  .direction-link span { max-width: 66px; font-size: 7.5px; }
}

@media (min-width: 901px) and (max-height: 760px) {
  h1 { margin-top: 38px; }
  .dek { margin-bottom: 30px; }
  h2 { margin-top: 48px; }
  figure { margin-block: 36px; }
}

@media print {
  body { padding: 0; font-size: 11pt; background: white; }
  .masthead, footer, #progress, .pressmark { display: none !important; }
  #page { max-width: none; }
  h1 { margin-top: 0; }
  h2, h3 { break-after: avoid; }
  p, li, .record, .revision { orphans: 3; widows: 3; }
  a { color: inherit; text-decoration: none; }
}
