/* ============================
   CSS CUSTOM PROPERTIES
============================ */
:root {
    --hue: 1;
    --bg:          oklch(0.16 0.010 var(--hue));
    --bg-2:        oklch(0.20 0.012 var(--hue));
    --ink:         oklch(0.97 0.004 var(--hue));
    --ink-2:       oklch(0.78 0.010 var(--hue));
    --ink-3:       oklch(0.56 0.012 var(--hue));
    --rule:        oklch(0.30 0.012 var(--hue));
    --rule-2:      oklch(0.24 0.010 var(--hue));
    --accent:      oklch(0.59 0.24 1);
    --accent-soft: oklch(0.26 0.10 1);
    --display: "Inter Tight", ui-sans-serif, system-ui, sans-serif;
    --mono:    "JetBrains Mono", ui-monospace, monospace;
    --serif:   "Instrument Serif", ui-serif, Georgia, serif;
    --section-y: clamp(56px, 9vw, 160px);
    --nav-h: 60px;
}

/* ============================
   RESET & BASE
============================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--display);
    font-feature-settings: "ss01", "cv11";
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.5;
    overflow-x: hidden;
}
::selection { background: var(--accent); color: var(--bg); }
img { max-width: 100%; display: block; }

/* ============================
   GRAIN OVERLAY
============================ */
.grain {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: .4;
    mix-blend-mode: screen;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ============================
   CURSOR GLOW (desktop only)
============================ */
.glow {
    position: fixed;
    width: 620px;
    height: 620px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(circle at center, color-mix(in oklab, var(--accent) 28%, transparent), transparent 60%);
    filter: blur(30px);
    transform: translate(-50%, -50%);
    transition: opacity .4s;
    opacity: 0;
}
@media (hover: hover) { .glow.on { opacity: 1; } }

/* ============================
   LAYOUT
============================ */
.wrap {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 clamp(16px, 5vw, 32px);
    position: relative;
    z-index: 2;
}

/* ============================
   NAVIGATION
============================ */
nav.top {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid transparent;
    transition: border-color .3s ease;
}
nav.top::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    backdrop-filter: saturate(140%) blur(12px);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    background: color-mix(in oklab, var(--bg) 78%, transparent);
    transition: background .3s ease;
}
nav.top.scrolled { border-bottom-color: var(--rule-2); }

nav.top .row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-h);
    position: relative;
}

.mark {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: .02em;
    color: var(--ink);
    text-decoration: none;
    flex-shrink: 0;
    z-index: 2;
}
.mark .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 60%, transparent);
    animation: pulse 2.6s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0   color-mix(in oklab, var(--accent) 55%, transparent); }
    50%       { box-shadow: 0 0 0 8px color-mix(in oklab, var(--accent) 0%,  transparent); }
}

nav.top ul {
    list-style: none;
    display: flex;
    gap: 28px;
    margin: 0; padding: 0;
    position: static;
    opacity: 1;
    transform: none;
    pointer-events: all;
    background: transparent;
}
nav.top ul a {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--ink-2);
    text-decoration: none;
    letter-spacing: .02em;
    position: relative;
    padding: 6px 0;
}
nav.top ul a::before {
    content: "";
    position: absolute;
    left: 0; bottom: 2px;
    height: 1px; width: 100%;
    background: var(--ink);
    transform: scaleX(0);
    transform-origin: right center;
    transition: transform .4s cubic-bezier(.6, .05, .1, 1);
}
nav.top ul a:hover { color: var(--ink); }
nav.top ul a:hover::before { transform: scaleX(1); transform-origin: left center; }
nav.top ul a .num { color: var(--ink-3); margin-right: 6px; }
nav.top ul a.active { color: var(--ink); }
nav.top ul a.active::before { transform: scaleX(1); transform-origin: left center; background: var(--accent); }

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px; height: 44px;
    background: none; border: none;
    cursor: pointer; padding: 10px;
    z-index: 2; flex-shrink: 0;
}
.nav-toggle span {
    display: block;
    width: 100%; height: 1.5px;
    background: var(--ink);
    border-radius: 2px;
    transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .25s;
    transform-origin: center;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
    flex-shrink: 0;
}

