/* ==========================================================================
   Design tokens + site styles.
   guitar.css uses --bg, --surface, --border(-hover), --text, --muted,
   --accent(-glow), --font(-mono) and --radius(-sm); keep those names.
   ========================================================================== */

@font-face {
    font-family: 'Geist';
    src: url('../fonts/geist-latin.woff2') format('woff2');
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Geist Mono';
    src: url('../fonts/geist-mono-latin.woff2') format('woff2');
    font-weight: 400 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Instrument Serif';
    src: url('../fonts/instrument-serif-italic-latin.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

:root {
    color-scheme: dark;

    /* Surfaces */
    --bg: #08080a;
    --bg-raised: #0c0c0f;
    --surface: #111115;
    --surface-2: #17171c;
    --border: #1e1e24;
    --border-hover: #2e2e37;

    /* Text */
    --text: #ededf0;
    --text-2: #c2c2ca;
    --muted: #8c8c96;   /* 6.0:1 on --bg */
    --faint: #7a7a84;   /* 4.6:1 on --bg */

    /* Accent */
    --accent: #7c83ff;
    --accent-2: #a3a8ff;
    --accent-glow: rgba(124, 131, 255, 0.22);
    --accent-soft: rgba(124, 131, 255, 0.09);
    --live: #5eead4;

    /* Type */
    --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --font-serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;

    --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
    --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.08rem);
    --step-1: clamp(1.15rem, 1.06rem + 0.45vw, 1.4rem);
    --step-2: clamp(1.45rem, 1.2rem + 1.1vw, 2.1rem);
    --step-3: clamp(2.1rem, 1.4rem + 3vw, 4rem);
    --step-display: clamp(3.4rem, 0.9rem + 10.4vw, 10.75rem);

    /* Space & layout */
    --gutter: clamp(16px, 4vw, 48px);
    --maxw: 1320px;
    --section: clamp(88px, 11vw, 152px);
    --nav-h: 64px;

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;

    /* Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --dur: 0.6s;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

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

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: var(--step-0);
    line-height: 1.6;
    font-feature-settings: 'ss01', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
}

/* Film grain */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
    opacity: 0.028;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img,
svg {
    display: block;
    max-width: 100%;
}

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

button,
input,
textarea {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: 0;
    cursor: pointer;
}

h1,
h2,
h3,
h4 {
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

em,
.serif {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    letter-spacing: -0.01em;
}

::selection {
    background: var(--accent);
    color: #fff;
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 300;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-weight: 500;
    transform: translateY(-160%);
    transition: transform 0.2s var(--ease-out);
}

.skip-link:focus {
    transform: none;
}

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

.mono {
    font-family: var(--font-mono);
    font-feature-settings: normal;
}

/* Mono label */
.eyebrow,
.section-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.section-label {
    margin-bottom: 28px;
}

.section-label::before {
    content: "";
    width: 18px;
    height: 1px;
    background: var(--accent);
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
    transition: transform 0.45s var(--ease-out), background-color 0.3s ease, border-color 0.3s ease;
    border-bottom: 1px solid transparent;
}

.nav.is-scrolled {
    background: rgba(8, 8, 10, 0.72);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    backdrop-filter: blur(14px) saturate(150%);
    border-bottom-color: var(--border);
}

.nav.is-hidden:not(:focus-within) {
    transform: translateY(-100%);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.brand-mark {
    width: 28px;
    height: 28px;
    transition: transform 0.5s var(--ease-out);
}

.brand:hover .brand-mark {
    transform: rotate(-8deg);
}

.brand-name {
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}

.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 0.88rem;
    color: var(--muted);
    transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link[aria-current] {
    color: var(--text);
}

.nav-cta {
    margin-left: 10px;
    padding: 7px 14px;
    border: 1px solid var(--border-hover);
    border-radius: 999px;
    color: var(--text);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

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

.menu-toggle {
    display: none;
    margin-left: auto;
    align-items: center;
    gap: 10px;
    padding: 8px 4px 8px 12px;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-2);
}

.menu-toggle-icon {
    position: relative;
    width: 18px;
    height: 10px;
}

.menu-toggle-icon::before,
.menu-toggle-icon::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 1.5px;
    background: currentColor;
    transition: transform 0.35s var(--ease-out), top 0.35s var(--ease-out);
}

.menu-toggle-icon::before { top: 0; }
.menu-toggle-icon::after { top: 8.5px; }

.menu-toggle[aria-expanded="true"] .menu-toggle-icon::before {
    top: 4.25px;
    transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-icon::after {
    top: 4.25px;
    transform: rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Buttons & links
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 48px;
    padding: 0 22px;
    border-radius: 999px;
    font-size: 0.94rem;
    font-weight: 500;
    letter-spacing: -0.005em;
    white-space: nowrap;
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s var(--ease-out);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--text);
    color: var(--bg);
}

.btn-primary:hover {
    background: #fff;
}

.btn-ghost {
    border: 1px solid var(--border-hover);
    color: var(--text);
}

.btn-ghost:hover {
    border-color: var(--text-2);
}

.arrow {
    width: 14px;
    height: 14px;
    flex: none;
    transition: transform 0.35s var(--ease-out);
}

a:hover > .arrow,
button:hover > .arrow {
    transform: translateX(3px);
}

a:hover > .arrow-ne,
button:hover > .arrow-ne {
    transform: translate(2px, -2px);
}

/* Animated underline */
.link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0 1px;
    transition: background-size 0.4s var(--ease-out), color 0.2s ease;
    padding-bottom: 2px;
}

.link:hover,
.link:focus-visible {
    background-size: 100% 1px;
}

.text-link {
    color: var(--text);
    background: linear-gradient(var(--accent), var(--accent)) no-repeat 0 100% / 100% 1px;
    transition: color 0.2s ease;
}

.text-link:hover {
    color: var(--accent-2);
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    list-style: none;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.social-links a:hover {
    color: var(--text);
}

.tag {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.01em;
    color: var(--muted);
    white-space: nowrap;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: calc(100svh - var(--nav-h));
    margin-top: calc(var(--nav-h) * -1);
    padding-top: var(--nav-h);
    overflow: clip;
    isolation: isolate;
}

/* Background glow */
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(40% 50% at 72% 46%, rgba(124, 131, 255, 0.11), transparent 70%),
        radial-gradient(60% 40% at 20% 0%, rgba(255, 255, 255, 0.03), transparent 70%);
}

/* Background grid */
.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 88px 88px;
    background-position: center top;
    -webkit-mask-image: radial-gradient(70% 70% at 70% 40%, #000 20%, transparent 75%);
    mask-image: radial-gradient(70% 70% at 70% 40%, #000 20%, transparent 75%);
}

.hero-visual {
    position: absolute;
    z-index: -1;
    top: var(--nav-h);
    bottom: 0;
    left: 42%;
    right: 0;
    container-type: size;
    overflow: hidden;
    pointer-events: none;
}

/* Matches the camera framing (FIT_H/FIT_W in frontend/src/layout.ts);
   0.866 is the lattice's projected aspect ratio. */
.hero-fallback {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(calc(62cqh * 0.866), 74cqw);
    height: auto;
    aspect-ratio: 0.866;
    transform: translate(-50%, -50%);
    transition: opacity 0.9s var(--ease-out);
}

.hero-canvas {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.9s var(--ease-out);
}

.hero-canvas canvas {
    display: block;
}

.hero-visual.is-live .hero-canvas {
    opacity: 1;
}

.hero-visual.is-live .hero-fallback {
    opacity: 0;
}

.hero-inner {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-block: clamp(48px, 9vh, 112px) 32px;
}

.hero-status {
    margin-bottom: clamp(24px, 4vh, 40px);
}

.status-mark {
    position: relative;
    width: 7px;
    height: 7px;
    background: var(--live);
    border-radius: 1px;
}

.status-mark::after {
    content: "";
    position: absolute;
    inset: -3px;
    border: 1px solid var(--live);
    border-radius: 2px;
    opacity: 0;
    animation: status-ping 2.8s var(--ease-out) infinite;
}

@keyframes status-ping {
    0% { opacity: 0.7; transform: scale(0.6); }
    70%, 100% { opacity: 0; transform: scale(1.6); }
}

.hero-title {
    font-size: var(--step-display);
    font-weight: 500;
    line-height: 0.86;
    letter-spacing: -0.055em;
    margin-left: -0.05em;
}

.hero-title .line {
    display: block;
}

.hero-title .line + .line {
    color: var(--text-2);
}

.hero-role {
    text-wrap: balance;
    margin-top: clamp(20px, 3vh, 32px);
    font-size: var(--step-2);
    letter-spacing: -0.025em;
    color: var(--text);
}

.hero-role em {
    color: var(--accent-2);
    padding-inline: 0.06em;
}

.hero-intro {
    max-width: 29em;
    margin-top: 16px;
    font-size: var(--step-1);
    line-height: 1.5;
    color: var(--muted);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 12px;
    margin-top: clamp(28px, 4.5vh, 44px);
}

.hero-actions .social-links {
    margin-left: 14px;
}

.hero-meta {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 28px;
}

.hero-meta dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, auto));
    gap: 8px clamp(24px, 5vw, 72px);
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.hero-meta dt {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 4px;
}

.hero-meta dd {
    font-size: 0.9rem;
    color: var(--text-2);
}

.hero-meta time {
    font-family: var(--font-mono);
    font-size: 0.84rem;
    font-variant-numeric: tabular-nums;
}

.scroll-cue {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.scroll-cue-line {
    position: relative;
    width: 1px;
    height: 44px;
    overflow: hidden;
    background: var(--border-hover);
}

.scroll-cue-line::after {
    content: "";
    position: absolute;
    left: 0;
    top: -50%;
    width: 1px;
    height: 50%;
    background: var(--text);
    animation: scroll-cue 2.4s var(--ease-in-out) infinite;
}

@keyframes scroll-cue {
    to { top: 100%; }
}

/* Staggered entrance */
.hero-enter > *,
.rise {
    animation: rise 1s var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 70ms);
}

@keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section {
    position: relative;
    padding-block: var(--section);
}

.section + .section {
    border-top: 1px solid var(--border);
}

/* 12-column grid: section index in cols 1–3, content in 4–12 */
.grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(16px, 2vw, 32px);
}

