/* ═══════════════════════════════════════════════════════════
   Z-INDEX SCALE
   ═══════════════════════════════════════════════════════════ */
:root {
    --z-grain:    1;
    --z-base:     10;
    --z-nav:      100;
    --z-mobile:   200;
    --z-cursor:   1000;
    --z-progress: 1001;
}

/* ═══════════════════════════════════════════════════════════
   THEME: OBSIDIAN (default)
   Warm charcoal · Ember orange · Syne display font
   ═══════════════════════════════════════════════════════════ */
[data-theme="obsidian"] {
    --bg:         #0e0e0e;
    --bg-surf:    #141414;
    --bg-card:    #1b1b1b;
    --text-1:     #f0ebe0;
    --text-2:     #7d7870;
    --text-3:     #3d3a36;
    --accent:     #e8704a;
    --accent-dim: #7a3820;
    --accent-glow:rgba(232,112,74,0.12);
    --border:     #242220;
    --border-h:   #3a3530;
    --shadow:     rgba(232,112,74,0.08);

    --font-display: 'Syne', sans-serif;
    --font-body:    'DM Sans', sans-serif;
    --font-mono:    'JetBrains Mono', monospace;

    --scrollbar-thumb: #3a3530;
    --scrollbar-hover: #e8704a;

    --cursor-color: #e8704a;
    --grain-op:   0.028;
    --scan-op:    0;
}

/* ═══════════════════════════════════════════════════════════
   THEME: PHOSPHOR
   Near-black green tint · Terminal green · Space Mono
   ═══════════════════════════════════════════════════════════ */
[data-theme="phosphor"] {
    --bg:         #050a05;
    --bg-surf:    #09110a;
    --bg-card:    #0d180d;
    --text-1:     #c8f5c8;
    --text-2:     #4a784a;
    --text-3:     #1e3a1e;
    --accent:     #3ae87a;
    --accent-dim: #1a6030;
    --accent-glow:rgba(58,232,122,0.1);
    --border:     #102010;
    --border-h:   #1e4020;
    --shadow:     rgba(58,232,122,0.06);

    --font-display: 'Space Mono', monospace;
    --font-body:    'DM Sans', sans-serif;
    --font-mono:    'Space Mono', monospace;

    --scrollbar-thumb: #1e4020;
    --scrollbar-hover: #3ae87a;

    --cursor-color: #3ae87a;
    --grain-op:   0.04;
    --scan-op:    1;
}

/* ═══════════════════════════════════════════════════════════
   THEME: MANUSCRIPT
   Warm parchment · Deep crimson · Playfair editorial
   ═══════════════════════════════════════════════════════════ */
[data-theme="manuscript"] {
    --bg:         #f2ece0;
    --bg-surf:    #ebe3d5;
    --bg-card:    #e4dac8;
    --text-1:     #1a0f08;
    --text-2:     #6a5a48;
    --text-3:     #b0a090;
    --accent:     #8b1a1a;
    --accent-dim: #5a1010;
    --accent-glow:rgba(139,26,26,0.08);
    --border:     #d0c5b0;
    --border-h:   #b0a090;
    --shadow:     rgba(139,26,26,0.06);

    --font-display: 'Playfair Display', serif;
    --font-body:    'DM Sans', sans-serif;
    --font-mono:    'JetBrains Mono', monospace;

    --scrollbar-thumb: #c0b098;
    --scrollbar-hover: #8b1a1a;

    --cursor-color: #8b1a1a;
    --grain-op:   0.05;
    --scan-op:    0;
}

/* ═══════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 72px;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text-2);
    line-height: 1.65;
    min-height: 100dvh;
    cursor: none;
    transition: background-color 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
}

/* Phosphor scanlines */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(58,232,122,0.015) 3px,
        rgba(58,232,122,0.015) 4px
    );
    pointer-events: none;
    z-index: var(--z-grain);
    opacity: var(--scan-op);
    transition: opacity 0.4s;
}

/* Hide custom cursor on touch devices */
@media (pointer: coarse) {
    body, a, button { cursor: auto; }
    .cursor-dot, .cursor-ring { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) var(--bg); }

/* ═══════════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════════ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--text-1);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

p { text-wrap: pretty; }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover { color: var(--text-1); }
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--bg-card);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 0;
}

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

/* Interactive elements — hide system cursor */
a, button, .theme-btn, .hamburger, .back-top { cursor: none; }

