/* =============================================
   IMMERSIVE PORTFOLIO — VISUAL SYSTEM
   1. Tokens & Reset
   2. Loader / Cursor / Progress / Ambient
   3. Navigation
   4. Hero
   5. Shared section system (titles, glass, buttons)
   6. About
   7. Technical Lab
   8. Resume / Timeline
   9. Contact
   10. Footer & Back-to-top
   11. Reduced motion
   12. Responsive
============================================= */

/* --- 1. TOKENS & RESET --- */
:root {
    --bg: #050505;
    --bg-soft: #0b0b0d;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-strong: rgba(255, 255, 255, 0.07);
    --border-glass: rgba(255, 255, 255, 0.1);
    --white: #f5f5f4;
    --gray: #9a9a9a;
    --gray-dim: #5c5c5c;
    --orange: #ff5722;
    --orange-deep: #e8450a;
    --orange-glow: rgba(255, 87, 34, 0.35);
    --font-main: 'Montserrat', sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --nav-h: 80px;
}

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

html { scroll-behavior: smooth; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
    font-family: var(--font-main);
    background-color: var(--bg);
    color: var(--white);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

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

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--orange); }

.accent { color: var(--orange); }

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

/* --- 2. LOADER / CURSOR / PROGRESS / AMBIENT --- */
.loader {
    position: fixed; inset: 0; z-index: 20000;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.7s var(--ease-out), visibility 0.7s;
}
.loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-inner { text-align: center; }
.loader-logo {
    font-weight: 900; font-size: 1.6rem; letter-spacing: -1px;
    display: block; margin-bottom: 18px;
    animation: loaderPulse 1.4s ease-in-out infinite;
}
.loader-bar {
    width: 180px; height: 2px; background: #222; margin: 0 auto;
    border-radius: 2px; overflow: hidden;
}
.loader-bar-fill {
    display: block; width: 40%; height: 100%; background: var(--orange);
    border-radius: 2px; animation: loaderSlide 1.1s var(--ease-out) infinite;
}
@keyframes loaderPulse { 50% { opacity: 0.55; } }
@keyframes loaderSlide {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(480%); }
}

/* Custom cursor */
.cursor-dot, .cursor-ring {
    position: fixed; top: 0; left: 0; z-index: 15000;
    pointer-events: none;
    transform: translate(-100px, -100px);
    will-change: transform;
}
.cursor-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--orange);
    mix-blend-mode: difference;
}
.cursor-ring {
    width: 38px; height: 38px; border-radius: 50%;
    border: 1.5px solid rgba(255, 87, 34, 0.55);
    display: flex; align-items: center; justify-content: center;
    transition: width 0.35s var(--ease-out), height 0.35s var(--ease-out),
        background 0.35s, border-color 0.35s;
}
.cursor-label {
    font-family: var(--font-mono); font-size: 0.55rem; font-weight: 700;
    letter-spacing: 1px; color: #fff; opacity: 0;
    transition: opacity 0.25s;
}
.cursor-ring.is-hover {
    width: 60px; height: 60px;
    background: rgba(255, 87, 34, 0.12);
    border-color: var(--orange);
}
.cursor-ring.is-view {
    width: 74px; height: 74px;
    background: rgba(5, 5, 5, 0.55);
    backdrop-filter: blur(4px);
    border-color: rgba(255, 255, 255, 0.4);
}
.cursor-ring.is-view .cursor-label { opacity: 1; }
.cursor-ring.is-down { transform-origin: center; }
body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: none; }

/* Scroll progress */
.scroll-progress {
    position: fixed; top: 0; left: 0; width: 100%; height: 3px;
    z-index: 12000; background: transparent;
}
.scroll-progress-fill {
    display: block; height: 100%; width: 100%;
    background: linear-gradient(90deg, var(--orange-deep), var(--orange));
    transform: scaleX(0); transform-origin: left;
    box-shadow: 0 0 12px var(--orange-glow);
}

/* Ambient glows + grain */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.glow {
    position: absolute; border-radius: 50%;
    filter: blur(120px); opacity: 0.5;
    will-change: transform;
}
.glow-a {
    width: 55vw; height: 55vw; top: -20vw; right: -15vw;
    background: radial-gradient(circle, rgba(255, 87, 34, 0.18), transparent 65%);
}
.glow-b {
    width: 45vw; height: 45vw; bottom: -18vw; left: -12vw;
    background: radial-gradient(circle, rgba(70, 90, 255, 0.10), transparent 65%);
}
.grain {
    position: absolute; inset: -50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
    animation: grainShift 9s steps(6) infinite;
}
@keyframes grainShift {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-3%, 2%); }
    40% { transform: translate(2%, -3%); }
    60% { transform: translate(-2%, -2%); }
    80% { transform: translate(3%, 3%); }
}

/* --- 3. NAVIGATION --- */
.navbar {
    height: var(--nav-h);
    position: fixed; top: 0; width: 100%; z-index: 10000;
    display: flex; align-items: center;
    background: transparent;
    border-bottom: 1px solid transparent;
    transition: background 0.5s var(--ease-out), border-color 0.5s,
        backdrop-filter 0.5s, height 0.4s var(--ease-out);
}
.navbar.scrolled {
    height: 64px;
    background: rgba(8, 8, 10, 0.65);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-bottom: 1px solid var(--border-glass);
}
.nav-container {
    width: min(92%, 1400px); margin: 0 auto;
    display: flex; justify-content: space-between; align-items: center;
}
.logo {
    font-weight: 900; font-size: 1.5rem; letter-spacing: -1px;
    color: var(--white); text-decoration: none; display: inline-block;
}
.logo span { color: var(--orange); }

