/* Review page shell on top of Pico CSS (classless, zinc). Tokens first, components after. */

@font-face { font-family: "Inter"; src: url("fonts/InterVariable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/JetBrainsMono-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/JetBrainsMono-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --pico-font-family-sans-serif: "Inter", system-ui, sans-serif;
  --pico-font-family-monospace: "JetBrains Mono", ui-monospace, monospace;
  --pico-font-size: 100%;
  --pico-line-height: 1.55;
  --pico-border-radius: 0.375rem;
  --pico-typography-spacing-vertical: 1rem;
  --pico-block-spacing-vertical: 1rem;

  /* review tokens: light */
  --rv-bg: #f7f7f5;
  --rv-surface: #ffffff;
  --rv-raised: #f1f1ee;
  --rv-ink: #1c1e21;
  --rv-muted: #5d6167;
  --rv-line: #dcdcd7;
  --rv-accent: #2f5f8f;
  --rv-add-ink: #1a6a42;
  --rv-add-bg: #e4f3ea;
  --rv-del-ink: #a5301f;
  --rv-del-bg: #fbe8e5;
  --rv-warn-ink: #7a5a10;
  --rv-warn-bg: #fbf1d6;
  --rv-code-bg: #fbfbfa;
  --rv-gutter: #9a9ea5;
  --rv-shadow: 0 16px 48px rgb(0 0 0 / 0.18);
  --rv-track: 72rem;
  --rv-measure: 66ch;

  /* syntax tokens: light */
  --tok-comment: #6e7681;
  --tok-keyword: #a03572;
  --tok-string: #1f6f4a;
  --tok-number: #8a4b0f;
  --tok-function: #2b5aa0;
  --tok-type: #7a3fa0;
  --tok-attr: #2b5aa0;
  --tok-punct: #4b4f55;

  --pico-background-color: var(--rv-bg);
  --pico-color: var(--rv-ink);
  --pico-muted-color: var(--rv-muted);
  --pico-muted-border-color: var(--rv-line);
  --pico-primary: var(--rv-accent);
  --pico-primary-hover: var(--rv-accent);
  --pico-primary-underline: color-mix(in srgb, var(--rv-accent) 40%, transparent);
  --pico-code-background-color: var(--rv-raised);
  --pico-code-color: var(--rv-ink);
  --pico-card-background-color: var(--rv-surface);
  --pico-card-border-color: var(--rv-line);
  --pico-modal-overlay-background-color: rgb(20 21 23 / 0.7);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --rv-bg: #141517; --rv-surface: #1b1d20; --rv-raised: #24272b; --rv-ink: #e8e6e1; --rv-muted: #a3a7ad;
    --rv-line: #33373c; --rv-accent: #8db8e6; --rv-add-ink: #7fd3a3; --rv-add-bg: #17301f; --rv-del-ink: #f1978a; --rv-del-bg: #3a1c18;
    --rv-warn-ink: #e6c36a; --rv-warn-bg: #3a2f12; --rv-code-bg: #17191c; --rv-gutter: #6b7078; --rv-shadow: 0 16px 48px rgb(0 0 0 / 0.6);
    --tok-comment: #8b949e; --tok-keyword: #e39ac5; --tok-string: #8fd3ab; --tok-number: #e9b07a; --tok-function: #9cc5f5; --tok-type: #c9a4ef; --tok-attr: #9cc5f5; --tok-punct: #b8bcc2;
    --pico-modal-overlay-background-color: rgb(0 0 0 / 0.75);
  }
}
:root[data-theme="dark"] {
  --rv-bg: #141517; --rv-surface: #1b1d20; --rv-raised: #24272b; --rv-ink: #e8e6e1; --rv-muted: #a3a7ad;
  --rv-line: #33373c; --rv-accent: #8db8e6; --rv-add-ink: #7fd3a3; --rv-add-bg: #17301f; --rv-del-ink: #f1978a; --rv-del-bg: #3a1c18;
  --rv-warn-ink: #e6c36a; --rv-warn-bg: #3a2f12; --rv-code-bg: #17191c; --rv-gutter: #6b7078; --rv-shadow: 0 16px 48px rgb(0 0 0 / 0.6);
  --tok-comment: #8b949e; --tok-keyword: #e39ac5; --tok-string: #8fd3ab; --tok-number: #e9b07a; --tok-function: #9cc5f5; --tok-type: #c9a4ef; --tok-attr: #9cc5f5; --tok-punct: #b8bcc2;
  --pico-modal-overlay-background-color: rgb(0 0 0 / 0.75);
}

