/* ==========================================================================
   nestchao.github.io: terminal / IDE themed portfolio
   Tokens live in tokens.css. Sections are in page order.
   ========================================================================== */

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--topbar-h) + 12px);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    padding-bottom: var(--statusbar-h);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color .3s ease, color .3s ease;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
code, kbd, pre { font-family: var(--font-mono); }
::selection { background: var(--selection); }

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

.icon {
    width: 1em;
    height: 1em;
    flex: none;
    vertical-align: -0.125em;
}

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 200;
    background: var(--accent);
    color: var(--accent-ink);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}
.skip-link:focus { top: 12px; }

kbd {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 5px;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--muted);
    line-height: 1.4;
}

/* ---------- Scroll progress ---------- */
.scroll-progress {
    position: fixed;
    inset: 0 0 auto 0;
    height: 2px;
    z-index: 120;
    pointer-events: none;
}
.scroll-progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--cyan), var(--purple));
    transform-origin: 0 50%;
    transform: scaleX(var(--progress, 0));
}

/* ---------- Top bar ---------- */
.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--topbar-h);
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid transparent;
    transition: border-color .3s ease, background-color .3s ease;
}
.topbar.scrolled { border-bottom-color: var(--border); }

.topbar-inner {
    height: 100%;
    max-width: calc(var(--container) + 120px);
    margin: 0 auto;
    padding: 0 var(--gutter);
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}
.brand-prompt { color: var(--accent); }
.brand-name { color: var(--text-strong); }
.brand-caret {
    width: 8px;
    height: 16px;
    margin-left: 3px;
    background: var(--accent);
    animation: blink 1.1s steps(1) infinite;
}

.tabs {
    position: relative;
    display: flex;
    align-items: stretch;
    height: 100%;
    margin-left: auto;
}
.tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    transition: color .2s ease, background-color .2s ease;
}
.tab:hover { color: var(--text-strong); background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.tab.active { color: var(--text-strong); }
.tab-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--c);
    opacity: .75;
}
.tab-indicator {
    position: absolute;
    bottom: -1px;
    left: 0;
    height: 2px;
    width: var(--w, 0);
    transform: translateX(var(--x, 0));
    background: var(--accent);
    box-shadow: 0 0 12px rgba(var(--accent-rgb), .7);
    opacity: var(--o, 0);
    transition: transform .45s var(--ease-out), width .45s var(--ease-out), opacity .3s ease;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.palette-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 8px 0 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    transition: border-color .2s ease, color .2s ease;
}
.palette-btn:hover { border-color: var(--border-strong); color: var(--text); }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color .2s ease, transform .2s ease;
}
.icon-btn:hover { border-color: var(--border-strong); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .icon { width: 17px; height: 17px; }

.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.menu-toggle { display: none; }
.menu-toggle .icon-close { display: none; }
.menu-open .menu-toggle .icon-close { display: block; }
.menu-open .menu-toggle .icon-menu { display: none; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 46px;
    padding: 0 20px;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease, box-shadow .3s ease, transform .2s ease;
    will-change: transform;
}
.btn .icon { width: 16px; height: 16px; }
.btn-primary {
    background: var(--accent);
    color: var(--accent-ink);
    box-shadow: 0 8px 24px -10px rgba(var(--accent-rgb), .8);
}
.btn-primary:hover { box-shadow: 0 10px 32px -8px rgba(var(--accent-rgb), .9); }
.btn-primary:hover .icon { transform: translateX(3px); }
.btn-primary .icon { transition: transform .2s ease; }
.btn-ghost {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text-strong);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    padding: calc(var(--topbar-h) + 48px) 0 96px;
    overflow: hidden;
    isolation: isolate;
}
.hero::after {
    /* soft vignette + accent glow */
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(600px 400px at 85% 30%, rgba(var(--accent-rgb), .10), transparent 70%),
        radial-gradient(500px 380px at 10% 85%, color-mix(in srgb, var(--purple) 12%, transparent), transparent 70%),
        linear-gradient(to bottom, transparent 70%, var(--bg));
    pointer-events: none;
}
.hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(32px, 5vw, 64px);
    align-items: center;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 22px;
    padding: 6px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 80%, transparent);
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--muted);
}
.pulse {
    position: relative;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}
.pulse::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: ping 2s var(--ease-out) infinite;
}