.nav-links { display: flex; list-style: none; gap: 34px; align-items: center; }
.nav-overlay-cta { display: none; }
.nav-link {
    text-decoration: none; color: var(--gray);
    font-size: 0.78rem; font-weight: 700; letter-spacing: 1.5px;
    position: relative; padding: 6px 0; display: inline-block;
    transition: color 0.3s;
}
.nav-link::after {
    content: ''; position: absolute; left: 0; bottom: 0;
    width: 100%; height: 2px; background: var(--orange);
    transform: scaleX(0); transform-origin: right;
    transition: transform 0.4s var(--ease-out);
}
.nav-link:hover, .nav-link.active { color: var(--white); }
.nav-link:hover::after, .nav-link.active::after {
    transform: scaleX(1); transform-origin: left;
}

.nav-cta {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, var(--orange), var(--orange-deep));
    color: #fff; padding: 11px 22px;
    text-decoration: none; font-weight: 800; font-size: 0.75rem;
    letter-spacing: 1px; border-radius: 100px; display: inline-block;
    box-shadow: 0 4px 24px var(--orange-glow);
    transition: box-shadow 0.4s, transform 0.4s var(--ease-spring);
}
.nav-cta:hover { box-shadow: 0 6px 34px rgba(255, 87, 34, 0.55); }
.nav-cta-glow {
    position: absolute; inset: 0; border-radius: inherit;
    background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.7s var(--ease-out);
}
.nav-cta:hover .nav-cta-glow { transform: translateX(100%); }

.menu-trigger { display: none; }

/* --- 4. HERO --- */
.hero {
    position: relative; min-height: 100vh; min-height: 100svh;
    display: flex; flex-direction: column; justify-content: center;
    overflow: hidden;
    perspective: 1000px;
    z-index: 1;
}
.hero-canvas {
    position: absolute; inset: 0; width: 100%; height: 100%;
    display: block; z-index: 0;
}
.hero::after {
    /* Cinematic vignette + bottom fade into next scene */
    content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background:
        radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%),
        linear-gradient(to bottom, transparent 82%, var(--bg) 100%);
}
.hero-inner {
    position: relative; z-index: 2;
    width: min(92%, 1400px); margin: 0 auto;
    display: grid; grid-template-columns: 1.4fr 1fr;
    align-items: center; gap: 40px;
    padding-top: var(--nav-h);
    transform-style: preserve-3d;
}

.badge {
    color: var(--orange); font-weight: 700; font-size: 0.85rem;
    letter-spacing: 3px; border-left: 3px solid var(--orange);
    padding-left: 12px; display: inline-block;
}
.hero-title {
    font-size: clamp(3.4rem, 8.5vw, 7.5rem);
    font-weight: 900; line-height: 0.92; margin: 24px 0;
    letter-spacing: -2px;
}
.accent-stroke {
    color: transparent;
    -webkit-text-stroke: 2px var(--white);
    background: linear-gradient(120deg, var(--orange), #ffb199);
    -webkit-background-clip: text; background-clip: text;
}
.hero-sub {
    color: var(--gray); max-width: 480px; line-height: 1.8;
    font-size: 1.05rem; margin-bottom: 36px;
}
.hero-sub strong { color: var(--white); }

/* Line-mask reveal (JS animates .line) */
.line-mask { display: block; overflow: hidden; }
.line-mask .line { display: inline-block; will-change: transform; }

.hero-btns { display: flex; gap: 18px; flex-wrap: wrap; }

.stats-row { display: flex; gap: 56px; margin-top: 64px; }
.stat-num {
    display: block; font-size: 2.2rem; font-weight: 900;
    font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 0.65rem; color: var(--gray-dim); letter-spacing: 2px; font-weight: 700; }

/* Portrait */
.hero-portrait { position: relative; display: flex; justify-content: center; }
.portrait-frame {
    position: relative; width: min(340px, 80%);
    border-radius: 24px; overflow: visible;
    transform-style: preserve-3d;
}
.portrait-img {
    position: relative; z-index: 2; width: 100%;
    border-radius: 24px;
    background: linear-gradient(180deg, #1c1c20, #0e0e10);
    border: 1px solid var(--border-glass);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
    filter: grayscale(15%);
}
.portrait-glow {
    position: absolute; inset: -8%; z-index: 1; border-radius: 32px;
    background: radial-gradient(circle at 50% 30%, var(--orange-glow), transparent 70%);
    filter: blur(30px);
    animation: breathe 5s ease-in-out infinite;
}
.portrait-ring {
    position: absolute; inset: -14px; z-index: 0;
    border: 1px dashed rgba(255, 87, 34, 0.35); border-radius: 32px;
    animation: ringFloat 7s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: 0.55; transform: scale(1.05); } }
@keyframes ringFloat { 50% { transform: translateY(-10px) rotate(1.2deg); } }

.vertical-tag {
    position: absolute; right: -30px; top: 50%;
    transform: rotate(90deg) translateX(-50%);
    color: var(--gray-dim); font-weight: 700; font-size: 0.65rem;
    letter-spacing: 6px; white-space: nowrap;
    font-family: var(--font-mono);
}

.scroll-hint {
    position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%);
    z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.scroll-hint-text {
    font-family: var(--font-mono); font-size: 0.55rem;
    letter-spacing: 4px; color: var(--gray-dim);
}
.scroll-hint-line {
    width: 1px; height: 48px; background: #333;
    position: relative; overflow: hidden;
}
.scroll-hint-line::after {
    content: ''; position: absolute; top: -50%; left: 0;
    width: 100%; height: 50%;
    background: var(--orange);
    animation: scrollDrip 1.8s var(--ease-out) infinite;
}
@keyframes scrollDrip { to { top: 110%; } }

/* --- 5. SHARED SECTION SYSTEM --- */
.section-panel { position: relative; padding: 140px 0; z-index: 1; }
.container { width: min(88%, 1240px); margin: 0 auto; }

.outline-text {
    font-size: clamp(4rem, 9vw, 7rem); font-weight: 900;
    color: transparent;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.13);
    display: block; margin-bottom: -22px; line-height: 1;
    user-select: none;
}
.section-title {
    font-size: clamp(2.6rem, 5.5vw, 4.2rem);
    font-weight: 900; line-height: 1.02; letter-spacing: -1.5px;
}
.section-sub {
    color: var(--gray); margin-top: 18px; max-width: 520px;
    line-height: 1.7; font-size: 0.98rem;
}