/* Skip link */
.skip-link {
    position: fixed;
    top: -100%;
    left: 1rem;
    z-index: calc(var(--z-cursor) + 1);
    padding: 8px 16px;
    background: var(--accent);
    color: var(--bg);
    font-weight: 600;
    border-radius: 4px;
    transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

/* ═══════════════════════════════════════════════════════════
   CURSOR
   ═══════════════════════════════════════════════════════════ */
.cursor-dot {
    position: fixed;
    top: 0; left: 0;
    width: 6px; height: 6px;
    background: var(--cursor-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: var(--z-cursor);
    transition: background 0.3s, width 0.2s, height 0.2s, opacity 0.2s;
    will-change: transform;
}
.cursor-ring {
    position: fixed;
    top: 0; left: 0;
    width: 30px; height: 30px;
    border: 1.5px solid var(--cursor-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: calc(var(--z-cursor) - 1);
    opacity: 0.5;
    transition: border-color 0.3s, width 0.25s ease, height 0.25s ease, opacity 0.25s;
    will-change: transform;
}
.cursor-ring.is-hovering {
    width: 48px; height: 48px;
    opacity: 0.3;
}
.cursor-dot.is-hovering {
    width: 10px; height: 10px;
    opacity: 0.6;
}
.cursor-ring.is-clicking { width: 22px; height: 22px; opacity: 0.8; }

/* ═══════════════════════════════════════════════════════════
   GRAIN OVERLAY
   ═══════════════════════════════════════════════════════════ */
.grain {
    position: fixed;
    inset: -100px;
    width: calc(100% + 200px);
    height: calc(100% + 200px);
    pointer-events: none;
    z-index: var(--z-grain);
    opacity: var(--grain-op);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 280px 280px;
    animation: grain-anim 8s steps(8) infinite;
    transition: opacity 0.4s;
}
@keyframes grain-anim {
    0%   { transform: translate(0, 0); }
    12%  { transform: translate(-6%, -12%); }
    25%  { transform: translate(-14%, 6%); }
    37%  { transform: translate(8%, -20%); }
    50%  { transform: translate(-4%, 22%); }
    62%  { transform: translate(-12%, 8%); }
    75%  { transform: translate(14%, -2%); }
    87%  { transform: translate(2%, 18%); }
    100% { transform: translate(0, 0); }
}

/* ═══════════════════════════════════════════════════════════
   SCROLL PROGRESS BAR
   ═══════════════════════════════════════════════════════════ */
.scroll-progress {
    position: fixed;
    top: 0; left: 0;
    height: 2px;
    background: var(--accent);
    width: 0%;
    z-index: var(--z-progress);
    transition: background 0.4s;
    transform-origin: left;
}

/* ═══════════════════════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════════════════════ */
.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: var(--z-nav);
    transition: background 0.3s, border-color 0.3s, backdrop-filter 0.3s;
}
.nav.is-scrolled {
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 28px;
    height: 68px;
    display: flex;
    align-items: center;
    gap: 40px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-1);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    transition: color 0.2s;
}
.nav-logo:hover { color: var(--accent); }
.nav-logo-img {
    width: 28px; height: 28px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 36px;
    margin-left: auto;
}

.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-2);
    position: relative;
    transition: color 0.2s;
    padding: 4px 0;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 0;
    width: 0; height: 1px;
    background: var(--accent);
    transition: width 0.25s ease;
}
.nav-link:hover { color: var(--text-1); }
.nav-link:hover::after { width: 100%; }
.nav-link.is-active { color: var(--text-1); }
.nav-link.is-active::after { width: 100%; }

/* Theme button */
.nav-actions { display: flex; align-items: center; gap: 12px; }

.theme-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-2);
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }
.theme-btn-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
    transition: background 0.4s;
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 6px;
    background: none;
    border: none;
}
.ham-line {
    display: block;
    width: 22px; height: 1.5px;
    background: var(--text-2);
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.25s, background 0.2s;
}
.hamburger.is-open .ham-line:first-child { transform: translateY(6.5px) rotate(45deg); background: var(--accent); }
.hamburger.is-open .ham-line:last-child  { transform: translateY(-6.5px) rotate(-45deg); background: var(--accent); }

/* Mobile menu */
.mobile-menu {
    max-height: 0;
    overflow: hidden;
    background: var(--bg-surf);
    border-top: 1px solid transparent;
    transition: max-height 0.35s ease, border-color 0.3s;
}
.mobile-menu.is-open {
    max-height: 400px;
    border-top-color: var(--border);
}
.mobile-link {
    display: block;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-2);
    border-bottom: 1px solid var(--border);
    transition: color 0.2s, padding-left 0.2s;
}
.mobile-link:hover { color: var(--accent); padding-left: 36px; }
.mobile-link:last-child { border-bottom: none; }

