:root {
    --ground: #111213; --ground-deep: #0B0C0C;
    --iron: #1B1C1C; --iron-raised: #232423; --iron-edge: #2E2F2E;
    --pewter-shadow: #57534E; --pewter: #A29787; --pewter-bright: #C9BCA6;
    --bone: #E8DFD1; --bone-2: #CFC6B8;
    --saffron: #D1670B; --saffron-hot: #EC7C0C; --green: #1C5221; --green-text: #3FA35A;
    --copper: #644730; --navy: #232E5C;
    --display: "Hubot Sans", "Arial Narrow", sans-serif;
    --text: "Mona Sans", system-ui, sans-serif;
    --pad: clamp(1.25rem, 4vw, 4rem);
  }
  * { box-sizing: border-box; }
  html { background: var(--ground); }
  body {
    margin: 0; color: var(--bone-2); font-family: var(--text); font-weight: 380; font-size: 1.125rem; line-height: 1.65;
    background-color: var(--ground);
    background-image:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1.1 0 0 0 -0.375 1.1 0 0 0 -0.375 1.1 0 0 0 -0.375 0 0 0 0 0.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
      url("../circuits.svg");
    background-size: 15rem 15rem, 60rem 60rem;
    -webkit-font-smoothing: antialiased;
  }
  #stage { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; display: block; pointer-events: none; }
  .page { position: relative; z-index: 1; }
  a { color: inherit; }
  :focus-visible { outline: 2px solid var(--saffron-hot); outline-offset: 3px; border-radius: 3px; }

  .label { font-family: var(--display); font-weight: 650; font-stretch: 87.5%; font-size: 0.8125rem; letter-spacing: 0.14em; text-transform: uppercase; }
  .engraved { color: var(--bone); text-shadow: 0 1px 0 rgba(255,240,220,0.08), 0 -1px 0 rgba(0,0,0,0.9), 0 0 1.125rem rgba(0,0,0,0.6); }

  .rail { position: fixed; z-index: 5; top: 0.875rem; left: var(--pad); right: var(--pad); height: 3.625rem; display: flex; align-items: center; gap: 1.75rem; padding: 0 0.75rem 0 1.375rem; }
  .rail .brand { font-family: var(--display); font-weight: 750; font-stretch: 87.5%; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; font-size: 1rem; white-space: nowrap; }
  .rail nav { display: flex; gap: 1.5rem; margin-left: auto; color: var(--bone-2); }
  .rail nav a { text-decoration: none; }
  .rail nav a:hover { color: var(--bone); }

  .btn { display: inline-flex; align-items: center; gap: 0.625rem; min-height: 2.875rem; padding: 0 1.25rem; border-radius: 0.25rem; text-decoration: none; white-space: nowrap; cursor: pointer; border: 0; }
  .btn:disabled { opacity: 0.45; cursor: default; }
  .btn-primary { background: linear-gradient(180deg, #E07410, #C35F08); color: #140A02; box-shadow: inset 0 1px 0 rgba(255,230,200,0.35), inset 0 -1px 0 rgba(0,0,0,0.3), 0 0.5rem 1.625rem rgba(209,103,11,0.28); }
  .btn-primary:hover { background: linear-gradient(180deg, #EC7C0C, #CC6409); }
  .btn-ghost { color: var(--bone); background: rgba(27,28,28,0.7); box-shadow: inset 0 0 0 1px var(--pewter-shadow), inset 0 1px 0 rgba(201,188,166,0.15); }
  .btn-ghost:hover { box-shadow: inset 0 0 0 1px var(--pewter); }

  .hero { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); align-items: center; gap: clamp(2rem, 5vw, 6rem); padding: 7.5rem var(--pad) 4.5rem; }
  .kicker { margin: 0 0 1.625rem; display: inline-block; padding: 0.5rem 0.875rem; color: var(--pewter); }
  h1 { margin: 0; font-family: var(--display); font-weight: 800; font-stretch: 75%; text-transform: uppercase; line-height: 0.96; letter-spacing: 0.015em; }
  h1 .bar { display: block; width: max-content; max-width: 100%; padding: 1rem 1.5rem 0.75rem; font-size: clamp(2.25rem, 4.4vw, 4.75rem); }
  h1 .bar-ea { margin-left: clamp(1.5rem, 6vw, 7.5rem); }
  h1 .splice { display: block; width: max-content; margin: 0.625rem 0 0.625rem clamp(5rem, 14vw, 16.25rem); padding: 0.5625rem 1.375rem 0.4375rem; font-family: var(--display); font-weight: 650; font-stretch: 87.5%; font-size: clamp(0.8125rem, 1.05vw, 1rem); letter-spacing: 0.42em; color: var(--saffron-hot); }
  .lede { max-width: 34em; margin: 2.125rem 0 1.875rem; font-size: clamp(1.0625rem, 1.2vw, 1.25rem); padding: 1.25rem 1.5rem; color: var(--bone-2); }
  .lede strong { color: var(--bone); font-weight: 600; }
  .lede cite { display: block; margin-top: 0.625rem; font-style: normal; color: var(--pewter); font-size: 0.875rem; }
  .actions { display: flex; gap: 0.875rem; flex-wrap: wrap; padding: 0 1.5rem; }
  .actions .hint { flex-basis: 100%; color: var(--pewter); font-size: 0.9375rem; margin: 0.25rem 0 0; }
  .logo-mount { margin: 0; justify-self: center; width: min(calc(100% - 7.5rem), 31.25rem); aspect-ratio: 1 / 1; }
  .logo-mount img { display: block; width: 100%; height: 100%; }

  .section { padding: 16vh var(--pad) 12vh; }
  .section-head { max-width: 56.25rem; margin-bottom: 3rem; }
  h2 { font-family: var(--display); font-weight: 800; font-stretch: 75%; text-transform: uppercase; font-size: clamp(2rem, 3.6vw, 3.625rem); line-height: 1; margin: 0 0 1.25rem; display: inline-block; padding: 0.875rem 1.375rem 0.625rem; }
  .section-head p { max-width: 42em; margin: 0; padding: 0 1.375rem; }
  .eyebrow { display: block; color: var(--saffron-hot); margin: 0 0 0.875rem 1.375rem; }

  .panel {
    position: relative; border-radius: 0.625rem;
    box-shadow: inset 0 0 0 1px var(--iron-edge), inset 0 1px 0 rgba(201,188,166,0.16), 0 1.875rem 4.375rem rgba(0,0,0,0.5);
    background-image:
      radial-gradient(circle at 1rem 1rem, #8b8273 0 2.6px, #3a3732 3.4px, transparent 0.2625rem),
      radial-gradient(circle at calc(100% - 1rem) 1rem, #8b8273 0 2.6px, #3a3732 3.4px, transparent 0.2625rem),
      radial-gradient(circle at 1rem calc(100% - 1rem), #8b8273 0 2.6px, #3a3732 3.4px, transparent 0.2625rem),
      radial-gradient(circle at calc(100% - 1rem) calc(100% - 1rem), #8b8273 0 2.6px, #3a3732 3.4px, transparent 0.2625rem),
      linear-gradient(180deg, #1F201F, #191A1A);
  }
  .panel::before { content: ""; position: absolute; left: 2.125rem; right: 2.125rem; top: 0.5625rem; height: 2px; background: linear-gradient(90deg, transparent, var(--copper) 12%, #7a5534 50%, var(--copper) 88%, transparent); opacity: 0.85; }

  #tangle { height: 420vh; position: relative; padding: 0 var(--pad); }
  .tangle-stage { position: sticky; top: 0; height: 100vh; display: grid; grid-template-columns: minmax(16.25rem, 0.75fr) minmax(0, 1.6fr); gap: clamp(1.25rem, 3vw, 3rem); align-items: center; padding: 6rem 0 2rem; }
  .steps { list-style: none; margin: 0; padding: 1.625rem 1.5rem; }
  .steps li { padding: 0.875rem 0 0.875rem 1.125rem; border-left: 2px solid var(--iron-edge); color: var(--pewter); transition: color .35s, border-color .35s; }
  .steps li b { display: block; font-family: var(--display); font-weight: 750; font-stretch: 87.5%; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.9375rem; margin-bottom: 0.25rem; }
  .steps li.on { color: var(--bone-2); border-left-color: var(--saffron-hot); }
  .steps li.on b { color: var(--bone); }
  .steps li.done { color: var(--pewter); border-left-color: var(--green-text); }
  .counter { display: flex; align-items: baseline; gap: 0.875rem; padding: 0.375rem 1.5rem 0; }
  .counter .n { font-family: var(--display); font-weight: 800; font-stretch: 75%; font-size: 4.5rem; line-height: 1; color: var(--bone); min-width: 1.2em; }
  .counter .t { color: var(--pewter); max-width: 14em; font-size: 0.9375rem; line-height: 1.4; }
  .diagram { padding: 1.75rem; }
  .diagram svg { width: 100%; height: auto; display: block; }
  .svg-label { font-family: var(--display); font-weight: 700; font-stretch: 87.5%; letter-spacing: 0.06em; text-transform: uppercase; }

  .run { padding: 1.875rem; }
  .run-controls { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin: 1.375rem 0 0; }
  .run-controls .spacer { flex: 1; }
  .decision { display: none; gap: 0.75rem; align-items: center; padding: 0.75rem 1rem; border-radius: 0.375rem; background: #2a1a0c; box-shadow: inset 0 0 0 1px #7a4410; color: var(--bone); }
  .decision.show { display: flex; }
  .btn-approve { background: #1C5221; color: var(--bone); box-shadow: inset 0 0 0 1px #3FA35A; }
  .btn-reject { background: #3a1d0d; color: var(--bone); box-shadow: inset 0 0 0 1px var(--saffron-hot); }
  .run-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(16.25rem, 0.8fr); gap: 1.5rem; margin-top: 0.5rem; }
  .log { margin: 0; padding: 1rem 1.125rem; border-radius: 0.375rem; background: #141515; box-shadow: inset 0 0 0 1px var(--iron-edge); min-height: 16.25rem; list-style: none; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.8438rem; line-height: 1.55; color: var(--bone-2); }
  .log li { padding: 0.375rem 0; border-bottom: 1px solid #222323; }
  .log li .tm { color: var(--pewter); margin-right: 0.5rem; }
  .log li.ok { color: #BFE3C8; } .log li.warn { color: #F5C79A; }
  .log .empty { color: var(--pewter); font-family: var(--text); font-size: 0.9375rem; }
  .fineprint { color: var(--pewter); font-size: 0.875rem; margin: 0.875rem 0 0; }

  .switch { display: grid; grid-template-columns: minmax(13.75rem, 0.6fr) minmax(0, 1.8fr); gap: 1.75rem; }
  .dept-list { list-style: none; margin: 0; padding: 1.125rem; display: grid; gap: 0.5rem; align-content: start; }
  .dept-list button { width: 100%; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 0.625rem; padding: 0.875rem 1rem; border-radius: 0.375rem; border: 0; cursor: pointer; background: transparent; color: var(--bone-2); font: 600 1rem/1.2 var(--text); }
  .dept-list button small { color: var(--pewter); font-family: var(--display); font-weight: 650; font-stretch: 87.5%; letter-spacing: 0.12em; font-size: 0.75rem; }
  .dept-list button:hover { background: var(--iron-raised); }
  .dept-list button[aria-selected="true"] { background: var(--iron-raised); color: var(--bone); box-shadow: inset 3px 0 0 var(--saffron-hot), inset 0 0 0 1px var(--iron-edge); }
  .dept-view { padding: 2.125rem 1.875rem 1.875rem; }
  .dept-title { display: flex; align-items: baseline; gap: 0.875rem; margin: 0 0 1.625rem; }
  .dept-title h3 { margin: 0; font-family: var(--display); font-weight: 800; font-stretch: 75%; text-transform: uppercase; font-size: clamp(1.75rem, 2.6vw, 2.5rem); color: var(--bone); }
  .dept-title span { color: var(--pewter); }
  .flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.125rem; position: relative; }
  .flow::before { content: ""; position: absolute; left: 4%; right: 4%; top: 1.375rem; height: 2px; background: var(--iron-edge); }
  .flow .spark { position: absolute; top: 1.0625rem; left: 4%; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--saffron-hot); box-shadow: 0 0 0.875rem 0.25rem rgba(236,124,12,0.55); opacity: 0; z-index: 2; }
  .stage { position: relative; padding: 3.5rem 1.125rem 1.25rem; border-radius: 0.5rem; background: #161717; box-shadow: inset 0 0 0 1px var(--iron-edge); }
  .stage .dot { position: absolute; top: 0.875rem; left: 1.125rem; width: 1.125rem; height: 1.125rem; border-radius: 50%; background: #2a2b2a; box-shadow: inset 0 0 0 2px var(--pewter-shadow); }
  .stage.lit .dot { background: var(--saffron); box-shadow: 0 0 0.75rem rgba(236,124,12,0.6); }
  .stage.person .dot { background: var(--green); box-shadow: inset 0 0 0 2px var(--green-text); }
  .stage h4 { margin: 0 0 0.5rem; color: var(--pewter); }
  .stage p { margin: 0; color: var(--bone); font-size: 1.0625rem; line-height: 1.5; }
  .dept-foot { margin: 1.375rem 0 0; color: var(--pewter); font-size: 0.9375rem; }

  .founder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(1.75rem, 4vw, 4rem); align-items: start; }
  .quote { margin: 0; padding: 2.5rem 2.25rem 2.125rem; }
  .quote p { margin: 0; font-family: var(--display); font-weight: 750; font-stretch: 87.5%; font-size: clamp(1.625rem, 2.4vw, 2.375rem); line-height: 1.15; color: var(--bone); }
  .quote footer { margin-top: 1.375rem; color: var(--pewter); }
  .figures { display: grid; grid-template-columns: 1fr 1fr; gap: 0.875rem; margin-top: 1.125rem; }
  .fig { padding: 1.125rem 1.125rem 1rem; border-radius: 0.5rem; background: #161717; box-shadow: inset 0 0 0 1px var(--iron-edge); }
  .fig b { display: block; font-family: var(--display); font-weight: 800; font-stretch: 75%; font-size: 2.5rem; line-height: 1; color: var(--bone); }
  .fig span { color: var(--bone-2); font-size: 0.9375rem; line-height: 1.4; display: block; margin-top: 0.375rem; }
  .timeline { list-style: none; margin: 0; padding: 1.875rem 1.875rem 1.875rem 3.375rem; position: relative; }
  .timeline::before { content: ""; position: absolute; left: 2rem; top: 2.5rem; bottom: 2.5rem; width: 2px; background: var(--iron-edge); }
  .timeline .fill { position: absolute; left: 2rem; top: 2.5rem; width: 2px; height: 0; background: linear-gradient(180deg, var(--saffron-hot), var(--green-text)); }
  .timeline li { position: relative; padding: 0 0 1.625rem; }
  .timeline li::before { content: ""; position: absolute; left: -28px; top: 0.375rem; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--iron-raised); box-shadow: inset 0 0 0 2px var(--pewter); }
  .timeline li .yr { color: var(--saffron-hot); }
  .timeline li p { margin: 0.25rem 0 0; color: var(--bone-2); }

  .verdict { max-width: 61.25rem; margin: 0 auto; padding: 3rem 2.75rem 2.5rem; }
  .verdict h2 { padding: 0; display: block; }
  .verdict ul { margin: 1.125rem 0 1.625rem; padding-left: 1.25rem; color: var(--bone); }
  .verdict li { margin: 0.375rem 0; }
  .note { padding: 6vh var(--pad) 10vh; color: var(--pewter); font-size: 0.8125rem; }

  .no-webgl [data-mount]:not(.logo-mount) { background: linear-gradient(180deg, #232423, #1B1C1C); border-radius: 0.25rem; box-shadow: inset 0 0 0 1px var(--iron-edge), inset 0 1px 0 rgba(201,188,166,0.14); }
  .no-webgl .logo-mount { padding: 1.125rem; background: #1B1C1C; border-radius: 0.625rem; box-shadow: inset 0 0 0 2px var(--pewter-shadow); }
  .measure h1 .bar, .measure h1 .splice { transform: none !important; }

  @media (max-width: 1000px) {
    .rail nav { display: none; }
    .hero { grid-template-columns: 1fr; padding-top: 6.875rem; }
    .logo-mount { width: min(calc(100% - 7.25rem), 27.5rem); order: -1; margin-bottom: 2.5rem; }
    .tangle-stage { grid-template-columns: 1fr; padding-top: 5.25rem; gap: 0.75rem; }
    .steps { padding: 0.875rem 1.125rem; } .steps li { padding: 0.375rem 0 0.375rem 0.875rem; font-size: 0.9375rem; } .steps li:not(.on) span { display: none; }
    .counter .n { font-size: 3rem; }
    .run-grid, .switch, .founder { grid-template-columns: 1fr; }
    .flow { grid-template-columns: 1fr 1fr; }
    .flow::before, .flow .spark { display: none; }
  }
  @media (max-width: 600px) { .hide-sm { display: none; } .rail { gap: 0.75rem; padding: 0 0.5rem 0 0.875rem; } .rail .brand { font-size: 0.8125rem; } .rail .btn { padding: 0 0.875rem; min-height: 2.5rem; } h1 .bar-ea { margin-left: 0.75rem; } h1 .splice { margin-left: 3.75rem; } }
  @media (prefers-reduced-motion: reduce) { #tangle { height: auto; } .tangle-stage { position: static; height: auto; } }
