/* Code Review page. The product is the page: real screenshots in browser
   frames, one click-through walkthrough of a single PR as the centrepiece.

   Everything is prefixed cr- so nothing here can leak onto another page, and
   every colour is a token. The blast-radius canvas and the closing band are
   dark on purpose; they stamp data-theme="dark" on themselves rather than
   carry a second palette (DESIGN.md, "Theme is opt-in per container"). */

.cr-eyebrow { font-family: var(--font-mono); font-size: var(--size-eyebrow); font-weight: var(--weight-bold); letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--text-muted); }
.cr-h2 { font-size: clamp(30px, 3.4vw, 48px); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-display); line-height: var(--leading-tight); color: var(--text-primary); text-wrap: balance; }
.cr-h3 { font-size: var(--size-ui); font-weight: var(--weight-semibold); line-height: var(--leading-snug); color: var(--text-primary); }
.cr-lede { font: var(--type-lead); color: var(--text-muted); }
.cr-muted { color: var(--text-muted); }
.cr-sec { position: relative; padding: var(--pad) 0; background: var(--surface-page); border-top: 1px solid var(--border-subtle); }
.cr-head { display: grid; gap: var(--space-4); margin-bottom: var(--space-12); }
.cr code, .cr-flow code { font-family: var(--font-mono); font-size: .86em; background: var(--surface-wash); padding: .08em .35em; border-radius: var(--radius-xs); }

/* browser frame around a screenshot */
.cr-frame { background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-panel); }
.cr-bar { display: flex; align-items: baseline; gap: var(--space-2); padding: 8px 14px; border-bottom: 1px solid var(--border-subtle); background: var(--surface-page); }
.cr-name { flex: none; font-size: var(--size-caption); font-weight: var(--weight-medium); color: var(--text-primary); }
.cr-desc { min-width: 0; font-size: var(--size-caption); color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-shot { position: relative; display: block; line-height: 0; background: var(--surface-card); }
.cr-shot img { width: 100%; height: auto; display: block; }

/* setup */
.cr-setup { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border-subtle); }
.cr-setup > li { padding: var(--space-6) var(--space-6) 0 0; display: grid; gap: var(--space-2); align-content: start; }
.cr-setup .cr-eyebrow { color: var(--accent); }
.cr-setup p { color: var(--text-muted); max-width: 40ch; }
@media (max-width: 760px) { .cr-setup { grid-template-columns: 1fr; } .cr-setup > li { padding-right: 0; } }

/* walkthrough */
.cr-walk { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--space-9); align-items: start; }
.cr-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; position: sticky; top: calc(var(--nav-h) + var(--space-3)); }
.cr-steps button { width: 100%; display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; text-align: left; padding: var(--space-3); border: 1px solid transparent; border-radius: var(--radius-md); background: transparent; color: var(--text-primary); font: inherit; cursor: pointer; transition: background .2s var(--ease-niro), border-color .2s var(--ease-niro); }
.cr-steps button:hover { border-color: var(--accent-hairline); }
.cr-steps .n { font-family: var(--font-mono); font-size: var(--size-micro); color: var(--text-muted); padding-top: 2px; }
.cr-steps b { display: block; font-size: var(--size-body); font-weight: var(--weight-semibold); line-height: 1.35; }
.cr-steps small { display: block; color: var(--text-muted); font-size: var(--size-micro); font-family: var(--font-mono); margin-top: 2px; }
.cr-steps button[aria-selected="true"] { background: var(--surface-card); border-color: var(--border-subtle); }
.cr-steps button[aria-selected="true"] .n { color: var(--accent); }
.cr-track.is-scrolly .cr-walk { position: sticky; top: calc(var(--nav-h) + var(--space-4)); }
.cr-track.is-scrolly .cr-steps { position: static; }
.cr-steps button { position: relative; }
.cr-steps button[aria-selected="true"]::after { content: ""; position: absolute; left: var(--space-3); right: var(--space-3); bottom: 5px; height: 2px; border-radius: 2px; background: var(--accent); transform: scaleX(var(--p, 0)); transform-origin: left; }
#cr-shot { overflow: hidden; transition: height .3s var(--ease-niro); }
.cr-layer { position: absolute; left: 0; top: 0; width: 100%; opacity: 0; transition: opacity .3s var(--ease-niro); }
.cr-layer.on { opacity: 1; z-index: 1; }
.cr-swap { animation: cr-in .3s var(--ease-niro); }
@keyframes cr-in { from { opacity: 0; transform: translateY(4px); } }
.cr-stage { display: grid; gap: var(--space-5); min-width: 0; }
.cr-cap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-4); align-items: end; }
.cr-cap h3 { font-size: var(--size-label-lg); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-heading); color: var(--text-primary); }
.cr-cap p { color: var(--text-muted); margin-top: 6px; max-width: 62ch; }
.cr-pager { display: flex; gap: 6px; align-items: center; font-family: var(--font-mono); font-size: var(--size-micro); color: var(--text-muted); }
.cr-pager button { width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); background: var(--surface-card); color: var(--text-primary); cursor: pointer; transition: border-color .2s var(--ease-niro); }
.cr-pager button:hover:not(:disabled) { border-color: var(--accent); }
.cr-pager button:disabled { opacity: .35; cursor: default; }
/* outline only: the active note draws a padded box with a soft halo, nothing
   else touches the screenshot. Padding keeps the stroke off the text. */