.section-head {
    margin-bottom: clamp(48px, 7vw, 96px);
}

.section-index {
    grid-column: 1 / span 3;
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding-top: 0.7em;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.section-index span {
    color: var(--accent);
}

.section-title {
    grid-column: 4 / -1;
    font-size: var(--step-3);
    line-height: 1.02;
    letter-spacing: -0.045em;
    max-width: 17em;
}

.section-title em {
    color: var(--text-2);
}

.section-body {
    grid-column: 4 / -1;
}

.more-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 48px;
    font-size: 0.95rem;
    color: var(--text);
}

/* --- About --- */

.about-copy {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px clamp(24px, 4vw, 64px);
    font-size: var(--step-1);
    line-height: 1.55;
    color: var(--text-2);
}

.about-copy p:first-child {
    color: var(--text);
}

.pillars {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: clamp(56px, 7vw, 96px);
    border-top: 1px solid var(--border);
    list-style: none;
}

.pillar {
    padding: 28px clamp(16px, 2.4vw, 32px) 8px 0;
}

.pillar + .pillar {
    padding-left: clamp(16px, 2.4vw, 32px);
    border-left: 1px solid var(--border);
}

.pillar-key {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent);
    letter-spacing: 0.06em;
}

.pillar h3 {
    margin: 14px 0 10px;
    font-size: var(--step-1);
    letter-spacing: -0.02em;
}