/* Glassmorphism card core */
.glass-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    transform-style: preserve-3d;
    transition: border-color 0.4s, box-shadow 0.5s var(--ease-out), background 0.4s;
    will-change: transform;
}
.glass-card:hover {
    border-color: rgba(255, 87, 34, 0.45);
    background: var(--surface-strong);
    box-shadow: 0 34px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(255, 87, 34, 0.08);
}
.card-shine {
    position: absolute; inset: 0; border-radius: inherit; z-index: 3;
    pointer-events: none; opacity: 0;
    background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%),
        rgba(255, 255, 255, 0.12), transparent 60%);
    transition: opacity 0.4s;
}
.glass-card:hover .card-shine { opacity: 1; }

.glass-chip {
    background: var(--surface); border: 1px solid var(--border-glass);
    border-radius: 14px; padding: 18px 26px;
    backdrop-filter: blur(10px);
    transition: border-color 0.35s, transform 0.35s var(--ease-out);
}
.glass-chip:hover { border-color: rgba(255, 87, 34, 0.5); }

/* Buttons */
.btn-main {
    position: relative; overflow: hidden;
    display: inline-flex; align-items: center; gap: 12px;
    font-family: var(--font-main); font-weight: 800; font-size: 0.8rem;
    letter-spacing: 1.5px; text-decoration: none;
    padding: 16px 32px; border-radius: 100px;
    cursor: pointer; border: none;
    transition: transform 0.4s var(--ease-spring), box-shadow 0.4s, background 0.4s, color 0.4s;
    will-change: transform;
}
.btn-fill {
    background: linear-gradient(135deg, var(--orange), var(--orange-deep));
    color: #fff;
    box-shadow: 0 8px 30px var(--orange-glow);
}
.btn-fill:hover { box-shadow: 0 12px 44px rgba(255, 87, 34, 0.55); }
.btn-ghost {
    background: rgba(255, 255, 255, 0.03);
    color: var(--white);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(8px);
}
.btn-ghost:hover { border-color: var(--orange); color: var(--orange); }
.btn-main i { transition: transform 0.4s var(--ease-spring); }
.btn-main:hover i { transform: translateX(5px); }
.btn-ripple {
    position: absolute; border-radius: 50%; pointer-events: none;
    background: rgba(255, 255, 255, 0.35);
    transform: scale(0); opacity: 0.8;
    width: 12px; height: 12px;
}
.btn-ripple.animate { animation: ripple 0.65s var(--ease-out) forwards; }
@keyframes ripple {
    to { transform: scale(26); opacity: 0; }
}

/* Word reveal (JS wraps words in spans) */
.reveal-words .word {
    display: inline-block;
    opacity: 0.12; filter: blur(2px);
    transform: translateY(8px);
    transition: opacity 0.5s var(--ease-out), filter 0.5s, transform 0.5s var(--ease-out);
}
.reveal-words .word.on { opacity: 1; filter: blur(0); transform: none; }

/* --- 6. ABOUT --- */
.about-section {
    background:
        radial-gradient(ellipse 70% 50% at 20% 20%, rgba(255, 87, 34, 0.05), transparent),
        var(--bg-soft);
}
.about-grid {
    display: grid; grid-template-columns: 0.9fr 1.1fr;
    gap: 70px; align-items: start;
}
.about-title { position: sticky; top: 140px; }
.title-orbit {
    position: relative; width: 90px; height: 90px; margin-top: 36px;
    border: 1px dashed rgba(255, 255, 255, 0.15); border-radius: 50%;
    animation: spin 14s linear infinite;
}
.orbit-dot {
    position: absolute; top: -5px; left: 50%; margin-left: -5px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--orange); box-shadow: 0 0 14px var(--orange);
}
@keyframes spin { to { transform: rotate(360deg); } }