@media (max-width: 720px) {
    .nav-toggle { display: flex; }
    nav.top ul {
        position: fixed;
        top: var(--nav-h);
        left: 0; right: 0; bottom: 0;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        gap: 0;
        background: var(--bg);
        z-index: 9999;
        opacity: 0;
        transform: translateY(-8px);
        pointer-events: none;
        transition: opacity .28s ease, transform .28s cubic-bezier(.2, .8, .2, 1);
        padding: 0;
        overflow-y: auto;
    }
    nav.top ul.open { opacity: 1; transform: translateY(0); pointer-events: all; }
    nav.top ul li { width: 100%; border-bottom: 1px solid var(--rule-2); }
    nav.top ul li:first-child { border-top: 1px solid var(--rule-2); }
    nav.top ul a {
        display: flex;
        align-items: center;
        gap: 16px;
        padding: 20px clamp(16px, 5vw, 32px);
        font-size: 18px;
        color: var(--ink);
        letter-spacing: .01em;
    }
    nav.top ul a .num { display: inline; font-size: 12px; color: var(--accent); margin-right: 0; }
    nav.top ul a::before { display: none; }
}

/* ============================
   HERO  (shared — index and blog both extend this)
============================ */
.hero {
    padding: clamp(56px, 12vw, 160px) 0 var(--section-y);
    position: relative;
}
.hero .eyebrow {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-3);
    letter-spacing: .08em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}
.hero .eyebrow::before {
    content: "";
    width: 28px; height: 1px;
    background: var(--ink-3);
    flex-shrink: 0;
}
.hero h1 {
    font-family: var(--display);
    font-weight: 500;
    font-size: clamp(36px, 8.4vw, 136px);
    line-height: .95;
    letter-spacing: -0.035em;
    margin: 0 0 clamp(20px, 4vw, 36px);
    color: var(--ink);
}
.hero h1 em {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    color: var(--accent);
    letter-spacing: -0.02em;
}
.hero .reveal-word {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
    padding-right: .08em;
}
.hero .reveal-word > span {
    display: inline-block;
    transform: translateY(110%);
    animation: rise .9s cubic-bezier(.2, .8, .2, 1) forwards;
}
@keyframes rise { to { transform: translateY(0); } }

.hero .lede {
    max-width: 680px;
    font-size: clamp(15px, 1.6vw, 22px);
    line-height: 1.6;
    color: var(--ink-2);
    margin: 0;
    font-weight: 400;
    opacity: 0;
    transform: translateY(14px);
    animation: fadeUp .9s .9s cubic-bezier(.2, .8, .2, 1) forwards;
}
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

/* ============================
   FOOTER
============================ */
footer.foot {
    padding: 22px 0 32px;
    border-top: 1px solid var(--rule-2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-3);
    letter-spacing: .04em;
    gap: 12px;
    flex-wrap: wrap;
}
footer.foot .time {
    display: flex;
    align-items: center;
    gap: 8px;
}
footer.foot .time::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: oklch(0.72 0.18 145);
    animation: pulse2 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes pulse2 { 50% { opacity: .35; } }
footer.foot a {
    color: var(--ink-2);
    text-decoration: none;
    border-bottom: 1px solid var(--rule);
    transition: border-color .25s, color .25s;
}
footer.foot a:hover { color: var(--ink); border-color: var(--ink); }
@media (max-width: 480px) {
    footer.foot { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* ============================
   REVEAL ANIMATION
============================ */
.r {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .9s cubic-bezier(.2, .8, .2, 1), transform .9s cubic-bezier(.2, .8, .2, 1);
}
.r.in { opacity: 1; transform: translateY(0); }
.r.d1 { transition-delay: .08s; }
.r.d2 { transition-delay: .16s; }
.r.d3 { transition-delay: .24s; }
.r.d4 { transition-delay: .32s; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
    .r { opacity: 1; transform: none; }
}

/* ============================
   TWEAKS PANEL
============================ */
.tweaks-panel {
    position: fixed;
    right: 16px; bottom: 16px;
    z-index: 100;
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 10px;
    padding: 14px 16px;
    font-family: var(--mono);
    font-size: 12px;
    display: none;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 20px 60px -20px color-mix(in oklab, var(--ink) 30%, transparent);
    min-width: 200px;
    max-width: calc(100vw - 32px);
}
.tweaks-panel.on { display: flex; }
.tweaks-panel .t-title { font-size: 10.5px; color: var(--ink-3); letter-spacing: .1em; text-transform: uppercase; }
.tweaks-panel label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 11.5px; color: var(--ink-2); }
.tweaks-panel input[type=range] { accent-color: var(--accent); max-width: 100px; }
.tweaks-panel .swatches { display: flex; gap: 6px; }
.tweaks-panel .sw { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--rule); cursor: pointer; }
.tweaks-panel .sw.on { outline: 2px solid var(--ink); outline-offset: 2px; }
