/* proofback site and app.
   Every size, weight and colour below comes from the tokens in :root.
   Palette: viewer grey, white page, highlighter yellow (marks and the main
   action), strike-out red (deletions only), mapping blue (links, selection).
   Fonts are self-hosted (SIL OFL 1.1, licences in fonts/). */

@font-face { font-family: "Schibsted Grotesk"; src: url("fonts/schibsted-grotesk.woff2") format("woff2"); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Libertinus Serif"; src: url("fonts/libertinus-serif-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Libertinus Serif"; src: url("fonts/libertinus-serif-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Libertinus Serif"; src: url("fonts/libertinus-serif-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  /* type: one scale for everything */
  --ui: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --tex: "Libertinus Serif", "Linux Libertine O", Georgia, serif;
  --fs-xs: 12px;   /* tags, line numbers, labels */
  --fs-s: 14px;    /* secondary text, nav, tables, controls */
  --fs-code: 13px; /* all monospace */
  --fs-m: 16px;    /* body */
  --fs-l: 18px;    /* lead paragraphs */
  --fs-h2: clamp(26px, 3vw, 34px);
  --fs-h1: clamp(40px, 6vw, 76px);
  --w-regular: 400;
  --w-strong: 600;
  --w-display: 800;
  --radius: 4px;

  /* page colours (light) */
  --bg: #dfe2e6;
  --well: #cdd1d7;
  --paper: #ffffff;
  --control: #ffffff;
  --ink: #15171a;
  --muted: #4f5660;
  --line: #bcc2ca;
  --yellow: #ffd400;
  --yellow-hover: #ffe14d;
  --yellow-soft: #fff2a6;
  --yellow-edge: #d9b400;
  --on-yellow: #15171a;
  --red: #e0262f;
  --blue: #1d5bd6;
  --blue-soft: rgba(29, 91, 214, .12);
  --green: #1a7f37;
  --amber: #9a6700;
  --shadow: 0 1px 3px rgba(0, 0, 0, .2);

  /* editor colours (the same in both themes) */
  --ed-bg: #17191d;
  --ed-bar: #202328;
  --ed-line: #2b2f35;
  --ed-field: #0f1114;
  --ed-ink: #e4e6ea;
  --ed-muted: #858c97;
  --ed-blue: #9dbcff;
  --ed-hit: rgba(109, 156, 255, .14);
  --ed-mark: rgba(109, 156, 255, .38);
  --ed-add: #8fd19e;
  --ed-del: #ff8a8f;
  --ed-amber: #f0c56a;

  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1e22; --well: #121417; --paper: #e9e8e4; --control: #262a30; --ink: #e7e9ec; --muted: #a1a8b2;
    --line: #353a42; --red: #ff4d55; --blue: #6d9cff; --blue-soft: rgba(109, 156, 255, .16);
    --green: #3fb950; --amber: #d29922; --ed-bg: #0f1114; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1e22; --well: #121417; --paper: #e9e8e4; --control: #262a30; --ink: #e7e9ec; --muted: #a1a8b2;
  --line: #353a42; --red: #ff4d55; --blue: #6d9cff; --blue-soft: rgba(109, 156, 255, .16);
  --green: #3fb950; --amber: #d29922; --ed-bg: #0f1114; color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: var(--w-regular) var(--fs-m)/1.55 var(--ui); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--blue); text-underline-offset: 2px; }
code, pre, kbd { font-family: var(--mono); font-size: var(--fs-code); }
h1, h2 { font-weight: var(--w-display); letter-spacing: -.035em; margin: 0; }
h1 { font-size: var(--fs-h1); line-height: 1; letter-spacing: -.045em; max-width: 11ch; }
h2 { font-size: var(--fs-h2); line-height: 1.1; margin-bottom: 16px; }
button { font: inherit; cursor: pointer; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; background: var(--paper); color: var(--on-yellow); padding: 8px 12px; z-index: 10; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }

/* header */
.top { max-width: 1200px; margin: 0 auto; padding: 18px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-weight: var(--w-display); font-size: var(--fs-l); letter-spacing: -.03em; color: var(--ink); text-decoration: none; }
.brand::after { content: ""; display: inline-block; width: 8px; height: 8px; background: var(--yellow); margin-left: 3px; }
.top nav { display: flex; align-items: center; gap: 20px; font-size: var(--fs-s); }
.top nav a { color: var(--ink); text-decoration: none; }
.top nav a:hover { color: var(--blue); }
.theme { background: none; border: 0; color: var(--ink); padding: 4px; display: grid; }
.theme svg { width: 18px; height: 18px; }

/* buttons and links */
.btn { display: inline-block; background: var(--yellow); color: var(--on-yellow); font-weight: var(--w-strong); font-size: var(--fs-m); padding: 10px 18px; border-radius: var(--radius); text-decoration: none; border: 1px solid var(--yellow-edge); }
.btn:hover { background: var(--yellow-hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.textlink { color: var(--ink); font-weight: var(--w-strong); }
.ctl { background: var(--control); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; font-size: var(--fs-s); }
.ctl:hover { border-color: var(--blue); }

/* intro */
.intro { max-width: 1200px; margin: 0 auto; padding: 48px 24px 40px; display: grid; grid-template-columns: 7fr 5fr; gap: 48px; align-items: end; }
.intro-side p { margin: 0 0 18px; color: var(--muted); font-size: var(--fs-l); }
.actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.intro-side .note { font-size: var(--fs-s); margin: 0; }

/* demo: PDF viewer next to an editor */
.viewer-hint { max-width: 1200px; margin: 0 auto; padding: 0 24px 10px; font-size: var(--fs-s); color: var(--muted); }
.viewer { max-width: 1200px; margin: 0 auto; padding: 0 24px; position: relative; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.pane { min-width: 0; border: 1px solid var(--line); }
.pane-pdf { border-right: 0; border-radius: 6px 0 0 6px; background: var(--well); }
.pane-src { border-radius: 0 6px 6px 0; background: var(--ed-bg); color: var(--ed-ink); border-color: var(--ed-bg); }
.bar { display: flex; justify-content: space-between; gap: 12px; padding: 8px 14px; font-size: var(--fs-s); border-bottom: 1px solid var(--line); background: var(--bg); }
.pane-src .bar { background: var(--ed-bar); border-color: var(--ed-line); color: var(--ed-ink); font-family: var(--mono); font-size: var(--fs-xs); }
.bar-dim { color: var(--muted); }
.pane-src .bar-dim { color: var(--ed-add); }
.pane-src .bar-dim.line { color: var(--ed-amber); }
.canvas { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 14px; padding: 24px 16px 28px 22px; }
.page { --blue: #1d5bd6; --red: #e0262f; background: var(--paper); color: #111; box-shadow: var(--shadow); padding: 34px 34px 24px; font: var(--fs-m)/1.6 var(--tex); text-align: justify; hyphens: auto; }
.page p { margin: 0 0 10px; text-indent: 1.5em; }
.page-h { font: 700 var(--fs-l)/1.3 var(--tex); margin: 0 0 12px; text-align: left; }
.page-h span { margin-right: .8em; }
.page-dim { color: #444; }
.pageno { text-align: center; font-size: var(--fs-s); margin-top: 18px; }
.page sup { font: var(--w-strong) .65em var(--ui); color: var(--blue); margin-left: 1px; }

.mk { all: unset; text-indent: 0; cursor: pointer; -webkit-box-decoration-break: clone; box-decoration-break: clone; border-radius: 1px; }
.mk:focus-visible { outline: 2px solid var(--blue); }
.mk-strike { text-decoration: line-through 2px var(--red); }
.mk-hl { background: color-mix(in srgb, var(--yellow) 70%, transparent); }
.mk-note { background: color-mix(in srgb, var(--yellow) 35%, transparent); border-bottom: 2px solid var(--yellow-edge); }
.mk-caret { display: inline-block; width: 12px; height: 14px; position: relative; top: 5px; margin-left: 1px; }
.mk-caret::before { content: ""; position: absolute; left: 1px; top: 2px; width: 7px; height: 7px; border-left: 2px solid var(--blue); border-top: 2px solid var(--blue); transform: rotate(45deg); }
.mk:hover, .mk[aria-pressed="true"] { outline: 1.5px solid var(--blue); outline-offset: 2px; }
.nw { white-space: nowrap; }

.popups { display: flex; flex-direction: column; gap: 12px; padding-top: 52px; }
.pop { background: var(--yellow-soft); color: var(--on-yellow); border: 1px solid var(--yellow-edge); border-radius: 2px; padding: 6px 8px 7px; font-size: var(--fs-xs); line-height: 1.4; box-shadow: var(--shadow); transition: box-shadow .15s; }
.pop b { display: block; font-weight: var(--w-strong); }
.pop.on { box-shadow: 0 0 0 2px var(--blue); }

.thread { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 2; }
#thread-path { fill: none; stroke: var(--blue); stroke-width: 1.5; }
#thread-dot { fill: var(--blue); }

/* source listing, shared by the demo and the app */
.code { margin: 0; padding: 12px 0; list-style: none; counter-reset: ln 37; font: var(--fs-code)/1.8 var(--mono); }
.code li { counter-increment: ln; padding: 0 14px 0 54px; position: relative; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.code li::before { content: counter(ln); position: absolute; left: 0; width: 38px; text-align: right; color: var(--ed-muted); }
.code li.on, .code li.hit { background: var(--ed-hit); }
.code .c { color: var(--ed-muted); }
.code .k { color: var(--ed-blue); }
.code .m { color: var(--ed-amber); }
.code mark { background: var(--ed-mark); color: #fff; border-radius: 2px; }
.code mark.ins { background: none; }
.code mark.ins::after { content: attr(data-ins); color: var(--ed-add); background: rgba(143, 209, 158, .14); }
.item { border-top: 1px solid var(--ed-line); padding: 14px 16px 16px; font: var(--fs-code)/1.6 var(--mono); min-height: 168px; }
.item .row1 { display: flex; gap: 12px; flex-wrap: wrap; color: var(--ed-muted); }
.item .id { color: var(--ed-ink); font-weight: var(--w-strong); }
.item .body { font: var(--w-strong) var(--fs-m)/1.4 var(--ui); color: var(--ed-ink); margin: 8px 0; }
.item .diff { margin: 0; white-space: pre-wrap; }
.item .dm { color: var(--ed-del); } .item .dp { color: var(--ed-add); } .item .dn { color: var(--ed-muted); }

/* sections */
body:not(.app) main > section:not(.intro):not(.viewer) { max-width: 1200px; margin: 0 auto; padding: 88px 24px 0; }
.lead { color: var(--muted); font-size: var(--fs-l); max-width: 62ch; margin: 0 0 24px; }

.steps { margin: 0; border-top: 2px solid var(--ink); }
.steps > div { display: grid; grid-template-columns: 360px 1fr; gap: 32px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.steps dt code { background: var(--paper); color: var(--on-yellow); padding: 3px 7px; border-radius: 3px; }
.steps dd { margin: 0; color: var(--muted); max-width: 64ch; }
.steps dd code { color: var(--ink); }

.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-m); }
.tbl th { text-align: left; font-size: var(--fs-xs); font-weight: var(--w-strong); color: var(--muted); padding: 0 16px 8px 0; border-bottom: 2px solid var(--ink); }
.tbl td { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td:first-child { font-weight: var(--w-strong); white-space: nowrap; }
.tbl td code { white-space: nowrap; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl th.num { text-align: right; }
.small { font-size: var(--fs-s); color: var(--muted); max-width: 70ch; margin: 14px 0 0; }

.agents { display: grid; grid-template-columns: 1fr 1.15fr; gap: 48px; align-items: start; }
.agents > * { min-width: 0; }
.agents p { color: var(--muted); max-width: 52ch; }
.term { margin: 0; background: var(--ed-bg); color: var(--ed-ink); border-radius: 6px; overflow: hidden; }
.term .bar { background: var(--ed-bar); border-color: var(--ed-line); color: var(--ed-muted); font-family: var(--mono); font-size: var(--fs-xs); }
.term pre { margin: 0; padding: 16px; line-height: 1.7; overflow-x: auto; }
.term .u { color: var(--yellow); } .term .a { color: var(--ed-blue); } .term .d { color: var(--ed-muted); }
.term .m { color: var(--ed-del); } .term .p { color: var(--ed-add); }

.install { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; max-width: 860px; }
.install li { background: var(--ed-bg); color: var(--ed-ink); border-radius: 6px; overflow: hidden; min-width: 0; }
.install .bar { background: var(--ed-bar); border-color: var(--ed-line); color: var(--ed-muted); font-size: var(--fs-xs); }
.install pre { margin: 0; padding: 12px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }

.foot { max-width: 1200px; margin: 96px auto 0; padding: 20px 24px 40px; border-top: 1px solid var(--line); font-size: var(--fs-s); color: var(--muted); display: flex; gap: 8px 24px; flex-wrap: wrap; }
.foot p { margin: 0; }

/* responsive */
@media (max-width: 980px) {
  .intro { grid-template-columns: 1fr; gap: 24px; padding-top: 28px; }
  .viewer { grid-template-columns: 1fr; }
  .pane-pdf { border-right: 1px solid var(--line); border-radius: 6px 6px 0 0; }
  .pane-src { border-radius: 0 0 6px 6px; }
  .thread { display: none; }
  .agents { grid-template-columns: 1fr; }
  .steps > div { grid-template-columns: 1fr; gap: 6px; }
}
@media (max-width: 640px) {
  .top, .intro, .viewer, .viewer-hint, body:not(.app) main > section:not(.intro):not(.viewer), .foot { padding-left: 16px; padding-right: 16px; }
  .top nav a:not([href^="https"]) { display: none; }
  .canvas { grid-template-columns: 1fr; padding: 14px; }
  .popups { display: none; }
  .page { padding: 24px 20px 18px; }
  .code li { padding-left: 40px; }
  .code li::before { width: 28px; }
  .tbl td:first-child { white-space: normal; }
  .tbl, .tbl thead, .tbl tbody, .tbl tr, .tbl td { display: block; }
  .tbl thead { display: none; }
  .tbl tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
  .tbl td, .tbl td.num { border: 0; padding: 2px 0; text-align: left; }
  .tbl td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: var(--fs-s); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .top nav, .viewer, .viewer-hint, .thread { display: none; } body { background: #fff; } }
