/*
 * Slashware: dark, single look, the sharp logo from the design canvas.
 * Logo Chakra Petch, headings Space Grotesk, body Inter, terminal and code JetBrains Mono.
 */
:root {
    color-scheme: dark;
    --bg: #0A0E14;
    --bg-2: #10151C;
    --bg-3: #161C24;
    --line: #222A33;
    --fg: #F4F6F5;
    --fg-2: #A9B3AE;
    --fg-3: #7C8782;
    --danger: #FF5C7A;
    --warn: #FFC857;

    --l-ink: #F4F6F5;
    --l-soft: #A9B3AE;
    --accent: #3DFF8A;
    --accent-ink: #06210F;
    --react: #F4F6F5;
    --nest: #F4F6F5;

    --f-logo: "Chakra Petch", "Space Grotesk", system-ui, sans-serif;
    --f-head: "Space Grotesk", "Inter", system-ui, sans-serif;
    --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    --gutter-l: max(16px, env(safe-area-inset-left, 0px));
    --gutter-r: max(16px, env(safe-area-inset-right, 0px));
    --max: 1160px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--f-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body::before {
    content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
    z-index: 60; background: var(--bg);
}

a { color: inherit; }

button { font: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap {
    max-width: var(--max); margin: 0 auto;
    padding-left: var(--gutter-l); padding-right: var(--gutter-r);
}

main { position: relative; z-index: 1; }

/* ───────── header ───────── */
.top {
    position: fixed; top: env(safe-area-inset-top, 0px); left: 0; right: 0; z-index: 50;
    border-bottom: 1px solid transparent;
    transition: background .3s, border-color .3s, transform .5s cubic-bezier(.2, .8, .2, 1);
    transform: translateY(calc(-100% - env(safe-area-inset-top, 0px)));
}

body.unlocked .top { transform: none; }

.top.solid {
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-color: var(--line);
}

.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; }

.mini {
    font-family: var(--f-logo); font-weight: 500; font-size: 22px; line-height: 1; letter-spacing: -.03em;
    color: var(--l-ink); text-decoration: none;
    display: inline-flex; align-items: center; gap: 2px; opacity: 0; transform: translateY(-4px);
    transition: opacity .3s, transform .3s; pointer-events: none; padding-block: 8px;
}

.top.solid .mini { opacity: 1; transform: none; pointer-events: auto; }

.mini svg { width: 12px; height: 20px; fill: var(--accent); }

.mini .c { width: 10px; height: 17px; background: var(--accent); animation: blink 1.05s steps(1) infinite; margin-left: 4px; }

.nav { display: flex; gap: 2px; align-items: center; font-family: var(--f-mono); font-size: 13px; }

.nav a, .nav button {
    text-decoration: none; color: var(--fg-2); padding: 10px; border-radius: 6px;
    background: none; border: 0; cursor: pointer; font-family: inherit; font-size: inherit; min-height: 40px;
}

.nav a:hover, .nav button:hover { color: var(--fg); background: var(--bg-2); }

.nav b { color: var(--accent); font-weight: 500; }

.nav .logout { color: var(--fg-3); }

/* ───────── hero ───────── */
.hero { position: relative; }

.hero.unlocked { height: 230svh; }

.stage {
    position: relative; min-height: 100svh; display: grid; place-items: center;
    padding-block: 56px;
}

.hero.unlocked .stage { position: sticky; top: 0; height: 100svh; min-height: 480px; overflow: hidden; padding-block: 0; }

.screen {
    display: flex; flex-direction: column; align-items: center; gap: clamp(22px, 4.5vh, 44px);
    padding-left: var(--gutter-l); padding-right: var(--gutter-r); width: 100%;
}

.logo {
    --size: min(124px, 11vw);
    margin: 0; font-weight: 600;
    font-family: var(--f-logo); font-size: var(--size); line-height: 1; letter-spacing: -.02em;
    display: flex; align-items: center; color: var(--l-ink);
}

.hero.unlocked .logo { --size: min(132px, 11.5vw); }

/* The slash cuts in from the bottom on boot (clip), and leans in on scroll (transform from JS). */
.slash {
    height: .91em; width: .545em; flex: none; margin-right: .076em; fill: var(--accent);
    clip-path: polygon(0 100%, 100% 100%, 100% 100%, 0 100%);
    transition: clip-path .38s cubic-bezier(.7, 0, .2, 1);
}

.slash.in { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }

.word { display: inline-flex; white-space: pre; }

.ch {
    display: inline-block; flex: none; overflow: hidden; text-align: center;
    transform-origin: 50% 100%; transition: color .35s, opacity .22s ease-out, transform .26s cubic-bezier(.2, .8, .2, 1), filter .26s;
}

.ch.hd { font-weight: 600; color: var(--l-ink); }

.ch.tl { font-weight: 300; color: var(--l-soft); }

/* /ware: the short form sets "ware" in medium, full ink. */
.logo.short .ch.tl { font-weight: 500; color: var(--l-ink); }

/* Not typed yet: the space is kept (no reflow), the letter rises in when typed. */
.ch.hid { opacity: 0; transform: translateY(.14em); filter: blur(6px); }

.ch.glitch { color: var(--accent); }

.ch.err { color: var(--danger); }

.logo.wave .ch { animation: wave 1.1s ease-in-out infinite; animation-delay: calc(var(--i) * 70ms); }

@keyframes wave {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-.18em); }
}