.hero-name {
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.02;
    color: var(--text-strong);
}
.hero-hello {
    display: block;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: clamp(15px, 1.6vw, 18px);
    letter-spacing: 0;
    color: var(--accent);
    margin-bottom: 10px;
}
.hero-name-text {
    display: block;
    font-size: clamp(42px, 6.6vw, 84px);
    background: linear-gradient(120deg, var(--text-strong) 30%, color-mix(in srgb, var(--accent) 70%, var(--text-strong)) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-role {
    margin: 18px 0 0;
    font-family: var(--font-mono);
    font-size: clamp(17px, 2vw, 22px);
    color: var(--text);
    min-height: 1.6em;
}
.hero-role-prompt { color: var(--accent); margin-right: 8px; }
.type-caret {
    display: inline-block;
    width: .55em;
    height: 1.1em;
    margin-left: 3px;
    vertical-align: -0.18em;
    background: var(--accent);
    animation: blink 1s steps(1) infinite;
}

.hero-desc {
    margin: 18px 0 0;
    max-width: 52ch;
    font-size: clamp(16px, 1.4vw, 18px);
    color: var(--muted);
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

.hero-meta {
    list-style: none;
    margin: 36px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--muted);
}
.hero-meta li { display: inline-flex; gap: 8px; align-items: baseline; }
.hero-meta b { color: var(--text-strong); font-weight: 600; }

.scroll-cue {
    position: absolute;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--faint);
}
.scroll-cue i {
    width: 1px;
    height: 36px;
    background: linear-gradient(var(--accent), transparent);
    animation: drip 2s var(--ease-out) infinite;
    transform-origin: top;
}

/* ---------- Windows (terminal + code) ---------- */
.terminal,
.code-window {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.terminal {
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--shadow), var(--glow);
}

.window-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--muted);
}
.dots { display: inline-flex; gap: 7px; }
.dots i {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #ff5f57;
}
.dots i:nth-child(2) { background: #febc2e; }
.dots i:nth-child(3) { background: #28c840; }
.window-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.window-hint { margin-left: auto; color: var(--faint); white-space: nowrap; }
.window-hint code { color: var(--accent); }

.terminal-body {
    height: 380px;
    overflow-y: auto;
    padding: 16px 18px 18px;
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.7;
    cursor: text;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}
.terminal-output { white-space: pre-wrap; word-break: break-word; }
.t-line { min-height: 1.7em; }
.t-cmd .t-typed { color: var(--text-strong); }
.t-dim { color: var(--faint); }
.t-muted { color: var(--muted); }
.t-accent { color: var(--accent); }
.t-cyan { color: var(--cyan); }
.t-purple { color: var(--purple); }
.t-yellow { color: var(--yellow); }
.t-orange { color: var(--orange); }
.t-red { color: var(--red); }
.t-strong { color: var(--text-strong); font-weight: 600; }
.t-item { display: inline-block; white-space: nowrap; margin-right: 2ch; }
.terminal-output a { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }
.terminal-output a:hover { color: var(--accent); }
.t-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0 18px;
}
.t-ascii {
    color: var(--accent);
    line-height: 1.15;
    font-size: 11px;
    margin: 4px 0 8px;
}

.prompt { white-space: nowrap; margin-right: 8px; }
.p-user { color: var(--accent); }
.p-at { color: var(--faint); }
.p-host { color: var(--cyan); }
.p-path { color: var(--purple); }
.p-sign { color: var(--text); margin-left: 4px; }

.terminal-input-row {
    display: flex;
    align-items: baseline;
    margin: 0;
}
.terminal-input-row[hidden] { display: none; }
.terminal-input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 0;
    background: transparent;
    color: var(--text-strong);
    font: inherit;
    caret-color: var(--accent);
}
.terminal-input:focus-visible { outline: none; }

/* code card */
.code {
    margin: 0;
    padding: 18px 18px 20px 0;
    font-size: 13.5px;
    line-height: 1.75;
    overflow-x: auto;
    counter-reset: ln;
    color: var(--text);
}
.code .ln {
    display: block;
    padding-left: 54px;
    position: relative;
    white-space: pre;
}
.code .ln::before {
    counter-increment: ln;
    content: counter(ln);
    position: absolute;
    left: 0;
    width: 38px;
    text-align: right;
    color: var(--faint);
    opacity: .7;
}
.tk-key { color: var(--tk-key); }
.tk-str { color: var(--tk-str); }
.tk-num { color: var(--tk-num); }
.tk-kw { color: var(--tk-kw); }
.tk-fn { color: var(--tk-fn); }
.tk-com { color: var(--tk-com); font-style: italic; }
.tk-punc { color: var(--tk-punc); }
.tk-type { color: var(--tk-type); }

