/* Atlas recap renderer.
   One sheet, one palette. Visual Recap's restrained charcoal review surface
   with Atlas's guided step navigation on the left. */

:root {
  color-scheme: dark;

  --bg: #1c1c1b;
  --bg-deep: #171716;
  --surface: #232322;
  --surface-raised: #2a2a29;
  --surface-soft: #201f1f;
  --block-bg: #222221;
  --block-head: #292928;
  --code-bg: #1e1e1d;
  --line: #333331;
  --line-soft: #292928;

  --text: #ecebe8;
  --muted: #a4a19c;
  --quiet: #736f6b;

  --accent: #ef4b12;
  --accent-soft: rgba(239, 75, 18, 0.14);
  --green: #4bbd8b;
  --green-soft: rgba(75, 189, 139, 0.13);
  --amber: #d8ac52;
  --amber-soft: rgba(216, 172, 82, 0.13);
  --red: #e2706c;
  --red-soft: rgba(226, 112, 108, 0.13);
  --blue: #7fb0f0;

  --pin: rgba(216, 172, 82, 0.28);
  --pin-text: #e8cf7a;
  --highlight: rgba(216, 172, 82, 0.08);
  --highlight-line: rgba(216, 172, 82, 0.45);
  --diff-added: rgba(75, 189, 139, 0.1);
  --diff-removed: rgba(226, 112, 108, 0.09);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --content: 1400px;
  --rail: 246px;
  --gutter: clamp(18px, 3vw, 40px);
  --sticky-top: 0px;
  --prose: 74ch;

  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

code,
pre {
  font-family: var(--mono);
}

p {
  margin: 0 0 0.85em;
}

p:last-child {
  margin-bottom: 0;
}

.skip-link {
  position: fixed;
  left: 14px;
  top: 10px;
  z-index: 100;
  transform: translateY(-160%);
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg-deep);
  padding: 7px 11px;
  font-size: 13px;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------------------------------------------------------------- Shell */

.recap-shell {
  min-height: 100vh;
}

.recap-hero {
  width: min(var(--content), calc(100% - var(--gutter) * 2));
  margin: 0 auto;
  padding: 40px 0 24px;
}

.hero-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow,
.rail-label,
.layer-label,
.diff-side-label {
  margin: 0;
  color: var(--quiet);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-date {
  margin: 0;
  color: var(--quiet);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.recap-hero h1 {
  max-width: 24ch;
  margin: 10px 0 10px;
  font-size: clamp(25px, 3vw, 33px);
  font-weight: 660;
  letter-spacing: -0.021em;
  line-height: 1.12;
}

.recap-brief {
  max-width: var(--prose);
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

/* Facts read as one quiet metadata line, not a row of chips. */

.fact-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 18px;
}

.fact {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fact strong {
  color: var(--quiet);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.status,
.change-pill,
.method {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  width: fit-content;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-verified {
  background: var(--green-soft);
  color: var(--green);
}

.status-partial {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-blocked {
  background: var(--red-soft);
  color: var(--red);
}

.status-unknown {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

/* --------------------------------------------------------------- Layout */

.recap-layout {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 0;
  width: min(var(--content), calc(100% - var(--gutter) * 2));
  margin: 0 auto;
  padding: 0 0 96px;
}

[data-single-step] .recap-layout {
  grid-template-columns: minmax(0, 1fr);
}

[data-single-step] .step-rail {
  display: none;
}

[data-single-step] .recap-main {
  border-left: 0;
  padding-left: 0;
}

.recap-main {
  min-width: 0;
  border-left: 1px solid var(--line-soft);
  padding-left: clamp(22px, 2.6vw, 40px);
  overflow-x: clip;
}

/* -------------------------------------------------- Step rail (level 1) */

.step-rail {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100dvh;
  overflow: auto;
  padding: 22px 20px 22px 0;
  scrollbar-width: thin;
}

.step-list {
  display: grid;
  gap: 1px;
  margin-top: 10px;
}

.step-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  padding: 7px 9px;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
}

.step-index {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}

.step-text {
  min-width: 0;
}

.step-text strong {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.38;
}

.step-text small {
  display: block;
  margin-top: 1px;
  color: var(--quiet);
  font-size: 11px;
  line-height: 1.38;
}

.step-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.step-item:hover .step-text strong {
  color: var(--text);
}

.step-item.is-active {
  background: var(--surface-raised);
}

.step-item.is-active .step-index {
  background: var(--accent-soft);
  color: var(--accent);
}

.step-item.is-active .step-text strong {
  color: var(--text);
}

/* --------------------------------------------------------- Step panel */

.step-panel {
  display: none;
  scroll-margin-top: 12px;
}

.step-panel.is-active {
  display: block;
  animation: panel-in 140ms ease-out;
}

@keyframes panel-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.step-header {
  padding: 30px 0 2px;
}

.step-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.step-header h2 {
  max-width: 34ch;
  margin: 8px 0 0;
  font-size: clamp(19px, 2vw, 24px);
  font-weight: 640;
  letter-spacing: -0.016em;
  line-height: 1.2;
}

.step-lede {
  max-width: var(--prose);
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14.5px;
}

.step-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 14px;
}

.step-links a {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 550;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  white-space: nowrap;
}

.step-links a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* ------------------------------------------------------- Story panel */

/* The class is kept as the runtime's one continuous story hook. It is not a
   tab strip: only the active work-unit panel is rendered. */

.view-panel {
  display: none;
}

.view-panel.is-active {
  display: block;
}

.step-header + .view-panel {
  padding-top: 34px;
}

.step-item:focus-visible,
.step-nav button:focus-visible,
.step-links a:focus-visible,
.file-row:focus-visible,
.tree-row:focus-visible,
.endpoint-card > summary:focus-visible,
.screenshot-open:focus-visible,
.viewer-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ----------------------------------------------------------------- Brief */

.brief-outcome {
  max-width: var(--prose);
  margin-bottom: 34px;
  border-left: 2px solid var(--accent);
  padding: 1px 0 1px 16px;
}

.brief-outcome.is-plain {
  border-left: 0;
  padding-left: 0;
}

.brief-outcome > .eyebrow {
  margin-bottom: 7px;
}

.brief-outcome p {
  margin: 0 0 0.85em;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.66;
}

.brief-outcome p:last-child {
  margin-bottom: 0;
}

.brief-outcome p + p {
  color: var(--muted);
}

.brief .content-section {
  margin-bottom: 40px;
}

.brief-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
}

.brief-aside {
  display: grid;
  align-content: start;
  gap: 14px;
}

.brief-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 13px 14px;
}

.brief-card > .eyebrow {
  margin-bottom: 9px;
}

.review-steps {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.review-steps li::marker {
  color: var(--quiet);
  font-weight: 700;
}

.review-steps strong {
  color: var(--text);
  font-weight: 620;
}

/* -------------------------------------------------------------- Sections */

.content-section {
  margin-bottom: 34px;
}

.content-section:last-child {
  margin-bottom: 0;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading h3 {
  max-width: 46ch;
  margin: 4px 0 0;
  font-size: 15.5px;
  font-weight: 620;
  letter-spacing: -0.008em;
  line-height: 1.35;
}

.section-heading > p:last-child:not(.eyebrow) {
  max-width: var(--prose);
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.section-heading code {
  color: var(--blue);
  font-size: 12.5px;
}

.section-prose {
  max-width: var(--prose);
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.66;
}

.section-prose strong {
  color: var(--text);
  font-weight: 620;
}

/* ----------------------------------------------------- Shared block chrome */

.diagram-block,
.architecture-map,
.file-tree-block,
.annotated-code-block,
.diff-block,
.endpoint-card,
.model-card,
.code-block,
.review-note {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--block-bg);
}

.file-tree-block,
.annotated-code-block,
.diff-block,
.endpoint-card,
.code-block {
  overflow: hidden;
}

.file-tree-block > header,
.annotated-code-block > header,
.diff-block > header,
.code-block > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 38px;
  border-bottom: 1px solid var(--line);
  background: var(--block-head);
  padding: 8px 13px;
}

.file-tree-block > header strong,
.diff-block > header strong,
.code-block > header strong {
  font-size: 12.5px;
  font-weight: 620;
}

.file-tree-block > header span,
.annotated-code-block > header span,
.diff-block > header span,
.code-block > header span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.annotated-code-block > header code,
.diff-block > header code,
.code-block > header code {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11.5px;
}

/* --------------------------------------------------------------- Diagrams */

.diagram-block {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.diagram-block .mermaid {
  margin: 0;
  overflow-x: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: pre;
}

.diagram-block .mermaid svg {
  display: block;
  margin-inline: auto;
  max-width: 100%;
  height: auto;
}

/* The compact brief diagram is capped so a small graph is not a large empty
   panel. Mermaid's own inline max-width sizes the svg; the container scrolls
   when the graph needs more room than the panel has. */

.diagram-block.is-compact {
  max-width: 880px;
  min-height: 180px;
  align-content: center;
  padding: 18px;
}

.diagram-block.is-compact .mermaid {
  width: 100%;
}

/* An exported diagram (tldraw, Figma, Excalidraw) is a plain local image. */

.diagram-image {
  display: block;
  width: 100%;
  max-width: 900px;
  height: auto;
  margin-inline: auto;
  border-radius: var(--radius-sm);
}

.block-caption {
  max-width: var(--prose);
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.architecture-map {
  display: grid;
  gap: 6px;
  padding: 16px;
}

.architecture-layer {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.layer-label {
  padding-top: 7px;
}

.architecture-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.architecture-node {
  flex: 1 1 180px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 9px 11px;
}

.architecture-node.accent {
  border-color: rgba(239, 75, 18, 0.4);
  background: var(--accent-soft);
}

.architecture-node strong {
  display: block;
  font-size: 12.5px;
  font-weight: 620;
}

.architecture-node span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.architecture-arrow {
  padding-left: 86px;
  color: var(--quiet);
  font-size: 13px;
}

/* ------------------------------------------------------------- Flow strip */

.flow-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.flow-strip article {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 13px;
}

.flow-strip article > span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-bottom: 7px;
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}

.flow-strip strong {
  display: block;
  font-size: 12.5px;
  font-weight: 620;
}

.flow-strip small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.flow-strip > i {
  color: var(--quiet);
  font-size: 13px;
  font-style: normal;
}

/* --------------------------------------------------- Decisions, validation */

.decision-list,
.validation-list {
  display: grid;
  gap: 1px;
}

.decision-list article {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: start;
  gap: 11px;
  border-top: 1px solid var(--line-soft);
  padding: 12px 2px;
}

.decision-list article:last-child {
  border-bottom: 1px solid var(--line-soft);
}

.decision-list article > span {
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.7;
}

.decision-list p {
  max-width: var(--prose);
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.decision-list.is-journey article > div {
  max-width: var(--prose);
}

.decision-list.is-journey h5 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 620;
}

.decision-list.is-journey dl {
  display: grid;
  gap: 3px;
  margin: 0;
}

.decision-list.is-journey dl > div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
}

.decision-list.is-journey dt {
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
}

.decision-list.is-journey dd {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.decision-list.is-journey .journey-gap dt {
  color: var(--amber);
}

.decision-list.is-journey .journey-gap dd {
  color: var(--text);
}

.decision-list.is-journey [data-surface="api"] > span {
  color: var(--amber);
}

.validation-list article {
  display: grid;
  grid-template-columns: 74px 150px minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
  border-top: 1px solid var(--line-soft);
  padding: 11px 2px;
}

.validation-list article:last-child {
  border-bottom: 1px solid var(--line-soft);
}

.validation-list strong {
  font-size: 13px;
  font-weight: 620;
}

.validation-list p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* ----------------------------------------------------------- Screenshots */

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: start;
  gap: 14px;
}

.screenshot-card {
  display: grid;
  gap: 8px;
  margin: 0;
}

.screenshot-open {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 0;
  overflow: hidden;
  cursor: zoom-in;
}

.screenshot-open img {
  display: block;
  width: 100%;
  height: auto;
}

.screenshot-placeholder {
  display: grid;
  place-items: center;
  min-height: 190px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--quiet);
  font-size: 12px;
}

.screenshot-placeholder.mobile {
  min-height: 300px;
  max-width: 230px;
}

.screenshot-card.is-portrait .screenshot-open {
  max-width: 300px;
}

.screenshot-card.is-mockup .screenshot-open {
  border-style: dashed;
}

.screenshot-card figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.screenshot-card figcaption strong {
  font-size: 12.5px;
  font-weight: 620;
}

.screenshot-card figcaption span {
  color: var(--quiet);
  font-size: 11.5px;
  text-align: right;
}

/* ------------------------------------------------------------- API surface */

.endpoint-card {
  padding: 0;
}

.endpoint-card + .endpoint-card {
  margin-top: 10px;
}

.endpoint-card > header,
.endpoint-card > summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  min-height: 44px;
  background: var(--block-head);
  padding: 9px 13px;
}

.endpoint-card > summary {
  cursor: pointer;
  list-style: none;
}

.endpoint-card > summary::-webkit-details-marker {
  display: none;
}

.endpoint-chevron {
  color: var(--quiet);
  font-size: 18px;
  line-height: 1;
  transition: transform 130ms ease;
}

.endpoint-card[open] .endpoint-chevron {
  transform: rotate(90deg);
}

.endpoint-card summary code,
.endpoint-card header code {
  overflow-wrap: anywhere;
  color: var(--blue);
  font-size: 12px;
  font-weight: 620;
}

.endpoint-summary {
  color: var(--muted);
  font-size: 12px;
}

.method {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-family: var(--mono);
}

.method-get {
  background: rgba(127, 176, 240, 0.14);
  color: var(--blue);
}

.method-post {
  background: var(--green-soft);
  color: var(--green);
}

.method-put {
  background: var(--amber-soft);
  color: var(--amber);
}

.method-delete {
  background: var(--red-soft);
  color: var(--red);
}

.change-pill {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.change-added .change-pill {
  background: var(--green-soft);
  color: var(--green);
}

.change-removed .change-pill {
  background: var(--red-soft);
  color: var(--red);
}

.endpoint-body {
  border-top: 1px solid var(--line);
  padding: 14px 15px 15px;
}

.endpoint-body > p {
  max-width: var(--prose);
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13.5px;
}

.contract-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--quiet);
  font-size: 11.5px;
}

.contract-flow span:nth-child(odd) {
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted);
  padding: 4px 8px;
}

/* -------------------------------------------------------------- Data model */

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.model-card {
  overflow: hidden;
  padding: 0;
}

.model-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--block-head);
  padding: 9px 13px;
  font-family: var(--mono);
  font-size: 12px;
}

