/* archetypos.app, version 3: the loop as the list.
   One reading column on the channel's bone ground, the banner as the opening line, then the loop
   (a film, your corrections, the next film) and the films themselves as a numbered chain.
   Colours come from the brand (brand/README.md): bone, rock and ember. Ember is deepened for text so
   it passes contrast on bone (5.7:1). Hard edges and square corners follow the banner's pixel grid.
   No scripts, no web fonts, no animation. */
:root {
  --bone: #ece4d2;
  --paper: #e4d9c2;
  --rock: #2a211c;
  --muted: #5c5144;
  --ember: #9a3608;
  --line: #cbbd9f;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --px: 3px;                         /* one cell of the banner's pixel grid */
  --gap: clamp(48px, 7vw, 72px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bone);
  color: var(--rock);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  padding-block: 0 48px;
  font-variant-numeric: tabular-nums;
}
img { max-width: 100%; }
p { margin: 0; }
a { color: var(--ember); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--rock); }
a:focus-visible, .button:focus-visible { outline: var(--px) solid var(--rock); outline-offset: var(--px); }

.skip {
  position: absolute; left: 16px; top: -64px; z-index: 1;
  background: var(--rock); color: var(--bone); padding: 10px 14px; text-decoration: none; font-weight: 600;
}
.skip:focus { top: 16px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Frame */
.hero { max-width: 750px; margin: 0 auto; padding-block: 36px 0; }
.hero img { display: block; width: 100%; height: auto; }
main, .site-footer, .legal { max-width: 40rem; margin: 0 auto; }
main { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); padding-top: 28px; }
main > * { min-width: 0; }