/* ---------- Sections ---------- */
.section {
    position: relative;
    padding: clamp(80px, 11vw, 136px) 0;
}
.section-alt {
    background: var(--bg-elev);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.section-head { margin-bottom: clamp(36px, 5vw, 56px); }
.section-index {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 10px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent);
}
.section-index::after {
    content: "";
    width: 48px;
    height: 1px;
    background: linear-gradient(90deg, var(--accent), transparent);
}
.section-title {
    margin: 0;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: clamp(30px, 4.4vw, 46px);
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--text-strong);
}
.section-sub {
    margin: 10px 0 0;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--tk-com);
}

/* ---------- About ---------- */
.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: clamp(28px, 4vw, 56px);
    align-items: start;
}
.about-text p {
    margin: 0 0 18px;
    font-size: 17px;
    color: var(--text);
}
.about-text p:first-child::first-letter {
    font-family: var(--font-mono);
    color: var(--accent);
    font-weight: 700;
}
.about-text strong { color: var(--text-strong); }
.about-text .hl {
    color: var(--accent);
    background: rgba(var(--accent-rgb), .1);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: .92em;
}

.skills {
    margin-top: clamp(40px, 6vw, 64px);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}
.skill-group {
    position: relative;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}
.skill-group h3 {
    margin: 0 0 14px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}
.skill-group h3 .tk-key { font-weight: 600; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text);
    transition: border-color .2s ease, color .2s ease, transform .2s ease;
}
.pill:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* ---------- Spotlight + tilt (shared by cards) ---------- */
[data-spotlight] { position: relative; }
[data-spotlight]::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--accent-rgb), .12), transparent 45%);
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
    z-index: 1;
}
[data-spotlight]:hover::before { opacity: 1; }
[data-tilt] { transform-style: preserve-3d; transition: transform .5s var(--ease-out), border-color .3s ease, box-shadow .3s ease; }

/* ---------- GitHub ---------- */
.gh-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.stat {
    min-height: 112px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}
.stat-value {
    display: block;
    font-family: var(--font-mono);
    font-size: clamp(28px, 3.4vw, 40px);
    font-weight: 700;
    color: var(--text-strong);
    line-height: 1.1;
}
.stat-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--muted);
}
.stat-label .icon { color: var(--accent); }

.gh-panels {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    align-items: start;
    gap: 14px;
    margin-top: 14px;
}
.panel {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    min-height: 220px;
    min-width: 0;
}
.panel-title {
    margin: 0 0 18px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}
.lang-bar {
    display: flex;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--surface-3);
    gap: 2px;
}
.lang-bar span {
    height: 100%;
    background: var(--c);
    transform-origin: left;
}
.lang-list {
    list-style: none;
    margin: 18px 0 0;
    padding: 0;
    display: grid;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 13px;
}
.lang-list li { display: flex; align-items: center; gap: 10px; }
.lang-list i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.lang-list .pct { margin-left: auto; color: var(--muted); }

.repo-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.repo-list li { min-width: 0; }
.repo {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    transition: border-color .2s ease, transform .2s ease;
}
.repo:hover { border-color: var(--accent); transform: translateX(4px); }
.repo-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--cyan);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.repo-desc {
    margin: 4px 0 8px;
    font-size: 13.5px;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.repo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--faint);
}
.repo-meta span { display: inline-flex; align-items: center; gap: 5px; }
.repo-meta i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }

.gh-error {
    grid-column: 1 / -1;
    padding: 28px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--muted);
    background: var(--surface);
}
.gh-error a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.gh-note {
    margin: 14px 0 0;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--faint);
}

.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--surface);
}
.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 6%, transparent), transparent);
    animation: shimmer 1.4s infinite;
}
.skeleton-block { height: 170px; border-radius: var(--radius-sm); background: var(--surface-2); }

/* ---------- Projects ---------- */
.project-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 28px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    transition: all .2s ease;
}
.chip:hover { color: var(--text-strong); border-color: var(--muted); }
.chip[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}
.chip-count { font-size: 11px; opacity: .7; }