.model-card dl {
  margin: 0;
  padding: 4px 0;
}

.model-card dl > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 10px;
  padding: 6px 13px;
}

.model-card dl > div + div {
  border-top: 1px solid var(--line-soft);
}

.model-card dt {
  color: var(--text);
  font-family: var(--mono);
  font-size: 11.5px;
}

.model-card dd {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

/* --------------------------------------------------------------- File maps */

.file-map {
  display: grid;
  gap: 16px;
}

.file-group h4 {
  margin: 0 0 6px;
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
}

.file-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  padding: 6px 8px;
  text-align: left;
  cursor: copy;
}

.file-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.file-row code {
  overflow-wrap: anywhere;
  color: var(--blue);
  font-size: 11.5px;
}

.file-row > span:last-child {
  color: var(--muted);
  font-size: 11.5px;
}

.change-mark {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
}

.change-mark.added {
  background: var(--green-soft);
  color: var(--green);
}

.change-mark.modified {
  background: var(--amber-soft);
  color: var(--amber);
}

.change-mark.deleted,
.change-mark.removed {
  background: var(--red-soft);
  color: var(--red);
}

.change-mark.renamed {
  background: rgba(127, 176, 240, 0.16);
  color: var(--blue);
}

/* -------------------------------------------------------------- File tree */

