/* ============================================================
   Martin Muskov · personal site
   Rebuilt from scratch · no framework · no build step
   ============================================================ */

:root {
    --bg:        #0a0a0c;
    --bg-soft:   #101014;
    --panel:     #14141a;
    --panel-2:   #17171f;
    --line:      #23232c;
    --line-soft: #1b1b22;
    --text:      #ecedf1;
    --muted:     #a2a3ae;
    /* Nudged from #6d6e79 so small text clears WCAG AA (4.6:1 on --bg). */
    --faint:     #787985;
    --accent:    #7c6cff;
    --accent-2:  #4f8cff;
    --radius:    16px;
    --maxw:      1080px;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    /* `hidden` on one axis forces the browser to compute `overflow-y: auto`,
       turning body into a second scroll container. `clip` contains the same
       horizontal bleed without creating one, so the page keeps exactly one
       scroller (the document) and sticky positioning behaves. */
    overflow-x: hidden;
    position: relative;
}
@supports (overflow: clip) {
    body { overflow-x: clip; }
}

a { color: inherit; text-decoration: none; }
strong { color: var(--text); font-weight: 600; }
img, svg { max-width: 100%; }
h1, h2, h3 { text-wrap: balance; }
::selection { background: rgba(124, 108, 255, .32); color: #fff; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- ambient background ---------- */
.glow {
    position: fixed;
    z-index: 0;
    border-radius: 50%;
    filter: blur(120px);
    opacity: .5;
    pointer-events: none;
}
.glow-a { top: -180px; left: -120px; width: 560px; height: 560px;
    background: radial-gradient(circle, rgba(124,108,255,.45), transparent 70%);
    animation: drift-a 22s ease-in-out infinite; }
.glow-b { top: 40%; right: -160px; width: 520px; height: 520px;
    background: radial-gradient(circle, rgba(79,140,255,.32), transparent 70%);
    animation: drift-b 26s ease-in-out infinite; }
@keyframes drift-a {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(60px, 40px) scale(1.12); }
}
@keyframes drift-b {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(-50px, -30px) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) { .glow-a, .glow-b { animation: none; } }
.grain {
    position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
#progress {
    position: fixed; top: 0; left: 0; height: 2px; width: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    z-index: 100; transition: width .1s linear;
}

/* ---------- nav ---------- */
.nav {
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(14px);
    background: rgba(10,10,12,.62);
    border-bottom: 1px solid transparent;
    transition: border-color .3s, background .3s;
}
.nav.scrolled { border-bottom-color: var(--line-soft); background: rgba(10,10,12,.85); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; font-size: 1.02rem; }
.brand .dot { color: var(--accent); }
.logo-mark { border-radius: 9px; flex: none; transition: transform .35s cubic-bezier(.2,.7,.2,1);
    box-shadow: 0 4px 16px -6px rgba(124,108,255,.8); }
.brand:hover .logo-mark { transform: rotate(-8deg) scale(1.06); }
.nav-links { display: flex; gap: 22px; }
/* Vertical padding gives each link a comfortable ~36px hit area without
   changing how it looks. */
.nav-links a {
    color: var(--muted); font-size: .92rem; font-weight: 500; transition: color .2s;
    display: inline-flex; align-items: center; padding: 8px 2px;
}
.nav-links a:hover { color: var(--text); }
.nav-gh {
    color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; margin-right: -8px;
    transition: color .2s, transform .2s;
}
.nav-gh:hover { color: var(--text); transform: translateY(-1px); }
/* Keep the nav usable on small screens: condense instead of hiding it. */
@media (max-width: 620px) {
    .brand-word { display: none; }
    .nav-links { gap: 18px; font-size: .86rem; }
}
@media (max-width: 400px) {
    .nav-links { gap: 13px; }
    .nav-gh { display: none; }
}

/* Visible keyboard focus for all interactive elements. */
a:focus-visible, .btn:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px;
}

/* ---------- reveal (progressive enhancement: only hidden when JS is active) ---------- */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- hero ---------- */
.hero { position: relative; z-index: 2; padding: clamp(90px, 16vh, 170px) 0 90px; overflow: hidden; }
/* 16vh of a tall phone screen pushed the hero past a full viewport before you
   saw anything else. Tighten the vertical rhythm on small screens. */
