/* Anticode
   Brief
   - Subject: an AI app builder whose output never looks vibe-coded and ships secure.
   - Single job: get someone to describe an app in one sentence and watch it get built.
   - Only-this-subject detail: a red pen that strikes generic AI tells, and a real security scan of the generated code.
   - Lead reference: xAI, studied live on 2026-10-19: #0a0a0a ground, tone-only #1a1a1a cards at 16px, #1f2228 hairlines,
     cool body grey with white headings, 44px pills (white primary, filled #222 secondary), w450 display at -1.5%,
     a centred hero with an announcement pill and a rotating last word, and live self-playing demo tiles under it.
   - Font: Onest, one variable family for everything. System mono only for the code view.
   - Palette: ground, surface, raised, text, muted, line; action = the white pill; --pen = the blue pen (brand accent); --danger = errors and destructive actions
     (what was struck out, and the agent working right now); --ok = passed checks.
   - House curve: cubic-bezier(.2,0,0,1). Reveals expo-out, springs only when the mark snaps shut.
   - Signature: the Anticode mark is the build engine. Its halves pull apart while the agents work and snap shut when every check passes. */

:root {
  --ground: #0a0a0a;
  --surface: #1a1a1a;
  --raised: #222222;
  --text: #ffffff;
  --body: #d5dae3;
  --muted: #8d9299;
  --line: #1f2228;
  --line-2: #2e323a;
  --action: #ffffff;
  --on-action: #0a0a0a;
  --pen: #4f8cff;
  --danger: #ff5a52;
  --ok: #3ddc97;
  --warn: #f5c451;
  --code-tag: #9cc4ff;
  --code-attr: #c7b8ff;
  --code-str: #ffc98a;

  --font: "Onest", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
  --fs-0: 12.5px; --fs-1: 14px; --fs-2: 16.5px; --fs-3: 20px;
  --fs-4: clamp(30px, 4.2vw, 52px); --fs-5: clamp(42px, 6.6vw, 88px);

  --r-control: 9999px; --r-card: 16px; --r-menu: 12px; --r-panel: 22px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px; --s-9: 120px;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-reveal: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-snap: cubic-bezier(0.23, 1, 0.32, 1);
  --t-exit: 90ms; --t-1: 150ms; --t-2: 250ms; --t-3: 420ms; --t-4: 700ms;
  --stagger: 30ms;

  --col: 1180px;
  --bar-h: 56px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ground: #f7f7f8; --surface: #ffffff; --raised: #ececee; --text: #0a0a0a; --body: #30343b; --muted: #61666e;
    --line: #e3e5e8; --line-2: #cfd2d7; --action: #0d0d0f; --on-action: #f7f7f8;
    --pen: #1d5fd6; --danger: #d92d20; --ok: #08744a; --code-tag: #1d5fd6; --code-attr: #7a3fd6; --code-str: #a65a00; color-scheme: light;
  }
}
:root[data-theme="light"] {
  --ground: #f7f7f8; --surface: #ffffff; --raised: #ececee; --text: #0a0a0a; --body: #30343b; --muted: #61666e;
  --line: #e3e5e8; --line-2: #cfd2d7; --action: #0d0d0f; --on-action: #f7f7f8;
  --pen: #1d5fd6; --danger: #d92d20; --ok: #08744a; --code-tag: #1d5fd6; --code-attr: #7a3fd6; --code-str: #a65a00; color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--ground); color: var(--body); font: 400 var(--fs-2)/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, video, canvas { display: block; max-width: 100%; height: auto; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
code, pre { font-family: var(--mono); }
p { margin: 0; }
h1, h2, h3 { margin: 0; text-wrap: balance; font-weight: 500; color: var(--text); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--pen); color: #fff; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: var(--col); margin-inline: auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.num { font-variant-numeric: tabular-nums; }
.label { font-size: var(--fs-0); font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.skip { position: fixed; left: 16px; top: -60px; z-index: 300; padding: 10px 16px; border-radius: var(--r-control); background: var(--action); color: var(--on-action); font-weight: 600; }
.skip:focus { top: 12px; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
svg.i-lg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 44px; padding: 0 20px; border-radius: var(--r-control); font-size: var(--fs-1); font-weight: 500; white-space: nowrap;
  transition: background-color var(--t-1) var(--ease), color var(--t-1) var(--ease), box-shadow var(--t-1) var(--ease), opacity var(--t-1) var(--ease); }
.btn-primary { background: var(--action); color: var(--on-action); }
.btn-primary:hover { background: color-mix(in srgb, var(--action) 84%, var(--ground)); }
.btn-quiet, .btn-dark { background: var(--raised); color: var(--text); }
.btn-quiet:hover, .btn-dark:hover { background: color-mix(in srgb, var(--raised) 91%, var(--text)); }
.btn-sm { min-height: 36px; padding: 0 16px; font-size: 13.5px; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }

.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; border-radius: var(--r-control); font-size: 13.5px; font-weight: 500; color: var(--muted); background: var(--raised);
  transition: color var(--t-1) var(--ease), background-color var(--t-1) var(--ease); }
.chip:hover span { color: var(--text); }
.chip input:checked + span { color: var(--on-action); background: var(--action); box-shadow: none; }
.chip input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 2px; }