.tree-body {
  padding: 5px 0 8px;
}

.tree-row {
  display: grid;
  grid-template-columns: 16px 18px minmax(140px, auto) 20px minmax(180px, max-content) minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 29px;
  border: 0;
  background: transparent;
  padding: 2px 14px;
  color: var(--text);
  text-align: left;
}

button.tree-row {
  cursor: pointer;
}

button.tree-row:hover {
  background: rgba(255, 255, 255, 0.032);
}

.tree-row.depth-1 {
  padding-left: 30px;
}

.tree-row.depth-2 {
  padding-left: 46px;
}

.tree-chevron,
.tree-folder-icon,
.tree-file-icon,
.tree-spacer {
  display: inline-grid;
  place-items: center;
  color: var(--quiet);
  font-size: 12px;
}

.tree-folder strong {
  grid-column: 3 / -1;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
}

.tree-file code {
  grid-column: 3;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--blue);
  font-size: 11.5px;
  font-weight: 600;
}

.tree-file .change-mark {
  grid-column: 4;
}

.tree-note {
  grid-column: 5;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

/* -------------------------------------------------------- Code and diffs */

.annotated-code-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(230px, 0.62fr);
  background: var(--code-bg);
}

/* The frame owns collapsing, so the author can keep one source line per
   `.code-line` span. `white-space: normal` here drops the newline between
   spans that `pre` would otherwise render as a blank line. */