h2 { margin: 0 0 20px; font-size: 1.5rem; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
h3 { margin: 0; font-size: inherit; }
.note { font-size: 0.875rem; color: var(--muted); }

/* Opening */
.opening { display: grid; gap: 24px; justify-items: start; }
.lede { font-size: clamp(1.3125rem, 1.15rem + 0.7vw, 1.5rem); line-height: 1.4; font-weight: 500; letter-spacing: -0.005em; }
.button {
  display: inline-block; padding: 13px 22px; min-height: 48px;
  background: var(--rock); color: var(--bone); border: var(--px) solid var(--rock);
  font-weight: 650; text-decoration: none; line-height: 1.3;
  box-shadow: calc(var(--px) * 2) calc(var(--px) * 2) 0 var(--ember);
}
.button:hover { color: var(--bone); background: var(--ember); border-color: var(--ember); box-shadow: calc(var(--px) * 2) calc(var(--px) * 2) 0 var(--rock); }
.button:active { transform: translate(var(--px), var(--px)); box-shadow: var(--px) var(--px) 0 var(--rock); }

/* The loop: three steps, closed by a drawn return line from the last step to the first. */
.loop { display: grid; gap: 24px; }
.steps {
  list-style: none; margin: 0; padding: 0 28px 0 0; position: relative;
  display: grid; gap: 12px;
}
.steps li {
  display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: center;
  background: var(--paper); border: var(--px) solid var(--rock); padding: 12px 14px 12px 12px;
  font-weight: 600; line-height: 1.35; position: relative; z-index: 1;
}
.step-n {
  display: grid; place-items: center; width: 40px; height: 40px;
  background: var(--rock); color: var(--bone); font-weight: 700;
}
.steps li:nth-child(2) .step-n { background: var(--ember); }
/* Phone: the return line runs up the right side, from step 3 back to step 1. */
.steps::after {
  content: ""; position: absolute; right: 6px; top: 26px; bottom: 26px; width: 22px;
  border: var(--px) solid var(--rock); border-left: 0;
}
.steps::before {                      /* arrowhead at step 1, pointing into it */
  content: ""; position: absolute; right: 19px; top: 20px; z-index: 2;
  border: 7.5px solid transparent; border-left: 0; border-right: 9px solid var(--rock);
}

/* Films: a chain from the newest film back to the first. */
.chain { list-style: none; margin: 0; padding: 0; display: grid; gap: 40px; position: relative; }
.chain .entry:not(:last-child)::before {   /* the dotted line from each film down to the one before it */
  content: ""; position: absolute; left: 18px; top: 40px; bottom: -40px; width: var(--px);
  background: repeating-linear-gradient(to bottom, var(--rock) 0 var(--px), transparent var(--px) calc(var(--px) * 3));
}
.entry { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; align-items: start; position: relative; }
.node {
  display: grid; place-items: center; width: 40px; height: 40px; position: relative; z-index: 1;
  background: var(--rock); color: var(--bone); font-weight: 700; font-size: 0.9375rem;
}
.entry.latest .node { background: var(--ember); }
.node.bead { width: 14px; height: 14px; margin: 13px; }
/* The head of the chain: the figure waits beside the next film's number. */
.entry.next .node { background: transparent; color: var(--rock); border: var(--px) dashed var(--rock); }
.entry.next { align-items: end; }
.figure { display: block; line-height: 0; }
.figure img { display: block; width: 67px; height: auto; image-rendering: pixelated; }
.entry-body { display: grid; gap: 14px; min-width: 0; }
.thumb { display: block; border: var(--px) solid var(--rock); background: var(--paper); line-height: 0; }
.thumb img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.entry-text { display: grid; gap: 8px; }
.entry-title { font-size: 1.1875rem; line-height: 1.3; font-weight: 700; }
.entry-title a { color: var(--rock); text-decoration-color: var(--line); text-decoration-thickness: 2px; }
.entry-title a:hover { color: var(--ember); text-decoration-color: currentColor; }
.entry-body:hover .thumb { border-color: var(--ember); }
.entry-line { font-size: 1.0625rem; line-height: 1.55; border-left: var(--px) solid var(--ember); padding-left: 14px; }
.entry:not(.latest):not(.next) .entry-body { grid-template-columns: 7rem minmax(0, 1fr); gap: 14px; align-items: start; }
.entry:not(.latest):not(.next) .entry-title { font-size: 1.0625rem; }
.entry:not(.latest):not(.next) .entry-line { font-size: 0.9375rem; padding-left: 10px; }

/* Shorts: a row that scrolls sideways on a phone and becomes a grid on wider screens. */
.short-row {
  list-style: none; margin: 0 calc(-1 * max(20px, env(safe-area-inset-left, 0px))); padding: 0 20px 8px;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 44%); gap: 16px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 20px; overscroll-behavior-x: contain;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.short-row li { scroll-snap-align: start; min-width: 0; }
.short { display: grid; gap: 10px; color: var(--rock); text-decoration: none; }
.short img {
  display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; object-fit: cover;
  border: var(--px) solid var(--rock); background: var(--paper);
}
.short-title { font-size: 0.9375rem; font-weight: 600; line-height: 1.35; }
.short-card {
  display: block; width: 100%; aspect-ratio: 9 / 16; border: var(--px) solid var(--rock);
  background: var(--paper) url("/img/archetypos-figure.png") center / 40% auto no-repeat;
}
.short:hover img, .short:hover .short-card { border-color: var(--ember); }
.short:hover .short-title { color: var(--ember); }
.short:focus-visible { outline: var(--px) solid var(--rock); outline-offset: var(--px); }
.more { margin-top: 20px; }

/* How to help: the one request, set apart. */
.help {
  display: grid; gap: 20px; justify-items: start;
  background: var(--paper); border: var(--px) solid var(--rock); padding: 24px;
  box-shadow: calc(var(--px) * 2) calc(var(--px) * 2) 0 var(--rock);
}
.help p:first-of-type { font-size: 1.1875rem; line-height: 1.45; font-weight: 600; }

.about { display: grid; gap: 16px; }
.elsewhere ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: 12px; }
.elsewhere a { text-align: center; }
.elsewhere a {
  display: block; padding: 9px 16px; min-height: 44px; border: var(--px) solid var(--rock);
  color: var(--rock); text-decoration: none; font-weight: 600;
}
.elsewhere a:hover { background: var(--rock); color: var(--bone); }

.site-footer {
  margin-top: var(--gap); padding-top: 20px; border-top: 1px solid var(--line);
  font-size: 0.875rem; color: var(--muted); display: grid; gap: 10px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }

/* Legal pages share the column. */
.legal { padding-top: 48px; }
main.legal { display: block; }          /* the home page grid spacing is not for prose pages */
.legal h1 { margin: 0 0 16px; font-size: 1.75rem; line-height: 1.2; }
.legal h2 { margin: 28px 0 12px; font-size: 1.1875rem; }
.legal p { margin: 0 0 12px; }
.legal ul { padding-left: 20px; }
.back { display: inline-block; margin-top: 8px; }

/* Wider screens */
@media (min-width: 720px) {
  main, .site-footer { max-width: 46rem; }
  .elsewhere ul { grid-template-columns: repeat(4, max-content); }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 0 0 30px; }
  .steps li { grid-template-columns: 1fr; align-content: start; align-items: start; padding: 14px; min-height: 100%; }
  /* Desktop: the return line runs under the steps, from step 3 back to step 1. */
  .steps::after { left: 16.6%; right: 16.6%; top: auto; bottom: 6px; width: auto; height: 30px; border: var(--px) solid var(--rock); border-top: 0; }
  .steps::before { left: calc(16.6% - 6px); right: auto; top: auto; bottom: 21px; border: 7.5px solid transparent; border-top: 0; border-bottom: 9px solid var(--rock); }
  .entry:not(.latest):not(.next) .entry-body { grid-template-columns: 15rem minmax(0, 1fr); gap: 20px; }
  .entry:not(.latest):not(.next) .entry-title { font-size: 1.1875rem; }
  .entry:not(.latest):not(.next) .entry-line { font-size: 1.0625rem; padding-left: 14px; }
  .figure img { width: 100px; }
  .short-row { margin: 0; padding: 0; overflow: visible; grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-columns: auto; }
  .help { padding: 32px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } .button:active { transform: none; } }
@media (forced-colors: active) {
  .chain .entry:not(:last-child)::before { forced-color-adjust: none; background: CanvasText; }
  .steps::after { border-color: CanvasText; }
  .steps::before { forced-color-adjust: none; border-right-color: CanvasText; }
  .node, .step-n { border: 1px solid CanvasText; }
}
@media (forced-colors: active) and (min-width: 720px) { .steps::before { border-right-color: transparent; border-bottom-color: CanvasText; } }
/* The next-film head sits at the bottom of its row, so its link to the chain starts below its node. */
.chain .entry.next::before { top: 100%; bottom: auto; height: 40px; }

/* Version 4: the rules, the record, and the story told film by film. */
/* Masthead on inner pages, and the site navigation on every page. */
.masthead { max-width: 46rem; margin: 0 auto; padding-top: 28px; }
.wordmark { display: inline-flex; align-items: center; gap: 12px; color: var(--rock); text-decoration: none; font-weight: 700; font-size: 1.125rem; }
.wordmark .mark { width: 34px; height: auto; image-rendering: pixelated; }
.sitenav { max-width: 46rem; margin: 20px auto 0; }
.sitenav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sitenav a { display: inline-block; padding: 8px 14px; min-height: 44px; line-height: 1.6; border: var(--px) solid var(--rock); color: var(--rock); text-decoration: none; font-weight: 600; }
.sitenav a:hover { background: var(--rock); color: var(--bone); }
.sitenav a[aria-current="page"] { background: var(--rock); color: var(--bone); }

/* Proof: one real thing a viewer changed, under the three steps. */
.proof { background: var(--paper); border: var(--px) solid var(--rock); padding: 18px; display: grid; gap: 12px;
  box-shadow: calc(var(--px) * 2) calc(var(--px) * 2) 0 var(--ember); }
.proof-label { font-weight: 700; font-size: 1.0625rem; }