.pillar p {
    color: var(--muted);
    font-size: 0.96rem;
}

.facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 16rem));
    gap: 24px;
    margin-top: clamp(56px, 7vw, 88px);
}

.fact-num {
    display: block;
    font-size: var(--step-3);
    font-weight: 400;
    letter-spacing: -0.05em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.fact-num sup {
    font-size: 0.45em;
    color: var(--accent);
    vertical-align: 0.9em;
    margin-left: 2px;
}

.fact-label {
    display: block;
    margin-top: 10px;
    max-width: 18em;
    font-size: 0.9rem;
    color: var(--muted);
}

/* --- Experience timeline --- */

.timeline {
    list-style: none;
    border-top: 1px solid var(--border);
}

.xp {
    position: relative;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(16px, 2vw, 32px);
    padding-block: clamp(32px, 4vw, 52px);
    border-bottom: 1px solid var(--border);
}

.xp-when {
    grid-column: 1 / span 3;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.7;
}

/* Timeline marker; highlighted for the current role */
.xp-when::before {
    content: "";
    display: block;
    width: 9px;
    height: 9px;
    margin-bottom: 18px;
    border: 1px solid var(--border-hover);
    background: var(--bg);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.xp.is-current .xp-when::before {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.xp:hover .xp-when::before {
    border-color: var(--accent);
}

.xp-main {
    grid-column: 4 / span 6;
}

.xp-role {
    font-size: var(--step-2);
    letter-spacing: -0.035em;
}

.xp-org {
    margin-top: 8px;
    color: var(--text-2);
}

.xp-summary {
    margin-top: 18px;
    color: var(--muted);
    max-width: 40em;
}

.xp-stack {
    grid-column: 10 / -1;
    align-self: start;
    justify-content: flex-end;
}

/* --- Work --- */

.work-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(16px, 2vw, 24px);
    list-style: none;
}

.work-card {
    --rx: 0deg;
    --ry: 0deg;
    --mx: 50%;
    --my: 0%;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: clamp(24px, 3vw, 40px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg-raised) 100%);
    transform: perspective(1100px) rotateX(var(--rx)) rotateY(var(--ry));
    transition: transform 0.6s var(--ease-out), border-color 0.3s ease;
    transform-style: preserve-3d;
}

.work-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(420px circle at var(--mx) var(--my), rgba(124, 131, 255, 0.1), transparent 60%);
    transition: opacity 0.4s ease;
}

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