.cr-box { position: absolute; margin: -6px 0 0 -6px; padding: 6px; box-sizing: content-box; border: 2px solid var(--accent); border-radius: var(--radius-sm); box-shadow: 0 0 0 4px var(--accent-soft); pointer-events: none; transition: left .3s var(--ease-niro), top .3s var(--ease-niro), width .3s var(--ease-niro), height .3s var(--ease-niro); }
.cr-box.snap { transition: none; }
.cr-notes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.cr-notes button { width: 100%; text-align: left; padding: var(--space-3) 14px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-card); color: var(--text-primary); font: inherit; font-size: var(--size-caption); line-height: 1.45; cursor: pointer; transition: border-color .2s var(--ease-niro); }
.cr-notes button[aria-pressed="true"] { border-color: var(--accent); }
@media (max-width: 960px) {
  .cr-walk { grid-template-columns: 1fr; gap: var(--space-6); }
  .cr-steps { position: static; display: flex; overflow-x: auto; gap: 6px; padding-bottom: 6px; }
  .cr-steps li { flex: 0 0 auto; }
  .cr-steps button { width: 220px; }
}
@media (max-width: 640px) { .cr-cap { grid-template-columns: 1fr; } }

/* blast radius: a dark canvas, change on the left, what still depends on it in
   the middle, where it lands on the right. Wires are drawn by the controller. */
.cr-flow { position: relative; border-radius: var(--radius-2xl); overflow: hidden; color: var(--text-primary); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-panel);
  background: var(--term); }
.cr-flow-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cr-flow-svg .arc { fill: none; stroke: var(--border-subtle); stroke-width: 1; }
.cr-flow-svg .arc.a1 { stroke: color-mix(in srgb, var(--status-error) 22%, transparent); }
.cr-flow-svg .wire { fill: none; stroke: var(--border-strong); stroke-width: 1.6; }
.cr-flow-svg .pulse { fill: none; stroke: var(--status-error); stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 6 14; animation: cr-dash 1.1s var(--ease-linear) infinite; opacity: 0; transition: opacity .3s var(--ease-niro); }
.cr-flow-svg .pulse.on { opacity: 1; }
@keyframes cr-dash { to { stroke-dashoffset: -20; } }
.cr-flow-head, .cr-flow-grid { position: relative; display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 80px; align-items: center; }
.cr-flow-head { padding: var(--space-6) 28px 0; }
.cr-flow-head > div { font-family: var(--font-mono); font-size: var(--size-micro); letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--text-muted); display: flex; gap: 10px; align-items: center; }
.cr-tour { position: absolute; right: 22px; top: 16px; font-family: var(--font-mono); font-size: var(--size-micro); color: var(--text-muted); background: var(--surface-card); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); padding: 6px 12px; cursor: pointer; transition: border-color .2s var(--ease-niro); }
.cr-tour:hover { border-color: var(--accent); }
.cr-flow-grid { padding: 26px 28px 30px; min-height: 360px; }
.cr-col { display: grid; gap: var(--space-4); align-content: center; }
.cr-fc { position: relative; display: grid; gap: 4px; text-align: left; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--surface-card); border: 1px solid var(--border-subtle); color: var(--text-primary); font: inherit; cursor: pointer; transition: border-color .2s var(--ease-niro), transform .2s var(--ease-niro), box-shadow .2s var(--ease-niro), opacity .2s var(--ease-niro); }
.cr-fc em::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--c); vertical-align: 1px; }
.cr-fc.chg, .cr-k.chg { --c: var(--status-error); }
.cr-fc.call, .cr-k.call { --c: var(--accent-indigo); }
.cr-fc.land, .cr-k.land { --c: var(--accent-amber); }
.cr-fc em { font-style: normal; font-family: var(--font-mono); font-size: var(--size-micro); color: var(--text-muted); padding-right: var(--space-9); }
.cr-fc b { font-family: var(--font-mono); font-size: var(--size-caption); font-weight: var(--weight-semibold); word-break: break-word; }
.cr-fc > span { font-size: var(--size-caption); color: var(--text-muted); }
.cr-fc i { position: absolute; top: 12px; right: 12px; font-style: normal; font-family: var(--font-mono); font-size: var(--size-micro); font-weight: var(--weight-semibold); color: var(--status-error); background: var(--status-error-soft); border-radius: var(--radius-xs); padding: 2px 6px; }
.cr-fc:hover { border-color: var(--border-strong); transform: translateY(var(--lift-hover)); }
.cr-fc[aria-pressed="true"] { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), var(--shadow-panel); }
.cr-flow.has-sel .cr-fc:not([aria-pressed="true"]):not(.lit) { opacity: .55; }
.cr-flow-foot { position: relative; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto; gap: var(--space-6); align-items: center; padding: var(--space-5) 28px; border-top: 1px solid var(--border-subtle); background: color-mix(in srgb, var(--term) 85%, transparent); }
.cr-k { font-family: var(--font-mono); font-size: var(--size-micro); letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--c); }
.cr-flow-foot h3 { font-family: var(--font-mono); font-size: var(--size-body); margin: 4px 0 6px; color: var(--text-primary); }
.cr-flow-foot p { font-size: var(--size-body); color: var(--text-muted); line-height: var(--leading-body); }
.cr-chain { font-family: var(--font-mono); font-size: var(--size-micro); line-height: 1.8; color: var(--text-muted); word-break: break-word; }
.cr-flow-foot a { color: var(--accent); text-decoration: none; }
.cr-flow-foot a:hover { text-decoration: underline; }
.cr-acts { display: grid; gap: 6px; font-size: var(--size-caption); justify-items: start; }
@media (max-width: 1020px) { .cr-flow-head, .cr-flow-grid { gap: 44px; } }
@media (max-width: 860px) {
  .cr-flow-head { grid-template-columns: 1fr; min-height: 40px; }
  .cr-flow-head > div { display: none; }
  .cr-flow-grid { grid-template-columns: 1fr; gap: 28px; padding: 18px; }
  .cr-flow-foot { grid-template-columns: 1fr; gap: var(--space-3); padding: 18px; }
}