/* ═══════════════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════════════ */
.hero {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 100px 28px 60px;
    position: relative;
    overflow: hidden;
}
/* Ambient glow behind name */
.hero::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 80vw;
    height: 50vh;
    background: radial-gradient(ellipse at center, var(--accent-glow) 0%, transparent 65%);
    pointer-events: none;
}

.hero-inner {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    position: relative;
}

.hero-eyebrow {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 40px;
    font-size: 0.85rem;
    color: var(--text-2);
}
.status-pulse {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #4aae8a;
    animation: pulse-anim 2.4s ease infinite;
}
@keyframes pulse-anim {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74,174,138,0.5); }
    50%       { box-shadow: 0 0 0 6px rgba(74,174,138,0); }
}
.status-text { color: var(--text-2); }
.hero-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-3);
}
.dot-sep { color: var(--text-3); }

/* Giant name */
.hero-name {
    display: block;
    font-size: clamp(4.5rem, 13vw, 10.5rem);
    font-weight: 800;
    line-height: 0.9;
    letter-spacing: -0.04em;
    margin-bottom: 28px;
    user-select: none;
}
.hero-name-line { display: block; }
.hero-name-accent {
    color: var(--accent);
    display: block;
}
/* Manuscript theme: accent line gets italic */
[data-theme="manuscript"] .hero-name-accent { font-style: italic; color: var(--accent); }

/* Thin rule that expands on load */
.hero-rule {
    height: 1px;
    background: var(--border);
    margin-bottom: 32px;
    transform-origin: left;
    transform: scaleX(0);
}
.hero-rule.is-visible { transform: scaleX(1); transition: transform 0.7s 0.4s cubic-bezier(0.77, 0, 0.18, 1); }

.hero-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px 60px;
    align-items: start;
}
.hero-role {
    grid-column: 1;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent);
    letter-spacing: 0.04em;
}
.hero-desc {
    grid-column: 2;
    grid-row: 1 / 3;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-2);
    max-width: 48ch;
}
.hero-cta {
    grid-column: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

/* Stats bar */
.hero-stats {
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 56px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}
.stat-item {
    flex: 1;
    text-align: center;
}
.stat-num {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    color: var(--text-1);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}
.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-3);
    letter-spacing: 0.05em;
    margin-top: 2px;
}
.stat-sep {
    width: 1px;
    height: 36px;
    background: var(--border);
    flex-shrink: 0;
}

/* Scroll hint */
.hero-scroll-hint {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.4;
    animation: hint-bob 2.5s ease infinite;
}
@keyframes hint-bob {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%       { transform: translateX(-50%) translateY(5px); }
}
.scroll-hint-line {
    width: 1px;
    height: 32px;
    background: linear-gradient(to bottom, var(--accent), transparent);
}
.scroll-hint-text {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    color: var(--text-2);
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 5px;
    border: none;
    transition: transform 0.18s, background 0.2s, color 0.2s, box-shadow 0.2s;
    position: relative;
}
.btn:active { transform: translateY(1px) scale(0.98); }

.btn-primary {
    background: var(--accent);
    color: var(--bg);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px var(--shadow);
    color: var(--bg);
}

.btn-outline {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.btn-text {
    background: none;
    color: var(--text-2);
    padding-left: 0;
    padding-right: 0;
}
.btn-text:hover { color: var(--text-1); }

.btn-submit { width: 100%; justify-content: center; font-size: 0.95rem; }
.btn-arrow { transition: transform 0.2s; }
.btn-submit:hover .btn-arrow { transform: translateX(4px); }

/* ═══════════════════════════════════════════════════════════
   SHARED SECTION STYLES
   ═══════════════════════════════════════════════════════════ */
.section { padding: 100px 28px; }
.section-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    align-items: baseline;
    gap: 20px;
    margin-bottom: 60px;
}
.section-num {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-3);
    letter-spacing: 0.05em;
    flex-shrink: 0;
    margin-top: 4px;
}
.section-heading {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 700;
    color: var(--text-1);
}
.section-sub {
    margin-top: 12px;
    font-size: 1rem;
    color: var(--text-2);
    max-width: 55ch;
    line-height: 1.7;
}

