/* ==================== VARIABLES ==================== */
:root {
    --bg: #0f1011;
    --bg-raised: #141517;
    --panel: #18191c;
    --panel-hover: #1d1f22;
    --line: #26282c;
    --line-strong: #34373c;

    --text: #e9e7e2;
    --text-muted: #9a9ca2;
    --text-dim: #6b6e75;

    --accent: #F2A900;
    --accent-soft: rgba(242, 169, 0, 0.12);
    --accent-ink: #1a1300;

    --axis-x: #d8504a;
    --axis-y: #6cbf4a;
    --axis-z: #4a86d8;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;

    --radius: 10px;
    --radius-sm: 6px;
    /* Navbar and logo start large at the top of the page, compact once scrolled */
    --nav-h: 68px;
    --nav-h-top: 96px;
    --logo-h: 28px;
    --logo-h-top: 50px; /* the logo image's own height, so it stays sharp */
    --nav-h-thin: 44px; /* phones, while the scene fills the screen */
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    /* Entering the hero scene on hover */
    --chrome-fade: 0.35s;
    --stage-grow: 0.9s;
    --immersive-ease: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-h);
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

code, pre {
    font-family: var(--font-mono);
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font: inherit;
    color: inherit;
}

strong {
    color: var(--text);
    font-weight: 600;
}

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

/* ==================== NAVIGATION ==================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-h-top);
    z-index: 1000;
    border-bottom: 1px solid transparent;
    transition: height 0.3s var(--ease), background 0.3s, border-color 0.3s;
}

.navbar.scrolled {
    height: var(--nav-h);
    background: rgba(15, 16, 17, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom-color: var(--line);
}

.nav-container {
    max-width: 1240px;
    height: 100%;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: var(--logo-h-top);
    width: auto;
    display: block;
    transition: height 0.3s var(--ease);
}

.navbar.scrolled .logo img {
    height: var(--logo-h);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    align-items: center;
}

.nav-link {
    display: block;
    padding: 0.5rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
}

.nav-link.active:not(.nav-cta) {
    background: var(--panel);
}

.nav-cta {
    margin-left: 0.5rem;
    color: var(--text);
    border: 1px solid var(--line-strong);
}

.nav-cta:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 40px;
    height: 40px;
    padding: 0 9px;
    -webkit-appearance: none;
    appearance: none;
    background: none;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: width 0.3s var(--ease), height 0.3s var(--ease);
}

.hamburger span {
    display: block;
    flex: none;
    width: 100%;
    height: 2px;
    background: var(--text);
    transition: transform 0.3s var(--ease);
}

.hamburger.open span:first-child { transform: translateY(4px) rotate(45deg); }
.hamburger.open span:last-child { transform: translateY(-4px) rotate(-45deg); }

/* ==================== HERO ==================== */
.hero {
    position: relative;
    display: flex;
    align-items: center;
    padding: calc(var(--nav-h-top) + 1.5rem) 1.5rem 5rem;
    background:
        radial-gradient(ellipse 60% 50% at 50% 50%, rgba(242, 169, 0, 0.06), transparent 70%),
        var(--bg);
}

/* Faint ground grid, like an editor viewport floor */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 20%, transparent 75%);
    mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 20%, transparent 75%);
    opacity: 0.45;
    pointer-events: none;
    transition: opacity var(--chrome-fade) var(--immersive-ease) var(--stage-grow);
}

.hero:has(.viewport.is-immersive)::before {
    opacity: 0;
    transition: opacity var(--chrome-fade) var(--immersive-ease);
}

