@layer reset, tokens, base, components, sections, responsive;

@font-face {
  font-family: "Anybody";
  font-style: normal;
  font-weight: 400 900;
  font-stretch: 75% 125%;
  font-display: swap;
  src: url("../fonts/anybody-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/atkinson-next-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/atkinson-next-italic-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Chivo Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/chivo-mono-latin.woff2") format("woff2");
}

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body, h1, h2, h3, p, figure, dl, dd { margin: 0; }
  button, a { font: inherit; }
  img { display: block; max-width: 100%; }
}

@layer tokens {
  :root {
    --bg: oklch(1 0 0);
    --surface: oklch(0.96 0.012 250);
    --ink: oklch(0.18 0.025 250);
    --muted: oklch(0.43 0.035 250);
    --cobalt: oklch(0.52 0.18 250);
    --cobalt-deep: oklch(0.32 0.15 250);
    --signal: oklch(0.86 0.17 95);
    --line: oklch(0.84 0.018 250);
    --cyan: oklch(0.75 0.12 190);
    --lime: oklch(0.78 0.16 145);
    --yellow: oklch(0.86 0.17 95);
    --violet: oklch(0.68 0.17 305);
    --coral: oklch(0.69 0.18 30);
    --display: "Anybody", "Arial Black", sans-serif;
    --body: "Atkinson Hyperlegible Next", "Segoe UI", sans-serif;
    --mono: "Chivo Mono", "Cascadia Mono", monospace;
    --frame: min(1280px, calc(100vw - 48px));
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --scroll-progress: 0;
  }
}

@layer base {
  html { scroll-padding-top: 90px; }
  body { min-width: 0; overflow-x: clip; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
  a { color: inherit; text-decoration: none; }
  button { color: inherit; }
  :focus-visible { outline: 3px solid var(--signal); outline-offset: 4px; }
  h1, h2, h3 { font-family: var(--display); font-weight: 760; letter-spacing: -0.035em; line-height: 0.98; text-wrap: balance; }
  p { text-wrap: pretty; }
  .section-pad { padding: clamp(90px, 11vw, 160px) max(24px, calc((100vw - 1280px) / 2)); }
  .plain-label { color: var(--cobalt); font-family: var(--mono); font-size: 0.82rem; font-weight: 600; letter-spacing: -0.02em; }
  html.js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out); }
  html.js [data-reveal].reveal-ready { will-change: opacity, transform; }
  html.js [data-reveal].is-visible { opacity: 1; transform: none; }
}

@layer components {
  .brand { display: inline-flex; align-items: center; gap: 11px; font-family: var(--display); font-size: 1.34rem; font-weight: 780; letter-spacing: -0.04em; }
  .brand-mark { display: inline-flex; gap: 3px; padding: 8px 7px; background: var(--cobalt); border-radius: 7px; }
  .brand-mark i { width: 5px; height: 5px; background: var(--bg); border-radius: 50%; }
  .brand-mark i:nth-child(2) { background: var(--signal); }
  .brand-mark i:nth-child(3) { background: var(--cyan); }
  .button { display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 52px; padding: 0 22px; border-radius: 10px; font-weight: 720; transition: transform 180ms var(--ease-out), background 180ms ease; }
  .button:hover { transform: translateY(-2px); }
  .button-small { min-height: 42px; padding: 0 17px; font-size: 0.9rem; }
  .button-ink { background: var(--ink); color: var(--bg); }
  .button-ink:hover { background: var(--cobalt-deep); }
  .button-signal { background: var(--signal); color: var(--ink); }
  .button-signal:hover { background: oklch(0.9 0.18 95); }
  .text-link { display: inline-flex; gap: 10px; align-items: center; padding: 12px 2px 8px; border-bottom: 2px solid currentColor; font-weight: 700; }
}