/* reviewers */
.cr-revs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border-subtle); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); overflow: hidden; }
.cr-rev { background: var(--surface-card); padding: 22px; display: grid; gap: 10px; align-content: start; }
.cr-rev-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cr-rev-top .cr-eyebrow { color: var(--accent); }
.cr-sev { font-family: var(--font-mono); font-size: var(--size-micro); font-weight: var(--weight-semibold); padding: 2px 7px; border-radius: var(--radius-xs); }
.cr-sev.p0 { background: var(--status-error-soft); color: var(--status-error); }
.cr-sev.p1 { background: var(--status-warning-soft); color: var(--status-warning); }
.cr-rev p { font-size: var(--size-caption); color: var(--text-muted); }
.cr-rev a { font-family: var(--font-mono); font-size: var(--size-micro); color: var(--text-muted); text-decoration: none; word-break: break-word; }
.cr-rev a:hover { color: var(--accent); }
@media (max-width: 960px) { .cr-revs { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .cr-revs { grid-template-columns: 1fr; } }

/* console */
.cr-ctabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-subtle); margin-bottom: var(--space-5); overflow-x: auto; }
.cr-ctabs button { border: 0; background: none; padding: 10px 14px; font: inherit; font-size: var(--size-body); color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .2s var(--ease-niro); }
.cr-ctabs button:hover { color: var(--text-primary); }
.cr-ctabs button[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: var(--weight-semibold); }
.cr-cpanel { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: var(--space-9); align-items: start; }
.cr-cpanel[hidden] { display: none; }
.cr-cpanel > div:last-child { display: grid; gap: var(--space-3); }
.cr-cpanel p { max-width: 44ch; }
.cr-credit { margin-top: var(--space-12); font-size: var(--size-caption); color: var(--text-muted); max-width: 80ch; }
.cr-credit a { color: inherit; }
@media (max-width: 960px) { .cr-cpanel { grid-template-columns: 1fr; } }

/* closing band */
.cr-cta { padding: 0; border-top: 1px solid var(--border-subtle); color: var(--text-primary);
  background: var(--term); }
.cr-cta-in { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 56px; align-items: end; padding-top: var(--pad); padding-bottom: var(--pad); }
.cr-cta h2 { font-size: clamp(32px, 4.4vw, 58px); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-display); line-height: 1.05; text-wrap: balance; }
.cr-cta-side { display: grid; gap: 22px; }
.cr-cta-side p { color: var(--text-muted); font: var(--type-lead); max-width: 44ch; }
@media (max-width: 860px) { .cr-cta-in { grid-template-columns: 1fr; gap: 28px; } }

@media (prefers-reduced-motion: reduce) {
  .cr-flow-svg .pulse, .cr-swap { animation: none; }
  #cr-shot, .cr-layer, .cr-box { transition: none; }
  .cr-fc, .cr-box { transition: none; }
}