/* Keep the navigation readable over the bright sky */
body:has(.viewport.is-immersive) .navbar {
    background: rgba(15, 16, 17, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* One centered column: title, the 3D viewport as hero asset, then the copy */
.hero-content {
    position: relative;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.75rem;
    text-align: center;
}

.hero-head {
    max-width: 52rem;
}

.hero-head .hero-title {
    margin-bottom: 0;
}

.hero-content .viewport {
    width: 100%;
}

.hero-text {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.kicker {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    margin-bottom: 1.5rem;
}

.kicker .sep {
    color: var(--accent);
    margin: 0 0.4rem;
}

.hero-title {
    font-size: clamp(2.4rem, 5vw, 4rem);
    line-height: 1.05;
    font-weight: 700;
    letter-spacing: -0.035em;
    margin-bottom: 1.5rem;
}

.hero-title em {
    font-style: normal;
    color: var(--accent);
}

.description {
    font-size: 1.125rem;
    color: var(--text-muted);
}

.cta-buttons {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.4rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-ink);
}

.btn-primary:hover {
    background: #ffbb1c;
    transform: translateY(-1px);
}

.btn-secondary {
    border-color: var(--line-strong);
    color: var(--text);
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    transform: translateY(-1px);
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

.hero-stats dt {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 0.25rem;
}

.hero-stats dd {
    font-size: 1.15rem;
    font-weight: 600;
}

/* ---------- 3D viewport ---------- */
.viewport {
    background: var(--bg-raised);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8);
    /* Runs when leaving the scene: the chrome fades back in once the stage has shrunk */
    transition: background var(--chrome-fade) var(--immersive-ease) var(--stage-grow),
        border-color var(--chrome-fade) var(--immersive-ease) var(--stage-grow),
        box-shadow var(--chrome-fade) var(--immersive-ease) var(--stage-grow);
}

.viewport-tabs,
.viewport-bar,
.outliner {
    transition: opacity var(--chrome-fade) var(--immersive-ease) var(--stage-grow);
}

/* Hovering the scene: the editor chrome fades, then the stage grows to the screen width (sized from JS) */
.viewport.is-immersive {
    background: transparent;
    border-color: transparent;
    box-shadow: 0 30px 80px -30px transparent;
    transition: background var(--chrome-fade) var(--immersive-ease),
        border-color var(--chrome-fade) var(--immersive-ease),
        box-shadow var(--chrome-fade) var(--immersive-ease);
}

.viewport.is-immersive .viewport-tabs,
.viewport.is-immersive .viewport-bar,
.viewport.is-immersive .outliner {
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--chrome-fade) var(--immersive-ease);
}

.viewport.is-immersive .viewport-stage {
    transform: translate(var(--immersive-x), var(--immersive-y)) scale(var(--immersive-scale));
    transition: transform var(--stage-grow) var(--immersive-ease) var(--chrome-fade);
}

/* Set until the stage has shrunk back, so it isn't clipped on the way */
.viewport.is-expanded {
    overflow: visible;
}

.viewport.is-expanded .viewport-stage {
    z-index: 2;
}

/* Dock tab strip, after the Unreal editor: raised tabs on a near-black strip */
.viewport-tabs {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 4px 6px 0;
    background: #0d0d0e;
}

.dock-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 10rem;
    padding: 0.35rem 0.55rem 0.4rem 0.6rem;
    background: transparent;
    border: none;
    border-radius: 5px 5px 0 0;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    color: var(--text-dim);
    white-space: nowrap;
    text-align: left;
    transition: background 0.2s, color 0.2s;
}

.dock-tab.is-active,
.dock-tab[aria-pressed="true"] {
    background: var(--panel);
    color: var(--text);
}

.dock-tab-icon {
    flex: none;
    width: 12px;
    height: 12px;
    fill: currentColor;
    opacity: 0.8;
}

.dock-tab-close {
    margin-left: auto;
    padding-left: 1.5rem;
    font-size: 0.95rem;
    line-height: 1;
    opacity: 0.6;
}

.outliner-tab {
    cursor: pointer;
}

.outliner-tab:hover {
    color: var(--text);
    background: var(--panel-hover);
}

/* Closed outliner: no close cross, like a tab waiting in the drawer */
.outliner-tab[aria-pressed="false"] .dock-tab-close {
    visibility: hidden;
}

/* Viewport toolbar under the tabs */
.viewport-bar {
    display: flex;
    align-items: center;
    padding: 0.35rem 0.5rem;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.viewport-modes {
    display: flex;
    gap: 2px;
    background: var(--bg);
    padding: 2px;
    border-radius: var(--radius-sm);
}

.mode-btn {
    padding: 0.3rem 0.65rem;
    background: none;
    border: none;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.mode-btn:hover {
    color: var(--text);
}

.mode-btn.active {
    background: var(--line-strong);
    color: var(--text);
}

/* Brief highlight on load, staggered from JS; an inset outline so the layout doesn't shift */
.intro-flash {
    animation: intro-flash 0.9s var(--ease) var(--intro-delay, 0s) both;
}

@keyframes intro-flash {
    0%, 100% { box-shadow: inset 0 0 0 1px transparent; }
    30%, 60% { box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); }
}

.viewport-tools {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.4rem;
}

/* Stage, plus the outliner column when it is open */
/* Widescreen as the full-width hero; phones switch back to 4:3 below */
.viewport-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    aspect-ratio: 16 / 9;
}

.viewport.outliner-open .viewport-body {
    grid-template-columns: minmax(0, 1fr) 210px;
}