.cursor {
    display: block; width: .455em; height: .79em; background: var(--accent);
    margin-left: .1em; flex: none; animation: blink 1.05s steps(1) infinite;
    transition: box-shadow .15s, transform .12s cubic-bezier(.2, .8, .2, 1);
}

.logo.typing .cursor { animation: none; }

.logo.fast .cursor { animation-duration: .3s; }

.cursor.hit { animation: none; box-shadow: 0 0 28px var(--accent); }

.logo.shake { animation: shake .45s cubic-bezier(.36, .07, .19, .97); }

@keyframes blink { 50% { opacity: 0; } }

@keyframes shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-8px); }
    40%, 60% { transform: translateX(8px); }
}

.tag {
    font-family: var(--f-head); font-weight: 500; font-size: clamp(18px, 2.4vw, 24px);
    color: var(--fg-2); text-align: center; text-wrap: balance; margin: 0; max-width: 34ch;
    opacity: 0; transform: translateY(8px); transition: opacity .8s .3s, transform .8s .3s;
}

.tag strong { color: var(--fg); font-weight: 600; }

.hero.locked .tag { display: none; }

body.revealed .tag { opacity: 1; transform: none; }

.hint {
    position: absolute; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
    font-family: var(--f-mono); font-size: 12px; color: var(--fg-3); display: none; gap: 10px; align-items: center;
    opacity: 0; transition: opacity .6s .8s;
}

.hero.unlocked .hint { display: flex; }

body.revealed .hint { opacity: 1; }

.hint i { display: block; width: 1px; height: 28px; background: linear-gradient(var(--accent), transparent); animation: drip 1.6s ease-in-out infinite; }

@keyframes drip {
    0% { transform: scaleY(0); transform-origin: top; }
    50% { transform: scaleY(1); transform-origin: top; }
    51% { transform: scaleY(1); transform-origin: bottom; }
    100% { transform: scaleY(0); transform-origin: bottom; }
}

/* CRT power-on */
.crt { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; }

.crt span { width: 100%; height: 2px; background: var(--l-ink); box-shadow: 0 0 18px var(--accent); transform: scaleX(0); opacity: 0; }

.powering .screen { animation: open .55s .35s cubic-bezier(.2, .8, .2, 1) both; }

.powering .crt span { animation: line .5s ease-out both; }

@keyframes line {
    0% { transform: scaleX(0); opacity: 1; }
    70% { transform: scaleX(1); opacity: 1; }
    100% { transform: scaleX(1) scaleY(30); opacity: 0; }
}

@keyframes open {
    from { clip-path: inset(50% 0 50% 0); filter: brightness(2.2); }
    to { clip-path: inset(0 0 0 0); filter: none; }
}

/* ───────── terminal ───────── */
.term {
    width: min(100%, 660px);
    background: color-mix(in srgb, var(--bg-2) 90%, transparent);
    backdrop-filter: blur(6px);
    border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
    box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .8);
    font-family: var(--f-mono); font-size: 13.5px; line-height: 1.7;
    opacity: 0; transform: translateY(18px) scale(.98);
    transition: opacity .5s, transform .6s cubic-bezier(.2, .8, .2, 1), border-color .3s;
}