/* ── one pull request: sticky scroll, driven by scroll position ────────── */
.cr-st { display: grid; grid-template-columns: 5fr 7fr; gap: var(--space-12); align-items: start; }
.cr-st-steps { position: relative; list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border-subtle); }
/* one indicator that slides, instead of a border that jumps between steps */
.cr-st-ind { position: absolute; left: -2px; top: 0; width: 2px; height: 0; background: var(--accent); border-radius: 2px;
  transition: transform 420ms cubic-bezier(.2, .7, .2, 1), height 420ms cubic-bezier(.2, .7, .2, 1); will-change: transform; }
.cr-st-steps button { display: grid; gap: 6px; width: 100%; text-align: left; background: none; border: 0;
  padding: var(--space-6) 0 var(--space-6) var(--space-6); cursor: pointer; opacity: .4; will-change: opacity; }
.cr-st-steps button:hover .cr-st-t { color: var(--accent); }
.cr-st-meta { font-size: var(--size-caption); color: var(--text-faint); }
.cr-st-t { font-size: 18px; font-weight: var(--weight-semibold); color: var(--text-primary); letter-spacing: -0.01em; transition: color 180ms ease-out; }
.cr-st-b { font-size: 15px; line-height: 1.55; color: var(--text-muted); }
.cr-st-pin { position: sticky; top: calc(var(--nav-h) + var(--space-6)); }
/* every screenshot is stacked; the frame eases to the active one's height */
.cr-st-shot { position: relative; overflow: hidden; background: var(--surface-card); line-height: 0; transition: height 420ms cubic-bezier(.2, .7, .2, 1); }
.cr-st-shot img { position: absolute; left: 0; top: 0; width: 100%; height: auto; opacity: 0; transform: scale(1.012); transform-origin: 50% 0;
  transition: opacity 380ms ease-out, transform 600ms cubic-bezier(.2, .7, .2, 1); }
.cr-st-shot img.on { opacity: 1; transform: none; }
.cr-st-notes { list-style: none; margin: var(--space-5) 0 0; padding: 0; display: grid; gap: var(--space-2); min-height: 5.4em; transition: opacity 140ms ease-out, transform 140ms ease-out; }
.cr-st-notes.out { opacity: 0; transform: translateY(4px); }
.cr-st-notes li { position: relative; padding-left: var(--space-4); font-size: 14px; line-height: 1.5; color: var(--text-muted); }
.cr-st-notes li::before { content: ""; position: absolute; left: 0; top: .75em; width: 8px; height: 1px; background: var(--text-faint); }
@media (max-width: 900px) {
  .cr-st { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
  .cr-st-pin { position: sticky; top: var(--nav-h); z-index: 2; order: -1; background: var(--surface-page); padding-bottom: var(--space-3); }
  .cr-st-notes { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cr-st-ind, .cr-st-shot, .cr-st-shot img, .cr-st-notes { transition: none; }
  .cr-st-shot img { transform: none; }
}

/* ── titles on one line ─────────────────────────────────────────────────
   Section titles are short enough to sit on one line at desktop widths; they
   only wrapped because the head column is capped for the lede's measure.
   The closing CTA stacks its copy and buttons under a full-width title. */
@media (min-width: 900px) {
  .cr-h2, .cr-cta h2 { white-space: nowrap; }
  .cr-cta-in { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); align-items: start; }
  .cr-cta h2 { font-size: clamp(32px, 3.6vw, 52px); }
  .cr-cta-side { grid-template-columns: minmax(0, 44ch) auto; align-items: end; justify-content: space-between; gap: var(--space-8); }
}

/* active step at full strength, the rest recede */
.cr-st-steps button { transition: opacity 220ms ease-out; }
.cr-st-steps button[aria-pressed="true"] { opacity: 1; }
.cr-st-b { max-height: 8em; overflow: hidden; transition: max-height 320ms cubic-bezier(.2, .7, .2, 1), opacity 220ms ease-out; }

/* pinned: the block sticks while its track scrolls; inactive steps fold to
   their title so all seven fit on screen at once */
#walk.is-pinned .cr-st { position: sticky; top: calc(var(--nav-h) + var(--space-6)); }
#walk.is-pinned .cr-st-pin { position: relative; top: 0; }
#walk.is-pinned .cr-st-steps button { padding-top: var(--space-3); padding-bottom: var(--space-3); }
#walk.is-pinned .cr-st-steps button:not([aria-pressed="true"]) .cr-st-b { max-height: 0; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .cr-st-b, .cr-st-steps button { transition: none; } }
#walk.is-measuring .cr-st-b, #walk.is-measuring .cr-st-steps button { transition: none; }

