/*
 * Oskrov — "TRACE"
 * A design grounded in the one thing this product actually does:
 * turn readable machine code into unreadable bytes. Paper-white,
 * ink-dark, one real blue, one amber reserved for marking a
 * "changed" byte. Hairline structure over card-and-shadow kits.
 * One signature motion (decode-in-place) instead of scattered
 * fade-ups; a continuous ambient shader for the living, video-like
 * feel; hover motion only where it answers an action.
 */

:root {
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-io: cubic-bezier(0.65, 0, 0.35, 1);

    --paper: #f6f7fa;
    --paper-dim: #eef0f5;
    --surface: #ffffff;

    --ink: #121620;
    --slate: #5b6472;
    --slate-dim: #8990a0;
    --line: #e2e6ed;
    --line-strong: #cdd3dd;

    --trace: #2458ff;
    --trace-deep: #1a3fc9;
    --trace-dim: rgba(36, 88, 255, 0.08);
    --trace-dim-2: rgba(36, 88, 255, 0.16);

    --signal: #ff7a32;
    --signal-dim: rgba(255, 122, 50, 0.12);

    --radius-sm: 7px;
    --radius-md: 11px;
    --radius-lg: 16px;
}

* { box-sizing: border-box; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'Hanken Grotesk', system-ui, sans-serif;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection { background: var(--trace); color: #fff; }

/* ── Scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 2px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--slate-dim); }
html { scrollbar-color: var(--line-strong) var(--paper); scrollbar-width: thin; }

/* ── Type ──────────────────────────────────────────────────────────── */
.font-display { font-family: 'Hanken Grotesk', sans-serif; }
.font-mono    { font-family: 'IBM Plex Mono', monospace; }

.text-ink   { color: var(--ink); }
.text-slate { color: var(--slate); }
.text-trace { color: var(--trace); }

.display {
    font-family: 'Hanken Grotesk', sans-serif;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.02;
}

/* ── Section label — informative, not decorative. No pill, no dot,
   no tracked-out caps; a plain small mono index the eye can skip. ── */
.meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12.5px;
    color: var(--slate);
}
.meta b { color: var(--ink); font-weight: 500; }

/* ── Bracketed tag — reads like a struct field, not a pill chip ──── */
.tag {
    display: inline-flex;
    align-items: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: var(--trace-deep);
    white-space: nowrap;
}
.tag::before { content: '['; color: var(--line-strong); margin-right: 2px; }
.tag::after  { content: ']'; color: var(--line-strong); margin-left: 2px; }

/* ── Nav ──────────────────────────────────────────────────────────── */
.nav {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 50;
    background: rgba(246, 247, 250, 0.7);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid transparent;
    transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
}
.nav.scrolled { background: rgba(246, 247, 250, 0.92); border-bottom-color: var(--line); }
.nav-inner { transition: padding 0.4s var(--ease); }
.nav.scrolled .nav-inner { padding-top: 0.8rem; padding-bottom: 0.8rem; }

.navlink { position: relative; transition: color 0.25s var(--ease); }
.navlink::after {
    content: ""; position: absolute; left: 0; right: 100%; bottom: -5px; height: 1.5px;
    background: var(--trace);
    transition: right 0.35s var(--ease);
}
.navlink:hover::after { right: 0; }
.navlink.active::after { right: 0; background: var(--ink); }

.mobile-menu { display: none; }
.mobile-menu.active { display: flex; animation: slide-down 0.3s var(--ease); }
@keyframes slide-down { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ── Buttons — rectangular, small radius, no pill, no forced arrow ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    border-radius: var(--radius-sm);
    font-family: 'Hanken Grotesk', sans-serif; font-weight: 600;
    white-space: nowrap; cursor: pointer; position: relative;
    transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.2s var(--ease);
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--trace); color: #fff; }
.btn-primary:hover { background: var(--trace-deep); }

.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #262c3c; }

.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--line-strong); }
.btn-outline:hover { border-color: var(--ink); background: var(--surface); }

.btn-ghost { background: transparent; color: var(--slate); }
.btn-ghost:hover { color: var(--ink); }

/* ── Segmented control (tabs) — one real component, reused ───────── */
.tabs {
    display: inline-flex; position: relative;
    background: var(--paper-dim);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}
.tabs[data-cols] { display: grid; grid-template-columns: repeat(var(--cols, 2), 1fr); width: 100%; }
.tab {
    position: relative; z-index: 1;
    padding: 0.55rem 1.1rem;
    font-family: 'Hanken Grotesk', sans-serif; font-weight: 600; font-size: 13.5px;
    color: var(--slate); background: transparent; border: none; cursor: pointer;
    border-radius: calc(var(--radius-sm) - 2px);
    transition: color 0.3s var(--ease);
    white-space: nowrap;
}
.tab[aria-selected="true"] { color: #fff; }
.tabs .tab-thumb {
    position: absolute; top: 3px; left: 3px; height: calc(100% - 6px);
    background: var(--ink);
    border-radius: calc(var(--radius-sm) - 2px);
    transition: transform 0.4s var(--ease), width 0.4s var(--ease);
    z-index: 0;
}

/* ── Panels — the few places real elevation is earned ─────────────── */
.panel {
    position: relative; border-radius: var(--radius-lg);
    background: var(--surface); border: 1px solid var(--line);
    box-shadow: 0 1px 2px rgba(18, 22, 32, 0.04);
    overflow: hidden;
}
.panel-raised {
    box-shadow: 0 24px 48px -28px rgba(18, 22, 32, 0.18);
    border-color: var(--line-strong);
}

/* ── Hairline rows — the default content container, not cards ────── */
.rows { border-top: 1px solid var(--line); }
.row {
    border-bottom: 1px solid var(--line);
    position: relative;
    transition: background 0.25s var(--ease);
}
.row::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
    background: var(--trace); transform: scaleY(0); transform-origin: top;
    transition: transform 0.35s var(--ease);
}
.row:hover::before { transform: scaleY(1); }
.row:hover { background: rgba(36, 88, 255, 0.025); }