/* ═══════════════════════════════════════════════════════════
   TAGS (tech stack)
   ═══════════════════════════════════════════════════════════ */
.tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 3px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-2);
    letter-spacing: 0.01em;
    transition: border-color 0.2s, color 0.2s;
}
.tag:hover { border-color: var(--accent); color: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   ABOUT SECTION
   ═══════════════════════════════════════════════════════════ */
.approach-section { background: var(--bg-surf); }

.about-intro {
    max-width: 65ch;
    margin-bottom: 48px;
}
.about-bio {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-2);
}

.education-block {
    margin-bottom: 48px;
}
.education-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 16px;
    font-weight: 500;
}
.education-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}
.education-card:hover { border-color: var(--border-h); }
.edu-main { display: flex; flex-direction: column; gap: 4px; }
.edu-degree {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-1);
}
.edu-school {
    font-size: 0.82rem;
    color: var(--text-2);
}
.edu-meta { text-align: right; }
.edu-year {
    font-size: 0.8rem;
    color: var(--text-3);
}
.edu-link {
    font-size: 0.82rem;
    font-weight: 500;
}

.approach-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.approach-item {
    padding: 44px 40px;
    border: 1px solid var(--border);
    position: relative;
    transition: border-color 0.25s, background 0.25s;
}
/* Remove doubled borders in the grid */
.approach-item:nth-child(1) { border-right: none; border-bottom: none; }
.approach-item:nth-child(2) { border-bottom: none; }
.approach-item:nth-child(3) { border-right: none; }
.approach-item:hover { border-color: var(--border-h); background: var(--bg-card); }

.approach-num {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    letter-spacing: 0.08em;
    display: block;
    margin-bottom: 18px;
}
.approach-item h3 {
    font-size: 1.25rem;
    margin-bottom: 14px;
    font-weight: 600;
}
.approach-item p {
    font-size: 0.9rem;
    line-height: 1.75;
    color: var(--text-2);
    margin-bottom: 20px;
    max-width: 40ch;
}
.approach-tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent);
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--accent-dim);
    padding-bottom: 1px;
}

/* ═══════════════════════════════════════════════════════════
   PROJECTS SECTION
   ═══════════════════════════════════════════════════════════ */
.projects-section { background: var(--bg); }

/* Featured cards */
.featured-block { margin-bottom: 60px; }
.featured-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-3);
    letter-spacing: 0.08em;
    margin-bottom: 20px;
}

.featured-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.featured-card {
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    transition: background 0.25s;
}
.featured-card:hover { background: var(--bg-surf); }

.featured-card-top {
    height: 130px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 18px 22px;
    position: relative;
    overflow: hidden;
}
.featured-card-top::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.12;
}
.fc-top-1 {
    background: linear-gradient(135deg, #1a4a3a 0%, #0a1f1a 100%);
}
.fc-top-2 {
    background: linear-gradient(135deg, #2a3a5a 0%, #0a1020 100%);
}
[data-theme="manuscript"] .fc-top-1 {
    background: linear-gradient(135deg, #d0c0a0 0%, #c0a888 100%);
}
[data-theme="manuscript"] .fc-top-2 {
    background: linear-gradient(135deg, #c8b0a0 0%, #b89880 100%);
}

.fc-top-3 {
    background: linear-gradient(135deg, #3a2a5a 0%, #1a0a2a 100%);
}
[data-theme="manuscript"] .fc-top-3 {
    background: linear-gradient(135deg, #d0c0c8 0%, #b8a0a8 100%);
}

.fc-live {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    color: #ffffff;
    background: rgba(0,0,0,0.35);
    padding: 5px 10px;
    border-radius: 20px;
    position: relative;
    z-index: 1;
}
.live-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #4aae8a;
    animation: live-pulse 2s ease infinite;
}
@keyframes live-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74,174,138,0.6); }
    70%       { box-shadow: 0 0 0 7px rgba(74,174,138,0); }
}
.fc-year {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: rgba(255,255,255,0.5);
    position: relative;
    z-index: 1;
}

.featured-card-body {
    padding: 22px 22px 26px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.fc-type {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-3);
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}
.fc-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}
.fc-desc {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-2);
    margin-bottom: 18px;
    flex: 1;
}
.fc-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}
.fc-tech span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-3);
    background: var(--bg-surf);
    padding: 3px 8px;
    border-radius: 3px;
    border: 1px solid var(--border);
}
.fc-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
    align-self: flex-start;
    transition: letter-spacing 0.2s;
}
.fc-link:hover { letter-spacing: 0.02em; color: var(--accent); }