/* Items: what someone said, who, and what it did. */
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.item { display: grid; gap: 6px; }
.item-words { margin: 0; padding: 2px 0 2px 14px; border-left: var(--px) solid var(--ember); }
.item-words p { margin: 0; font-size: 1.0625rem; line-height: 1.5; font-weight: 500; }
.item-words p::before { content: "\201C"; } .item-words p::after { content: "\201D"; }
.item-said { margin: 0; padding-left: 14px; border-left: var(--px) solid var(--line); }
.item-who { margin: 0; font-size: 0.9375rem; color: var(--muted); }
.item-who a { color: var(--ember); }
.item-change { margin: 0; font-size: 0.9375rem; line-height: 1.5; }
.chip { display: inline-block; padding: 1px 8px; margin-right: 4px; font-size: 0.8125rem; font-weight: 700; border: 2px solid var(--rock); vertical-align: 1px; }
.chip.changed { background: var(--ember); border-color: var(--ember); color: var(--bone); }
.chip.open { background: var(--bone); color: var(--rock); }
.chip.parked { background: var(--paper); color: var(--rock); border-style: dashed; }
.chip.none { background: var(--rock); color: var(--bone); }
.chip.late { background: var(--rock); color: var(--bone); border-color: var(--ember); }
.prediction { display: grid; gap: 6px; padding-left: 14px; border-left: var(--px) solid var(--rock); }
.prediction-change, .prediction-claim { margin: 0; font-size: 0.9375rem; line-height: 1.5; }
.prediction-change { color: var(--muted); }

/* Each film's panels: plain HTML details, so they work without scripts. */
details.said { border-top: 1px solid var(--line); padding-top: 10px; }
details.said > summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; gap: 10px; list-style: none; }
details.said > summary::-webkit-details-marker { display: none; }
details.said > summary::before { content: "+"; display: inline-grid; place-items: center; width: 24px; height: 24px; background: var(--rock); color: var(--bone); font-weight: 700; }
details.said[open] > summary::before { content: "\2212"; }
details.said > summary:focus-visible { outline: var(--px) solid var(--rock); outline-offset: var(--px); }
details.said .items { margin: 8px 0 14px; }

/* The next film's node: the invitation. */
.next-body { display: grid; gap: 14px; }
.next-body .figure { display: block; }
.entry.next .figure img { width: 67px; }
.entry-title.plain { font-size: 1.1875rem; }
.next-body .entry-text { display: grid; gap: 12px; }

/* Questions, in plain text. */
.questions dl { margin: 0; display: grid; gap: 18px; }
.qa dt { font-weight: 700; font-size: 1.0625rem; margin-bottom: 4px; }
.qa dd { margin: 0; }

/* Inner pages: intro, contents, tally, rules, record. */
.page-intro { display: grid; gap: 16px; }
.page-intro h1 { margin: 0; font-size: clamp(2rem, 1.6rem + 2vw, 2.75rem); line-height: 1.1; letter-spacing: -0.01em; }
.sentence { font-weight: 600; border-left: var(--px) solid var(--ember); padding-left: 14px; }
.toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.toc a { font-weight: 600; }
.tally { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tally li { background: var(--paper); border: var(--px) solid var(--rock); padding: 10px 12px; font-size: 0.9375rem; }
.tally strong { display: block; font-size: 1.75rem; line-height: 1.1; }
.rule-section, .record-group { display: grid; gap: 14px; }
.rule-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rule-list li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; padding-left: 14px; border-left: var(--px) solid var(--rock); }
ul.rule-list li { grid-template-columns: minmax(0, 1fr); }
.rule-n { display: grid; place-items: center; width: 28px; height: 28px; background: var(--rock); color: var(--bone); font-weight: 700; font-size: 0.875rem; }
.record-group h3 { margin: 8px 0 0; font-size: 1.125rem; }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: var(--px);
  background: repeating-linear-gradient(to bottom, var(--rock) 0 var(--px), transparent var(--px) calc(var(--px) * 3)); }
.timeline > .item { position: relative; }
.timeline > .item::before { content: ""; position: absolute; left: -22px; top: 8px; width: 11px; height: 11px; background: var(--rock); }
.record-foot { border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 8px; font-size: 0.9375rem; color: var(--muted); }
@media (min-width: 720px) {
  .tally { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .entry.next .figure img { width: 100px; }
}
@media (forced-colors: active) { .timeline::before, .timeline > .item::before { forced-color-adjust: none; background: CanvasText; } }
/* The next film's node now carries the invitation, so it sits at the top like every film. */
.entry.next { align-items: start; }
.chain .entry.next::before { top: 40px; bottom: -40px; height: auto; }
/* Each older film's panels span the whole row, under the thumbnail and the text. */
.entry:not(.latest):not(.next) .entry-body > details.said { grid-column: 1 / -1; }
