/* pagescan — landing page
 *
 * Every colour, weight and tracking value here comes from the identity guide
 * (mark 4a, v1.0) rather than from taste: brand/USAGE.txt is the contract this
 * file implements. The two rules that shape most of the decisions below:
 *
 *   Signal red is punctuation, not surface. One accent per view, 24px and up,
 *   never body copy — it clears 3.8:1 on paper, which is a headline ratio, not
 *   a paragraph one. So --signal appears on large type and on mark strokes,
 *   and nowhere else.
 *
 *   The mark is two opposing corners at stroke 6.5 on a 64 grid, and the
 *   stroke thickens as it shrinks (6.5 / 7.5 / 9 at 48 / 32 / 16 px). Small
 *   marks on this page use the favicon cut, never a scaled-down master.
 *
 * Hand-written CSS, no framework and no build step — the same reasoning as
 * agentiqrm.com: this is a static page and a framework would be shipped to
 * every visitor to save an afternoon once.
 */

:root {
  /* Identity guide 02 — colour. */
  --ink: #16181C;
  --paper: #F7F6F2;
  --signal: #DE4B2E;
  --graphite: #7C7E84;

  /* Derived surfaces. The guide gives four colours; these are the ink mixed
     into paper for rules and cards, so nothing new enters the palette. */
  --line: #E2E0DA;
  --line-strong: #CFCCC4;
  --surface: #FFFFFF;
  --surface-sunk: #F0EEE8;

  --body: #3A3D43;
  --max: 1040px;
  --radius: 4px;

  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* Dark is the reversed lockup world: paper on ink. The guide forbids the red
   mark on dark, so .mark-accent drops its accent stroke here — see below. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16181C;
    --ink: #F7F6F2;
    --line: #2A2D33;
    --line-strong: #3A3E45;
    --surface: #1C1F24;
    --surface-sunk: #121417;
    --body: #C6C7CA;
    --graphite: #8E9096;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--ink); margin: 0 0 .5em; }
h1 {
  font-weight: 600;
  font-size: clamp(1.9rem, 4.4vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
}
h2 {
  font-weight: 600;
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
h3 { font-weight: 500; font-size: 1.05rem; line-height: 1.35; margin-bottom: .35em; }
p { margin: 0 0 1em; }
a { color: var(--ink); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--signal); }
code, kbd, samp, pre { font-family: var(--mono); }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* Identity guide 02 — mono small caps at 10–11px, 0.12em tracking. Every
   section is introduced by one of these, the way the design book pages are. */
.label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--graphite);
  margin: 0 0 10px;
}

/* The one place Signal is allowed to be small: as a mark stroke, not as text.
   Used for the rule that opens a section. */
.label::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 0;
  border-top: 2px solid var(--signal);
  vertical-align: middle;
  margin-right: 10px;
  transform: translateY(-1px);
}

/* One accent per view means the rule has to stand down wherever something
   else in the same screenful already carries Signal — the hero headline — or
   wherever labels repeat inside one section. */
.hero .label::before,
.stage-group > .label::before,
.usage-grid .label::before { border-top-color: var(--line-strong); }

.lead {
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  line-height: 1.6;
  color: var(--body);
  max-width: 42ch;
}

section { padding: 72px 0; border-top: 1px solid var(--line); }
section:first-of-type { border-top: 0; }

/* ------------------------------------------------------------------- brand */

/* The wordmark: Plex Sans Medium, −2% tracking, always lowercase. Never bold,
   never italic, never letterspaced out — identity guide 02. */
.wordmark {
  font-family: var(--sans);
  font-weight: 500;
  letter-spacing: -0.02em;
  text-transform: lowercase;
  color: var(--ink);
}

.mark { display: block; color: var(--ink); }

/* Clear space is one arm — 14 of the 64 grid — on all four sides. Giving the
   inline SVGs padding is how that survives being dropped next to text. */
.lockup {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}
.lockup .wordmark { font-size: 22px; }

/* ------------------------------------------------------------------ header */

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 62px;
}
header nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 14px;
}
header nav a { text-decoration: none; color: var(--body); }
header nav a:hover { color: var(--ink); }
.version {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--graphite);
}
@media (max-width: 720px) {
  header nav a:not(.btn) { display: none; }
  header nav .version { display: inline; }
}

/* Human / machine view switch. Deliberately quiet: it is a wayfinding control,
   not a call to action, and the page's one Signal accent is already spent on
   the headline. Square dots, never round — the mark is all right angles. */
.mode {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  overflow: hidden;
}
.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--graphite);
  text-decoration: none;
  background: transparent;
  transition: color .15s ease, background .15s ease;
}
.mode-btn + .mode-btn { border-left: 1px solid var(--line-strong); }
.mode-btn:hover { color: var(--ink); background: var(--surface-sunk); }
.mode-btn.is-active { color: var(--ink); background: var(--surface-sunk); cursor: default; }
.mode-dot {
  width: 6px;
  height: 6px;
  background: var(--line-strong);
  transition: background .15s ease;
}
.mode-btn.is-active .mode-dot,
.mode-btn:hover .mode-dot { background: var(--ink); }