/* Editorial project list */
.project-list { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.project-list-head {
    display: grid;
    grid-template-columns: 48px 1fr 180px 130px 80px;
    gap: 0 16px;
    padding: 10px 22px;
    background: var(--bg-surf);
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-3);
    letter-spacing: 0.08em;
}
.project-row {
    display: grid;
    grid-template-columns: 48px 1fr 180px 130px 80px;
    gap: 0 16px;
    align-items: center;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}
.project-row:last-child { border-bottom: none; }
.project-row:hover { background: var(--bg-surf); }

.pr-num {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-3);
    letter-spacing: 0.04em;
}
.pr-info { min-width: 0; }
.pr-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-1);
    font-family: var(--font-body);
    margin-bottom: 2px;
}
.pr-sub {
    display: block;
    font-size: 0.78rem;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pr-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.pr-type {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-2);
    white-space: nowrap;
}
.pr-link {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-2);
    transition: color 0.2s;
}
.pr-link:hover { color: var(--accent); }
.pr-links {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ═══════════════════════════════════════════════════════════
   SKILLS SECTION
   ═══════════════════════════════════════════════════════════ */
.skills-section { background: var(--bg-surf); }

.skills-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.skills-col {
    background: var(--bg-card);
    padding: 36px 32px;
}
.skills-col-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 24px;
    font-weight: 500;
}
.skills-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.skills-list li { display: flex; flex-direction: column; gap: 3px; }
.skill-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-1);
}
.skill-note {
    font-size: 0.82rem;
    color: var(--text-2);
    line-height: 1.55;
}

/* ═══════════════════════════════════════════════════════════
   GITHUB STATS SECTION
   ═══════════════════════════════════════════════════════════ */
.github-section { background: var(--bg); }

.github-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}
.github-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.github-stats-img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.github-contribution {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.github-contribution-img {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════
   ROADMAP
   ═══════════════════════════════════════════════════════════ */
.roadmap-section { background: var(--bg); }

.timeline {
    list-style: none;
    position: relative;
    padding-left: 32px;
    max-width: 700px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 6px; top: 8px; bottom: 8px;
    width: 1px;
    background: linear-gradient(to bottom, var(--accent) 0%, var(--border) 60%);
}
.timeline-item {
    position: relative;
    padding-bottom: 44px;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-marker {
    position: absolute;
    left: -32px;
    top: 6px;
}
.tm-dot {
    display: block;
    width: 13px; height: 13px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg);
    transition: border-color 0.3s, background 0.3s;
}
.timeline-item--active .tm-dot {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}
.timeline-item:hover .tm-dot { border-color: var(--accent); }

.timeline-content {
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.2s, transform 0.2s;
}
.timeline-item:hover .timeline-content {
    border-color: var(--border-h);
    transform: translateX(4px);
}
.tl-date {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent);
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}
.timeline-content h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}
.timeline-content p {
    font-size: 0.88rem;
    color: var(--text-2);
    line-height: 1.65;
}

/* ═══════════════════════════════════════════════════════════
   CONTACT
   ═══════════════════════════════════════════════════════════ */
.contact-section { background: var(--bg-surf); }

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 48px;
    align-items: start;
}

/* Form */
.contact-form-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 36px;
}
.contact-form { display: flex; flex-direction: column; gap: 20px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-2);
    letter-spacing: 0.03em;
    font-family: var(--font-mono);
}
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-1);
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.5;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group input.is-invalid,
.form-group textarea.is-invalid {
    border-color: #c44040;
}
.form-error {
    font-size: 0.78rem;
    color: #c44040;
    min-height: 1em;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-3); }

/* Thank you state */
.thank-you {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.ty-icon {
    font-size: 2.5rem;
    color: #4aae8a;
    line-height: 1;
}
.thank-you h3 { font-size: 1.4rem; }
.thank-you p { color: var(--text-2); font-size: 0.9rem; }

/* Sidebar */
.contact-sidebar { display: flex; flex-direction: column; gap: 28px; }
.contact-links { display: flex; flex-direction: column; }
.contact-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-2);
    transition: color 0.2s;
}
.contact-link:first-child { border-top: 1px solid var(--border); }
.contact-link:hover { color: var(--accent); }
.cl-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-3);
    letter-spacing: 0.06em;
    min-width: 72px;
}
.cl-val {
    font-size: 0.875rem;
    font-weight: 500;
    color: inherit;
}