.grep {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 38px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    font-family: var(--font-mono);
    font-size: 13px;
    min-width: min(100%, 300px);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.grep:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15); }
.grep-prompt { color: var(--accent); white-space: nowrap; }
.grep input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-strong);
    font: inherit;
}
.grep input::placeholder { color: var(--faint); }

.projects {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}
.project {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow: hidden;
    min-width: 0;
}
.project:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--glow); }
.project[hidden] { display: none; }
.project-media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.project-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform .7s var(--ease-out), filter .4s ease;
    filter: saturate(.9);
}
.project-art {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 4px;
    padding: 18px 20px;
    font-family: var(--font-mono);
    background:
        radial-gradient(420px 220px at 85% 0%, rgba(var(--accent-rgb), .22), transparent 70%),
        radial-gradient(320px 200px at 0% 100%, color-mix(in srgb, var(--purple) 20%, transparent), transparent 70%),
        repeating-linear-gradient(0deg, transparent 0 23px, var(--grid-dot) 23px 24px),
        var(--surface-2);
}
.project-art-name { font-size: clamp(18px, 2vw, 24px); font-weight: 700; color: var(--text-strong); overflow-wrap: anywhere; }
.project-art-name::before { content: "> "; color: var(--accent); }
.project-art-lang { font-size: 12px; color: var(--muted); }
.project:hover .project-media img { transform: scale(1.06); filter: saturate(1.05); }
.project-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, color-mix(in srgb, var(--surface) 85%, transparent), transparent 55%);
}
.project-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 700;
}
.project-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 18px 20px 20px;
}
.project-path {
    margin: 0 0 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--faint);
}
.project-title {
    margin: 0 0 10px;
    font-size: 18px;
    line-height: 1.35;
    color: var(--text-strong);
}
.project-desc {
    margin: 0 0 16px;
    font-size: 14.5px;
    color: var(--muted);
    flex: 1;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag {
    font-family: var(--font-mono);
    font-size: 11.5px;
    padding: 2px 8px;
    border-radius: 5px;
    color: var(--cyan);
    background: color-mix(in srgb, var(--cyan) 10%, transparent);
}
.project-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-strong);
}
.project-link .icon { width: 15px; height: 15px; }
.project-link:hover { color: var(--accent); }
.project-link::after {
    /* full-card click target */
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
}

.empty-state {
    padding: 40px;
    text-align: center;
    font-family: var(--font-mono);
    color: var(--muted);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}
.empty-state code { color: var(--accent); }

/* ---------- Experience: git log ---------- */
.gitlog-wrap { position: relative; max-width: 860px; }
.gitlog-rail {
    position: absolute;
    left: 11px;
    top: 14px;
    bottom: 14px;
    width: 2px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}
.gitlog-rail-fill {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(var(--accent), var(--cyan), var(--purple));
    transform-origin: top;
}
.gitlog { list-style: none; margin: 0; padding: 0; display: grid; gap: 28px; }
.commit {
    position: relative;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 22px;
}
.commit-node {
    position: relative;
    z-index: 1;
    width: 24px;
    height: 24px;
    margin-top: 16px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: var(--bg-elev);
    display: grid;
    place-items: center;
}
.commit-node::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}
.commit[data-type="work"] .commit-node { border-color: var(--orange); }
.commit[data-type="work"] .commit-node::after { background: var(--orange); }
.commit-card {
    padding: 18px 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.commit-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    font-family: var(--font-mono);
    font-size: 12.5px;
}
.commit-hash { color: var(--yellow); }
.ref {
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid currentColor;
    font-size: 11px;
}
.ref-head { color: var(--cyan); }
.ref-edu { color: var(--accent); }
.ref-work { color: var(--orange); }
.commit-date { margin-left: auto; color: var(--faint); }
.commit-title {
    margin: 10px 0 2px;
    font-size: 18px;
    color: var(--text-strong);
}
.commit-org { margin: 0 0 10px; font-size: 14px; color: var(--cyan); }
.commit-desc { margin: 0; font-size: 14.5px; color: var(--muted); }