/* Shell: a centered reading column; code, tables, and media step out to the wide track. */
body { background: var(--rv-bg); color: var(--rv-ink); }
body > header, body > main, body > footer { max-width: var(--rv-track); margin-inline: auto; padding-inline: 1.5rem; }
body > main { padding-block: 0 5rem; }
main > section > :not(.wide, article), main > section > article > :not(.wide), body > header > :not(.wide) { max-width: var(--rv-measure); }
main article { margin: 0; padding: 0; background: none; border: 0; box-shadow: none; }
.wide { max-width: none; }
h1, h2, h3 { text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.35rem; margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--rv-line); }
h3 { font-size: 1.1rem; margin-top: 2.5rem; }
h2 + article > h3, h2 + p, h2 + .wide, h2 + dl, h2 + ol { margin-top: 1rem; }
p, li { max-width: var(--rv-measure); }
code, kbd, .path { font-family: var(--pico-font-family-monospace); font-size: 0.875em; font-variant-ligatures: none; }
:not(pre) > code { padding: 0.1em 0.35em; }
.path { color: var(--rv-muted); word-break: break-all; }
small, .muted { color: var(--rv-muted); }

/* Top bar: document name and section links; the current section is marked by review.js. */
body > header nav { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; align-items: baseline;
  margin-inline: -1.5rem; padding: 0.75rem 1.5rem; background: color-mix(in srgb, var(--rv-bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rv-line); }
body > header nav ul { margin: 0; padding: 0; display: contents; }
body > header nav li { list-style: none; margin: 0; padding: 0; }
body > header nav a { display: inline-block; padding: 0.35rem 0; font-size: 0.9rem; color: var(--rv-muted); text-decoration: none; border-bottom: 2px solid transparent; }
body > header nav a:hover, body > header nav a:focus-visible { color: var(--rv-ink); }
body > header nav a[aria-current="true"] { color: var(--rv-ink); border-bottom-color: var(--rv-accent); }
body > header nav .doc { font-weight: 600; color: var(--rv-ink); margin-right: auto; }
.skip { position: absolute; left: -999px; top: 0.5rem; padding: 0.5rem 0.75rem; background: var(--rv-surface); border: 1px solid var(--rv-line); border-radius: var(--pico-border-radius); z-index: 4; }
.skip:focus { left: 1rem; }

/* Metadata: label and value pairs under the title. */
dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1.25rem; margin: 1rem 0 0; font-size: 0.925rem; }
dl.meta dt { color: var(--rv-muted); font-weight: 500; margin: 0; }
dl.meta dd { margin: 0; }

/* Code figure: caption with label and path, then a highlighted pane that scrolls inside itself. */
figure.code { margin: 1rem 0 0; }
figure.code > figcaption { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: baseline; margin: 0; padding: 0.4rem 0.75rem;
  font-size: 0.8rem; color: var(--rv-muted); background: var(--rv-raised); border: 1px solid var(--rv-line); border-bottom: 0;
  border-radius: var(--pico-border-radius) var(--pico-border-radius) 0 0; }
figure.code > figcaption > b { font-weight: 600; color: var(--rv-ink); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.72rem; }
figure.code > figcaption > .lang { margin-left: auto; }
figure.code > pre { margin: 0; padding: 0; overflow: auto; max-height: 36rem; background: var(--rv-code-bg); border: 1px solid var(--rv-line);
  border-radius: 0 0 var(--pico-border-radius) var(--pico-border-radius); font-size: 0.8125rem; line-height: 1.5; }
figure.code > pre > code { display: block; min-width: max-content; padding: 0.6rem 0; background: none; color: var(--rv-ink); }
.line { display: flex; }
.line > .n { flex: 0 0 3.25rem; padding-right: 0.75rem; text-align: right; color: var(--rv-gutter); user-select: none; }
.line > .t { flex: 1; padding: 0 1rem 0 0; white-space: pre; }
.line > .t::before { content: " "; display: inline-block; width: 1ch; margin-right: 0.5ch; color: var(--rv-gutter); }
.line.add { background: var(--rv-add-bg); }
.line.add > .n { color: var(--rv-add-ink); }
.line.add > .t::before { content: "+"; color: var(--rv-add-ink); }
.line.del { background: var(--rv-del-bg); }
.line.del > .n { color: var(--rv-del-ink); }
.line.del > .t::before { content: "-"; color: var(--rv-del-ink); }
.line.mark { background: var(--rv-warn-bg); }
.line.mark > .t::before { content: "!"; color: var(--rv-warn-ink); }
pre:not([data-diff]) .line > .t::before { display: none; }
figure.code > figcaption + pre.plain { padding: 0.6rem 1rem; }