.work-card:hover::before {
    opacity: 1;
}

.work-card.is-tilting {
    transition: transform 0.12s linear, border-color 0.3s ease;
}

.work-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.work-num {
    color: var(--accent);
}

.work-title {
    margin-top: clamp(24px, 3vw, 40px);
    font-size: var(--step-2);
    letter-spacing: -0.035em;
}

.work-impact {
    margin-top: 14px;
    font-size: var(--step-1);
    line-height: 1.45;
    color: var(--text-2);
    max-width: 30em;
}

.work-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-top: auto;
    padding-top: 32px;
}

.work-links {
    display: flex;
    gap: 18px;
}

.work-links a {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text);
}

/* --- Beyond work --- */

.interests {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: clamp(16px, 2vw, 24px);
    list-style: none;
}

.interest {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-raised);
    transition: border-color 0.3s ease;
}

.interest:hover {
    border-color: var(--border-hover);
}

.interest-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.interest h3 {
    font-size: var(--step-1);
    letter-spacing: -0.02em;
}

.interest p {
    color: var(--muted);
    font-size: 0.95rem;
}

.interest .link {
    margin-top: auto;
    padding-top: 8px;
    font-size: 0.9rem;
}

/* --- Stack --- */

.stack {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: clamp(32px, 4vw, 48px) clamp(24px, 3vw, 40px);
}

.stack-group h3 {
    padding-bottom: 14px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.stack-group ul {
    list-style: none;
}

.stack-group li {
    display: flex;
    flex-direction: column;
    padding-block: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}

.stack-name {
    font-size: 1.02rem;
    letter-spacing: -0.01em;
    color: var(--text);
    transition: color 0.2s ease;
}

.stack-group li:hover .stack-name {
    color: var(--accent-2);
}

.certs {
    margin-top: clamp(56px, 7vw, 88px);
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.certs ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px clamp(24px, 3vw, 40px);
    list-style: none;
}

.certs-plain {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.cert {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 14px;
    align-items: baseline;
}

.cert-year {
    grid-row: span 2;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--accent);
}

.cert-name {
    font-size: 0.96rem;
    color: var(--text);
}

.cert-org {
    font-size: 0.82rem;
    color: var(--muted);
}

/* --- Contact --- */

.contact-section {
    padding-block: var(--section) clamp(64px, 8vw, 112px);
    overflow: clip;
}

.contact-section .section-index {
    margin-bottom: 28px;
}

.contact-title {
    font-size: clamp(2.6rem, 0.8rem + 7.6vw, 8.4rem);
    font-weight: 500;
    line-height: 0.92;
    letter-spacing: -0.055em;
}

.contact-title em {
    color: var(--accent-2);
}

.contact-lead {
    max-width: 32em;
    margin-top: 28px;
    font-size: var(--step-1);
    color: var(--muted);
}

.contact-email {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    margin-top: clamp(40px, 5vw, 64px);
}

.email-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    max-width: 100%;
    font-size: clamp(1.05rem, 5.2vw, 2.1rem);
    letter-spacing: -0.03em;
    overflow-wrap: break-word;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border-hover);
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--muted);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.copy-btn:hover {
    color: var(--text);
    border-color: var(--text-2);
}

