/* ngcpanel.com. Direction: "Warm Calm Console, showroom cut" - the panel's own warm neutrals and
   flare-magenta accent (OKLCH hue 331), Instrument Sans in its narrow width for display type,
   JetBrains Mono for anything a server would print. Light and dark follow the OS
   (prefers-color-scheme). CSP: default-src 'self' - no inline styles or scripts anywhere.
   No inner scroll boxes: code wraps, tables become cards on phones, everything reflows.

   The TOKENS and CHROME sections are repeated in the docs stylesheet
   (CoB NGCP repo: scripts/docsite/assets/style.css). Change both together. */

@layer reset, tokens, base, chrome, page;

/* == SHARED START (keep identical to the docs stylesheet; tools/check_shared_css.py) == */

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol, pre { margin: 0; }
  img, svg, picture { display: block; max-width: 100%; }
  img { height: auto; }
  button, input { font: inherit; color: inherit; }
  [hidden]:not([hidden="until-found"]) { display: none !important; }
}

@layer tokens {
  @font-face {
    font-family: "Instrument Sans";
    font-style: normal;
    font-display: swap;
    font-weight: 400 700;
    font-stretch: 75% 100%;
    src: url("/fonts/instrument-sans.woff2") format("woff2-variations"), url("/fonts/instrument-sans.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  }
  @font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-display: swap;
    font-weight: 400 700;
    src: url("/fonts/jetbrains-mono.woff2") format("woff2-variations"), url("/fonts/jetbrains-mono.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  }

  :root {
    color-scheme: light dark;
    --font-sans: "Instrument Sans", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, Consolas, monospace;
    --radius-ctl: 6px;
    --radius-card: 12px;
    --measure: 68ch;
    --page: 1200px;
    --gutter: clamp(16px, 4vw, 40px);

    /* light: warm parchment (values from the panel's web/src/index.css) */
    --bg: oklch(96.5% 0.009 95);
    --surface: oklch(98.8% 0.005 95);
    --surface-2: oklch(93.5% 0.011 95);
    --surface-3: oklch(90% 0.013 95);
    --border: oklch(88% 0.012 95);
    --border-strong: oklch(60% 0.012 90);
    --fg: oklch(21.5% 0.008 85);
    --fg-muted: oklch(43% 0.012 85);
    --fg-subtle: oklch(50% 0.012 85);
    --accent: oklch(54% 0.197 331);
    --accent-hover: oklch(49% 0.19 331);
    --on-accent: oklch(98.8% 0.005 95);
    --accent-text: oklch(48% 0.18 331);
    --accent-soft: oklch(93% 0.04 331);
    --success-text: oklch(48% 0.12 145);
    --success-soft: oklch(94.5% 0.035 145);
    --danger-text: oklch(50% 0.17 30);
    --danger-soft: oklch(94% 0.03 30);
    --warning-text: oklch(50% 0.105 70);
    --warning-soft: oklch(95% 0.04 85);
    --code-bg: oklch(21.5% 0.008 85);
    --code-fg: oklch(95.5% 0.008 85);
    --code-muted: oklch(78% 0.012 80);
    --code-key: oklch(81% 0.13 331);
    --shadow-color: oklch(20% 0.01 75 / 0.14);
    --shot-shadow: 0 1px 2px var(--shadow-color), 0 18px 48px -12px oklch(20% 0.01 75 / 0.28);
  }

  @media (prefers-color-scheme: dark) {
    :root {
      /* dark: warm near-black, yellow-brown undertone */
      --bg: oklch(17% 0.008 75);
      --surface: oklch(20.5% 0.009 75);
      --surface-2: oklch(24.5% 0.01 75);
      --surface-3: oklch(29% 0.011 75);
      --border: oklch(32% 0.011 75);
      --border-strong: oklch(54% 0.012 78);
      --fg: oklch(95.5% 0.008 85);
      --fg-muted: oklch(80% 0.012 80);
      --fg-subtle: oklch(70% 0.013 78);
      --accent: oklch(73% 0.17 331);
      --accent-hover: oklch(78% 0.15 331);
      --on-accent: oklch(20% 0.04 331);
      --accent-text: oklch(81% 0.13 331);
      --accent-soft: oklch(30% 0.06 331);
      --success-text: oklch(79% 0.14 140);
      --success-soft: oklch(27% 0.04 140);
      --danger-text: oklch(76% 0.14 30);
      --danger-soft: oklch(28% 0.05 30);
      --warning-text: oklch(82% 0.13 78);
      --warning-soft: oklch(29% 0.045 78);
      --code-bg: oklch(13.5% 0.007 75);
      --code-fg: oklch(95.5% 0.008 85);
      --code-muted: oklch(74% 0.012 80);
      --code-key: oklch(81% 0.13 331);
      --shadow-color: oklch(5% 0.005 75 / 0.6);
      --shot-shadow: 0 0 0 1px oklch(32% 0.011 75), 0 24px 60px -16px oklch(5% 0.005 75 / 0.9);
    }
  }
}

@layer base {
  html { scroll-padding-top: 24px; }
  html, body { overflow-x: clip; }
  body {
    min-height: 100dvh;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    font-synthesis: none;
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word;
  }
  a { color: var(--accent-text); text-underline-offset: 3px; text-decoration-thickness: 1px; }
  a:hover { text-decoration-thickness: 2px; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
  ::selection { background: var(--accent-soft); color: var(--fg); }
  code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.9em; }
  :not(pre) > code {
    background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere;
  }
  strong { font-weight: 650; }
  .vh {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
}

/* ---------- CHROME: skip link, header, footer (shared with the docs) ---------- */
@layer chrome {
  .skip {
    position: absolute; left: 8px; top: -60px; z-index: 20;
    background: var(--surface); color: var(--fg); padding: 10px 14px;
    border: 2px solid var(--accent); border-radius: var(--radius-ctl);
  }
  .skip:focus { top: 8px; }

  .site-head { border-bottom: 1px solid var(--border); background: var(--bg); }
  .site-head-in {
    max-width: var(--page); margin: 0 auto; padding: 12px var(--gutter);
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px;
  }
  .brand {
    display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
    color: var(--fg); text-decoration: none;
  }
  .brand-mark { width: 30px; height: 30px; flex: none; }
  .brand-mark rect { fill: var(--fg); }
  .brand-mark path { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
  .brand-name { font-weight: 700; font-stretch: 85%; font-size: 21px; letter-spacing: 0.01em; line-height: 1; }
  .brand-tag { color: var(--fg-muted); font-size: 14px; line-height: 1.2; }
  .site-nav { margin-left: auto; }
  .site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
  .site-nav a {
    display: inline-flex; align-items: center; min-height: 40px; padding: 6px 12px;
    color: var(--fg-muted); text-decoration: none; font-weight: 550; border-radius: var(--radius-ctl);
  }
  .site-nav a:hover { color: var(--fg); background: var(--surface-2); }
  .site-nav a[aria-current] { color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
  @media (max-width: 599px) {
    .brand-tag { display: none; }
    .site-nav { margin-left: 0; flex-basis: 100%; }
    .site-nav ul { margin-left: -8px; }
    .site-nav a { padding-inline: 8px; }
  }

  .site-foot { border-top: 1px solid var(--border); margin-top: 96px; color: var(--fg-muted); font-size: 15px; }
  .site-foot-in {
    max-width: var(--page); margin: 0 auto; padding: 32px var(--gutter) 40px;
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 40px;
  }
  .site-foot p { margin: 0; }
  .site-foot .maker { color: var(--fg); font-weight: 600; }
  .site-foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 20px; }
  .site-foot a { color: var(--fg-muted); display: inline-block; padding: 4px 0; }
  .site-foot a:hover { color: var(--fg); }
}

/* == SHARED END == */

/* ---------- PAGE ---------- */
@layer page {
  .wrap { max-width: var(--page); margin-inline: auto; padding-inline: var(--gutter); }
  section { padding-top: clamp(64px, 9vw, 112px); }

  /* type */
  .display, h1, h2 { font-stretch: 78%; font-weight: 650; letter-spacing: -0.015em; text-wrap: balance; }
  h1 { font-size: clamp(42px, 7.4vw, 88px); line-height: 0.98; }
  h2 { font-size: clamp(32px, 4.6vw, 54px); line-height: 1.04; }
  h3 { font-size: 22px; line-height: 1.25; font-weight: 650; text-wrap: balance; }
  .kicker {
    font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; letter-spacing: 0.02em;
    color: var(--accent-text); margin-bottom: 14px; display: flex; align-items: center; gap: 10px;
  }
  .kicker::before { content: ""; width: 22px; height: 2px; background: var(--accent); flex: none; }
  .lede { font-size: clamp(18px, 1.6vw, 20px); line-height: 1.55; color: var(--fg-muted); max-width: 46ch; text-wrap: pretty; }
  .prose { max-width: var(--measure); }
  .prose p + p, .prose p + ul, .prose ul + p { margin-top: 14px; }
  .muted { color: var(--fg-muted); }

  /* buttons */
  .actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 10px 22px; border-radius: var(--radius-ctl);
    font-weight: 600; font-size: 16px; text-decoration: none; border: 1px solid transparent;
  }
  .btn-primary { background: var(--accent); color: var(--on-accent); }
  .btn-primary:hover { background: var(--accent-hover); }
  .btn-quiet { background: transparent; color: var(--fg); border-color: var(--border-strong); }
  .btn-quiet:hover { background: var(--surface-2); }
  .btn svg { width: 18px; height: 18px; flex: none; }

  .status {
    display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 10px;
    border: 1px solid var(--border-strong); border-radius: 999px;
    font-family: var(--font-mono); font-size: 12.5px; color: var(--fg); background: var(--surface);
  }
  @media (max-width: 400px) { .status { font-size: 12.5px; letter-spacing: -0.01em; padding-inline: 8px 10px; } }
  .status::before {
    content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warning-text); flex: none;
  }

  /* hero */
  .hero { padding-top: clamp(48px, 8vw, 104px); }
  .hero h1 { margin-top: 22px; max-width: 15ch; }
  .hero .lede { margin-top: 24px; }
  .hero .actions { margin-top: 32px; }
  .hero-note { margin-top: 18px; font-size: 15px; color: var(--fg-muted); }
  .facts {
    margin-top: clamp(40px, 6vw, 64px);
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    border-top: 1px solid var(--border);
  }
  .facts div { padding: 16px 20px 16px 0; border-bottom: 1px solid var(--border); }
  .facts dt { font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-subtle); }
  .facts dd { margin-top: 4px; font-weight: 600; font-size: 17px; }

  /* screenshots */
  .shot {
    margin-top: 32px; border-radius: var(--radius-card); overflow: hidden;
    background: var(--surface-2); box-shadow: var(--shot-shadow);
  }
  .shot img { width: 100%; }
  .hero-shot { margin-top: clamp(40px, 6vw, 64px); }
  figcaption, .caption { margin-top: 12px; font-size: 14px; color: var(--fg-subtle); }
  .shot + figcaption { padding: 0 2px; }

  /* origin band */
  .origin {
    margin-top: clamp(40px, 5vw, 56px); padding: 28px 0;
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  }
  .origin p { font-size: clamp(20px, 2.2vw, 26px); line-height: 1.35; font-stretch: 88%; max-width: 46ch; text-wrap: balance; }
  .origin strong { color: var(--accent-text); font-weight: 650; }

  /* split rows */
  .split { display: grid; gap: 32px 56px; align-items: start; }
  @media (min-width: 900px) {
    .split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
    .split.flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
    .split.flip > :first-child { order: 2; }
    .split.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  }
  .split h2 + p, .split h2 + .lede { margin-top: 20px; }
  .ticks { list-style: none; padding: 0; margin-top: 22px; display: grid; gap: 10px; }
  .ticks li { position: relative; padding-left: 28px; }
  .ticks li::before {
    content: ""; position: absolute; left: 2px; top: 0.55em; width: 12px; height: 7px;
    border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg) translateY(-3px);
  }
  .more { margin-top: 22px; font-weight: 600; }
  .more a { text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 1px; }
  .more a:hover { border-bottom-width: 2px; }

  /* architecture diagram */
  .diagram { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); padding: clamp(12px, 2vw, 24px); }
  .diagram svg { width: 100%; height: auto; }
  .diagram .dg-tall { display: none; max-width: 420px; margin: 0 auto; }
  @media (max-width: 559px) {
    .diagram .dg-wide { display: none; }
    .diagram .dg-tall { display: block; }
  }
  .diagram .box { fill: var(--surface-2); stroke: var(--border-strong); stroke-width: 1.5; }
  .diagram .box-panel { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
  .diagram .t { fill: var(--fg); font-family: var(--font-sans); font-size: 17px; font-weight: 650; }
  .diagram .t-s { fill: var(--fg-muted); font-family: var(--font-mono); font-size: 12.5px; }
  .diagram .t-a { fill: var(--accent-text); font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }
  .diagram .t-b { fill: var(--fg-subtle); font-family: var(--font-mono); font-size: 12.5px; }
  .diagram .link { stroke: var(--accent); stroke-width: 2.5; fill: none; }
  .diagram .arrow { fill: var(--accent); }
  .diagram .nat { fill: none; stroke: var(--border-strong); stroke-width: 1.5; stroke-dasharray: 6 6; }
  .diagram .game { fill: var(--surface-3); }
  .diagram .no { stroke: var(--fg-subtle); stroke-width: 2; }

  /* games */
  .games { list-style: none; padding: 0; margin-top: 28px; border-top: 1px solid var(--border); }
  .games li {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 24px; padding: 16px 0; border-bottom: 1px solid var(--border);
  }
  @media (min-width: 560px) { .games li { grid-template-columns: 13ch minmax(0, 1fr); align-items: baseline; } }
  .games b { font-weight: 650; font-size: 18px; font-stretch: 88%; }
  .games span { color: var(--fg-muted); }

  /* code */
  pre {
    background: var(--code-bg); color: var(--code-fg); border-radius: var(--radius-card);
    padding: 18px 20px; font-size: 13.5px; line-height: 1.6;
    white-space: break-spaces; overflow-wrap: anywhere;
    border: 1px solid var(--border);
  }
  pre .c { color: var(--code-muted); }
  pre .k { color: var(--code-key); }
  .code-title {
    display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-subtle); margin-bottom: 8px;
  }

  /* feature rows (home) */
  .feature + .feature { margin-top: clamp(64px, 8vw, 104px); }
  .feature .shot { margin-top: 0; }
  @media (min-width: 900px) {
    .feature { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); align-items: center; }
    .feature.flip { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); }
  }
  .feature h3 { font-size: clamp(26px, 2.8vw, 34px); font-stretch: 80%; line-height: 1.08; letter-spacing: -0.01em; }
  .feature p { margin-top: 16px; color: var(--fg-muted); max-width: 50ch; }

  /* two-column lists */
  .cols { display: grid; gap: 28px 56px; margin-top: 36px; }
  @media (min-width: 760px) { .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (min-width: 1100px) { .cols.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
  .cols h3 { font-size: 20px; }
  .cols p { margin-top: 8px; color: var(--fg-muted); }
  .cols .label { font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-subtle); margin-bottom: 6px; }
  .rule-top { border-top: 2px solid var(--fg); padding-top: 16px; }

  .oneliner { margin-top: 36px; }

  /* closing band */
  .closing {
    margin-top: clamp(80px, 10vw, 128px); padding: clamp(32px, 5vw, 56px);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
    border-top: 3px solid var(--accent);
  }
  .closing h2 { max-width: 18ch; }
  .closing p { margin-top: 18px; max-width: 50ch; color: var(--fg-muted); }
  .closing .actions { margin-top: 28px; }

  /* features page */
  .page-head { padding-top: clamp(48px, 7vw, 88px); }
  .page-head h1 { font-size: clamp(40px, 6.2vw, 72px); max-width: 16ch; }
  .page-head .lede { margin-top: 22px; }
  .jump { margin-top: 32px; }
  .jump ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
  .jump a {
    display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px;
    border: 1px solid var(--border-strong); border-radius: 999px; color: var(--fg);
    text-decoration: none; font-size: 15px; font-weight: 550; background: var(--surface);
  }
  .jump a:hover { border-color: var(--accent); }
  .fgroup { scroll-margin-top: 16px; }
  .fgroup .split { margin-top: 0; }
  .fgroup h2 { font-size: clamp(30px, 3.8vw, 44px); }
  .fgroup .lede { margin-top: 16px; font-size: 18px; }
  .flist { list-style: none; padding: 0; margin-top: 24px; display: grid; gap: 0; border-top: 1px solid var(--border); }
  .flist li { padding: 14px 0; border-bottom: 1px solid var(--border); }
  .flist b { display: block; font-weight: 650; }
  .flist span { display: block; margin-top: 2px; color: var(--fg-muted); }
  .docs-links { margin-top: 20px; font-size: 15px; color: var(--fg-muted); }
  .docs-links a { font-weight: 600; white-space: nowrap; }
  .fgroup .shot { margin-top: 0; }
  @media (min-width: 900px) { .fgroup .sticky { position: sticky; top: 24px; } }

  /* download page */
  .offers { list-style: none; padding: 0; margin-top: 40px; display: grid; gap: 16px; }
  @media (min-width: 760px) { .offers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .offers li {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
    padding: 24px; display: flex; flex-direction: column; gap: 10px;
  }
  .offers .what { font-family: var(--font-mono); font-size: 12.5px; color: var(--fg-subtle); }
  .offers h2 { font-size: 24px; font-stretch: 85%; letter-spacing: -0.005em; line-height: 1.2; }
  .offers p { color: var(--fg-muted); }
  .offers .soon {
    margin-top: auto; padding-top: 8px; font-family: var(--font-mono); font-size: 12.5px; color: var(--warning-text);
    display: flex; align-items: center; gap: 8px;
  }
  .offers .soon svg { width: 16px; height: 16px; flex: none; }
  .next-steps { list-style: none; padding: 0; margin-top: 28px; display: grid; gap: 12px; max-width: 760px; }
  .next-steps a {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center;
    padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius-card);
    background: var(--surface); text-decoration: none; color: var(--fg);
  }
  .next-steps a:hover { border-color: var(--accent); }
  .next-steps b { font-weight: 650; font-size: 18px; }
  .next-steps span { color: var(--fg-muted); grid-column: 1; }
  .next-steps svg { width: 20px; height: 20px; grid-row: 1 / span 2; grid-column: 2; color: var(--accent-text); }

  /* 404 */
  .notfound { padding-top: clamp(64px, 12vw, 160px); }
  .notfound .code { font-family: var(--font-mono); color: var(--accent-text); font-size: 15px; }
  .notfound h1 { margin-top: 12px; font-size: clamp(40px, 6vw, 72px); }
  .notfound .actions { margin-top: 32px; }
}