.term.show { opacity: 1; transform: none; }

.term:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

.term.shake { animation: shake .45s cubic-bezier(.36, .07, .19, .97); border-color: var(--danger); }

.term.granted { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 60px -10px color-mix(in srgb, var(--accent) 50%, transparent); }

.hero.unlocked .term { display: none; }

.term-bar { display: flex; align-items: center; gap: 7px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--fg-3); font-size: 12px; }

.term-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }

.term-bar span { margin-left: auto; margin-right: auto; padding-right: 51px; }

.term-out {
    padding: 14px 18px 2px; height: clamp(170px, 26vh, 230px); overflow-y: auto;
    white-space: pre-wrap; word-break: break-word; color: var(--fg-2);
    scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}

.term-out .cmd { color: var(--fg); }

.term-out .ok { color: var(--accent); }

.term-out .err { color: var(--danger); }

.term-out .warn { color: var(--warn); }

.term-out .dim { color: var(--fg-3); }

.term-out .hl { color: var(--fg); }

.term-out .bar { color: var(--accent); }

.term-status {
    margin: 6px 18px 10px; padding: 10px 12px; overflow: hidden;
    border: 1px dashed var(--line); border-radius: 8px; color: var(--fg-2); line-height: 1.65;
    opacity: 0; transition: opacity .6s;
}

.term-status.on { opacity: 1; }

/* Fixed line heights, no wrapping: the box never changes size while it animates. */
.term-status > div { height: 1.65em; line-height: 1.65em; white-space: pre; overflow: hidden; text-overflow: ellipsis; }

/* The spinner glyphs fall back to other fonts with other metrics: box them so nothing moves. */
.term-status .glyph {
    display: inline-block; width: 1.4em; height: 1.65em; line-height: 1.65em; overflow: hidden;
    vertical-align: top; text-align: left;
}

.term-status > div > span { transition: opacity .3s; }

.term-status .cmd { color: var(--fg); }

.term-status .ok, .term-status .bar { color: var(--accent); }

.term-status .dim { color: var(--fg-3); }

.term-line { display: flex; gap: 10px; padding: 2px 18px 14px; align-items: baseline; margin: 0; transition: opacity .4s; }

.term-line.off, .term-hint.off { visibility: hidden; opacity: 0; }

.ps1 { color: var(--accent); flex: none; cursor: text; }

.ps1-short { display: none; }

.field { position: relative; flex: 1; min-width: 0; font-family: var(--f-mono); font-size: 16px; line-height: 1.5; }

.field input {
    display: block; width: 100%; background: none; border: 0; outline: 0; padding: 0; margin: 0;
    font: inherit; letter-spacing: 0; color: transparent; caret-color: var(--accent);
}

.field input::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

.mirror {
    position: absolute; inset: 0; pointer-events: none; white-space: pre; overflow: hidden;
    color: var(--fg); letter-spacing: 0;
}

.mirror .flag { color: var(--accent); }

.mirror .pw { color: var(--fg-2); }

.term-hint {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
    padding: 10px 18px 12px; border-top: 1px solid var(--line); color: var(--fg-3); font-size: 12px;
    transition: opacity .4s;
}

.chip {
    font-family: var(--f-mono); font-size: 12px; color: var(--fg); background: var(--bg-3);
    border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; cursor: pointer; min-height: 36px;
}

.chip:hover { border-color: var(--accent); color: var(--accent); }