.copy-btn.is-copied {
    color: var(--live);
    border-color: var(--live);
}

.contact-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: clamp(40px, 5vw, 64px);
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   Inner pages (about, projects, contact, admin)
   -------------------------------------------------------------------------- */

.page-head {
    padding-block: clamp(72px, 12vw, 160px) clamp(48px, 6vw, 80px);
}

.page-title {
    grid-column: 4 / -1;
    font-size: clamp(3rem, 1rem + 8vw, 8rem);
    font-weight: 500;
    line-height: 0.92;
    letter-spacing: -0.055em;
}

.page-lead {
    grid-column: 4 / span 7;
    margin-top: 28px;
    font-size: var(--step-1);
    line-height: 1.5;
    color: var(--muted);
}

.page-section {
    padding-block: clamp(56px, 8vw, 112px);
    border-top: 1px solid var(--border);
}

.bio {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: clamp(32px, 5vw, 80px);
    align-items: start;
}

.bio-copy {
    display: grid;
    gap: 20px;
    font-size: var(--step-1);
    line-height: 1.6;
    color: var(--text-2);
    max-width: 38em;
}

.portrait {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(1) contrast(1.05);
    transition: filter 0.6s var(--ease-out);
}

.portrait:hover img {
    filter: none;
}

.portrait figcaption {
    position: absolute;
    left: 12px;
    bottom: 10px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

.edu {
    list-style: none;
}

.edu li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 20px;
    padding-block: 18px;
    border-bottom: 1px solid var(--border);
}

.edu .edu-where {
    color: var(--muted);
    font-size: 0.92rem;
}

.edu .edu-when {
    grid-row: span 2;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
}

/* Contact form */
.contact-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    gap: clamp(40px, 6vw, 96px);
    align-items: start;
}

.contact-aside {
    display: grid;
    gap: 28px;
}

.contact-aside .email-link {
    font-size: var(--step-1);
}

.form {
    display: grid;
    gap: 22px;
}

.field {
    display: grid;
    gap: 8px;
}

.field label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.field input,
.field textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 1rem;
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field textarea {
    min-height: 168px;
    resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
    color: var(--faint);
}

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.form .btn {
    justify-self: start;
}