/* ---------- Blog ---------- */
.posts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 18px;
}
.post-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow: hidden;
    transition: border-color .3s ease, transform .3s var(--ease-out);
}
.post-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-4px); }
.post-meta {
    display: flex;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--faint);
}
.post-title { margin: 10px 0 8px; font-size: 19px; line-height: 1.35; color: var(--text-strong); }
.post-summary { margin: 0 0 16px; font-size: 14.5px; color: var(--muted); flex: 1; }
.post-read {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.post-read::after { content: ""; position: absolute; inset: 0; }

/* ---------- Contact ---------- */
.contact-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(28px, 5vw, 64px);
    align-items: center;
}
.contact-grid .section-head { margin-bottom: 0; }
.contact-lead { margin: 22px 0 0; font-size: 17px; color: var(--muted); max-width: 46ch; }
.contact-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.contact-lines {
    padding: 18px 20px 22px;
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.9;
}
.c-line { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.c-key { color: var(--tk-kw); min-width: 7.5ch; }
.c-arrow { color: var(--faint); }
.c-val {
    color: var(--tk-str);
    min-width: 0;
    overflow-wrap: anywhere;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: text-decoration-color .2s ease, color .2s ease;
}
a.c-val:hover { text-decoration-color: currentColor; color: var(--accent); }
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding: 0 8px;
    border-radius: 5px;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    cursor: pointer;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.copy-btn .icon { width: 12px; height: 12px; }
.c-comment { color: var(--tk-com); font-style: italic; }
.c-run { margin-top: 10px; color: var(--accent); }

/* ---------- Status bar ---------- */
.statusbar {
    position: fixed;
    inset: auto 0 0 0;
    height: var(--statusbar-h);
    z-index: 90;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    background: var(--surface-2);
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--muted);
}
.status-left, .status-right { display: flex; align-items: stretch; min-width: 0; }
.status-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    white-space: nowrap;
}
.status-branch { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* ---------- Command palette ---------- */
.palette {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: start center;
    padding: 12vh 16px 16px;
}
.palette[hidden] { display: none; }
.palette-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 8, 12, .55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.palette-panel {
    position: relative;
    width: min(620px, 100%);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .6), var(--glow);
    overflow: hidden;
    animation: pop .25s var(--ease-out);
}
.palette-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
}
.palette-caret { color: var(--accent); font-weight: 700; }
.palette-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-strong);
    font: inherit;
    font-size: 15px;
}
.palette-list {
    list-style: none;
    margin: 0;
    padding: 8px;
    max-height: min(52vh, 420px);
    overflow-y: auto;
}
.palette-group {
    padding: 8px 10px 4px;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--faint);
}
.palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14.5px;
    color: var(--text);
}
.palette-item .icon { width: 16px; height: 16px; color: var(--muted); }
.palette-item small { margin-left: auto; font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.palette-item[aria-selected="true"] { background: rgba(var(--accent-rgb), .12); color: var(--text-strong); }
.palette-item[aria-selected="true"] .icon { color: var(--accent); }
.palette-empty { padding: 18px; text-align: center; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--statusbar-h) + 20px);
    z-index: 310;
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    padding: 10px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    box-shadow: var(--shadow);
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-strong);
    transition: opacity .25s ease, transform .35s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast::before { content: "✓ "; color: var(--accent); }

.noscript {
    position: fixed;
    inset: auto 16px calc(var(--statusbar-h) + 16px) 16px;
    padding: 14px 18px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    z-index: 400;
}
.noscript a { color: var(--accent); }

/* ---------- Reveal on scroll ---------- */
.motion [data-reveal] {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
    transition-delay: var(--delay, 0s);
    /* safety net: never leave content hidden if scripts fail */
    animation: reveal-fallback 0s 4s forwards;
}
.motion [data-reveal].in {
    opacity: 1;
    transform: none;
    animation: none;
}