kbd { font-family: var(--f-mono); font-size: 11px; color: var(--fg-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }

/* transition canvas */
.wipe { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 90; pointer-events: none; }

/* ───────── content (loaded after unlock) ───────── */
#content { position: relative; z-index: 1; background: var(--bg); }

#content:empty { display: none; }

section.block { padding-block: clamp(72px, 12vw, 140px); border-top: 1px solid var(--line); }

.eyebrow { font-family: var(--f-mono); font-size: 13px; color: var(--accent); letter-spacing: .02em; margin: 0 0 18px; }

h2 {
    font-family: var(--f-head); font-weight: 700; font-size: clamp(34px, 5.4vw, 64px); line-height: 1.02;
    letter-spacing: -.025em; margin: 0; text-wrap: balance;
}

h2 .sl { color: var(--accent); }

h3 { font-family: var(--f-head); font-weight: 600; font-size: 22px; letter-spacing: -.01em; margin: 0; }

p.lead { font-size: clamp(17px, 1.6vw, 19px); color: var(--fg-2); max-width: 60ch; margin: 0; }

p.lead.small { font-size: 17px; }

code.i { font-family: var(--f-mono); font-size: .9em; color: var(--fg); }

.col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.about { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(32px, 6vw, 88px); align-items: end; }

.about > * { min-width: 0; }

.facts { display: grid; margin: 0; border-top: 1px solid var(--line); }

.fact { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding-block: 18px; border-bottom: 1px solid var(--line); }

.fact dt { font-family: var(--f-mono); font-size: 13px; color: var(--fg-3); padding-top: 2px; }

.fact dd { margin: 0; color: var(--fg-2); }

.fact dd b { color: var(--fg); font-weight: 600; }

.stack-head { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: end; margin-bottom: clamp(40px, 6vw, 72px); }

.stack-head.flush { margin-bottom: 0; }

.stack-head > * { min-width: 0; }

.pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; }

.card {
    background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: clamp(22px, 3vw, 36px);
    display: flex; flex-direction: column; gap: 22px; min-width: 0;
}

.card-top { display: flex; align-items: center; gap: 16px; }

.card-top svg { width: 52px; height: 52px; flex: none; }

.card-top .meta { display: flex; flex-direction: column; gap: 2px; }

.card-top h3 { font-size: 28px; }

.ver { font-family: var(--f-mono); font-size: 13px; color: var(--fg-3); }

.card p { margin: 0; color: var(--fg-2); }

.path { font-family: var(--f-mono); font-size: 13px; color: var(--fg-2); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; align-self: flex-start; }

.libs { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--line); }

.libs li { display: flex; justify-content: space-between; gap: 12px; padding-block: 11px; border-bottom: 1px solid var(--line); font-size: 15px; }

.libs li span:last-child { font-family: var(--f-mono); font-size: 13px; color: var(--fg-3); text-align: right; }

.react-logo { color: var(--react); }

.nest-logo { color: var(--nest); }

.react-logo.spin { animation: spin 18s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.bridge { display: flex; flex-direction: column; align-items: center; justify-content: center; padding-inline: clamp(14px, 2.4vw, 28px); gap: 10px; }

.bridge .ln { width: 1px; flex: 1; background: var(--line); min-height: 24px; }

.zod {
    font-family: var(--f-mono); font-size: 12px; color: var(--accent-ink); background: var(--accent);
    padding: 8px 10px; border-radius: 6px; writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: .04em;
}

.contract { margin-top: clamp(28px, 4vw, 40px); display: grid; grid-template-columns: 1fr 1.25fr; gap: clamp(24px, 4vw, 48px); align-items: center; }

.contract > * { min-width: 0; }

.code { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }

.code-bar { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-family: var(--f-mono); font-size: 12px; color: var(--fg-3); }

.code pre { margin: 0; padding: 18px 20px; overflow-x: auto; font-family: var(--f-mono); font-size: 13px; line-height: 1.75; color: var(--fg-2); }

.k, .f, .t { color: var(--fg); }

.s { color: var(--accent); }

.c { color: var(--fg-3); }

.flow { margin-top: clamp(56px, 8vw, 96px); }

.flow h3 { margin-bottom: 20px; }

.lane { overflow-x: auto; padding-top: 14px; padding-bottom: 6px; }

.steps { display: flex; align-items: stretch; min-width: 820px; position: relative; }

.step { flex: 1; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); display: flex; flex-direction: column; gap: 4px; }

.step b { font-family: var(--f-head); font-weight: 600; font-size: 15px; }

.step span { font-family: var(--f-mono); font-size: 12px; color: var(--fg-3); }

.step.z { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }

.arrow { width: 28px; flex: none; align-self: center; height: 1px; background: var(--fg-3); position: relative; }

.arrow::after { content: ""; position: absolute; right: 0; top: -3px; border: 3.5px solid transparent; border-left: 5px solid var(--fg-3); border-right: 0; }