.about-text .lead {
    font-size: 1.45rem; font-weight: 500; line-height: 1.65;
    margin-bottom: 28px;
}
.about-text .lead strong { font-weight: 900; color: var(--white); }
.about-text p { font-size: 1.06rem; line-height: 1.9; color: var(--gray); }
.about-text p strong { color: var(--white); }

.highlight {
    color: var(--orange); font-weight: 700;
    border-bottom: 2px solid var(--orange);
}
.about-quote {
    font-size: 1.5rem; font-weight: 800; font-style: italic;
    line-height: 1.45; text-align: left;
    border-left: 4px solid var(--orange);
    padding: 26px 30px; margin: 44px 0;
    border-radius: 0 18px 18px 0;
    background: linear-gradient(100deg, rgba(255, 87, 34, 0.10), rgba(255, 255, 255, 0.02));
    backdrop-filter: blur(8px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.skills-list { display: flex; gap: 22px; margin-top: 42px; flex-wrap: wrap; }
.skill-group h4 {
    font-size: 0.68rem; letter-spacing: 3px; color: var(--gray-dim);
    margin-bottom: 6px; text-transform: uppercase; font-family: var(--font-mono);
}
.skill-group p { font-weight: 800; color: var(--white); font-size: 1rem; }

/* --- 7. TECHNICAL LAB --- */
.tech-lab {
    background:
        radial-gradient(ellipse 60% 45% at 85% 15%, rgba(70, 90, 255, 0.06), transparent),
        var(--bg);
}
.lab-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 28px; margin-top: 70px;
    perspective: 1200px;
}
.lab-item { padding: 44px 34px; overflow: hidden; }
.lab-icon {
    font-size: 2.1rem; color: var(--orange);
    margin: 22px 0; display: block;
    filter: drop-shadow(0 0 16px var(--orange-glow));
}
.lab-header { display: flex; gap: 15px; margin-bottom: 6px; align-items: center; }
.tech-tag {
    font-size: 0.68rem; font-weight: 900; color: var(--orange);
    letter-spacing: 2px; font-family: var(--font-mono);
}
.status {
    font-size: 0.58rem; color: var(--gray); letter-spacing: 1px;
    border: 1px solid var(--border-glass); padding: 3px 10px;
    border-radius: 20px; font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.03);
}
.lab-item h3 {
    font-size: 1.55rem; font-weight: 800; margin-bottom: 12px;
    letter-spacing: -0.5px;
}
.lab-item p { color: var(--gray); line-height: 1.75; font-size: 0.95rem; }
.lab-index {
    position: absolute; bottom: 14px; right: 22px;
    font-family: var(--font-mono); font-size: 2.4rem; font-weight: 700;
    color: rgba(255, 255, 255, 0.05); user-select: none;
}
[data-tilt-child] { transform: translateZ(30px); }

/* --- 8. RESUME / TIMELINE --- */
.resume-section {
    background:
        radial-gradient(ellipse 60% 40% at 15% 80%, rgba(255, 87, 34, 0.06), transparent),
        var(--bg-soft);
}
.outline-dark { -webkit-text-stroke-color: rgba(255, 255, 255, 0.13); }

/* --- 8b. RESUME 3D STORYTELLING --- */
/* Default (mobile / no-WebGL) = clean vertical stack. The .r3d-live class is
   added by JS only when the WebGL scene is actually running (desktop cinema),
   which flips this into the fullscreen pinned 3D experience. */
.resume-3d { padding: 0; }
.resume-stage { position: relative; width: 100%; }
.resume-canvas { display: none; }

/* HUD + scroll cue only matter in the live 3D mode */
.resume-hud, .resume-scrollcue { display: none; }
.resume-fallback-head {
    text-align: center; padding: 0 20px 10px;
}
.resume-fallback-head .outline-text { margin: 0 auto -18px; }
.resume-fallback-head .section-title { font-size: clamp(2.4rem, 8vw, 4rem); }
.resume-fallback-head .section-sub { margin: 16px auto 0; }

.resume-overlays {
    display: flex; flex-direction: column; gap: 60px;
    width: min(88%, 720px); margin: 40px auto 0;
}
.milestone {
    display: flex; flex-direction: column; gap: 22px;
}
.m-visual {
    border-radius: 20px; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border-glass);
    display: flex; align-items: center; justify-content: center;
    padding: 30px; aspect-ratio: 1 / 1; max-height: 300px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.m-visual img { width: 70%; height: auto; object-fit: contain; filter: drop-shadow(0 10px 30px rgba(0,0,0,0.4)); }