/* ---------- Blog post page ---------- */
.post-page { padding: calc(var(--topbar-h) + 56px) 0 96px; }
.post-page .container { max-width: 780px; }
.post-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 28px;
}
.post-back:hover { color: var(--accent); }
.post-header h1 {
    margin: 12px 0 14px;
    font-size: clamp(30px, 5vw, 44px);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--text-strong);
}
.post-header .tags { margin: 0; }
.post-header {
    padding-bottom: 28px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border);
}
.prose { font-size: 17px; line-height: 1.8; }
.prose > :first-child { margin-top: 0; }
.prose h2, .prose h3 { color: var(--text-strong); line-height: 1.3; margin: 2em 0 .6em; }
.prose h2 { font-size: 26px; }
.prose h2::before { content: "## "; font-family: var(--font-mono); color: var(--accent); font-size: .8em; }
.prose h3 { font-size: 20px; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table { margin: 0 0 1.25em; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose strong { color: var(--text-strong); }
.prose li { margin: .3em 0; }
.prose li::marker { color: var(--accent); }
.prose blockquote {
    padding: 4px 0 4px 18px;
    border-left: 3px solid var(--accent);
    color: var(--muted);
}
.prose :not(pre) > code {
    padding: 2px 6px;
    border-radius: 5px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--tk-str);
    font-size: .88em;
}
.prose pre {
    padding: 18px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.7;
}
.prose img { border-radius: var(--radius); border: 1px solid var(--border); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 56px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 13px;
}
.post-nav a { color: var(--muted); }
.post-nav a:hover { color: var(--accent); }

/* highlight.js → editor tokens */
.hljs-keyword, .hljs-built_in, .hljs-selector-tag, .hljs-literal { color: var(--tk-kw); }
.hljs-string, .hljs-regexp, .hljs-addition { color: var(--tk-str); }
.hljs-number, .hljs-symbol { color: var(--tk-num); }
.hljs-comment, .hljs-quote { color: var(--tk-com); font-style: italic; }
.hljs-title, .hljs-title.function_, .hljs-section { color: var(--tk-fn); }
.hljs-attr, .hljs-attribute, .hljs-property, .hljs-variable, .hljs-name { color: var(--tk-key); }
.hljs-type, .hljs-title.class_, .hljs-meta { color: var(--tk-type); }
.hljs-deletion { color: var(--red); }
.hljs-punctuation { color: var(--tk-punc); }

/* ---------- Keyframes ---------- */
@keyframes blink { 50% { opacity: 0; } }
@keyframes ping { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.8); opacity: 0; } }
@keyframes drip { 0% { transform: scaleY(0); opacity: 1; } 70% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes reveal-fallback { to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .tab { padding: 0 10px; }
    .palette-btn-label, .kbd-hint { display: none; }
    .palette-btn { width: 34px; padding: 0; justify-content: center; }
}

@media (max-width: 1024px) {
    .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gh-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
    .menu-toggle { display: inline-grid; }
    .topbar-actions { margin-left: auto; }
    .tabs {
        position: fixed;
        top: var(--topbar-h);
        left: 0;
        right: 0;
        height: auto;
        flex-direction: column;
        padding: 10px var(--gutter) 18px;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 30px 40px -20px rgba(0, 0, 0, .5);
        transform: translateY(-8px);
        opacity: 0;
        visibility: hidden;
        transition: opacity .25s ease, transform .3s var(--ease-out), visibility .25s;
    }
    .menu-open .tabs { opacity: 1; transform: none; visibility: visible; }
    .tab { padding: 12px 6px; font-size: 15px; border-bottom: 1px solid var(--border); }
    .tab:last-of-type { border-bottom: 0; }
    .tab.active { color: var(--accent); }
    .tab-indicator { display: none; }

    .hero { min-height: auto; }
    .hero-grid, .about-grid, .contact-grid, .gh-panels { grid-template-columns: minmax(0, 1fr); }
    .terminal-body { height: 340px; }
    .scroll-cue { display: none; }
}

@media (max-width: 640px) {
    body { font-size: 15px; }
    .projects { grid-template-columns: minmax(0, 1fr); }
    .terminal-body { height: 320px; font-size: 12.5px; padding: 12px 12px 14px; }
    .window-hint { display: none; }
    .prompt .p-user, .prompt .p-at, .prompt .p-host { display: none; }
    .hero-cta .btn { flex: 1 1 auto; }
    .grep { width: 100%; }
    .commit { grid-template-columns: 20px minmax(0, 1fr); gap: 14px; }
    .commit-node { width: 20px; height: 20px; }
    .gitlog-rail { left: 9px; }
    .commit-date { margin-left: 0; width: 100%; }
    .status-hide-sm { display: none; }
    .stat { min-height: 96px; padding: 16px; }
    .about-text p { font-size: 16px; }
    .code { font-size: 12.5px; }
    .contact-lines { padding: 16px 14px 18px; font-size: 12.5px; }
    .c-line { gap: 6px 8px; }
    .c-key { min-width: 0; }
    .c-key::after { content: ":"; color: var(--faint); }
    .c-arrow { display: none; }
}

@media (hover: none) {
    [data-spotlight]::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
    .brand-caret, .type-caret { animation: none; }
}