.viewport-stage {
    position: relative;
    min-height: 0;
    background: radial-gradient(ellipse at 50% 35%, #26282c 0%, #151618 70%);
    cursor: grab;
    touch-action: pan-y;
    transition: transform var(--stage-grow) var(--immersive-ease);
}

.viewport-stage:active {
    cursor: grabbing;
}

#hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.viewport-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.mode-btn[aria-pressed="true"] {
    background: var(--accent-soft);
    color: var(--accent);
}

.viewport.no-webgl .viewport-fallback { display: block; }
.viewport.no-webgl .viewport-bar,
.viewport.no-webgl .outliner-tab,
.viewport.no-webgl .viewport-modes,
.viewport.no-webgl .outliner,
.viewport.no-webgl .hud { display: none; }
.viewport.no-webgl .viewport-body { grid-template-columns: minmax(0, 1fr); }

/* ---------- Outliner ---------- */
.outliner {
    display: none;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    background: var(--panel);
    border-left: 1px solid var(--line);
    font-size: 0.75rem;
}

.viewport.outliner-open .outliner {
    display: flex;
}

.outliner-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    padding: 0.45rem 0.7rem;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
}

.outliner-folder {
    padding: 0.45rem 0.7rem 0.25rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.outliner-count {
    color: var(--text-dim);
}

.outliner-list {
    list-style: none;
    padding-bottom: 0.4rem;
}

.ol-row {
    display: grid;
    grid-template-columns: 9px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.3rem 0.7rem 0.3rem 1.3rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
}

.ol-row:hover,
.ol-row.is-hovered {
    background: var(--panel-hover);
    color: var(--text);
}

.ol-row.is-selected {
    background: var(--accent-soft);
    color: var(--text);
}

.ol-row:focus-visible {
    outline-offset: -2px;
}

.ol-icon {
    width: 9px;
    height: 9px;
    border: 1px solid currentColor;
    border-radius: 2px;
    opacity: 0.7;
}

.ol-row.is-selected .ol-icon {
    background: var(--accent);
    border-color: var(--accent);
    opacity: 1;
}

.ol-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ol-year {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-dim);
}
.viewport.no-webgl .viewport-stage { cursor: default; }

.hud {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    pointer-events: none;
    user-select: none;
}

/* --unzoom (set from JS each frame) keeps overlays their normal size while the stage is scaled up */
.hud-tl { top: 0.75rem; left: 0.9rem; transform-origin: 0 0; scale: var(--unzoom, 1); }
.hud-br { bottom: 0.75rem; right: 0.9rem; text-align: right; transform-origin: 100% 100%; scale: var(--unzoom, 1); }

.hud-tl,
.hud-br {
    transition: color var(--stage-grow) var(--immersive-ease);
}

/* Dark text over the meadow and sky */
.viewport.is-immersive .hud-tl,
.viewport.is-immersive .hud-br {
    color: #14242e;
}

/* First-time hint, above the gizmo and stats row */
.viewport-hint {
    bottom: 5.5rem;
    left: 50%;
    transform: translateX(-50%);
    transform-origin: 0 100%;
    scale: var(--unzoom, 1);
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: max-content;
    max-width: calc(100% - 1.5rem);
    padding: 0.45rem 0.85rem 0.45rem 0.65rem;
    background: rgba(15, 16, 17, 0.82);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    color: var(--text);
    text-align: center;
    transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), visibility 0.5s;
}

.vh-icon {
    flex: none;
    width: 18px;
    height: 18px;
    color: var(--accent);
    animation: hint-nudge 2.4s var(--ease) infinite;
}

@keyframes hint-nudge {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.viewport.interacted .viewport-hint {
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 6px);
}

.viewport-stage.is-pointing {
    cursor: pointer;
}

/* Label for the hovered project prop, positioned from JS */
.viewport-label {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    transform-origin: 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.4rem 0.65rem;
    background: rgba(15, 16, 17, 0.9);
    border: 1px solid var(--accent);
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: auto;
}

.viewport-label[hidden] {
    display: none;
}

.vl-keywords {
    max-width: 18rem; /* the longest keyword lines wrap instead of outgrowing a phone screen */
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--accent);
    white-space: normal;
}

.vl-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

/* ==================== SECTIONS ==================== */
section {
    padding: 7rem 1.5rem;
}

.container {
    max-width: 1240px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 3rem;
}

.section-title {
    font-size: clamp(1.8rem, 3.2vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.15;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-top: 0.75rem;
    max-width: 36rem;
}

.muted {
    color: var(--text-muted);
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.75rem;
}

.panel-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 1.25rem;
}