.code-frame,
.code-frame > code {
  white-space: normal;
}

.code-block pre,
.code-block pre > code {
  white-space: pre;
}

.code-frame,
.code-block pre {
  min-width: 0;
  overflow-x: auto;
  margin: 0;
  padding: 7px 0;
  background: var(--code-bg);
  color: #dcd9d4;
  font-size: 12.5px;
  line-height: 1.42;
  tab-size: 2;
}

.code-frame {
  border-right: 1px solid var(--line);
}

.code-frame > code,
.code-block pre > code {
  display: block;
  min-width: max-content;
}

.code-line {
  display: block;
  padding-right: 16px;
  white-space: pre;
}

.code-line.is-annotated {
  background: var(--highlight);
  box-shadow: inset 2px 0 var(--highlight-line);
}

.code-line.is-removed {
  background: var(--diff-removed);
  box-shadow: inset 2px 0 var(--red);
}

.code-line.is-added {
  background: var(--diff-added);
  box-shadow: inset 2px 0 var(--green);
}

.code-line.is-empty {
  background: rgba(255, 255, 255, 0.018);
}

.line-number {
  display: inline-block;
  width: 36px;
  padding-right: 10px;
  color: #5f5c58;
  font-variant-numeric: tabular-nums;
  text-align: right;
  user-select: none;
}