.packet { position: absolute; top: -12px; left: 0; width: 8px; height: 8px; background: var(--accent); animation: travel 5s linear infinite; }

@keyframes travel { from { left: 0; } to { left: calc(100% - 8px); } }

.tree { margin-top: clamp(40px, 6vw, 64px); display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 4vw, 48px); align-items: start; }

.tree > * { min-width: 0; }

.tree pre { margin: 0; font-family: var(--f-mono); font-size: 13px; line-height: 1.9; color: var(--fg-2); overflow-x: auto; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; }

.tree pre .d { color: var(--fg); }

.tree pre .n { color: var(--fg-3); }

.tree ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }

.tree li { display: grid; grid-template-columns: 24px 1fr; gap: 12px; color: var(--fg-2); }

.tree li::before { content: "/"; font-family: var(--f-mono); color: var(--accent); font-weight: 500; }

.tree li b { color: var(--fg); font-weight: 600; }

.marks { margin-top: clamp(32px, 5vw, 56px); display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }

.mark { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; background: var(--bg-2); min-width: 0; }

.mark .lockup {
    flex: 1; min-height: clamp(160px, 22vw, 260px); display: flex; align-items: center; justify-content: center;
    font-family: var(--f-logo); font-weight: 300; letter-spacing: -.02em; line-height: 1;
    font-size: clamp(30px, 5.4vw, 64px); color: var(--soft); --ink: var(--l-ink); --soft: var(--l-soft); --cut: var(--accent);
}

.mark.dark .lockup { background: var(--bg); }

.mark.light .lockup { background: #F7F8F6; --ink: #0A0E14; --soft: #4F5A55; --cut: #00A35A; }

.lockup svg { height: .91em; width: .545em; margin-right: .076em; fill: var(--cut); flex: none; }

.lockup b { font-weight: 600; color: var(--ink); }

.lockup.short { font-weight: 500; color: var(--ink); letter-spacing: -.03em; }

.lockup.short svg { margin-right: .02em; }

.lockup .cu { display: block; width: .45em; height: .79em; background: var(--cut); margin-left: .09em; animation: blink 1.05s steps(1) infinite; }

.mark.icon .lockup { font-size: clamp(56px, 8vw, 96px); }

.mark figcaption { display: flex; justify-content: space-between; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 500; }

.mark figcaption span:last-child { font-family: var(--f-mono); font-size: 12px; color: var(--fg-3); }

/* reveal on entry, from a visible resting state */
.reveal { transition: opacity .7s, transform .7s cubic-bezier(.2, .8, .2, 1); }

.reveal.pre { opacity: .001; transform: translateY(24px); }

.foot { display: none; position: relative; z-index: 1; background: var(--bg); border-top: 1px solid var(--line); padding-block: 40px calc(40px + env(safe-area-inset-bottom, 0px)); }

body.unlocked .foot { display: block; }

.foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-family: var(--f-mono); font-size: 13px; color: var(--fg-3); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 860px) {
    .about, .stack-head, .contract, .tree { grid-template-columns: 1fr; }
    .pair { grid-template-columns: 1fr; }
    .bridge { flex-direction: row; padding: 14px 0; }
    .bridge .ln { height: 1px; width: auto; min-height: 0; }
    .zod { writing-mode: horizontal-tb; transform: none; }
    .marks { grid-template-columns: 1fr; }
    .nav .hide-s { display: none; }
}

@media (max-width: 520px) {
    .fact { grid-template-columns: 1fr; gap: 4px; }
    .term { font-size: 12.5px; }
    .term-out { padding-inline: 14px; }
    .term-line { padding-inline: 14px; }
    .term-status { margin-inline: 14px; font-size: 11.5px; }
    .term-hint { padding-inline: 14px; }
    .ps1-long { display: none; }
    .ps1-short { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .cursor, .mini .c, .lockup .cu, .react-logo.spin, .packet, .hint i, .logo.wave .ch { animation: none !important; }
    .powering .screen, .powering .crt span, .logo.shake, .term.shake { animation: none !important; }
    .slash, .ch, .cursor { transition: none; }
    .reveal.pre { opacity: 1; transform: none; }
}