@layer sections {
  .site-header { position: sticky; top: 0; z-index: 30; width: var(--frame); height: 78px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 28px; background: color-mix(in oklch, var(--bg) 94%, transparent); transition: box-shadow 220ms ease, background 220ms ease; }
  .site-header::after { content: ""; position: absolute; left: 0; bottom: -1px; width: calc(var(--scroll-progress) * 100%); height: 3px; background: var(--signal); transform-origin: left; transition: width 120ms linear; }
  .site-header.is-scrolled { background: var(--bg); box-shadow: 0 5px 18px oklch(0.18 0.025 250 / 0.08); }
  .site-header nav { display: flex; gap: 30px; margin-left: auto; font-size: 0.92rem; font-weight: 650; }
  .site-header nav a { color: var(--muted); transition: color 160ms ease; }
  .site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--cobalt); }
  .mobile-menu { display: none; }

  .hero { min-height: calc(100svh - 78px); display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr); align-items: center; gap: clamp(48px, 7vw, 110px); padding: clamp(60px, 8vw, 112px) max(24px, calc((100vw - 1280px) / 2)) clamp(86px, 10vw, 138px); background: var(--cobalt); color: var(--bg); overflow: hidden; }
  .hero > * { min-width: 0; }
  .hero-copy { max-width: 760px; animation: hero-in 850ms var(--ease-out) both; }
  .hero-note { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: clamp(0.72rem, 1vw, 0.83rem); color: oklch(0.92 0.025 250); }
  .hero-note span { width: 9px; height: 9px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 5px oklch(0.86 0.17 95 / 0.16); }
  .hero h1 { max-width: 760px; margin-top: 28px; font-size: clamp(4rem, 7.5vw, 6rem); font-weight: 860; line-height: 0.88; }
  .hero h1 em { display: inline-block; color: var(--signal); font-style: normal; font-variation-settings: "wdth" 120; }
  .hero-lede { max-width: 600px; margin-top: 36px; color: oklch(0.95 0.018 250); font-size: clamp(1.12rem, 1.6vw, 1.35rem); line-height: 1.45; }
  .hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 30px; margin-top: 42px; }

  .lm-machine { --tilt-x: 0deg; --tilt-y: 0deg; position: relative; width: 100%; max-width: 100%; min-width: 0; transform: rotate(1.5deg); background: var(--ink); border: 10px solid oklch(0.27 0.035 250); border-radius: 14px; box-shadow: 14px 18px 0 oklch(0.28 0.13 250 / 0.7); animation: machine-in 950ms 120ms var(--ease-out) both; transition: transform 260ms var(--ease-out); }
  .lm-machine.tilt-active { animation: none; transform: perspective(1100px) rotateX(var(--tilt-y)) rotateY(var(--tilt-x)) rotate(1.5deg) scale(1.012); }
  .machine-top, .machine-controls { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 18px; font-family: var(--mono); font-size: 0.7rem; color: oklch(0.78 0.025 250); }
  .machine-name { display: flex; align-items: center; gap: 9px; color: var(--bg); font-family: var(--display); font-size: 1.08rem; font-weight: 750; }
  .machine-led { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); }
  .machine-screen { min-height: 390px; margin: 0 4px; padding: clamp(22px, 3vw, 38px); background: oklch(0.12 0.02 250); border-top: 1px solid oklch(0.35 0.04 250); border-bottom: 1px solid oklch(0.35 0.04 250); font-family: var(--mono); }
  .machine-screen.machine-screenshot { min-height: 0; padding: 0; background: var(--bg); overflow: hidden; }
  .machine-screenshot img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; object-position: top; }
  .screen-label { margin-bottom: 32px; color: oklch(0.65 0.035 250); font-size: 0.7rem; }
  .prompt-line, .response-line { display: grid; grid-template-columns: 48px 1fr; gap: 12px; }
  .prompt-line span { color: var(--signal); font-size: 0.72rem; }
  .prompt-line p { color: var(--bg); font-size: clamp(0.88rem, 1.25vw, 1.02rem); }
  .response-line { margin-top: 32px; }
  .response-glyph { color: var(--cyan); }
  .response-line p { color: oklch(0.86 0.03 250); font-size: clamp(0.85rem, 1.2vw, 0.98rem); line-height: 1.65; }
  .cursor-line { display: flex; gap: 12px; align-items: center; margin-top: 42px; color: var(--signal); }
  .cursor-line i { width: 9px; height: 19px; background: var(--signal); animation: blink 1s steps(1) infinite; }
  .machine-controls span { display: inline-flex; align-items: center; gap: 8px; }
  .control-dot { width: 7px; height: 7px; background: var(--lime); border-radius: 50%; }
  .machine-controls a { color: var(--signal); font-weight: 600; }

  .section-intro { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr); align-items: end; gap: 80px; margin-bottom: 70px; }
  .section-intro h2, .mission h2, .artifact h2 { max-width: 800px; margin-top: 17px; font-size: clamp(2.8rem, 5.5vw, 5rem); }
  .section-intro > p { max-width: 520px; color: var(--muted); font-size: 1.12rem; }

  .bench { display: grid; grid-template-columns: minmax(230px, 0.31fr) minmax(0, 0.69fr); background: var(--ink); border-radius: 14px; overflow: hidden; }
  .bench-rail { padding: 18px 0; background: oklch(0.23 0.035 250); }
  .bench-tab { position: relative; width: 100%; min-height: 82px; display: grid; grid-template-columns: 18px 1fr; grid-template-rows: auto auto; column-gap: 14px; padding: 16px 22px; background: transparent; color: oklch(0.76 0.025 250); text-align: left; border: 0; cursor: pointer; transition: background 180ms ease, color 180ms ease; }
  .bench-tab:hover { background: oklch(0.28 0.04 250); color: var(--bg); }
  .bench-tab.is-active { background: var(--project-accent); color: var(--ink); }
  .tab-port { grid-row: 1 / span 2; align-self: center; width: 12px; height: 12px; border: 2px solid currentColor; border-radius: 50%; }
  .is-active .tab-port { background: var(--ink); box-shadow: 0 0 0 4px oklch(0.18 0.025 250 / 0.12); }
  .tab-name { font-family: var(--display); font-size: 1.16rem; font-weight: 740; letter-spacing: -0.025em; }
  .tab-status { font-family: var(--mono); font-size: 0.63rem; opacity: 0.75; }
  .bench-stage { position: relative; min-height: 510px; display: flex; flex-direction: column; padding: clamp(28px, 5vw, 68px); background: var(--surface); overflow: hidden; animation: stage-in 360ms var(--ease-out); }
  .signal-track { position: absolute; inset: 0 0 auto; height: 6px; background: oklch(0.87 0.018 250); overflow: hidden; }
  .signal-track span { display: block; width: 35%; height: 100%; background: var(--project-accent); animation: signal-sweep 650ms var(--ease-out) both; }
  .stage-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
  .status-chip { display: inline-flex; align-items: center; gap: 9px; padding: 7px 10px; background: var(--bg); border-radius: 7px; font-family: var(--mono); font-size: 0.68rem; }
  .status-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--project-accent); }
  .stage-tech { color: var(--muted); font-family: var(--mono); font-size: 0.7rem; text-align: right; }
  .stage-body { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 25px; align-items: start; margin-top: auto; padding: 72px 0; }
  .stage-index { color: var(--project-accent); font-family: var(--display); font-size: 3.3rem; font-weight: 820; line-height: 1; }
  .stage-body h3 { max-width: 750px; font-size: clamp(2.6rem, 5vw, 5rem); }
  .stage-body div > p { max-width: 680px; margin-top: 26px; color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.18rem); }
  .command-strip { min-height: 58px; display: flex; align-items: center; gap: 13px; padding: 12px 16px; background: var(--ink); color: oklch(0.88 0.025 250); border-radius: 8px; font-family: var(--mono); font-size: 0.72rem; }
  .command-strip > span:first-child { color: var(--project-accent); font-size: 1.1rem; }
  .command-strip code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .command-strip a, .source-soon { margin-left: auto; color: var(--project-accent); white-space: nowrap; }
  .source-soon { color: oklch(0.64 0.03 250); }

  .mission { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(440px, 1.1fr); gap: clamp(70px, 10vw, 150px); background: var(--signal); }
  .mission-statement > p:last-child { max-width: 620px; margin-top: 34px; font-size: 1.22rem; }
  .principles { align-self: center; }
  .principles article { display: grid; grid-template-columns: 52px 0.7fr 1.3fr; gap: 24px; align-items: start; padding: 28px 0; border-bottom: 1px solid oklch(0.38 0.06 95 / 0.35); }
  .principles article:first-child { border-top: 1px solid oklch(0.38 0.06 95 / 0.35); }
  .principle-glyph { font-family: var(--mono); font-size: 1.6rem; }
  .principles h3 { font-size: 1.45rem; line-height: 1.15; }
  .principles p { font-size: 0.97rem; }

  .artifact { display: grid; grid-template-columns: minmax(300px, 0.75fr) minmax(0, 1.25fr); gap: clamp(60px, 9vw, 130px); align-items: center; background: var(--surface); }
  .artifact-copy > p:not(.plain-label) { max-width: 560px; margin-top: 32px; color: var(--muted); font-size: 1.08rem; }
  .artifact dl { margin-top: 45px; border-top: 1px solid var(--line); }
  .artifact dl div { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 20px; padding: 15px 0; border-bottom: 1px solid var(--line); font-size: 0.85rem; }
  .artifact dt { color: var(--muted); }
  .artifact dd { font-weight: 680; }
  .artifact-window { --tilt-x: 0deg; --tilt-y: 0deg; background: var(--ink); border: 8px solid oklch(0.3 0.035 250); border-radius: 12px; box-shadow: 12px 14px 0 var(--cobalt); overflow: hidden; transform: rotate(-1deg); transition: transform 260ms var(--ease-out); }
  .artifact-window.tilt-active { transform: perspective(1100px) rotateX(var(--tilt-y)) rotateY(var(--tilt-x)) rotate(-1deg) scale(1.012); }
  .artifact-bar { display: flex; justify-content: space-between; padding: 11px 15px; color: var(--signal); font-family: var(--mono); font-size: 0.63rem; }
  .artifact-window img { width: 100%; aspect-ratio: 712 / 848; object-fit: cover; object-position: top; }
  .artifact-window figcaption { padding: 10px 14px; color: oklch(0.68 0.025 250); font-family: var(--mono); font-size: 0.62rem; }

  .contact { min-height: 620px; display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 70px; align-items: end; padding: clamp(95px, 12vw, 170px) max(24px, calc((100vw - 1280px) / 2)); background: var(--cobalt); color: var(--bg); }
  .contact-overline { color: var(--signal); font-family: var(--mono); font-size: 0.82rem; }
  .contact h2 { margin-top: 20px; font-size: clamp(4rem, 8vw, 6rem); }
  .contact-action { max-width: 490px; justify-self: end; }
  .contact-action p { margin-bottom: 34px; color: oklch(0.94 0.018 250); font-size: 1.15rem; }

  footer { min-height: 100px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 28px; width: var(--frame); margin: 0 auto; color: var(--muted); font-size: 0.78rem; }
  footer p:last-child { text-align: right; }

  .boot-shell { min-height: 100svh; display: grid; place-content: center; justify-items: start; padding: 30px; background: var(--cobalt); color: var(--bg); }
  .boot-brand { font-family: var(--display); font-size: 1.5rem; font-weight: 800; }
  .boot-shell > p { max-width: 680px; margin-top: 35px; font-family: var(--display); font-size: clamp(3rem, 8vw, 6rem); font-weight: 800; line-height: 0.95; }
  .boot-meter { width: min(320px, 70vw); height: 6px; margin-top: 42px; background: oklch(0.38 0.13 250); overflow: hidden; }
  .boot-meter span { display: block; width: 45%; height: 100%; background: var(--signal); animation: loading 1.2s ease-in-out infinite alternate; }
  .boot-shell small { margin-top: 12px; font-family: var(--mono); }
  #blazor-error-ui { display: none; position: fixed; inset: auto 20px 20px; z-index: 500; padding: 14px 48px 14px 16px; background: var(--signal); color: var(--ink); border-radius: 8px; box-shadow: 0 4px 8px oklch(0.1 0 0 / 0.2); }
  #blazor-error-ui .reload { text-decoration: underline; font-weight: 700; }
  #blazor-error-ui .dismiss { position: absolute; right: 12px; top: 8px; border: 0; background: transparent; font-size: 1.4rem; cursor: pointer; }

  @keyframes hero-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
  @keyframes machine-in { from { opacity: 0; transform: rotate(1.5deg) translateY(38px); } to { opacity: 1; transform: rotate(1.5deg); } }
  @keyframes blink { 50% { opacity: 0; } }
  @keyframes stage-in { from { opacity: 0.72; filter: blur(4px); } to { opacity: 1; filter: none; } }
  @keyframes signal-sweep { from { transform: translateX(-100%); } to { transform: translateX(286%); } }
  @keyframes loading { to { transform: translateX(120%); } }
}