.m-visual--wide { aspect-ratio: 16 / 10; padding: 0; }
.m-visual--wide img { width: 100%; height: 100%; object-fit: cover; filter: none; }
.m-visual--blueprint {
    position: relative; aspect-ratio: 16 / 10;
    background:
        linear-gradient(rgba(120, 210, 255, 0.06), rgba(120, 210, 255, 0.06)),
        var(--bg);
    border-color: rgba(120, 210, 255, 0.25);
}
.m-visual--blueprint .bp-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(120, 210, 255, 0.18) 1px, transparent 1px),
        linear-gradient(90deg, rgba(120, 210, 255, 0.18) 1px, transparent 1px);
    background-size: 28px 28px;
}
.m-visual--blueprint .bp-label {
    position: relative; font-weight: 900; font-size: 2.4rem;
    color: rgba(140, 220, 255, 0.9); letter-spacing: 2px;
    text-shadow: 0 0 24px rgba(120, 210, 255, 0.5);
}
.m-eyebrow {
    font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 3px;
    color: var(--orange); text-transform: uppercase; display: block; margin-bottom: 12px;
}
.m-title { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 900; letter-spacing: -1px; line-height: 1.05; }
.m-meta { color: var(--white); font-weight: 700; font-size: 0.95rem; margin: 8px 0 14px; }
.m-desc { color: var(--gray); line-height: 1.75; font-size: 0.98rem; margin-bottom: 8px; }
.m-desc strong { color: var(--orange); font-weight: 700; }
.m-closing {
    color: var(--white); font-style: italic; font-weight: 600;
    line-height: 1.6; margin: 18px 0 22px;
    padding-left: 18px; border-left: 3px solid var(--orange);
}
.m-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.m-tags span {
    font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 1px;
    padding: 7px 12px; border-radius: 100px;
    background: rgba(255, 87, 34, 0.08); border: 1px solid rgba(255, 87, 34, 0.25);
    color: var(--orange);
}
.m-body .btn-download { margin-top: 6px; }

/* ---- LIVE 3D MODE (desktop cinema, JS adds body.r3d-live) ---- */
.r3d-live .resume-3d, .r3d-live .resume-stage { position: absolute; inset: 0; height: 100%; }
.r3d-live .resume-canvas {
    display: block; position: absolute; inset: 0; width: 100%; height: 100%;
}
.r3d-live .resume-fallback-head { display: none; }
.r3d-live .resume-hud {
    display: block; position: absolute; top: 12%; left: 6%; z-index: 3;
}
.r3d-live .resume-kicker {
    font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 4px;
    color: var(--gray); text-transform: uppercase;
}
.r3d-live .resume-rail {
    margin-top: 16px; width: 2px; height: 120px;
    background: rgba(255, 255, 255, 0.12); border-radius: 2px; overflow: hidden;
}
.r3d-live .resume-rail-fill {
    display: block; width: 100%; height: 100%;
    background: linear-gradient(var(--orange), var(--orange-deep));
    transform: scaleY(0); transform-origin: top;
    box-shadow: 0 0 12px var(--orange-glow);
}
.r3d-live .resume-overlays {
    position: absolute; inset: 0; width: auto; margin: 0; display: block;
    pointer-events: none;
}
/* each caption is pinned to one side, faded in/out by JS via opacity */
.r3d-live .milestone {
    position: absolute; top: 50%; width: min(38%, 460px);
    transform: translateY(-50%); gap: 0; opacity: 0;
}
.r3d-live .milestone[data-m="0"],
.r3d-live .milestone[data-m="2"] { left: 6%; }
.r3d-live .milestone[data-m="1"],
.r3d-live .milestone[data-m="3"] { right: 6%; }
.r3d-live .m-visual { display: none; }          /* the 3D object replaces the image */
.r3d-live .m-body {
    background: rgba(8, 10, 14, 0.34);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass); border-radius: 20px;
    padding: 32px 34px; pointer-events: auto;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
}
.r3d-live .resume-scrollcue {
    display: block; position: absolute; bottom: 8%; left: 50%;
    transform: translateX(-50%); z-index: 3;
    font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 4px;
    color: var(--gray-dim);
    animation: cuePulse 2.2s ease-in-out infinite;
}
@keyframes cuePulse { 50% { opacity: 0.4; } }

/* ---- MOBILE CINEMATIC 3D (body.r3d-mobile, capable phones only) ----
   Tall section + sticky canvas: the user scrolls, the camera does the work.
   Captions sit bottom-centered as a glass panel, faded by the scene via JS.
   Guarded by both the JS class and the mobile breakpoint. */
@media screen and (max-width: 1024px) {
    .r3d-mobile .resume-3d {
        position: relative; inset: auto; height: auto;
        min-height: 420vh;                 /* ~3.2 screens of cinematic scroll */
        padding: 0;
    }
    .r3d-mobile .resume-stage {
        position: sticky; inset: auto; top: 0;
        height: 100vh; height: 100svh; width: 100%;
        overflow: hidden;
    }
    .r3d-mobile .resume-canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
    .r3d-mobile .resume-fallback-head { display: none; }
    .r3d-mobile .resume-overlays { position: absolute; inset: 0; margin: 0; width: auto; display: block; pointer-events: none; }
    .r3d-mobile .m-visual { display: none; }   /* the 3D object replaces the image */

    /* one caption pinned bottom-centre; JS fades each by focus */
    .r3d-mobile .milestone[data-m] {
        position: absolute; left: 50%; right: auto; top: auto; bottom: 5%;
        width: min(92%, 520px); transform: translateX(-50%);
        gap: 0; opacity: 0; text-align: center;
    }
    .r3d-mobile .milestone .m-body {
        background: rgba(8, 10, 14, 0.42);
        backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        border: 1px solid var(--border-glass); border-radius: 20px;
        padding: 22px 22px 24px; pointer-events: auto;
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    }
    .r3d-mobile .m-tags { justify-content: center; }
    .r3d-mobile .m-closing { text-align: left; }

    /* HUD: keep a subtle progress rail + scroll cue, top and bottom */
    .r3d-mobile .resume-hud { display: block; position: absolute; top: 14px; left: 20px; z-index: 3; }
    .r3d-mobile .resume-kicker { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 3px; color: var(--gray); text-transform: uppercase; }
    .r3d-mobile .resume-rail { margin-top: 10px; width: 40px; height: 2px; background: rgba(255,255,255,0.14); border-radius: 2px; overflow: hidden; }
    .r3d-mobile .resume-rail-fill { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--orange), var(--orange-deep)); transform: scaleX(0); transform-origin: left; }
    .r3d-mobile .resume-scrollcue {
        display: block; position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
        z-index: 3; font-family: var(--font-mono); font-size: 0.55rem; letter-spacing: 3px;
        color: var(--gray-dim); animation: cuePulse 2.2s ease-in-out infinite;
    }
}