.contact-quote {
    border-left: 2px solid var(--accent);
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: 0 4px 4px 0;
}
.contact-quote p {
    font-style: italic;
    color: var(--text-2);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 6px;
}
.contact-quote cite {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-3);
    font-style: normal;
}

.contact-loc {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.contact-loc .mono { font-size: 0.8rem; color: var(--text-2); }
.loc-note { font-size: 0.78rem; color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */
.footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 28px 28px;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
}
.footer-left { display: flex; flex-direction: column; gap: 2px; }
.footer-name {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-1);
}
.footer-role { font-size: 0.78rem; color: var(--text-3); }
.footer-nav {
    display: flex;
    gap: 24px;
    margin-left: auto;
}
.footer-nav a { font-size: 0.82rem; color: var(--text-3); transition: color 0.2s; }
.footer-nav a:hover { color: var(--accent); }
.footer-copy { font-size: 0.72rem; color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════
   BACK TO TOP
   ═══════════════════════════════════════════════════════════ */
.back-top {
    position: fixed;
    bottom: 28px; right: 28px;
    width: 44px; height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-2);
    z-index: var(--z-base);
    transition: border-color 0.2s, color 0.2s, transform 0.2s, background 0.2s;
}
.back-top:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-3px);
}

/* ═══════════════════════════════════════════════════════════
   SCROLL ANIMATIONS
   ═══════════════════════════════════════════════════════════ */
[data-animate] {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}
[data-animate="fade-up"]   { transform: translateY(24px); }
[data-animate="slide-up"]  { transform: translateY(40px); }
[data-animate="expand"]    { transform: scaleX(0); transform-origin: left; }

[data-animate].is-visible  { opacity: 1; transform: none; }

[data-delay="1"] { transition-delay: 0.08s; }
[data-delay="2"] { transition-delay: 0.16s; }
[data-delay="3"] { transition-delay: 0.24s; }
[data-delay="4"] { transition-delay: 0.32s; }
[data-delay="5"] { transition-delay: 0.40s; }

/* ═══════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    [data-animate] { opacity: 1; transform: none; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — tablet
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .hero-bottom {
        grid-template-columns: 1fr;
    }
    .hero-desc { grid-column: 1; grid-row: auto; }
    .contact-grid { grid-template-columns: 1fr; }
    .contact-sidebar { flex-direction: row; flex-wrap: wrap; }
    .contact-links { flex: 1 1 280px; }
    .skills-cols { grid-template-columns: 1fr; }
    .project-list-head { display: none; }
    .project-row {
        grid-template-columns: 32px 1fr;
        grid-template-rows: auto auto auto;
        gap: 6px 12px;
        padding: 18px 18px;
    }
    .pr-num { grid-row: 1; }
    .pr-info { grid-column: 2; }
    .pr-stack { grid-column: 2; grid-row: 2; }
    .pr-type { display: none; }
    .pr-link { grid-column: 2; grid-row: 3; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — mobile
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .hamburger { display: flex; }

    .hero { padding: 90px 20px 50px; }
    .hero-eyebrow { flex-wrap: wrap; }
    .hero-meta { margin-left: 0; flex-wrap: wrap; }
    .hero-cta { flex-direction: column; align-items: flex-start; }
    .hero-stats { flex-wrap: wrap; gap: 20px; justify-content: center; }
    .stat-sep { display: none; }
    .stat-item { min-width: 120px; }

    .section { padding: 72px 20px; }
    .section-header { flex-direction: column; gap: 8px; margin-bottom: 40px; }

    .approach-grid { grid-template-columns: 1fr; }
    .approach-item { border-right: 1px solid var(--border) !important; border-bottom: none !important; }
    .approach-item:last-child { border-bottom: 1px solid var(--border) !important; }

    .featured-grid { grid-template-columns: 1fr; }
    .featured-card:first-child { border-bottom: 1px solid var(--border); }

    .contact-form-wrap { padding: 22px 18px; }
    .contact-sidebar { flex-direction: column; }

    .footer-inner { flex-direction: column; align-items: flex-start; gap: 16px; }
    .footer-nav { margin-left: 0; flex-wrap: wrap; }

    .back-top { bottom: 16px; right: 16px; }

    .hero-scroll-hint { display: none; }
}

@media (max-width: 480px) {
    .hero { padding: 88px 16px 44px; }
    .section { padding: 60px 16px; }
    .approach-item { padding: 30px 22px; }
    .nav-inner { padding: 0 16px; }
    .theme-btn-label { display: none; }
}