@layer responsive {
  @media (max-width: 980px) {
    .site-header nav { display: none; }
    .mobile-menu { position: relative; display: block; margin-left: auto; }
    .mobile-menu summary { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); cursor: pointer; font-family: var(--mono); font-size: 0.7rem; font-weight: 650; list-style: none; }
    .mobile-menu summary::-webkit-details-marker { display: none; }
    .mobile-menu summary span:first-child { color: var(--cobalt); font-size: 0.9rem; }
    .mobile-menu[open] summary { background: var(--signal); border-color: var(--signal); }
    .mobile-menu-panel { position: absolute; top: calc(100% + 12px); right: 0; z-index: 40; display: grid; min-width: 190px; padding: 8px; background: var(--ink); border-radius: 10px; box-shadow: 0 10px 24px oklch(0.18 0.025 250 / 0.22); }
    .mobile-menu-panel a { display: flex; align-items: center; justify-content: space-between; padding: 11px 10px; color: white; border-bottom: 1px solid oklch(0.45 0.03 250); font-weight: 650; }
    .mobile-menu-panel a:last-child { border: 0; color: var(--signal); }
    .mobile-menu-panel a:hover, .mobile-menu-panel a[aria-current="page"] { color: var(--signal); }
    .hero { grid-template-columns: minmax(0, 1fr); min-height: auto; }
    .hero-copy { max-width: 780px; }
    .lm-machine { width: min(680px, 100%); }
    .section-intro, .mission, .artifact, .contact { grid-template-columns: 1fr; }
    .section-intro { gap: 30px; }
    .bench { grid-template-columns: 1fr; }
    .bench-rail { display: flex; overflow-x: auto; padding: 0; scrollbar-width: thin; }
    .bench-tab { flex: 0 0 190px; min-height: 90px; }
    .mission { gap: 65px; }
    .contact { align-items: start; }
    .contact-action { justify-self: start; }
  }

  @media (max-width: 640px) {
    :root { --frame: calc(100vw - 32px); }
    body { font-size: 16px; }
    .site-header { height: 70px; }
    .site-header .button { display: none; }
    .hero { padding-top: 62px; }
    .hero h1 { font-size: clamp(3.1rem, 15vw, 4.2rem); }
    .hero-actions { align-items: stretch; flex-direction: column; gap: 18px; }
    .hero-actions .button { width: 100%; }
    .text-link { align-self: flex-start; }
    .lm-machine { border-width: 6px; box-shadow: 8px 10px 0 oklch(0.28 0.13 250 / 0.7); transform: rotate(0.7deg); }
    .machine-top, .machine-controls { padding: 0 12px; }
    .machine-top > span { display: none; }
    .machine-screen { min-height: 355px; padding: 22px 17px; }
    .prompt-line, .response-line { grid-template-columns: 36px 1fr; gap: 8px; }
    .machine-model { display: none !important; }
    .section-intro h2, .mission h2, .artifact h2 { font-size: clamp(2.55rem, 13vw, 3.7rem); }
    .bench-tab { flex-basis: 160px; padding: 14px; }
    .bench-stage { min-height: 510px; padding: 28px 20px 22px; }
    .stage-head { align-items: flex-start; }
    .stage-body { grid-template-columns: 1fr; gap: 15px; padding: 52px 0; }
    .stage-index { font-size: 2.2rem; }
    .stage-body h3 { font-size: clamp(2.55rem, 13vw, 3.8rem); }
    .command-strip { align-items: flex-start; flex-wrap: wrap; }
    .command-strip code { width: calc(100% - 32px); white-space: normal; overflow-wrap: anywhere; }
    .command-strip a, .source-soon { width: 100%; margin: 5px 0 0 25px; }
    .principles article { grid-template-columns: 42px 1fr; gap: 10px 16px; }
    .principles p { grid-column: 2; }
    .artifact-window { box-shadow: 7px 9px 0 var(--cobalt); }
    .contact { min-height: 660px; }
    .contact h2 { font-size: clamp(3.7rem, 17vw, 5.3rem); }
    .contact-action .button { width: 100%; font-size: 0.92rem; }
    footer { grid-template-columns: 1fr; padding: 28px 0; text-align: left; }
    footer p:last-child { text-align: left; }
  }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
    .button:hover { transform: none; }
    html.js [data-reveal] { opacity: 1; transform: none; }
  }
}