.resume-layout {
    display: grid; grid-template-columns: 1.8fr 1fr;
    gap: 70px; margin-top: 70px; align-items: start;
}

.resume-timeline { position: relative; padding-left: 44px; }
.timeline-progress {
    position: absolute; left: 5px; top: 6px; bottom: 6px;
    width: 2px; background: rgba(255, 255, 255, 0.1); border-radius: 2px;
    overflow: hidden;
}
.timeline-progress-fill {
    display: block; width: 100%; height: 100%;
    background: linear-gradient(to bottom, var(--orange), var(--orange-deep));
    transform: scaleY(0); transform-origin: top;
    box-shadow: 0 0 12px var(--orange-glow);
}
.timeline-item {
    position: relative; margin-bottom: 56px;
    padding: 28px 30px;
    background: var(--surface);
    border: 1px solid var(--border-glass);
    border-radius: 18px;
    backdrop-filter: blur(10px);
    transition: transform 0.45s var(--ease-out), border-color 0.4s, box-shadow 0.5s;
}
.timeline-item:hover {
    transform: translateX(10px);
    border-color: rgba(255, 87, 34, 0.4);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.timeline-dot {
    position: absolute; left: -45px; top: 34px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--orange);
    box-shadow: 0 0 0 4px rgba(255, 87, 34, 0.18);
}
.dot-pulse {
    position: absolute; inset: -6px; border-radius: 50%;
    border: 1px solid var(--orange); opacity: 0;
}
.timeline-item.lit .dot-pulse { animation: dotPulse 2.4s ease-out infinite; }
@keyframes dotPulse {
    0% { transform: scale(0.6); opacity: 0.8; }
    100% { transform: scale(2); opacity: 0; }
}
.timeline-date {
    display: inline-block; font-size: 0.65rem; font-weight: 900;
    color: var(--orange); letter-spacing: 3px; margin-bottom: 8px;
    font-family: var(--font-mono);
}
.timeline-item h3 { font-size: 1.5rem; font-weight: 800; margin-bottom: 5px; letter-spacing: -0.5px; }
.timeline-loc { font-size: 0.83rem; color: var(--gray); margin-bottom: 15px; font-style: italic; }
.timeline-item p { color: #bdbdbd; line-height: 1.75; font-size: 0.95rem; }

.resume-sidebar {
    display: flex; flex-direction: column; gap: 34px;
    position: sticky; top: 130px;
}
.download-card { padding: 36px 30px; text-align: center; }
.download-card h3 { font-size: 1.3rem; font-weight: 800; margin-bottom: 14px; }
.download-card p { font-size: 0.9rem; color: var(--gray); margin-bottom: 26px; line-height: 1.6; }
.btn-download { width: 100%; justify-content: center; }

.skills-highlight { padding: 30px; }
.skills-highlight h4 {
    font-size: 0.72rem; letter-spacing: 3px; color: var(--gray-dim);
    margin-bottom: 20px; font-family: var(--font-mono);
}
.skill-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.skill-tags .tech-tag {
    background: rgba(255, 87, 34, 0.08);
    padding: 9px 14px; border-radius: 100px;
    border: 1px solid rgba(255, 87, 34, 0.25);
    font-size: 0.68rem; display: inline-block;
    transition: background 0.3s, transform 0.3s var(--ease-spring), box-shadow 0.3s;
}
.skill-tags .tech-tag:hover {
    background: rgba(255, 87, 34, 0.2);
    box-shadow: 0 0 20px rgba(255, 87, 34, 0.2);
}

/* --- 9. CONTACT --- */
.contact-section {
    background:
        radial-gradient(ellipse 70% 55% at 50% 110%, rgba(255, 87, 34, 0.10), transparent),
        var(--bg);
}
.contact-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 28px; margin-top: 70px;
    perspective: 1200px;
}
.contact-card { text-align: center; padding: 48px 26px; overflow: hidden; }
.contact-card i {
    font-size: 2.4rem; color: var(--orange); margin-bottom: 22px;
    display: inline-block;
    filter: drop-shadow(0 0 18px var(--orange-glow));
    transition: transform 0.45s var(--ease-spring);
}
.contact-card:hover i { transform: translateY(-6px) scale(1.1); }
.contact-card h3 { font-size: 1.45rem; font-weight: 800; margin-bottom: 10px; }
.contact-card p {
    color: var(--gray); margin-bottom: 28px; font-size: 0.88rem;
    line-height: 1.6; overflow-wrap: anywhere;
}
.contact-card .btn-main { font-size: 0.72rem; padding: 13px 26px; }
.contact-card--primary {
    border-color: rgba(255, 87, 34, 0.45);
    background: linear-gradient(160deg, rgba(255, 87, 34, 0.10), var(--surface));
}