/* Reveal on scroll (only when JS is running) */
.js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.js .reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ==================== ABOUT ==================== */
.projects {
    border-top: 1px solid var(--line);
}

.about-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 3.5rem;
    align-items: center;
    margin-bottom: 3.5rem;
}

.about-intro p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 1.25rem;
}

.about-intro .lead {
    color: var(--text);
    font-size: 1.45rem;
    line-height: 1.45;
    letter-spacing: -0.01em;
}

.code-block {
    background: var(--bg-raised);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.9rem;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.code-file {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.code-content {
    padding: 1.25rem 1.4rem;
    color: #c9ccd1;
    font-size: 0.82rem;
    line-height: 1.7;
    overflow-x: auto;
}

/* A styled scrollbar is always drawn, unlike the hidden overlay ones on narrow and touch screens */
.code-content::-webkit-scrollbar {
    height: 8px;
}

.code-content::-webkit-scrollbar-track {
    background: var(--bg);
}

.code-content::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 4px;
}

.code-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Firefox: the standard properties (Chromium ignores ::-webkit-scrollbar once these are set) */
@supports not selector(::-webkit-scrollbar) {
    .code-content {
        scrollbar-width: thin;
        scrollbar-color: var(--line-strong) var(--bg);
    }
}

.code-content .keyword { color: #cc7832; }
.code-content .macro { color: #bbb529; }
.code-content .type { color: #6fafbd; }
.code-content .property { color: #c77dbb; }
.code-content .string { color: #6a9955; }
.code-content .function { color: #ffc66d; }
.code-content .numeral { color: #6897bb; }

.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 1.5rem;
}

.timeline {
    list-style: none;
}

.timeline li {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--line);
    color: var(--text-muted);
}

.timeline li:first-child { padding-top: 0; }
.timeline li:last-child { border-bottom: none; padding-bottom: 0; }

.t-year {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text);
    padding-top: 0.1rem;
}

.lang-list {
    list-style: none;
}

.lang-list li {
    display: flex;
    flex-direction: column;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--line);
}

.lang-list li:first-child { padding-top: 0; }
.lang-list li:last-child { border-bottom: none; padding-bottom: 0; }

.lang-list .muted { font-size: 0.9rem; }

/* ==================== SKILLS ==================== */
.skills {
    background: var(--bg-raised);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.skill-category {
    padding: 1.75rem;
    background: var(--panel);
    transition: background 0.25s;
}

.skill-category + .skill-category {
    border-left: 1px solid var(--line);
}

.skill-category:hover {
    background: var(--panel-hover);
}

.category-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.category-icon {
    width: 28px;
    height: 28px;
    filter: grayscale(1) brightness(1.6);
}

.category-glyph {
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    height: 28px;
    padding: 0 4px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--accent);
}

.skill-category h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.skill-list {
    list-style: none;
}

.skill-list li {
    position: relative;
    padding: 0.55rem 0 0.55rem 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.skill-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 5px;
    height: 1px;
    background: var(--text-dim);
}

/* ==================== PROJECTS ==================== */
.project-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}

.filter-btn {
    padding: 0.45rem 0.9rem;
    background: transparent;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.filter-btn:hover {
    color: var(--text);
    border-color: var(--text-dim);
}

.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    perspective: 1400px;
}

.project-card {
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.3s;
}

.project-card:hover {
    border-color: var(--accent);
}

.project-card.hidden {
    display: none;
}

/* Flashed when a project is picked from the hero scene */
.project-card.is-focused {
    border-color: var(--accent);
    animation: card-focus 2.4s var(--ease);
}

@keyframes card-focus {
    0%, 60% { box-shadow: 0 0 0 1px var(--accent); }
    100% { box-shadow: 0 0 0 1px transparent; }
}

.project-image {
    position: relative;
    aspect-ratio: 16 / 10;
    background-color: var(--bg-raised);
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

.project-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 16, 17, 0.55) 0%, transparent 35%);
}

.project-metadata {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.meta-year,
.meta-client {
    padding: 0.25rem 0.5rem;
    background: rgba(15, 16, 17, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 4px;
}

.meta-year {
    color: var(--accent);
    white-space: nowrap;
}

.meta-client {
    color: var(--text);
    text-align: right;
}

/* Year and client appear on card hover; touch screens can't hover, so they stay visible there */
@media (hover: hover) {
    .project-metadata,
    .project-image::after {
        opacity: 0;
        transition: opacity 0.25s var(--ease);
    }

    .project-card:hover .project-metadata,
    .project-card:hover .project-image::after {
        opacity: 1;
    }
}

.project-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.4rem 1.5rem 1.5rem;
}

.project-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--accent);
    letter-spacing: -0.01em;
    margin-bottom: 0.4rem;
}