/* ── Icon — small, functional, not a rotate-on-hover tile kit ─────── */
.icon-mark {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--trace-dim); color: var(--trace-deep); flex-shrink: 0;
}
/* Default size at zero specificity so a Tailwind w-/h- utility on the
   same element always wins, regardless of which stylesheet the CDN
   JIT happens to inject later — a plain `.icon-mark { width: … }`
   rule would tie with the utility class and the winner would depend
   on load order instead of intent. */
:where(.icon-mark) { width: 2.5rem; height: 2.5rem; }

/* ── Gradient used once, deliberately, for the shader-backed hero ── */
.ink-on-light { color: var(--ink); }

/* ── Code ─────────────────────────────────────────────────────────── */
.code {
    background: #fbfbfd; border: 1px solid var(--line); border-radius: var(--radius-md);
    font-family: 'IBM Plex Mono', monospace; color: var(--ink);
}
/* Standalone, not scoped to .code — also used in the hero's byte-diff
   panel (.byte-op), which is a .panel, not a .code block. */
.c-kw  { color: var(--trace-deep); }
.c-str { color: #0d8a6f; }
.c-com { color: var(--slate-dim); }
.c-fn  { color: #8b5a00; }
.c-mac { color: var(--trace); font-weight: 600; }
.c-num { color: var(--signal); }
.c-punc{ color: var(--slate-dim); }
.c-addr{ color: var(--slate-dim); }
.c-diff{ color: var(--signal); background: var(--signal-dim); border-radius: 3px; padding: 0 2px; }

/* ── Tables ───────────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
    text-align: left; padding: 0.65rem 1.1rem;
    font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--slate);
    border-bottom: 1px solid var(--line);
}
.tbl td { padding: 0.75rem 1.1rem; border-bottom: 1px solid var(--line); font-size: 0.875rem; color: var(--ink); }
.tbl tr:hover td { background: var(--trace-dim); }

/* ── Forms ────────────────────────────────────────────────────────── */
.field label {
    display: block; font-family: 'IBM Plex Mono', monospace;
    font-size: 11.5px; color: var(--slate); margin-bottom: 0.45rem;
}
.input {
    width: 100%; background: var(--surface); border: 1.5px solid var(--line);
    border-radius: var(--radius-sm); padding: 0.8rem 0.95rem; font-size: 0.9rem; color: var(--ink);
    transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.input::placeholder { color: var(--slate-dim); }
.input:focus { outline: none; border-color: var(--trace); box-shadow: 0 0 0 3px var(--trace-dim); }

/* Visible keyboard focus everywhere, not just inputs */
a:focus-visible, button:focus-visible, summary:focus-visible, .tab:focus-visible {
    outline: 2px solid var(--trace); outline-offset: 2px; border-radius: 4px;
}

/* ── Decode — the signature motion: text resolves out of noise ───── */
.decode { display: inline-block; }
/* Atomic per word: adjacent inline-block boxes are valid line-break
   points by default, so without this the browser can wrap a line
   between any two letters, not just at spaces. */
.decode-word { display: inline-block; white-space: nowrap; }
.decode-char { display: inline-block; }
@media (prefers-reduced-motion: reduce) {
    .decode-char { animation: none !important; }
}

/* ── Scroll progress ──────────────────────────────────────────────── */
.scroll-progress {
    position: fixed; top: 0; left: 0; height: 2px; width: 0%; z-index: 60;
    background: var(--trace);
    transition: width 0.1s linear;
}

/* ── Marquee — real module names, slash-separated like a path ────── */
.marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee-track { display: flex; gap: 2.25rem; width: max-content; animation: marquee 38s linear infinite; }
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee:hover .marquee-track { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; } }

/* ── Pipeline connector — one flowing light, used once ────────────── */
.flow-line { position: relative; overflow: hidden; background: var(--line); }
.flow-line::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, var(--trace), transparent);
    width: 50%; transform: translateX(-150%);
    animation: flow 3.2s var(--ease-io) infinite;
}
@keyframes flow { to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .flow-line::after { animation: none; opacity: 0; } }

/* ── Byte-diff hero visual ───────────────────────────────────────── */
.byte-line { display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.9rem; align-items: baseline; }
.byte-addr { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--slate-dim); }
.byte-op   { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--ink); }

/* ── Accordion (FAQ) ──────────────────────────────────────────────── */
details.faq { border-bottom: 1px solid var(--line); }
details.faq summary { list-style: none; cursor: pointer; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq .chev { transition: transform 0.35s var(--ease); color: var(--slate-dim); }
details.faq[open] .chev { transform: rotate(45deg); color: var(--trace); }

/* ── Simple utility motion (hover-triggered only) ─────────────────── */
.lift { transition: transform 0.3s var(--ease); }
.lift:hover { transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .lift:hover { transform: none; } }

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

.stat-num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