/* Two panes side by side on wide screens; they stack below 1024 px. */
.pair { display: grid; gap: 1rem; margin-top: 1rem; }
@media (min-width: 1024px) { .pair { grid-template-columns: 1fr 1fr; } }
.pair > figure.code { margin: 0; min-width: 0; }

/* Syntax tokens (highlight.js classes) on the theme tokens. */
.hljs-comment, .hljs-quote { color: var(--tok-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-doctag, .hljs-meta { color: var(--tok-keyword); }
.hljs-string, .hljs-regexp, .hljs-template-tag, .hljs-addition { color: var(--tok-string); }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-link { color: var(--tok-number); }
.hljs-title, .hljs-title.function_, .hljs-section, .hljs-name { color: var(--tok-function); }
.hljs-type, .hljs-title.class_, .hljs-built_in, .hljs-selector-class, .hljs-selector-id { color: var(--tok-type); }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-params, .hljs-property { color: var(--tok-attr); }
.hljs-punctuation, .hljs-operator, .hljs-tag { color: var(--tok-punct); }
.hljs-deletion { color: var(--tok-comment); }
.hljs-emphasis { font-style: italic; } .hljs-strong { font-weight: 700; }

/* Tables: wide track, real headers, reason columns get the room. */
.table { overflow-x: auto; margin-top: 1rem; border: 1px solid var(--rv-line); border-radius: var(--pico-border-radius); background: var(--rv-surface); }
.table table { margin: 0; font-size: 0.925rem; }
.table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--rv-muted); white-space: nowrap; }
.table td, .table th { vertical-align: top; }
.table td:first-child { font-family: var(--pico-font-family-monospace); font-size: 0.8125rem; word-break: break-all; }

/* Status marks for checks and findings. */
mark[data-status] { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; background: var(--rv-raised); color: var(--rv-ink); white-space: nowrap; }
mark[data-status="pass"] { background: var(--rv-add-bg); color: var(--rv-add-ink); }
mark[data-status="fail"] { background: var(--rv-del-bg); color: var(--rv-del-ink); }
mark[data-status="pending"], mark[data-status="skip"] { background: var(--rv-warn-bg); color: var(--rv-warn-ink); }

/* Test steps: one action, one expected result per step. */
ol.steps { padding-left: 1.5rem; }
ol.steps > li { margin-top: 0.75rem; }
ol.steps > li > p { margin: 0; }
ol.steps > li > p + p { margin-top: 0.25rem; }

/* Media: captures and clips on the wide track, in a raised frame. */
figure.shot, figure.clip { margin: 1rem 0 0; }
figure.shot > button { display: block; width: 100%; margin: 0; padding: 0; border: 1px solid var(--rv-line); border-radius: var(--pico-border-radius); background: var(--rv-raised); overflow: hidden; cursor: zoom-in; }
figure.shot > button:focus-visible { outline: 2px solid var(--rv-accent); outline-offset: 2px; }
figure.shot img, figure.clip video { display: block; width: 100%; height: auto; }
figure.clip > video { border: 1px solid var(--rv-line); border-radius: var(--pico-border-radius); background: #000; }
figure.shot > figcaption, figure.clip > figcaption { margin-top: 0.5rem; font-size: 0.875rem; color: var(--rv-muted); max-width: var(--rv-measure); }
.media { display: grid; gap: 1rem; margin-top: 1rem; }
@media (min-width: 1024px) { .media { grid-template-columns: 1fr 1fr; } .media > figure { margin: 0; } }

/* Zoom dialog: native <dialog>, actual size on a second click. */
dialog.zoom { max-width: none; max-height: none; width: 100vw; height: 100vh; margin: 0; padding: 0; border: 0; background: transparent; }
dialog.zoom::backdrop { background: var(--pico-modal-overlay-background-color); }
dialog.zoom > form { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; overflow: auto; padding: 3rem 1.5rem; }
dialog.zoom img { max-width: 100%; max-height: calc(100vh - 6rem); width: auto; height: auto; box-shadow: var(--rv-shadow); border-radius: var(--pico-border-radius); cursor: zoom-in; }
dialog.zoom[data-actual] img { max-width: none; max-height: none; cursor: zoom-out; }
dialog.zoom > form > button { position: fixed; top: 0.75rem; right: 0.75rem; width: auto; margin: 0; padding: 0.4rem 0.9rem; font-size: 0.875rem; }
dialog.zoom > form > p { position: fixed; left: 1rem; bottom: 0.75rem; margin: 0; font-size: 0.8rem; color: #fff; opacity: 0.85; }

/* Keep long content inside its box. */
img, video { max-width: 100%; }
a { overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media print { body > header nav { position: static; } figure.code > pre { max-height: none; } }