.annotation-pin,
.annotation-gutter {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 6px;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
  vertical-align: text-bottom;
}

.annotation-pin {
  background: var(--pin);
  color: var(--pin-text);
}

.annotation-list {
  display: grid;
  align-content: start;
  gap: 12px;
  margin: 0;
  border-left: 1px solid var(--line);
  background: var(--block-bg);
  padding: 16px;
  list-style: none;
}

.annotation-list li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
}

.annotation-list li > span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 3px;
  background: var(--pin);
  color: var(--pin-text);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 800;
}

.annotation-list p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.58;
}

.annotation-list strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
  font-weight: 620;
}

/* Notes qualify the block they sit in, so they render as that block's footer
   rather than as a bullet list floating in the section. */

.code-notes {
  display: grid;
  gap: 6px;
  margin: 0;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 10px 16px 11px 34px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.code-notes li::marker {
  color: var(--quiet);
}

.code-notes code {
  color: var(--blue);
  font-size: 11.5px;
}

/* Split diff. Reuses the code frame so both read with the same rhythm. */

.diff-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--code-bg);
}

.diff-block[data-mode="unified"] .diff-split {
  grid-template-columns: minmax(0, 1fr);
}

.diff-side {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.diff-side + .diff-side {
  border-left: 1px solid var(--line);
}

.diff-side-label {
  border-bottom: 1px solid var(--line-soft);
  background: var(--block-head);
  padding: 6px 14px;
}

.diff-side .code-frame {
  border-right: 0;
}

.tok-keyword { color: #e2818c; }
.tok-string { color: #6fcfa2; }
.tok-prop { color: #7fb0f0; }
.tok-call { color: #bda3ea; }
.tok-type { color: #d9bc78; }
.tok-comment { color: #6d6a66; font-style: italic; }

/* ------------------------------------------------- Review notes, invariants */

.review-note {
  max-width: var(--prose);
  border-color: var(--line-soft);
  background: var(--surface-soft);
  padding: 12px 15px;
}

.review-note strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
  font-weight: 620;
}

.review-note p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.review-note code {
  color: var(--blue);
  font-size: 11.5px;
}

/* A risk keeps the amber signal in a 2px rule and the faintest wash, so a
   review with several of them still reads as prose and not as warning boxes. */

.review-note.risk {
  border-left: 2px solid var(--amber);
  background: rgba(216, 172, 82, 0.05);
}

/* Invariants are claims, not boxes: one sparse hairline list, key then claim. */

.invariant-list {
  display: grid;
  max-width: var(--prose);
  margin: 0;
  padding: 0;
  list-style: none;
}

.invariant-list li {
  display: grid;
  grid-template-columns: minmax(0, 0.42fr) minmax(0, 1fr);
  align-items: baseline;
  gap: 3px 18px;
  border-top: 1px solid var(--line-soft);
  padding: 9px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.56;
}

.invariant-list li:last-child {
  border-bottom: 1px solid var(--line-soft);
}

/* The chapter separator already closes the list when it ends a chapter. */

.review-chapter > .invariant-list:last-child li:last-child {
  border-bottom: 0;
}

.invariant-list strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 620;
}

.invariant-list code {
  color: var(--blue);
  font-size: 11.5px;
}

/* ------------------------------------------------------- Review document */

.review-doc {
  max-width: 1020px;
}

.review-doc .diagram-block {
  margin: 0;
}

.review-lede {
  max-width: var(--prose);
  margin: 0 0 30px;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.68;
}

.review-lede p + p {
  color: var(--muted);
}

/* One hairline per chapter boundary carries the rhythm; the spacing does the
   rest, so a seven-chapter review never turns into seven framed cards. */

.review-chapter {
  scroll-margin-top: 12px;
}

.review-chapter + .review-chapter {
  margin-top: 34px;
  border-top: 1px solid var(--line-soft);
  padding-top: 30px;
}

.review-chapter > * + * {
  margin-top: 14px;
}

.chapter-head {
  display: grid;
  gap: 4px;
}

.chapter-head .eyebrow {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.chapter-head .chapter-ordinal {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 800;
}

.chapter-head h4 {
  max-width: 52ch;
  margin: 0;
  font-size: 16px;
  font-weight: 620;
  letter-spacing: -0.011em;
  line-height: 1.32;
}

.chapter-prose {
  max-width: var(--prose);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.68;
}

.chapter-prose p:last-child {
  margin-bottom: 0;
}

.chapter-prose strong {
  color: var(--text);
  font-weight: 620;
}

.chapter-prose code {
  color: var(--blue);
  font-size: 12.5px;
}

.review-doc .annotated-code-block,
.review-doc .diff-block,
.review-doc .review-note,
.review-doc .invariant-list,
.review-doc .code-block {
  max-width: 100%;
}

/* Comments stay readable in the main review column instead of collapsing to a
   sliver. */

.review-doc .annotated-code-layout {
  grid-template-columns: minmax(0, 1.55fr) minmax(268px, 0.66fr);
}

/* A capture inside a chapter supports the prose; it does not become the page. */

.review-doc .screenshot-card {
  max-width: 720px;
}

.review-doc .screenshot-card.is-portrait {
  max-width: 320px;
}

/* -------------------------------------------------------------- Step nav */

/* Previous and next are navigation, not content. A single hairline and a wide
   gap above it keep them clear of the last section's notes. */

.step-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  margin-top: 72px;
  border-top: 1px solid var(--line-soft);
}

.step-nav[hidden] {
  display: none;
}

.step-nav button {
  border: 0;
  background: transparent;
  padding: 17px 16px 17px 0;
  text-align: left;
  cursor: pointer;
}

.step-nav button + button {
  border-left: 1px solid var(--line-soft);
  padding-right: 0;
  padding-left: 18px;
}

.step-nav button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.022);
}

.step-nav button:disabled {
  cursor: default;
  opacity: 0.42;
}

.step-nav button:last-child {
  text-align: right;
}

.step-nav small {
  display: block;
  color: var(--quiet);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.step-nav strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
}

/* ------------------------------------------------------------ Image viewer */

.image-viewer {
  width: min(1180px, calc(100vw - 40px));
  max-width: none;
  max-height: calc(100dvh - 40px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  color: var(--text);
}

.image-viewer::backdrop {
  background: rgba(12, 12, 11, 0.72);
}

.image-viewer img {
  display: block;
  width: 100%;
  max-height: calc(100dvh - 120px);
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.image-viewer p {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 12.5px;
}

.viewer-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

/* -------------------------------------------------------------- Copy toast */

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 80;
  transform: translate(-50%, 14px);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-raised);
  padding: 7px 14px;
  color: var(--text);
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}

.copy-toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* ------------------------------------------------------------- Responsive */

@media (max-width: 1040px) {
  .annotated-code-layout,
  .review-doc .annotated-code-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .code-frame {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .annotation-list {
    border-left: 0;
  }
}

/* Below this width the step rail becomes a contained horizontal scroller. */

@media (max-width: 900px) {
  :root {
    --sticky-top: 47px;
  }

  .recap-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .recap-main {
    border-left: 0;
    padding-left: 0;
  }

  .step-rail {
    position: sticky;
    top: 0;
    z-index: 24;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0 calc(var(--gutter) * -1);
    border-bottom: 1px solid var(--line-soft);
    padding: 8px var(--gutter);
    background: var(--bg);
    scrollbar-width: none;
  }

  .step-rail::-webkit-scrollbar {
    display: none;
  }

  .step-rail .rail-label {
    display: none;
  }

  .step-list {
    display: flex;
    gap: 3px;
    width: max-content;
    margin: 0;
  }

  .step-item {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    width: auto;
    padding: 5px 9px 5px 7px;
    white-space: nowrap;
  }

  .step-text strong {
    max-width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .step-text small {
    display: none;
  }

  .step-header {
    padding-top: 24px;
  }

  .brief-columns,
  .flow-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-strip > i {
    justify-self: center;
    transform: rotate(90deg);
  }

  .diff-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .diff-side + .diff-side {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .validation-list article {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .validation-list p {
    grid-column: 2;
  }

  .review-chapter + .review-chapter {
    margin-top: 28px;
    padding-top: 24px;
  }
}

@media (max-width: 620px) {
  body {
    min-width: 0;
  }

  .recap-hero {
    padding-top: 30px;
  }

  .recap-hero h1 {
    max-width: none;
    font-size: 25px;
  }

  .recap-layout {
    padding-bottom: 64px;
  }

  .step-text strong {
    max-width: 168px;
  }

  .architecture-layer {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .layer-label {
    padding-top: 0;
  }

  .architecture-arrow {
    padding-left: 0;
    text-align: center;
  }

  .diagram-block.is-compact {
    min-height: 150px;
    padding: 14px;
  }

  .model-card dl > div,
  .validation-list article {
    grid-template-columns: minmax(0, 1fr);
  }

  .decision-list.is-journey dl > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .decision-list.is-journey dt {
    margin-top: 5px;
  }

  .decision-list.is-journey dd {
    margin-bottom: 3px;
  }

  .validation-list p {
    grid-column: 1;
  }

  .screenshot-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .screenshot-card figcaption {
    align-items: flex-start;
    flex-direction: column;
    gap: 1px;
  }

  .screenshot-card figcaption span {
    text-align: left;
  }

  .tree-row {
    grid-template-columns: 16px 18px minmax(0, 1fr) 20px auto;
    align-items: baseline;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .tree-note {
    grid-row: 2;
    grid-column: 3 / -1;
  }

  .tree-row.depth-1 {
    padding-left: 20px;
  }

  .tree-row.depth-2 {
    padding-left: 32px;
  }

  .step-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .step-nav button:last-child {
    text-align: left;
  }

  .invariant-list li {
    grid-template-columns: minmax(0, 1fr);
  }

  .chapter-head h4 {
    font-size: 15.5px;
  }

  .step-nav button,
  .step-nav button + button {
    padding: 14px 0;
  }

  .step-nav button + button {
    border-top: 1px solid var(--line-soft);
    border-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------ Source peek */

/* Optional evidence only. A tree row opens one file's change beside the
   story; the story itself never moves into this panel. */

.source-peek-cue {
  grid-column: 6;
  justify-self: end;
  color: var(--quiet);
  font-size: 11px;
  font-weight: 620;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 120ms ease;
}

.tree-row:hover .source-peek-cue,
.tree-row:focus-visible .source-peek-cue,
.tree-row.is-peeking .source-peek-cue {
  color: var(--accent);
  opacity: 1;
}

.tree-row.is-peeking {
  background: rgba(255, 255, 255, 0.032);
  box-shadow: inset 2px 0 var(--accent);
}

.source-peek {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(760px, 100vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  padding: 0;
  color: var(--text);
  overflow: hidden;
}

.source-peek[open] {
  animation: source-peek-in 170ms ease-out;
}

@keyframes source-peek-in {
  from {
    transform: translateX(18px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.source-peek::backdrop {
  background: rgba(12, 12, 11, 0.42);
}

.source-peek-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
}

.source-peek-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--block-head);
  padding: 16px 20px 14px;
}

.source-peek-heading {
  min-width: 0;
}

.source-peek-heading .eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
}

.source-peek-heading .change-mark:empty {
  display: none;
}

.source-peek-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.source-peek-title code {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12.5px;
}

.source-peek-meta {
  margin: 5px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
}

.source-peek-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 6px;
}

.source-peek-action {
  display: inline-flex;
  align-items: center;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  padding: 0 10px;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.source-peek-action[hidden] {
  display: none;
}

.source-peek-action:hover {
  border-color: var(--quiet);
  color: var(--accent);
}

.source-peek-action.is-done {
  border-color: rgba(75, 189, 139, 0.4);
  color: var(--green);
}

.source-peek-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.source-peek-close:hover {
  color: var(--accent);
}

.source-peek-action:focus-visible,
.source-peek-close:focus-visible,
.source-peek-more:focus-visible,
.source-peek-story a:focus-visible,
.source-peek-details > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.source-peek-body {
  display: grid;
  /* Rows must size to their content. The body has a definite height, and a
     code section clips with `overflow: hidden`, so an `auto` row would treat
     that section as zero-height, stretch it to the leftover space, and clip
     the code frame instead of letting this body scroll. */
  grid-auto-rows: max-content;
  gap: 18px;
  align-content: start;
  overflow: auto;
  padding: 18px 20px 32px;
  scrollbar-gutter: stable;
}

/* The body takes focus on open so arrow keys scroll the code at once; the
   panel frame is the visible boundary, so no extra ring. */

.source-peek-body:focus {
  outline: none;
}

.source-peek-section .eyebrow {
  margin: 0 0 5px;
}

.source-peek-section p {
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.source-peek-section p strong {
  color: var(--text);
  font-weight: 600;
}

.source-peek-story ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-peek-story a {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: baseline;
  gap: 6px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 7px 11px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 550;
  text-decoration: none;
}

.source-peek-story a:hover {
  border-color: var(--line);
  color: var(--accent);
}

.source-peek-story a > span:first-child {
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
}

.source-peek-story a small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 450;
}

.source-peek-code {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--block-bg);
  overflow: hidden;
}

.source-peek-code > header,
.source-peek-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 38px;
  border-bottom: 1px solid var(--line);
  background: var(--block-head);
  padding: 8px 13px;
}

.source-peek-code > header strong,
.source-peek-details > summary strong {
  font-size: 12.5px;
  font-weight: 620;
}

.source-peek-code > header span,
.source-peek-details > summary span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.source-peek-details > summary {
  list-style: none;
  cursor: pointer;
}

.source-peek-details > summary::-webkit-details-marker {
  display: none;
}

.source-peek-details:not([open]) > summary {
  border-bottom: 0;
}

.source-peek-details > summary strong::before {
  content: '›';
  display: inline-block;
  width: 12px;
  color: var(--quiet);
  transition: transform 120ms ease;
}

.source-peek-details[open] > summary strong::before {
  transform: rotate(90deg);
}

.source-peek-code .code-frame {
  border-right: 0;
}

.source-peek-sign {
  display: inline-block;
  width: 16px;
  color: var(--quiet);
  text-align: center;
  user-select: none;
}

.code-line.is-added .source-peek-sign {
  color: var(--green);
}

.code-line.is-removed .source-peek-sign {
  color: var(--red);
}

.code-line.source-peek-hunk {
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--quiet);
  font-style: italic;
}

.code-line.source-peek-hunk:first-child {
  margin-top: 0;
}

.source-peek-more {
  display: block;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--block-head);
  padding: 9px 13px;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 550;
  text-align: center;
  cursor: pointer;
}

.source-peek-more:hover {
  color: var(--accent);
}

.source-peek-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.source-peek-empty strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 620;
}

.source-peek-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

/* A story link lands on its topic and marks it briefly so the eye finds it. */

.review-chapter.is-peek-target {
  animation: peek-target 1600ms ease-out;
}

.review-chapter:focus {
  outline: none;
}

@keyframes peek-target {
  from {
    box-shadow: -12px 0 0 -10px var(--accent);
  }
  to {
    box-shadow: -12px 0 0 -10px transparent;
  }
}

@media (max-width: 900px) {
  .source-peek-cue {
    opacity: 1;
  }

  .source-peek {
    inset: auto 0 0 0;
    width: 100vw;
    height: min(88dvh, 100%);
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  @keyframes source-peek-in {
    from {
      transform: translateY(18px);
      opacity: 0;
    }
    to {
      transform: none;
      opacity: 1;
    }
  }

  .source-peek-head {
    flex-wrap: wrap;
    padding: 14px 16px 12px;
  }

  .source-peek-actions {
    order: -1;
    width: 100%;
    justify-content: flex-end;
  }

  .source-peek-body {
    padding: 16px 16px 28px;
  }
}

/* At 620px the tree row loses its sixth column and the note drops to a second
   row, so the cue takes the trailing cell of the first row instead. */

@media (max-width: 620px) {
  .source-peek-cue {
    grid-row: 1;
    grid-column: 5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .source-peek[open],
  .review-chapter.is-peek-target {
    animation: none;
  }

  .source-peek-cue,
  .source-peek-details > summary strong::before {
    transition: none;
  }
}
