/* ---------- Tokens ---------- */
/* Dark is the default; light applies only when chosen with the toggle. */
:root {
    --bg: #06060c;
    --surface: #0c0d18;
    --surface-2: #121427;
    --border: #1d2038;
    --border-strong: #2c3156;
    --text: #e8eaf6;
    --muted: #9da1bf;
    --subtle: #6d7194;
    --accent: #22e6ff;
    --accent-hover: #7af1ff;
    --accent-2: #ff2bd6;
    --accent-contrast: #021015;
    --live: #39ff88;
    --dot: rgba(34, 230, 255, .16);
    --glow-a: rgba(255, 43, 214, .13);
    --glow-b: rgba(34, 230, 255, .09);
    --scanline: rgba(255, 255, 255, .022);

    --tint-amber: #f5e663;
    --tint-red: #ff2bd6;
    --tint-green: #39ff88;
    --tint-blue: #22e6ff;

    --cut: 14px;
    --font-display: 'Chakra Petch', 'Inter', system-ui, sans-serif;
    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;

    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #f3f4fa;
    --surface: #ffffff;
    --surface-2: #eceef8;
    --border: #d9dcec;
    --border-strong: #b9bdd8;
    --text: #12132a;
    --muted: #4a4e70;
    --subtle: #6d7194;
    --accent: #0891b2;
    --accent-hover: #0e7490;
    --accent-2: #c026d3;
    --accent-contrast: #ffffff;
    --live: #059669;
    --dot: rgba(8, 145, 178, .22);
    --glow-a: rgba(192, 38, 211, .08);
    --glow-b: rgba(8, 145, 178, .08);
    --scanline: transparent;

    --tint-amber: #b45309;
    --tint-red: #c026d3;
    --tint-green: #059669;
    --tint-blue: #0891b2;

    color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(1100px 620px at 88% -8%, var(--glow-a), transparent 62%),
        radial-gradient(900px 560px at -8% 12%, var(--glow-b), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* faint CRT scanlines over everything (dark theme only) */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom, var(--scanline) 0 1px, transparent 1px 3px);
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; letter-spacing: -0.01em; margin: 0; }
p { margin: 0; }
a { color: inherit; }
svg { display: block; }

::selection { background: var(--accent-2); color: #fff; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

html { scrollbar-color: var(--border-strong) var(--bg); scrollbar-width: thin; }

.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

.muted { color: var(--subtle); }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.mono { font-family: var(--font-mono); font-size: 13px; }

.skip-link {
    position: absolute;
    left: 16px;
    top: -48px;
    padding: 8px 14px;
    background: var(--accent);
    color: var(--accent-contrast);
    text-decoration: none;
    z-index: 200;
}
.skip-link:focus { top: 12px; }

/* ---------- Cut-corner panels ----------
   The element's background is the border colour, clipped to a chamfered shape;
   ::before paints the fill 1px inside it. Set --edge / --fill to restyle. */
.cut {
    --edge: var(--border);
    --fill: var(--surface);
    position: relative;
    isolation: isolate;
    border: 0;
    background: var(--edge);
    clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
    transition: background-color .2s;
}
.cut::before {
    content: '';
    position: absolute;
    inset: 1px;
    z-index: -1;
    background: var(--fill);
    clip-path: polygon(0 0, calc(100% - var(--cut) + .5px) 0, 100% calc(var(--cut) - .5px), 100% 100%, calc(var(--cut) - .5px) 100%, 0 calc(100% - var(--cut) + .5px));
    transition: background-color .2s;
}

/* ---------- Background physics canvas ---------- */
#bg-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

main, .site-footer { position: relative; z-index: 1; }

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
}
.site-header::after,
.site-footer::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent) 25%, var(--accent-2) 75%, transparent);
    opacity: .45;
}
.site-header::after { bottom: 0; }
.site-footer::before { top: 0; }

.nav {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 64px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    background: var(--accent);
    color: var(--accent-contrast);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 17px;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

.brand-tld { color: var(--accent); }

.nav-links {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.nav-links a {
    padding: 6px 12px;
    color: var(--muted);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    transition: color .15s;
}
.nav-links a::before { content: '['; opacity: 0; margin-right: 4px; color: var(--accent); transition: opacity .15s; }
.nav-links a::after { content: ']'; opacity: 0; margin-left: 4px; color: var(--accent); transition: opacity .15s; }
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::before,
.nav-links a:hover::after { opacity: 1; }

.nav-actions { display: flex; gap: 4px; }

.icon-btn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid transparent;
    background: none;
    color: var(--muted);
    cursor: pointer;
    transition: color .15s, border-color .15s, box-shadow .15s;
}
.icon-btn:hover {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    box-shadow: 0 0 14px -4px var(--accent), inset 0 0 10px -6px var(--accent);
}
.icon-btn svg { width: 18px; height: 18px; }

/* show the icon for the theme you'd switch to */
.icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

/* ---------- Hero ---------- */
.hero {
    padding-top: 96px;
    padding-bottom: 48px;
}

.eyebrow {
    --cut: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 12px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 28px;
}
.eyebrow .sep { color: var(--accent-2); }
.eyebrow > span:nth-child(2) { color: var(--live); }

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--live);
    box-shadow: 0 0 8px var(--live);
}