.hp-field {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.notice {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid rgba(94, 234, 212, 0.35);
    border-radius: var(--radius);
    background: rgba(94, 234, 212, 0.06);
    color: var(--text);
    font-size: 0.95rem;
}

.notice-error {
    border-color: rgba(251, 113, 133, 0.4);
    background: rgba(251, 113, 133, 0.06);
}

/* Admin messages */
.messages-title {
    font-size: var(--step-2);
    margin-bottom: 8px;
}

.messages-count {
    margin-bottom: 32px;
    font-family: var(--font-mono);
    font-size: 0.86rem;
    color: var(--muted);
}

.messages-count span {
    color: var(--accent);
}

.messages-scroll {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.messages-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.messages-table th {
    padding: 12px 14px;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.messages-table td {
    padding: 14px;
    max-width: 420px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    overflow-wrap: anywhere;
}

.messages-table .msg-meta {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--muted);
}

.messages-table .msg-time {
    white-space: nowrap;
}

.messages-empty {
    padding: 64px 20px;
    text-align: center;
    font-family: var(--font-mono);
    color: var(--muted);
}

/* Fretboard Lab */
.gt-section {
    padding: clamp(56px, 8vw, 96px) var(--gutter);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
    border-top: 1px solid var(--border);
    padding-block: 28px;
    font-size: 0.86rem;
    color: var(--muted);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 32px;
}

.footer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 24px;
}

.footer a {
    transition: color 0.2s ease;
}

.footer a:hover {
    color: var(--text);
}

.footer .social-links a {
    font-size: 0.86rem;
}

.to-top {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.to-top .arrow {
    transform: rotate(-90deg);
}

.to-top:hover .arrow {
    transform: rotate(-90deg) translateX(3px);
}

/* --------------------------------------------------------------------------
   Motion: scroll reveal + scroll-linked hero (progressive enhancement)
   -------------------------------------------------------------------------- */

.js .reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s var(--ease-out), transform 1.1s var(--ease-out);
    transition-delay: calc(var(--i, 0) * 70ms);
}

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

@supports (animation-timeline: scroll()) {
    @media (prefers-reduced-motion: no-preference) {
        .hero-inner,
        .hero-meta {
            animation: hero-recede linear both;
            animation-timeline: scroll(root);
            animation-range: 0 90vh;
        }

        @keyframes hero-recede {
            to { opacity: 0; transform: translateY(-6vh); }
        }
    }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
    .xp-main { grid-column: 4 / -1; }
    .xp-stack {
        grid-column: 4 / -1;
        justify-content: flex-start;
        margin-top: 22px;
    }
}

/* Tablet: keep the cluster clear of the intro copy */
@media (min-width: 761px) and (max-width: 1100px) {
    .hero-visual {
        left: 44%;
        bottom: 42%;
        opacity: 0.75;
    }
}

@media (max-width: 900px) {
    :root { --nav-h: 60px; }

    .menu-toggle { display: inline-flex; }

    .nav-links {
        position: fixed;
        inset: var(--nav-h) 0 auto 0;
        height: calc(100dvh - var(--nav-h));
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 24px var(--gutter) 40px;
        background: var(--bg);
        border-top: 1px solid var(--border);
        visibility: hidden;
        opacity: 0;
        transform: translateY(-8px);
        transition: opacity 0.3s ease, transform 0.4s var(--ease-out), visibility 0s linear 0.4s;
    }

    .nav.is-open .nav-links {
        visibility: visible;
        opacity: 1;
        transform: none;
        transition: opacity 0.3s ease, transform 0.4s var(--ease-out), visibility 0s;
    }

    .nav.is-open {
        background: var(--bg);
        border-bottom-color: var(--border);
    }

    .nav-links li {
        border-bottom: 1px solid var(--border);
    }

    .nav-link {
        width: 100%;
        padding: 18px 0;
        font-size: 1.6rem;
        letter-spacing: -0.03em;
        color: var(--text);
    }

    .nav-cta {
        margin: 24px 0 0;
        border: 0;
        justify-content: flex-start;
    }

    .grid { display: block; }

    .section-index { padding-top: 0; margin-bottom: 20px; }

    .section-title,
    .page-title { max-width: none; }

    .page-lead { max-width: 36em; }

    .about-copy,
    .pillars,
    .contact-layout { grid-template-columns: 1fr; }

    .pillar,
    .pillar + .pillar {
        padding: 24px 0;
        border-left: 0;
        border-top: 1px solid var(--border);
    }

    .pillars { border-top: 0; }

    .xp { display: block; }
    .xp-when { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-bottom: 16px; }
    .xp-when::before { margin: 0 6px 0 0; }
    .xp-stack { margin-top: 22px; }

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

    .bio { grid-template-columns: 1fr; }
    .portrait { max-width: 220px; grid-row: 1; }
}

@media (max-width: 760px) {

    .hero { min-height: auto; }

    /* Cluster sits behind the title as a watermark */
    .hero-visual {
        top: calc(var(--nav-h) + 8px);
        left: 34%;
        right: -14%;
        bottom: auto;
        height: min(92vw, 440px);
        opacity: 0.55;
    }

    .hero-inner { padding-top: clamp(128px, 42vw, 220px); }

    .hero-actions .social-links {
        width: 100%;
        margin: 10px 0 0;
    }

    .hero-meta { padding-top: 40px; }

    .hero-meta dl {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .scroll-cue { display: none; }

    .facts { grid-template-columns: 1fr 1fr; gap: 24px; }

    /* Stack items wrap inline */
    .stack { gap: 32px; }
    .stack-group ul {
        display: flex;
        flex-wrap: wrap;
        gap: 10px 20px;
        padding-top: 10px;
    }
    .stack-group li {
        padding: 0;
        border: 0;
    }
}

@media (max-width: 420px) {
    .btn { height: 46px; padding: 0 18px; }

    :root { --step-3: clamp(1.85rem, 1.2rem + 3vw, 4rem); }
}

/* Touch: 44px minimum hit area */
@media (pointer: coarse) {
    .social-links { gap: 0 22px; }

    .social-links a,
    .footer-meta a,
    .work-links a,
    .interest .link,
    .more-link,
    .contact-foot > .link,
    .copy-btn {
        min-height: 44px;
    }

    .footer-meta { align-items: center; }
}

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

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .js .reveal { opacity: 1; transform: none; }
    .work-card { transform: none !important; }
    .status-mark::after,
    .scroll-cue-line::after { display: none; }
}