.project-title {
    display: block;
    font-size: 0.93rem;
    font-weight: 500;
    margin-bottom: 0.6rem;
}

.project-info p {
    flex: 1;
    color: var(--text-muted);
    font-size: 0.93rem;
    margin-bottom: 1.25rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag {
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ==================== CONTACT ==================== */
.contact {
    padding-top: 2rem;
}

.contact-panel {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 2rem;
    flex-wrap: wrap;
    padding: 3rem;
    background:
        linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 40px 40px,
        linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 40px 40px,
        var(--panel);
    background-blend-mode: normal;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
}

.contact-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--panel) 35%, rgba(24, 25, 28, 0.7));
    pointer-events: none;
}

.contact-panel > * {
    position: relative;
}

/* ==================== FOOTER ==================== */
.footer {
    border-top: 1px solid var(--line);
    padding: 2rem 1.5rem;
}

.footer-content {
    max-width: 1240px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .hero-content {
        gap: 2.25rem;
    }

    .about-content,
    .about-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .skills-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .skill-category + .skill-category { border-left: none; }
    .skill-category:nth-child(even) { border-left: 1px solid var(--line); }
    .skill-category:nth-child(n+3) { border-top: 1px solid var(--line); }
}

@media (max-width: 768px) {
    :root {
        --nav-h-top: 80px;
        --logo-h-top: 40px;
    }

    .nav-menu {
        position: fixed;
        top: var(--nav-h-top);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.75rem 1rem 1rem;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
        transform: translateY(-110%);
        visibility: hidden;
        transition: transform 0.3s var(--ease), visibility 0.3s;
    }

    .navbar.scrolled .nav-menu {
        top: var(--nav-h);
    }

    .nav-menu.active {
        transform: none;
        visibility: visible;
    }

    .nav-link {
        padding: 0.85rem 0.5rem;
        font-size: 1rem;
    }

    .nav-cta {
        margin: 0.5rem 0 0;
        text-align: center;
    }

    .hamburger {
        display: flex;
    }

    .navbar.menu-open {
        background: var(--bg);
        border-bottom-color: var(--line);
    }

    section {
        padding: 5rem 1rem;
    }

    .hero {
        padding: calc(var(--nav-h-top) + 1rem) 1rem 3rem;
    }

    .hero-stats {
        gap: 1.5rem;
    }

    .dock-tab {
        min-width: 0;
    }

    .viewport-tools {
        justify-content: center;
    }

    /* The stage is short on phones: keep the hint in the empty space at the top */
    .viewport-hint {
        top: 2.3rem;
        bottom: auto;
    }

    /* On phones the outliner always sits under the stage: tiny props are hard to tap */
    .outliner-tab {
        display: none;
    }

    .viewport-body,
    .viewport.outliner-open .viewport-body {
        display: block;
        aspect-ratio: auto;
    }

    .viewport-stage {
        aspect-ratio: 4 / 3;
    }

    /* The scene fills the screen under a thin navbar; the stage's box is set from JS */
    .viewport.is-immersive .viewport-stage {
        transform: none;
        transition: none;
    }

    .viewport.is-fullscreen .viewport-stage {
        position: fixed;
        transition: none;
    }

    /* Holds the stage's place in the page, at the same 4:3 */
    .viewport.is-fullscreen .viewport-body {
        padding-top: 75%;
    }

    body:has(.viewport.is-immersive) .navbar {
        height: var(--nav-h-thin);
    }

    body:has(.viewport.is-immersive) .logo img {
        height: 22px;
    }

    body:has(.viewport.is-immersive) .hamburger {
        width: 34px;
        height: 34px;
        padding: 0 7px;
    }

    body:has(.viewport.is-immersive) .nav-menu {
        top: var(--nav-h-thin);
    }

    .outliner,
    .viewport.outliner-open .outliner {
        display: flex;
        max-height: 220px;
        border-left: none;
        border-top: 1px solid var(--line);
    }

    .viewport.no-webgl .outliner {
        display: none;
    }

    .section-header {
        margin-bottom: 2rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .contact-panel {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 520px) {
    .skills-grid {
        grid-template-columns: 1fr;
    }

    .skill-category:nth-child(even) { border-left: none; }
    .skill-category + .skill-category { border-top: 1px solid var(--line); }

    .timeline li {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }

    .cta-buttons .btn {
        flex: 1;
        justify-content: center;
    }

    .hero-stats dd {
        font-size: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .vh-icon { animation: none; }

    .js .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