/* --- 10. FOOTER & BACK-TO-TOP --- */
.footer {
    position: relative; z-index: 1;
    background: #030303; padding: 48px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.footer-content {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 20px;
}
.footer-logo { font-weight: 900; font-size: 1.2rem; letter-spacing: -1px; }
.footer-logo span { color: var(--orange); }
.footer p { font-size: 0.78rem; color: var(--gray-dim); }
.footer-socials { display: flex; gap: 18px; }
.footer-socials a {
    color: var(--gray); font-size: 1.15rem;
    display: inline-flex; width: 42px; height: 42px;
    align-items: center; justify-content: center;
    border: 1px solid var(--border-glass); border-radius: 50%;
    transition: color 0.3s, border-color 0.3s, box-shadow 0.3s, transform 0.3s var(--ease-spring);
}
.footer-socials a:hover {
    color: var(--orange); border-color: var(--orange);
    box-shadow: 0 0 20px rgba(255, 87, 34, 0.25);
}

.btn-top {
    position: fixed; bottom: 30px; right: 30px; z-index: 11000;
    background: linear-gradient(135deg, var(--orange), var(--orange-deep));
    color: #fff; width: 52px; height: 52px; border-radius: 50%;
    border: none; font-size: 1.1rem; cursor: pointer;
    box-shadow: 0 8px 26px var(--orange-glow);
    opacity: 0; pointer-events: none; transform: translateY(20px);
    transition: opacity 0.4s, transform 0.4s var(--ease-spring), box-shadow 0.3s;
}
.btn-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.btn-top:hover { box-shadow: 0 12px 36px rgba(255, 87, 34, 0.55); }

/* --- 10.5 CINEMATIC CAMERA MODE (desktop only, applied by JS) --- */
body.cinema { overflow-x: hidden; }
body.cinema .cinema-stage {
    position: fixed; inset: 0; z-index: 1;
    perspective: 1200px; overflow: hidden;
}
body.cinema .cinema-spacer {
    position: relative; width: 100%; pointer-events: none;
}
body.cinema .cinema-panel {
    position: absolute; inset: 0;
    overflow: hidden; visibility: hidden;
    transform-origin: 50% 50%;
    transform-style: preserve-3d;
    will-change: transform, opacity;
}
body.cinema .panel-inner {
    position: relative; min-height: 100%;
    display: flex; flex-direction: column; justify-content: center;
    will-change: transform;
}
body.cinema .section-panel { padding: 0; }
body.cinema .section-panel .panel-inner { padding: 120px 0 80px; }
body.cinema .hero .panel-inner { padding: 0; }
body.cinema .hero-canvas { position: absolute; inset: 0; }
/* sticky layouts can't live inside a clipped, translated frame */
body.cinema .about-title, body.cinema .resume-sidebar { position: static; }
/* GSAP owns word styling in cinema mode */
body.cinema .reveal-words .word { transition: none; }
body.cinema .footer {
    background: transparent; margin-top: 70px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* --- 10.8 MOBILE LIGHTWEIGHT REVEALS (classes added by JS on mobile) --- */
.m-reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
    transition-delay: var(--m-delay, 0ms);
    will-change: opacity, transform;
}
.m-reveal.m-in { opacity: 1; transform: none; }

/* --- 11. REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
    .cursor-dot, .cursor-ring, .hero-canvas, .grain { display: none !important; }
    .line-mask .line { transform: none !important; opacity: 1 !important; }
    .reveal-words .word { opacity: 1; filter: none; transform: none; }
}

/* --- 12. RESPONSIVE --- */
@media screen and (min-width: 769px) and (max-width: 1100px) {
    .hero-inner { grid-template-columns: 1.2fr 0.9fr; }
    .lab-grid { grid-template-columns: repeat(2, 1fr); }
    .resume-layout { grid-template-columns: 1fr; }
    .resume-sidebar { position: static; flex-direction: row; }
    .resume-sidebar > * { flex: 1; }
    .contact-grid { grid-template-columns: repeat(2, 1fr); }
    .about-grid { grid-template-columns: 1fr; gap: 50px; }
    .about-title { position: static; }
}