@media (max-width: 720px) {
  .mode { display: none; }
}

/* -------------------------------------------------------------------- hero */

.hero { padding: 84px 0 72px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
}

/* The headline sets the page's single large Signal accent — one word, at
   3.4rem. Above 24px the 3.8:1 ratio is a headline ratio, which is exactly
   what the guide permits and the only thing it permits. */
h1 .accent { color: var(--signal); }

.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity .15s ease;
}
.btn:hover { opacity: .86; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--ink); opacity: 1; }

/* ---------------------------------------------------------------- terminal */

/* Mono carries anything technical — install lines, output, version numbers.
   Plex Sans never sets code (identity guide 02). */
.terminal {
  background: var(--ink);
  color: var(--paper);
  border-radius: 6px;
  padding: 20px 22px;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.85;
  overflow-x: auto;
}
@media (prefers-color-scheme: dark) {
  .terminal { background: var(--surface-sunk); color: var(--ink); border: 1px solid var(--line); }
}
.terminal .prompt { color: var(--graphite); user-select: none; }
.terminal .ok { color: inherit; }
.terminal .dim { color: var(--graphite); }
.terminal-row { white-space: pre; }

/* The install line doubles as the primary call to action, so it is a field,
   not a code block: selectable, one click to copy. */
.install {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
  padding: 12px 12px 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  max-width: 100%;
}
/* The command scrolls inside its own box; the button must not be pushed out
   of the field by a long URL. */
.install code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; }
.install .copy { flex: 0 0 auto; }
.install .prompt { color: var(--graphite); user-select: none; }
.install code { flex: 1; }
.copy {
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: transparent;
  color: var(--graphite);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 5px 9px;
  cursor: pointer;
}
.copy:hover { color: var(--ink); border-color: var(--ink); }

/* ------------------------------------------------------------------- cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 36px;
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 24px;
}
.card p { margin: 0; font-size: 15px; }
.card .num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--graphite);
  display: block;
  margin-bottom: 14px;
}

/* ---------------------------------------------------------------- pipeline */

/* The diagram from brand/banners/pipeline-1120x1350.png, rebuilt in markup so
   it reflows on a phone, follows the theme and can be read aloud. Same seven
   stages, same two escape hatches, same contract: 01–04 are model-driven and
   can fail, both fallbacks rejoin the main flow, 05–07 always run. */
.pipeline { margin-top: 40px; }

.stage-group + .stage-group { margin-top: 34px; }
.stage-group > .label { margin-bottom: 16px; }

.stage {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) minmax(0, 200px);
  gap: 18px;
  align-items: baseline;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
@media (max-width: 720px) {
  .stage { grid-template-columns: 40px minmax(0, 1fr); }
  .stage .handoff { grid-column: 2; }
}
.stage .no {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--graphite);        /* Signal is barred below 24px on text */
  font-variant-numeric: tabular-nums;
}
.stage h3 { margin: 0; }
.stage .what { font-size: 14px; color: var(--body); margin: 2px 0 0; }
.stage .handoff {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--graphite);
  text-align: right;
}
@media (max-width: 720px) { .stage .handoff { text-align: left; margin-top: 6px; } }

/* Escape hatches sit beside the flow, dashed, so they never read as a step
   every photo takes. */
.hatch {
  margin: 12px 0 0 64px;
  padding: 12px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-sunk);
  font-size: 14px;
}
@media (max-width: 720px) { .hatch { margin-left: 0; } }
.hatch .tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--graphite);
  margin-right: 10px;
}
.hatch strong { color: var(--ink); font-weight: 500; }

.io {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--graphite);
  padding: 14px 0;
}
.io strong { color: var(--ink); font-weight: 400; letter-spacing: 0; text-transform: none; font-size: 14px; }

.legend {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--graphite);
  max-width: 62ch;
}

/* ------------------------------------------------------------------ models */

.models { display: grid; gap: 0; margin-top: 32px; }
.model {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: 20px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  align-items: baseline;
}
@media (max-width: 640px) { .model { grid-template-columns: 1fr; gap: 4px; } }
.model .name { font-family: var(--mono); font-size: 14px; color: var(--ink); }
.model p { margin: 0; font-size: 15px; }

/* ------------------------------------------------------------------- usage */

.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 32px;
}
pre.code {
  margin: 0;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-sunk);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.75;
  overflow-x: auto;
}
pre.code .c { color: var(--graphite); }

/* ------------------------------------------------------------------ footer */

footer {
  border-top: 1px solid var(--line);
  padding: 40px 0 56px;
  font-size: 14px;
  color: var(--graphite);
}
footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
footer a { color: var(--graphite); text-decoration: none; }
footer a:hover { color: var(--ink); }
