:root {
    --bg: #ebe9e3;
    --panel: #f6f5f1;
    --panel-2: #dfddd6;
    --ink: #151514;
    --ink-2: #4a4945;
    --muted: #87857e;
    --rule: #c9c6bd;
    --signal: #ff5418;
    --signal-deep: #cc4416;
    --green: #2fa55a;
    --amber: #e8a317;
    --blue: #2f6fe0;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 1px 2px rgba(20, 20, 18, 0.06), 0 12px 32px -18px rgba(20, 20, 18, 0.25);

    --sans: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --gutter: clamp(16px, 4vw, 48px);
    --max: 1240px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0e0e0d;
        --panel: #181817;
        --panel-2: #222220;
        --ink: #f0eee8;
        --ink-2: #bdbab2;
        --muted: #7d7b74;
        --rule: #2e2d2a;
        --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 32px -18px rgba(0, 0, 0, 0.8);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0e0e0d;
    --panel: #181817;
    --panel-2: #222220;
    --ink: #f0eee8;
    --ink-2: #bdbab2;
    --muted: #7d7b74;
    --rule: #2e2d2a;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 32px -18px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 17px/1.55 var(--sans);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0; }
::selection { background: var(--signal); color: #fff; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 4px; }

/* ---------- top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
    padding: 14px var(--gutter);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid color-mix(in srgb, var(--rule) 60%, transparent);
}
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font: 600 15px/1 var(--sans); letter-spacing: -0.01em; justify-self: start; }
.brand-glyph { width: 20px; height: 19px; fill: currentColor; flex: 0 0 auto; }
.topnav { display: flex; gap: 4px; }
.topnav a {
    font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em;
    text-decoration: none; color: var(--ink-2);
    padding: 8px 12px; border-radius: 999px;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.topnav a:hover { background: var(--panel-2); color: var(--ink); }
.readout {
    justify-self: end; display: inline-flex; align-items: center; gap: 8px;
    font: 500 12px/1 var(--mono); letter-spacing: 0.08em; color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}
.led { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 18%, transparent); }
.readout .led { animation: blink 2.4s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

/* ---------- hero ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.hero {
    display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: clamp(28px, 5vw, 72px); align-items: center;
    padding: clamp(40px, 8vw, 104px) 0 clamp(56px, 9vw, 120px);
}
.hero-panel {
    position: relative; aspect-ratio: 1 / 1;
    display: grid; grid-template-rows: auto 1fr auto;
    padding: 18px;
    --tick: var(--ink);
    background:
        linear-gradient(var(--tick), var(--tick)) top left / 18px 1.5px,
        linear-gradient(var(--tick), var(--tick)) top left / 1.5px 18px,
        linear-gradient(var(--tick), var(--tick)) top right / 18px 1.5px,
        linear-gradient(var(--tick), var(--tick)) top right / 1.5px 18px,
        linear-gradient(var(--tick), var(--tick)) bottom left / 18px 1.5px,
        linear-gradient(var(--tick), var(--tick)) bottom left / 1.5px 18px,
        linear-gradient(var(--tick), var(--tick)) bottom right / 18px 1.5px,
        linear-gradient(var(--tick), var(--tick)) bottom right / 1.5px 18px;
    background-repeat: no-repeat;
}
.hero-panel::after {
    content: ""; position: absolute; inset: 50% 18px auto; height: 1px;
    background: repeating-linear-gradient(90deg, var(--rule) 0 6px, transparent 6px 12px);
    opacity: 0.6; pointer-events: none; z-index: -1;
}
.panel-labels, .panel-foot {
    padding: 4px 10px;
    display: flex; justify-content: space-between; align-items: center;
    font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
}
#markState { color: var(--ink-2); transition: color 0.2s var(--ease); }
.hero-panel.is-engaged #markState { color: var(--signal); }
.tick-row { display: inline-flex; gap: 5px; }
.tick-row i { display: block; width: 2px; height: 9px; background: var(--rule); border-radius: 1px; transition: background 0.15s var(--ease), transform 0.3s var(--spring); }
.tick-row i.on { background: var(--signal); transform: scaleY(1.5); }

.mark {
    all: unset; cursor: grab; display: grid; place-items: center;
    width: 100%; height: 100%;
    touch-action: none; -webkit-tap-highlight-color: transparent;
    border-radius: 20px;
}
.mark:active { cursor: grabbing; }
.mark:focus-visible { outline: 2px solid var(--signal); outline-offset: -6px; }
.mark svg { width: 72%; height: auto; overflow: visible; fill: var(--ink); }
.mark path {
    transform-box: fill-box; transform-origin: center;
    will-change: transform;
    transition: fill 0.35s var(--ease);
}
.mark-l { transform: translate3d(calc(var(--spread, 0) * -1px), calc(var(--lift, 0) * -1px), 0); }
.mark-r { transform: translate3d(calc(var(--spread, 0) * 1px), calc(var(--lift, 0) * 1px), 0); }
.mark-c { transform: rotate(calc(var(--turn, 0) * 1deg)) scale(var(--pop, 1)); fill: var(--signal); }
.hero-panel.is-engaged .mark-l,
.hero-panel.is-engaged .mark-r { fill: var(--ink); }

/* ---------- hero copy ---------- */
.eyebrow, .section-num, .kicker, .code, .spec {
    font: 500 12px/1.2 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
}
.hero-copy h1 {
    margin: 18px 0 22px;
    font-size: clamp(42px, 6.4vw, 88px); line-height: 0.98; letter-spacing: -0.045em; font-weight: 600;
}
.hero-copy h1 em { font-style: normal; color: var(--signal); }
.lede { max-width: 34em; font-size: clamp(17px, 1.5vw, 20px); color: var(--ink-2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.btn {
    display: inline-flex; align-items: center; height: 46px; padding: 0 22px;
    font: 600 15px/1 var(--sans); text-decoration: none;
    border-radius: 999px; border: 1px solid var(--rule); background: var(--panel);
    transition: transform 0.25s var(--spring), background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn:hover { transform: translateY(-1px); border-color: var(--ink-2); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--signal); border-color: var(--signal); color: #fff; }

/* ---------- sections ---------- */
section { scroll-margin-top: 72px; }
.section-head {
    display: grid; grid-template-columns: 80px 1fr auto; align-items: baseline; gap: 16px;
    padding: 18px 0 28px; border-top: 1px solid var(--ink);
}
.section-head h2 { font-size: clamp(28px, 3.4vw, 44px); letter-spacing: -0.035em; }
.section-note { max-width: 24em; color: var(--ink-2); font-size: 15px; text-align: right; }

/* ---------- product index ---------- */
.work { padding-bottom: clamp(64px, 9vw, 120px); }
.index { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.row {
    position: relative;
    display: grid; grid-template-columns: 80px minmax(0, 4fr) minmax(0, 5fr) minmax(170px, 2fr);
    gap: 16px 24px; align-items: start;
    padding: 30px 0 32px;
    border-bottom: 1px solid var(--rule);
}
.row::before {
    content: ""; position: absolute; left: 0; top: -1px; height: 2px; width: 100%;
    background: var(--signal); transform: scaleX(0); transform-origin: left;
    transition: transform 0.55s var(--ease);
}
.row:hover::before { transform: scaleX(1); }
.row .code { padding-top: 10px; }
.row-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.row h3 { font-size: clamp(30px, 3.2vw, 44px); letter-spacing: -0.04em; line-height: 1; transition: transform 0.45s var(--ease); }
.row:hover h3 { transform: translateX(6px); }
.row-body { display: grid; gap: 6px; padding-top: 4px; }
.row-meta { display: grid; justify-items: end; gap: 12px; padding-top: 6px; text-align: right; }

.row-feature { padding: 40px 0 44px; }
.row-feature::before { transform: scaleX(1); height: 3px; top: -2px; }
.row-feature h3::after {
    content: ""; display: inline-block; width: 0.22em; height: 0.22em; margin-left: 0.12em;
    border-radius: 50%; background: var(--signal); vertical-align: 0.55em;
}
.row-feature .row-name { display: block; }
.row-feature .kicker { color: var(--signal); margin-bottom: 10px; }
.row-feature .tagline { font-size: clamp(24px, 2.4vw, 34px); line-height: 1.12; letter-spacing: -0.03em; margin-bottom: 6px; }
.row-feature .link { background: var(--signal); color: #fff; border: 0; padding: 10px 16px; border-radius: 999px; }
.row-feature .link:hover { background: var(--ink); color: var(--bg); }

.status {
    display: inline-flex; align-items: center; gap: 7px;
    font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink);
}
.status .led { width: 6px; height: 6px; box-shadow: none; }
.status-soon .led { background: var(--signal); animation: blink 1.6s steps(1) infinite; }
.status-dev .led { background: var(--amber); }
.status-test .led { background: var(--blue); }
.status-live .led { background: var(--green); }
.wt {
    font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--muted); border: 1px dashed var(--rule); padding: 4px 6px; border-radius: 4px;
}
.tagline { font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.desc { font-size: 15px; color: var(--ink-2); max-width: 36em; }
kbd {
    font: 500 12px/1 var(--mono); padding: 2px 5px; margin: 0 1px;
    border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 4px; background: var(--bg);
}
.link {
    font: 600 14px/1 var(--sans); text-decoration: none; color: var(--ink);
    border-bottom: 1.5px solid var(--signal); padding-bottom: 3px;
    transition: color 0.2s var(--ease);
}
.link:hover { color: var(--signal); }

/* ---------- principles ---------- */
.principles { padding-bottom: clamp(64px, 9vw, 120px); }
.principle-list {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0;
    border-top: 1px solid var(--rule);
}
.principle-list li { padding: 24px 24px 8px 0; border-right: 1px solid var(--rule); }
.principle-list li + li { padding-left: 24px; }
.principle-list li:last-child { border-right: 0; }
.p-num {
    display: inline-grid; place-items: center; width: 30px; height: 30px; margin-bottom: 40px;
    font: 600 13px/1 var(--mono); color: var(--bg); background: var(--ink); border-radius: 50%;
}
.principle-list li:nth-child(3) .p-num { background: var(--signal); color: #fff; }
.principle-list h3 { font-size: 21px; margin-bottom: 10px; letter-spacing: -0.025em; }
.principle-list p { font-size: 15px; color: var(--ink-2); }

/* ---------- studio ---------- */
.studio { padding-bottom: clamp(64px, 9vw, 120px); }
.studio-body { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.portrait { margin: 0; position: sticky; top: 88px; }
.portrait img {
    display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 30%;
    filter: grayscale(1) contrast(1.08) brightness(1.02);
    transition: filter 0.6s var(--ease);
}
.portrait:hover img { filter: grayscale(0) contrast(1); }
.portrait figcaption {
    display: flex; justify-content: space-between; padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--ink);
    font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
}
.studio-statement { font-size: clamp(26px, 2.8vw, 38px); line-height: 1.18; letter-spacing: -0.03em; }
.studio-statement strong { font-weight: 600; }
.studio-prose { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 28px; color: var(--ink-2); font-size: 16px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 44px 0 36px; border-top: 1px solid var(--ink); }
.stats div { padding: 14px 16px 0 0; }
.stats div + div { padding-left: 16px; border-left: 1px solid var(--rule); }
.stats dt { white-space: nowrap; font: 500 11px/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.stats dd { margin: 10px 0 0; font-size: clamp(28px, 2.9vw, 42px); white-space: nowrap; font-weight: 600; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.stats dd span { color: var(--signal); }
.spec-sheet { margin: 0; border-top: 1px solid var(--ink); }
.spec-sheet div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.spec-sheet dt { font: 500 11px/1.6 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.spec-sheet dd { margin: 0; font-size: 15px; font-weight: 500; text-align: right; }

/* ---------- contact ---------- */
.contact {
    display: grid; justify-items: start; gap: 18px;
    padding: 28px 0 clamp(72px, 10vw, 140px); border-top: 1px solid var(--ink);
}
.contact h2 { font-size: clamp(38px, 6vw, 84px); line-height: 1; letter-spacing: -0.05em; max-width: 12em; }
.contact-mail {
    font: 500 clamp(17px, 2vw, 24px)/1 var(--mono); color: var(--signal); text-decoration: none;
    border-bottom: 2px solid currentColor; padding-bottom: 4px;
    overflow-wrap: anywhere;
}
.contact-mail:hover { color: var(--ink); }

/* ---------- footer ---------- */
.footer {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px;
    max-width: var(--max); margin: 0 auto; padding: 22px var(--gutter) 32px;
    border-top: 1px solid var(--rule);
    font: 500 12px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
}
.footer-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.footer-brand .brand-glyph { width: 14px; height: 13px; }
.footer-links { display: flex; gap: 18px; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--signal); }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
    .row { grid-template-columns: 60px minmax(0, 1fr) minmax(0, 1.3fr); }
    .row-meta { grid-column: 2 / -1; justify-items: start; text-align: left; grid-auto-flow: column; justify-content: start; gap: 20px; align-items: center; }
    .principle-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .principle-list li:nth-child(2) { border-right: 0; }
    .principle-list li:nth-child(3) { padding-left: 0; }
    .principle-list li:nth-child(n + 3) { border-top: 1px solid var(--rule); }
}
@media (max-width: 760px) {
    body { font-size: 16px; }
    .topbar { grid-template-columns: 1fr auto; }
    .topnav { display: none; }
    .hero { grid-template-columns: 1fr; padding-top: 24px; }
    .hero-panel { max-width: 440px; width: 100%; }
    .section-head { grid-template-columns: 40px 1fr; }
    .section-note { grid-column: 1 / -1; text-align: left; }
    .row { grid-template-columns: 1fr; gap: 10px; padding: 24px 0 26px; }
    .row .code { padding-top: 0; }
    .row-meta { grid-column: auto; flex-wrap: wrap; display: flex; }
    .principle-list { grid-template-columns: 1fr; }
    .principle-list li, .principle-list li + li { padding: 22px 0 18px; border-right: 0; border-top: 1px solid var(--rule); }
    .principle-list li:first-child { border-top: 0; }
    .p-num { margin-bottom: 18px; }
    .studio-body { grid-template-columns: 1fr; }
    .portrait { position: static; max-width: 320px; }
    .studio-prose { grid-template-columns: 1fr; gap: 14px; }
    .stats { grid-template-columns: 1fr 1fr; }
    .stats div:nth-child(3) { padding-left: 0; border-left: 0; }
    .stats div:nth-child(n + 3) { margin-top: 18px; }
    .footer { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
    .reveal { opacity: 1; transform: none; }
}