.caret {
    width: 7px;
    height: 13px;
    margin-left: 2px;
    background: var(--accent);
    animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.lede {
    max-width: 60ch;
    font-size: 1.125rem;
    color: var(--muted);
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 36px;
}

.btn {
    --cut: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 46px;
    padding: 0 22px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .08em;
    text-decoration: none;
    clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
    transition: background-color .15s, color .15s, transform .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost { --edge: var(--border-strong); color: var(--text); }
.btn-ghost:hover { --edge: var(--accent-2); color: var(--accent-2); }

/* ---------- Sections ---------- */
.section { padding-top: 80px; padding-bottom: 24px; }
.section:last-child { padding-bottom: 96px; }

.section-head { margin-bottom: 28px; }
.section-head h2 {
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.section-head p { margin-top: 6px; color: var(--muted); }

.kicker {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--accent-2);
}
.kicker::after {
    content: '';
    width: 64px;
    height: 1px;
    background: linear-gradient(90deg, var(--accent-2), transparent);
}

.section-head-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

/* ---------- Featured projects ---------- */
.project-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.project {
    --cut: 18px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 26px;
}
.project:hover { --edge: color-mix(in srgb, var(--tint) 70%, transparent); }
.project:hover::before {
    background:
        radial-gradient(420px 220px at 0% 0%, color-mix(in srgb, var(--tint) 9%, transparent), transparent 70%),
        var(--fill);
}

/* accent tab along the top-left edge */
.project::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 56px;
    height: 2px;
    background: var(--tint);
    box-shadow: 0 0 12px var(--tint);
    transition: width .3s;
}
.project:hover::after { width: 120px; }

.project-index {
    position: absolute;
    top: 22px;
    right: 30px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--subtle);
    letter-spacing: .1em;
}

.project-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    color: var(--tint);
    background: color-mix(in srgb, var(--tint) 12%, transparent);
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.project-icon svg {
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 0 6px color-mix(in srgb, var(--tint) 60%, transparent));
}

.project-body { flex: 1; }

.project-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 10px;
}

.project h3 { font-size: 1.45rem; font-weight: 600; margin-bottom: 8px; }
.project p { color: var(--muted); font-size: 15px; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .06em;
    white-space: nowrap;
}

.badge-live {
    color: var(--live);
    border-color: color-mix(in srgb, var(--live) 40%, transparent);
    background: color-mix(in srgb, var(--live) 8%, transparent);
    text-shadow: 0 0 8px color-mix(in srgb, var(--live) 60%, transparent);
}

.pulse {
    position: relative;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.pulse::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
    0% { transform: scale(1); opacity: .6; }
    100% { transform: scale(3); opacity: 0; }
}

.project-links {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-strong);
    font-family: var(--font-mono);
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.link-arrow {
    color: var(--accent);
    text-decoration: none;
}
.link-arrow::after {
    content: '→';
    display: inline-block;
    margin-left: 6px;
    transition: transform .15s;
}
.link-arrow:hover { color: var(--accent-hover); text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent); }
.link-arrow:hover::after { transform: translateX(3px); }

.link-quiet { color: var(--muted); text-decoration: none; }
.link-quiet:hover { color: var(--accent-2); }

/* ---------- Repositories ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
    --cut: 7px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0 12px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    cursor: pointer;
    transition: color .15s, background-color .15s;
}
.chip:hover { --edge: var(--border-strong); color: var(--text); }
.chip[aria-pressed="true"] { --edge: var(--accent); --fill: var(--accent); color: var(--accent-contrast); }
.chip[aria-pressed="true"] .lang-dot { box-shadow: none; }
.chip .count { font-variant-numeric: tabular-nums; opacity: .6; }

.repo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.repo {
    --cut: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    text-decoration: none;
}
.repo:hover { --edge: color-mix(in srgb, var(--accent) 65%, transparent); --fill: var(--surface-2); }
.repo:hover .repo-name { color: var(--accent); }

.repo-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.repo-name {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    overflow-wrap: anywhere;
    transition: color .15s;
}

.repo-desc {
    flex: 1;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.55;
}

.repo-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--subtle);
}
.repo-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.repo-meta svg { width: 12px; height: 12px; }

.lang-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--lang, var(--subtle));
    box-shadow: 0 0 6px var(--lang, transparent);
}

.repo-footer {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}

/* ---------- Footer ---------- */
.site-footer { background: color-mix(in srgb, var(--bg) 80%, transparent); }
.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 28px;
    padding-bottom: 28px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .repo-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
    .container { padding: 0 16px; }
    .nav { gap: 12px; }
    .nav-links { display: none; }
    .nav-actions { margin-left: auto; }

    .hero { padding-top: 56px; }

    .project-grid,
    .repo-grid { grid-template-columns: 1fr; }

    .section { padding-top: 60px; }
    .section:last-child { padding-bottom: 64px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
