/* AI Arcs design tokens.
 *
 * One source of truth for both surfaces. The landing page and the Studio share a palette,
 * a type scale and a node-colour vocabulary; they differ only in density, which is a single
 * class (.dense) that rescales spacing and type rather than a second set of colours.
 *
 * This replaces the previous arrangement where styles.css, studio.css and feature.css each
 * appended overrides — .brand-mark alone had four competing definitions, and the last one
 * to load won.
 */

:root {
  /* Surfaces, warm paper stock. */
  --paper: #f5f1ea;
  --surface: #fffdf8;
  --surface-sunk: #efe9e0;
  --surface-raised: #ffffff;

  /* Ink. */
  --ink: #222126;
  --ink-soft: #5f5b62;
  --muted: #8b8585;
  --line: #d9d2c8;
  --line-soft: #eee8df;

  /* Accents. */
  --accent: #ff8d53;
  --violet: #8c77ca;
  --violet-soft: #f0ebff;
  --green: #61a473;
  --danger: #c4564a;

  /* Node vocabulary. These are the node_type values the reference library actually uses,
   * so a diagram is readable without a legend once the hues are learned. */
  --n-harness: #4d83c4;
  --n-model: #8c77ca;
  --n-prompt: #e08a5d;
  --n-mcp_server: #c2853f;
  --n-tool: #3f9c93;
  --n-datastore: #5e9b71;
  --n-guardrail: #c4564a;
  --n-output: #6b6570;
  --n-context: #9b7fd4;
  --n-api: #b8863c;
  --n-default: #8b8585;

  /* Type. */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, monospace;
  --font-serif: Georgia, 'Times New Roman', serif;

  /* Spacing scale. The Studio rescales this, not the individual rules. */
  --unit: 4px;
  --s1: calc(var(--unit) * 1);
  --s2: calc(var(--unit) * 2);
  --s3: calc(var(--unit) * 3);
  --s4: calc(var(--unit) * 4);
  --s5: calc(var(--unit) * 5);
  --s6: calc(var(--unit) * 6);
  --s8: calc(var(--unit) * 8);
  --s12: calc(var(--unit) * 12);
  --s16: calc(var(--unit) * 16);

  /* Sizes. */
  --text-xs: 10px;
  --text-sm: 11px;
  --text-base: 13px;
  --text-md: 15px;
  --text-lg: 18px;

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

  --shadow-sm: 0 1px 2px #8f83730f, 0 2px 8px #8f83730a;
  --shadow: 0 4px 12px #8f837314, 0 12px 32px #8f83730f;
  --shadow-lg: 0 18px 45px #8f83731a;

  --ring: 0 0 0 3px color-mix(in srgb, var(--violet) 28%, transparent);
  --speed: 160ms;
}

/* Denser working variant for the Studio: same colours, tighter rhythm and smaller type,
 * so a tool reads as a tool rather than as a brochure. */
.dense {
  --unit: 3px;
  --text-xs: 9px;
  --text-sm: 10px;
  --text-base: 12px;
  --text-md: 13px;
  --text-lg: 15px;
  --radius-lg: 10px;
}

/* Dark is opt-in via [data-theme="dark"] and follows the system preference only when the
 * user has not chosen. Both blocks redefine tokens only — never a colour's sole definition. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #191a1d;
    --surface: #212328;
    --surface-sunk: #16171a;
    --surface-raised: #2a2d33;
    --ink: #eae6e0;
    --ink-soft: #b4aeb6;
    --muted: #857f88;
    --line: #34373d;
    --line-soft: #282b30;
    --violet-soft: #2b2545;
    --shadow-sm: 0 1px 2px #0006;
    --shadow: 0 4px 14px #00000059;
    --shadow-lg: 0 18px 45px #0000006b;
  }
}

:root[data-theme="dark"] {
  --paper: #191a1d;
  --surface: #212328;
  --surface-sunk: #16171a;
  --surface-raised: #2a2d33;
  --ink: #eae6e0;
  --ink-soft: #b4aeb6;
  --muted: #857f88;
  --line: #34373d;
  --line-soft: #282b30;
  --violet-soft: #2b2545;
  --shadow-sm: 0 1px 2px #0006;
  --shadow: 0 4px 14px #00000059;
  --shadow-lg: 0 18px 45px #0000006b;
}

/* ---------- reset ---------- */

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* The UA's [hidden] rule is `display: none` at zero specificity, so any class that sets a
   display — .gallery-more, .filter-row, .pick — silently beat it, and every element the
   scripts hide by setting `.hidden = true` stayed on screen. Restated here with the weight
   to win, since "hidden" is never a thing a layout rule should be able to override. */
[hidden] { display: none !important; }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- primitives ---------- */

.mono-label, .eyebrow, .section-kicker, .tag {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: var(--text-xs);
  letter-spacing: 0.13em;
  color: var(--muted);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: var(--s4) var(--s5);
  font-weight: 600;
  font-size: var(--text-base);
  cursor: pointer;
  background: var(--ink);
  color: var(--paper);
  white-space: nowrap;
  transition: transform var(--speed), background var(--speed), border-color var(--speed);
}
.button:active { transform: translateY(1px); }

.button-primary { background: var(--ink); color: var(--paper); }
.button-primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--accent)); }

.button-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.button-ghost:hover { border-color: var(--ink); }

.button-quiet { background: transparent; border-color: transparent; color: var(--ink-soft); padding: var(--s2) var(--s3); }
.button-quiet:hover { color: var(--ink); background: var(--surface-sunk); }

.field {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--s3);
  font: inherit;
  font-size: var(--text-base);
  color: var(--ink);
}
.field::placeholder { color: var(--muted); }
.field:focus-visible { border-color: var(--violet); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Brand mark. Defined once.
 *
 * Three arcs spring from one hub node to three others, each reaching further than the last.
 * That is the name at all three of its levels: an arc is a connection, a set of arcs is an
 * architecture, and the widening sweep is the arc a system travels as it grows. The previous
 * mark packed a brain squiggle inside a closed loop, which collapsed into an unreadable blob
 * below about 24px — the size it is actually used at in the nav and the favicon. */
.brand { display: flex; gap: var(--s3); align-items: center; font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); color: var(--ink); letter-spacing: -0.02em; }
.brand-mark { width: 30px; height: 26px; display: block; overflow: visible; flex: none; }
.brand-arc { fill: none; stroke: var(--accent); stroke-width: 1.9; stroke-linecap: round; }
.brand-hub { fill: var(--accent); }
.brand-node { fill: var(--paper); stroke: var(--accent); stroke-width: 1.9; }