@media screen and (max-width: 768px) {
    .cursor-dot, .cursor-ring { display: none; }
    body.has-cursor, body.has-cursor a, body.has-cursor button { cursor: auto; }

    .section-panel { padding: 90px 0; }

    /* Mobile menu trigger */
    .menu-trigger {
        display: flex; align-items: center; gap: 8px;
        cursor: pointer; z-index: 11000; position: relative; padding: 10px;
    }
    .bracket {
        font-size: 1.5rem; font-weight: 900; color: var(--orange);
        font-family: var(--font-mono);
        transition: transform 0.4s var(--ease-spring);
    }
    .menu-text {
        font-size: 0.7rem; font-weight: 900; letter-spacing: 2px; color: var(--white);
    }
    .is-active .bracket:first-child { transform: rotate(-90deg) translateX(-5px); }
    .is-active .bracket:last-child { transform: rotate(90deg) translateX(5px); }
    .is-active .menu-text { color: var(--orange); }

    /* Fullscreen overlay nav */
    .nav-links {
        position: fixed; inset: 0; height: 100vh; height: 100svh; width: 100%;
        background: rgba(4, 4, 6, 0.88);
        backdrop-filter: blur(24px) saturate(1.3);
        -webkit-backdrop-filter: blur(24px) saturate(1.3);
        z-index: 10500;
        flex-direction: column; justify-content: center; align-items: center;
        opacity: 0; visibility: hidden; pointer-events: none;
        transition: opacity 0.5s var(--ease-out), visibility 0.5s;
        gap: 0;
    }
    .nav-links.active { opacity: 1; visibility: visible; pointer-events: auto; }
    .nav-links li {
        list-style: none;
        opacity: 0; transform: translateY(34px);
        transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
    }
    .nav-links.active li { opacity: 1; transform: none; }
    .nav-links.active li:nth-child(1) { transition-delay: 0.08s; }
    .nav-links.active li:nth-child(2) { transition-delay: 0.16s; }
    .nav-links.active li:nth-child(3) { transition-delay: 0.24s; }
    .nav-links.active li:nth-child(4) { transition-delay: 0.32s; }
    .nav-links.active li:nth-child(5) { transition-delay: 0.40s; }
    .nav-links .nav-link {
        font-size: 2.4rem; margin: 16px 0; color: var(--white);
        font-weight: 900; letter-spacing: 1px;
    }
    .nav-overlay-cta { display: block; margin-top: 20px; }
    .nav-overlay-cta .nav-link { color: var(--orange); font-size: 1.4rem; }
    .nav-cta { display: none; }

    /* Hero stacks */
    .hero-inner {
        grid-template-columns: 1fr;
        gap: 44px; text-align: center;
        padding-top: calc(var(--nav-h) + 30px);
        padding-bottom: 90px;
    }
    .hero-portrait { order: -1; }
    .portrait-frame { width: min(240px, 65%); }
    .vertical-tag { display: none; }
    .badge { border-left: none; border-bottom: 3px solid var(--orange); padding: 0 0 8px; }
    .hero-sub { margin-left: auto; margin-right: auto; }
    .hero-btns { justify-content: center; }
    .stats-row { justify-content: center; gap: 34px; margin-top: 44px; }
    .scroll-hint { display: none; }

    /* Sections */
    .about-grid { grid-template-columns: 1fr; gap: 44px; text-align: center; }
    .about-title { position: static; }
    .title-orbit { margin: 30px auto 0; }
    .about-quote { text-align: left; }
    .skills-list { justify-content: center; }

    .section-header { text-align: center; }
    .section-sub { margin-left: auto; margin-right: auto; }
    .lab-grid { grid-template-columns: 1fr; gap: 20px; }
    .lab-item { text-align: center; }
    .lab-header { justify-content: center; }
    .lab-item p { margin: 0 auto; max-width: 92%; }

    .resume-layout { grid-template-columns: 1fr; gap: 44px; }
    .resume-sidebar { position: static; }
    .resume-timeline { padding-left: 30px; }
    .timeline-dot { left: -31px; }
    .timeline-progress { left: 1px; }
    .timeline-item:hover { transform: none; }

    .contact-grid { grid-template-columns: 1fr; }
    .footer-content { flex-direction: column; text-align: center; }

    /* Premium spacing + readable type */
    .container { width: 100%; padding: 0 20px; }
    .section-panel { padding: 76px 0; }
    .hero-title { letter-spacing: -1px; }
    .hero-sub { font-size: 1rem; max-width: 340px; }
    .about-text .lead { font-size: 1.2rem; }

    /* Full-width, thumb-friendly CTAs */
    .hero-btns { flex-direction: column; width: 100%; max-width: 320px; margin: 0 auto; }
    .hero-btns .btn-main { width: 100%; justify-content: center; }
    .btn-main { padding: 16px 28px; }

    /* App-like tap feedback */
    .btn-main:active { transform: scale(0.97); }
    .glass-card:active, .lab-item:active,
    .contact-card:active, .timeline-item:active { transform: scale(0.985); }

    /* Cleaner cards */
    .lab-item, .contact-card, .timeline-item, .glass-card { border-radius: 18px; }
    .timeline-item { padding: 22px 22px; }
}

/* --- Mobile & small-tablet (< 1025px): lightweight, no heavy 3D --- */
@media screen and (max-width: 1024px) {
    /* Kill GPU-heavy ambient work; keep a soft premium backdrop */
    .grain { display: none; }
    .glow { opacity: 0.4; filter: blur(90px); }
    .hero-canvas { display: none; }
    .portrait-ring { animation: none; }
    .title-orbit { animation-duration: 26s; }

    /* Lightweight hero backdrop with a slow, subtle zoom (replaces WebGL) */
    .hero::before {
        content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
        background:
            radial-gradient(90% 60% at 50% 8%, rgba(255, 87, 34, 0.16), transparent 60%),
            radial-gradient(70% 50% at 85% 90%, rgba(70, 90, 255, 0.10), transparent 60%);
        transform-origin: 50% 40%;
        animation: heroZoom 16s ease-in-out infinite alternate;
    }

    /* Larger touch targets */
    .nav-link { padding: 8px 0; }
    .footer-socials a { width: 46px; height: 46px; }
}
@keyframes heroZoom {
    from { transform: scale(1); }
    to { transform: scale(1.14); }
}
@media (prefers-reduced-motion: reduce) {
    .hero::before { animation: none; }
}