@media (max-width: 620px) {
    .hero { padding: 64px 0 56px; }
    .hero h1 { margin-bottom: 18px; }
    .eyebrow { margin-bottom: 16px; }
    .hero-cta { margin-top: 28px; }
}
.hero .wrap { position: relative; z-index: 1; }
.hero-watermark {
    position: absolute; right: -3%; top: 50%; transform: translateY(-50%);
    width: min(46vw, 520px); height: auto; opacity: .06; z-index: 0; pointer-events: none;
    animation: float-mark 12s ease-in-out infinite;
}
@keyframes float-mark {
    0%, 100% { transform: translateY(-50%); }
    50%      { transform: translateY(-54%); }
}
@media (prefers-reduced-motion: reduce) { .hero-watermark { animation: none; } }
@media (max-width: 620px) { .hero-watermark { opacity: .04; right: -12%; } }
.eyebrow {
    font-family: var(--mono); font-size: .8rem; letter-spacing: .04em;
    color: var(--accent); text-transform: uppercase; margin-bottom: 22px;
}
.hero h1 {
    font-size: clamp(3rem, 9vw, 5.6rem); line-height: .98; letter-spacing: -.035em;
    font-weight: 800; margin-bottom: 26px;
    background: linear-gradient(110deg, #ffffff 18%, #a9aab8 40%, #ffffff 62%, #b8b9c6 130%);
    background-size: 220% auto;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: sheen 9s linear infinite;
}
@keyframes sheen { to { background-position: 220% center; } }
@media (prefers-reduced-motion: reduce) { .hero h1 { animation: none; } }
.lead { font-size: clamp(1.12rem, 2.4vw, 1.5rem); color: var(--muted); max-width: 40ch; line-height: 1.5; }
.lead a { color: var(--text); border-bottom: 1px solid var(--accent); transition: color .2s; }
.lead a:hover { color: var(--accent); }
.hero-cta { display: flex; gap: 14px; margin-top: 38px; flex-wrap: wrap; }

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: .95rem; font-weight: 600; padding: 12px 22px; border-radius: 999px;
    transition: transform .2s, background .2s, border-color .2s, box-shadow .2s; cursor: pointer;
}
.btn-primary {
    background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: #fff;
    box-shadow: 0 8px 30px -10px rgba(124,108,255,.7);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 40px -12px rgba(124,108,255,.85); }
.btn-ghost { border: 1px solid var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); transform: translateY(-2px); }

.hero-stats {
    list-style: none; display: flex; flex-wrap: wrap; gap: 40px; margin-top: 60px;
    padding-top: 34px; border-top: 1px solid var(--line-soft);
}
/* On phones the four stats wrap to two rows; a 40px gap left a big hole
   between them, so switch to an even 2-column grid. */
@media (max-width: 620px) {
    .hero-stats {
        display: grid; grid-template-columns: 1fr 1fr;
        gap: 18px 16px; margin-top: 40px; padding-top: 26px;
    }
}
.hero-stats li { display: flex; flex-direction: column; gap: 3px; }
.hero-stats .num { font-family: var(--mono); font-size: 1.5rem; font-weight: 600; color: var(--text); }
.hero-stats .cap { font-size: .82rem; color: var(--faint); }

/* ---------- section scaffolding ---------- */
/* Offset anchor targets so headings clear the sticky nav. */
section[id], #top { scroll-margin-top: 80px; }
.section { position: relative; z-index: 2; padding: 80px 0; border-top: 1px solid var(--line-soft); }
.section-head { margin-bottom: 40px; }
.kicker {
    font-family: var(--mono); font-size: .78rem; letter-spacing: .05em; text-transform: uppercase;
    color: var(--accent); display: block; margin-bottom: 12px;
}
.section-head h2 { font-size: clamp(1.9rem, 4vw, 2.7rem); letter-spacing: -.03em; font-weight: 700; }
.section-sub { color: var(--muted); max-width: 56ch; margin-top: 14px; }

/* ---------- Credda ---------- */
.credda-card {
    display: grid; grid-template-columns: 1.4fr 1fr; gap: 44px; align-items: center;
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(124,108,255,.10), transparent 55%),
        var(--panel);
    border: 1px solid var(--line); border-radius: 24px; padding: 40px;
}
.credda-tag { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: 14px; }
.credda-copy { color: var(--muted); font-size: 1.05rem; margin-bottom: 22px; }
.credda-points { list-style: none; display: flex; flex-direction: column; gap: 12px; margin-bottom: 26px; }
.credda-points li { color: var(--muted); padding-left: 20px; position: relative; font-size: .98rem; }
.credda-points li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }
.credda-links { display: flex; gap: 12px; flex-wrap: wrap; }