.mark { display: block; overflow: visible; }
.mark path { fill: currentColor; transform-box: fill-box; transform-origin: 50% 50%; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand .mark { width: 24px; height: 27px; }
.brand-word { font-size: 19px; font-weight: 500; letter-spacing: -0.01em; }
.brand:hover .mk-a { transform: translate(1.5%, -3%); }
.brand:hover .mk-b { transform: translate(-1.5%, 3%); }
.brand .mark path { transition: transform var(--t-3) var(--ease-spring); }

.engine { --s: 0; --r: 0deg; position: relative; display: grid; place-items: center; color: var(--text); }
.engine .mark { width: 100%; height: auto; }
.engine .mk-a { transform: translate(calc(var(--s) * 0.5px), calc(var(--s) * -1px)) rotate(var(--r)); transition: transform var(--t-4) var(--ease-reveal), fill var(--t-3) var(--ease); }
.engine .mk-b { transform: translate(calc(var(--s) * -0.5px), calc(var(--s) * 1px)) rotate(var(--r)); transition: transform var(--t-4) var(--ease-reveal), fill var(--t-3) var(--ease); }
.engine-ring { position: absolute; inset: 6%; border-radius: 50%; border: 1.5px solid var(--ok); opacity: 0; pointer-events: none; }
.engine[data-state="split"] { --s: 70; --r: -10deg; }
.engine[data-state="work"] { --s: 34; }
.engine[data-state="work"] .mk-a { animation: mk-a 1.5s var(--ease) infinite alternate; }
.engine[data-state="work"] .mk-b { fill: var(--pen); animation: mk-b 1.5s var(--ease) infinite alternate; }
.engine[data-state="done"] { --s: 0; }
.engine[data-state="done"] .mk-a, .engine[data-state="done"] .mk-b { transition: transform var(--t-4) var(--ease-spring), fill var(--t-3) var(--ease); }
.engine[data-state="done"] .engine-ring { animation: ring 1100ms var(--ease-reveal) 380ms both; }
.engine[data-state="fail"] { --s: 18; }
.engine[data-state="fail"] .mk-b { fill: var(--warn); }
@keyframes mk-a { from { transform: translate(17px, -34px) rotate(0deg); } to { transform: translate(24px, -48px) rotate(-5deg); } }
@keyframes mk-b { from { transform: translate(-17px, 34px) rotate(0deg); } to { transform: translate(-24px, 48px) rotate(-5deg); } }
@keyframes ring { from { opacity: 0.7; transform: scale(0.82); } to { opacity: 0; transform: scale(1.25); } }

/* shared controls: press, morphing arrows, gliding highlight, split pill, menus */
.btn, .announce, .chip span, .seg button, .mob-tabs button, .tile, .menu button, .result .chips button { transition-property: background-color, color, box-shadow, opacity, scale; transition-duration: var(--t-1); transition-timing-function: var(--ease); }
.btn:active, .announce:active { scale: 0.985; }
.btn-icon:active, .seg button:active, .split-more:active, .chip:active span { scale: 0.94; }
.tile:active { scale: 0.992; }

.arw path { transform-box: fill-box; transition: opacity var(--t-1) var(--ease), transform 240ms var(--ease-reveal); }
.arw .shaft { opacity: 0; transform: scaleX(0.3); transform-origin: 100% 50%; }
:is(.btn, .announce):is(:hover, :focus-visible) .arw .shaft { opacity: 1; transform: none; }
:is(.btn, .announce):is(:hover, :focus-visible) .arw .head { transform: translateX(1.5px); }
.send:hover svg, .announce:hover svg { transform: none; }
.explore span { display: inline-block; transition: transform 300ms var(--ease-reveal); }
.tile:hover .explore span { transform: translateX(3px); }

.nav, .menu { position: relative; }
.nav a, .menu button { position: relative; z-index: 1; }
.hl { position: absolute; left: 0; top: 0; z-index: 0; border-radius: var(--r-control); background: color-mix(in srgb, var(--text) 7%, transparent); opacity: 0; pointer-events: none;
  transition: opacity 120ms var(--ease), transform 280ms var(--ease-reveal), width 280ms var(--ease-reveal), height 280ms var(--ease-reveal); }
.menu .hl { border-radius: 8px; background: color-mix(in srgb, var(--text) 5%, transparent); }
.hl.on { opacity: 1; }
.hl.no-move { transition: opacity 120ms var(--ease); }

.split { position: relative; display: inline-flex; }
.split-main { border-radius: var(--r-control) 0 0 var(--r-control); padding-right: 12px; }
.split-more { border-radius: 0 var(--r-control) var(--r-control) 0; padding: 0 12px 0 9px; box-shadow: inset 1px 0 0 color-mix(in srgb, var(--on-action) 14%, transparent); }
.chev { width: 16px; height: 16px; transition: transform 220ms var(--ease); }
.split-more[aria-expanded="true"] .chev { transform: rotate(180deg); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 130; display: grid; width: min(272px, calc(100vw - 32px)); padding: 8px; border-radius: 12px; background: var(--ground);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 8%, transparent), 0 16px 48px -8px rgba(0, 0, 0, 0.55); }
.menu.pop { --origin: top right; transition: opacity var(--t-exit) linear, transform var(--t-exit) linear, visibility 0s linear var(--t-exit); }
.menu.pop { transform-origin: var(--origin, top right); }
.menu.pop:not(.is-open) { opacity: 0; visibility: hidden; pointer-events: none; transform: scale(0.95); }
.menu.pop.is-open { transition: opacity var(--t-1) var(--ease-reveal), transform var(--t-1) var(--ease-reveal), visibility 0s; }
.menu-label { padding: 6px 10px 8px; font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.menu button { display: grid; gap: 2px; width: 100%; padding: 9px 10px; border-radius: 8px; text-align: left; }
.menu b { font-size: 14px; font-weight: 500; color: var(--text); }
.menu span { font-size: 12.5px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 0s !important; scroll-behavior: auto !important; }
  .engine[data-state="work"] .mk-a, .engine[data-state="work"] .mk-b { animation: none; }
}


/* toasts (status messages, optional action) */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 200; translate: -50% 0; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 10px 18px; border-radius: var(--r-control); background: var(--text); color: var(--ground); font-size: 14px; font-weight: 500; box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.5); }
.toast[hidden] { display: none; }
.toast:not([hidden]) { animation: toast-in var(--t-2) var(--ease-reveal); }
.toast button { margin-right: -8px; padding: 5px 12px; border-radius: var(--r-control); font-weight: 600; background: color-mix(in srgb, var(--ground) 12%, transparent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(0.96); } }