.credda-score { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.verify-card {
    display: flex; align-items: center; gap: 14px; width: 100%; max-width: 320px;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px 20px; transition: transform .2s, border-color .2s, background .2s;
}
.verify-card:hover { transform: translateY(-3px); border-color: var(--accent); background: var(--panel-2); }
.verify-badge { flex: none; display: inline-flex; filter: drop-shadow(0 4px 12px rgba(124,108,255,.5)); }
.verify-text { display: flex; flex-direction: column; gap: 2px; }
.verify-title { font-weight: 600; color: var(--text); font-size: 1rem; }
.verify-handle { font-family: var(--mono); font-size: .82rem; color: var(--muted); }
.verify-cta { margin-left: auto; font-size: .78rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
.verify-note { font-size: .82rem; color: var(--faint); text-align: center; max-width: 320px; line-height: 1.5; }

/* ---------- work grid ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 860px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }

.card {
    --c: var(--accent);
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 24px; display: flex; flex-direction: column; gap: 14px;
    position: relative; overflow: hidden; transition: transform .25s, border-color .25s, background .25s;
}
.card::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--c); opacity: .0; transition: opacity .25s;
}
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--c) 55%, var(--line));
    background: var(--panel-2); }
.card:hover::before { opacity: .9; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-top h3 { font-family: var(--mono); font-size: 1.15rem; font-weight: 600; color: var(--text); }
.card-top h3::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--c); margin-right: 9px; vertical-align: middle;
    box-shadow: 0 0 10px var(--c); }
.pill {
    font-family: var(--mono); font-size: .68rem; color: var(--muted);
    border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.card p { color: var(--muted); font-size: .92rem; line-height: 1.55; flex: 1; }
.card p code, .cmd { font-family: var(--mono); }
.card p code { color: var(--text); font-size: .85em; background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; }
.cmd {
    display: block; font-size: .8rem; color: var(--muted); background: var(--bg-soft);
    border: 1px solid var(--line-soft); border-radius: 8px; padding: 9px 11px;
    overflow-x: auto; white-space: nowrap;
    /* Long commands (flux, raster) scroll, so style the bar to match the
       theme instead of falling back to the browser default. Chrome 121+,
       Firefox and Safari 18+ use the standard properties; older WebKit falls
       back to the ::-webkit-scrollbar rules below. */
    scrollbar-width: thin;
    scrollbar-color: #3a3a48 transparent;
    overscroll-behavior-x: contain;
}
.cmd:hover { scrollbar-color: var(--accent) transparent; }
/* Copy button. The wrapper is the positioning context so the button stays put
   while the command itself scrolls underneath it. */
.cmd-wrap { position: relative; }
.cmd-wrap .cmd { padding-right: 40px; }
.cmd-copy {
    position: absolute; top: 50%; right: 5px; transform: translateY(-50%);
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; padding: 0;
    background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: 7px;
    color: var(--faint); cursor: pointer;
    transition: color .2s, border-color .2s, background .2s;
}
.cmd-copy:hover { color: var(--text); border-color: var(--line); background: var(--panel-2); }
.cmd-copy svg { width: 14px; height: 14px; display: block; }
.cmd-copy .icon-check { display: none; }
.cmd-copy.copied { color: #22c55e; border-color: #22c55e; }
.cmd-copy.copied .icon-copy { display: none; }
.cmd-copy.copied .icon-check { display: block; }
/* Touch devices have no hover, so keep the control clearly visible and bigger. */
@media (hover: none) {
    .cmd-copy { width: 34px; height: 34px; color: var(--muted); }
    .cmd-wrap .cmd { padding-right: 44px; }
}

.cmd::-webkit-scrollbar { height: 6px; }
.cmd::-webkit-scrollbar-track { background: transparent; }
.cmd::-webkit-scrollbar-thumb { background: #3a3a48; border-radius: 999px; }
.cmd:hover::-webkit-scrollbar-thumb { background: var(--accent); }
.cmd::before { content: "$ "; color: var(--accent); }
/* Not a runnable command, so no shell prompt and no copy button. */
.cmd[data-nocopy]::before { content: ""; }
.card-links { display: flex; gap: 16px; }
.card-links a { font-size: .84rem; font-weight: 500; color: var(--muted); transition: color .2s; }
.card-links a:hover { color: var(--c); }

.card-suite {
    background: linear-gradient(140deg, rgba(124,108,255,.10), rgba(79,140,255,.05)), var(--panel);
    border-style: dashed;
}
.card-suite .card-top h3 { color: var(--text); }
.card-suite .card-top h3::before { display: none; }

/* ---------- also ---------- */
.also { margin-top: 34px; padding-top: 28px; border-top: 1px dashed var(--line); }
.also-label { font-family: var(--mono); font-size: .76rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--faint); }
.also-items { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.also-chip {
    font-size: .88rem; color: var(--muted);
    border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; transition: all .2s;
}
.also-chip strong { color: var(--text); }
.also-chip:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 40px; align-items: start; }
@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; } }
.about-body p { color: var(--muted); font-size: 1.05rem; margin-bottom: 18px; max-width: 62ch; }
.about-body p a {
    color: var(--text); border-bottom: 1px solid var(--accent); transition: color .2s;
}
.about-body p a:hover { color: var(--accent); }
.stack { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.stack li {
    font-family: var(--mono); font-size: .8rem; color: var(--muted);
    border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; background: var(--panel);
}

/* ---------- contact ---------- */
.contact { padding-bottom: 90px; }
.contact-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 560px) { .contact-links { grid-template-columns: 1fr; } }
.contact-link {
    display: flex; flex-direction: column; gap: 4px;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 22px 24px; transition: transform .2s, border-color .2s, background .2s;
}
.contact-link:hover { transform: translateY(-3px); border-color: var(--accent); background: var(--panel-2); }
.cl-k { font-family: var(--mono); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.cl-v { font-size: 1.15rem; font-weight: 600; color: var(--text); }

/* ---------- footer ---------- */
.footer { position: relative; z-index: 2; border-top: 1px solid var(--line-soft); padding: 30px 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px;
    flex-wrap: wrap; color: var(--faint); font-size: .84rem; }
.footer-brand { display: inline-flex; align-items: center; gap: 9px; }
.footer-note { font-family: var(--mono); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
    .credda-card { grid-template-columns: 1fr; padding: 28px; }
    .credda-score { order: -1; }
    .section { padding: 60px 0; }
}
