/* ============ TOKENS ============ */
:root {
    --bg: #14141a;
    --bg-elevated: #1b1b23;
    --bg-elevated-2: #212129;
    --text: #ecebe6;
    --text-dim: #97969f;
    --text-faint: #626169;
    --border: rgba(255,255,255,0.09);
    --border-strong: rgba(255,255,255,0.16);
    --accent: #4d6bfb;
    --accent-text: #6f88ff;
    --accent-dim: rgba(77,107,251,0.14);

    --font-display: 'Inter Tight', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --container: 1120px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
    --bg: #f6f3ec;
    --bg-elevated: #ffffff;
    --bg-elevated-2: #efece3;
    --text: #17171b;
    --text-dim: #62606a;
    --text-faint: #8d8b93;
    --border: rgba(20,20,25,0.09);
    --border-strong: rgba(20,20,25,0.16);
    --accent: #3452e0;
    --accent-text: #3452e0;
    --accent-dim: rgba(52,82,224,0.09);
}

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

html { scroll-behavior: auto; -webkit-text-size-adjust: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background 0.4s var(--ease), color 0.4s var(--ease);
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 32px; }

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

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

body.keyboard-user :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}
:focus:not(:focus-visible) { outline: none; }

/* ============ REVEAL ============ */
[data-reveal] {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
[data-reveal].visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
    [data-reveal] { opacity: 1; transform: none; transition: none; }
    * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ============ PROGRESS BAR ============ */
.progress-bar {
    position: fixed; top: 0; left: 0; height: 2px;
    background: var(--accent); width: 0%; z-index: 1000;
    transition: width 0.1s linear;
}

/* ============ NAV ============ */
.nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 900;
    padding: 22px 0;
    transition: padding 0.3s var(--ease), background 0.3s var(--ease), border-color 0.3s var(--ease);
    border-bottom: 1px solid transparent;
}
.nav.scrolled {
    padding: 14px 0;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(12px);
    border-bottom-color: var(--border);
}
.nav-inner {
    max-width: var(--container); margin: 0 auto; padding: 0 32px;
    display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
    font-family: var(--font-mono); font-size: 15px; font-weight: 500;
    letter-spacing: -0.02em;
}
.nav-logo .cursor { color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 28px; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-link {
    font-size: 14.5px; color: var(--text-dim); font-weight: 500;
    transition: color 0.2s;
}
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link--highlight {
    color: var(--text); border: 1px solid var(--border-strong);
    padding: 7px 14px; border-radius: 100px; font-size: 13.5px;
}
.nav-link--highlight:hover { border-color: var(--accent); color: var(--accent-text); }

.theme-toggle {
    background: none; border: 1px solid var(--border); border-radius: 100px;
    width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-dim); transition: border-color 0.2s, color 0.2s;
}
.theme-toggle:hover { border-color: var(--border-strong); color: var(--text); }
.theme-icon { display: none; }
[data-theme="dark"] .theme-icon--dark { display: flex; }
[data-theme="light"] .theme-icon--light { display: flex; }

.nav-toggle {
    display: none; flex-direction: column; justify-content: center; gap: 5px;
    width: 34px; height: 34px; background: none; border: none; cursor: pointer;
}
.nav-toggle span { width: 18px; height: 1.5px; background: var(--text); transition: transform 0.3s var(--ease), opacity 0.3s; }
.nav-toggle.active span:first-child { transform: translateY(3.25px) rotate(45deg); }
.nav-toggle.active span:last-child { transform: translateY(-3.25px) rotate(-45deg); }

/* ============ EYEBROW / MONO LABEL ============ */
.eyebrow {
    font-family: var(--font-mono); font-size: 13px; color: var(--text-dim);
    letter-spacing: 0.01em; display: block; margin-bottom: 18px;
}
.eyebrow .prompt { color: var(--accent); margin-right: 2px; }

/* ============ HERO ============ */
.hero {
    min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
    padding: 140px 32px 80px;
    position: relative;
}
.hero-inner { max-width: 940px; margin: 0 auto; width: 100%; }
.hero-grid {
    display: grid; grid-template-columns: 1fr 260px; gap: 56px; align-items: center;
}
.hero-photo-frame {
    position: relative; aspect-ratio: 1 / 1; border-radius: 20px; overflow: hidden;
    border: 1px solid var(--border-strong); background: var(--bg-elevated);
}
.hero-photo-frame::after {
    content: ''; position: absolute; inset: 0; border-radius: 20px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.hero-photo-frame img {
    width: 100%; height: 100%; object-fit: cover;
    filter: grayscale(45%) contrast(1.02);
    transition: filter 0.5s var(--ease), transform 0.5s var(--ease);
}
.hero-photo:hover .hero-photo-frame img { filter: grayscale(0%); transform: scale(1.03); }

@media (max-width: 860px) {
    .hero-grid { grid-template-columns: 1fr; gap: 36px; }
    .hero-photo { order: -1; max-width: 200px; }
}

.hero-title {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(48px, 9vw, 96px);
    line-height: 0.98; letter-spacing: -0.03em;
    margin-bottom: 28px;
}
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line span {
    display: inline-block; transform: translateY(110%);
    transition: transform 0.9s var(--ease);
}
.hero-title.animate .line span { transform: translateY(0); }
.hero-title .line:nth-child(2) span { transition-delay: 0.08s; }
.hero-cursor {
    display: inline-block; color: var(--accent);
    animation: blink 1.1s step-end infinite;
}
@keyframes blink { 0%, 45% { opacity: 1; } 50%, 95% { opacity: 0; } 100% { opacity: 1; } }

.hero-sub {
    font-size: clamp(17px, 2vw, 20px); color: var(--text-dim);
    max-width: 560px; margin-bottom: 36px; line-height: 1.55;
}

.hero-actions { display: flex; gap: 14px; margin-bottom: 32px; flex-wrap: wrap; }
.hero-meta {
    font-family: var(--font-mono); font-size: 13px; color: var(--text-faint);
    display: flex; align-items: center; gap: 9px;
}
.hero-meta .dot {
    width: 6px; height: 6px; border-radius: 50%; background: #4ade80;
    box-shadow: 0 0 0 3px rgba(74,222,128,0.15);
}

.scroll-hint {
    position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    font-family: var(--font-mono); font-size: 11px; color: var(--text-faint);
    letter-spacing: 0.08em; text-transform: uppercase;
}
.scroll-line { width: 1px; height: 32px; background: var(--border-strong); position: relative; overflow: hidden; }
.scroll-line::after {
    content: ''; position: absolute; top: -100%; left: 0; width: 100%; height: 100%;
    background: var(--accent); animation: scrollLine 1.8s ease-in-out infinite;
}
@keyframes scrollLine { 0% { top: -100%; } 60%, 100% { top: 100%; } }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 13px 26px; border-radius: 8px; font-size: 14.5px; font-weight: 500;
    transition: transform 0.25s var(--ease), background 0.25s, border-color 0.25s, color 0.25s;
    will-change: transform;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { border: 1px solid var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-text); transform: translateY(-2px); }

/* ============ SECTIONS ============ */
.section { padding: 120px 0; border-top: 1px solid var(--border); }
.section-header { max-width: 620px; margin-bottom: 64px; }
.section-title {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(30px, 4vw, 44px); letter-spacing: -0.02em; margin-bottom: 14px;
}
.section-sub { color: var(--text-dim); font-size: 16.5px; }

/* ============ WORK ============ */
.work-list { display: flex; flex-direction: column; gap: 28px; }

.project {
    display: grid; grid-template-columns: 280px 1fr; gap: 0;
    border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
    background: var(--bg-elevated);
    transition: border-color 0.3s;
}
.project:hover { border-color: var(--border-strong); }
.project--featured { grid-template-columns: 320px 1fr; }

.project-media {
    background: var(--bg-elevated-2);
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 28px; position: relative; border-right: 1px solid var(--border);
}
.project-media::before {
    content: ''; position: absolute; inset: 0;
    background-image: radial-gradient(var(--border-strong) 1px, transparent 1px);
    background-size: 16px 16px; opacity: 0.5;
}
.project-media-inner { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: space-between; height: 100%; gap: 40px; }
.project-badge {
    align-self: flex-start; font-size: 12px; font-weight: 500;
    padding: 5px 11px; border-radius: 100px;
    background: var(--accent-dim); color: var(--accent-text);
}
.project-mono {
    font-family: var(--font-mono); font-size: 13px; color: var(--text-faint);
}

.project-body { padding: 32px 36px; }
.project-name {
    font-family: var(--font-display); font-weight: 600; font-size: 22px;
    letter-spacing: -0.01em; margin-bottom: 18px;
}
.project-pattern { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.project-pattern div { display: grid; grid-template-columns: 76px 1fr; gap: 12px; }
.project-pattern dt {
    font-family: var(--font-mono); font-size: 12px; color: var(--text-faint);
    text-transform: uppercase; letter-spacing: 0.04em; padding-top: 2px;
}
.project-pattern dd { color: var(--text-dim); font-size: 14.5px; line-height: 1.55; }

.project-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.project-tag {
    font-size: 12.5px; color: var(--text-dim); border: 1px solid var(--border);
    padding: 4px 10px; border-radius: 100px;
}
.project-links { display: flex; gap: 18px; align-items: center; }
.project-links a { font-size: 13.5px; font-weight: 500; color: var(--accent-text); }
.project-links a:hover { text-decoration: underline; }
.project-status {
    font-family: var(--font-mono); font-size: 12.5px; color: var(--text-faint);
}

@media (max-width: 800px) {
    .project, .project--featured { grid-template-columns: 1fr; }
    .project-media { border-right: none; border-bottom: 1px solid var(--border); flex-direction: row; padding: 20px 28px; }
    .project-media-inner { flex-direction: row; align-items: center; height: auto; gap: 16px; }
}

/* ============ GITHUB BANNER ============ */
.github-banner { margin-top: 40px; }
.github-banner-inner {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    border: 1px dashed var(--border-strong); border-radius: 14px; padding: 22px 28px;
    flex-wrap: wrap;
}
.github-banner-mono { font-family: var(--font-mono); font-size: 13px; color: var(--accent-text); display: block; margin-bottom: 6px; }
.github-banner-text { color: var(--text-dim); font-size: 14.5px; }
.github-count { color: var(--text); font-weight: 600; }
.github-banner-link {
    font-size: 13.5px; font-weight: 500; color: var(--text);
    border: 1px solid var(--border-strong); padding: 9px 18px; border-radius: 100px; flex-shrink: 0;
    transition: border-color 0.2s, color 0.2s;
}
.github-banner-link:hover { border-color: var(--accent); color: var(--accent-text); }

/* ============ JOURNEY / TIMELINE ============ */
.timeline { position: relative; max-width: 720px; }
.timeline::before {
    content: ''; position: absolute; left: 84px; top: 8px; bottom: 8px; width: 1px;
    background: var(--border-strong);
}
.timeline-item {
    display: grid; grid-template-columns: 84px 1fr; gap: 32px;
    padding-bottom: 52px; position: relative;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-year {
    font-family: var(--font-mono); font-size: 13px; color: var(--text-faint);
    padding-top: 3px; text-align: right;
}
.timeline-content { position: relative; padding-left: 32px; }
.timeline-content::before {
    content: ''; position: absolute; left: -5px; top: 6px; width: 9px; height: 9px;
    border-radius: 50%; background: var(--bg); border: 2px solid var(--accent);
}
.timeline-content h3 { font-family: var(--font-display); font-weight: 600; font-size: 18.5px; margin-bottom: 8px; letter-spacing: -0.01em; }
.timeline-content p { color: var(--text-dim); font-size: 15px; line-height: 1.6; max-width: 480px; }

@media (max-width: 640px) {
    .timeline::before { left: 4px; }
    .timeline-item { grid-template-columns: 1fr; gap: 6px; }
    .timeline-year { text-align: left; }
    .timeline-content { padding-left: 20px; }
    .timeline-content::before { left: -21px; }
}

/* ============ ABOUT ============ */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 64px; }
.about-text .lead { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; margin-bottom: 22px; }
.about-text p { color: var(--text-dim); font-size: 16px; margin-bottom: 16px; max-width: 520px; }
.toolkit-label {
    font-family: var(--font-mono); font-size: 12px; color: var(--text-faint);
    text-transform: uppercase; letter-spacing: 0.06em; display: block; margin-bottom: 16px;
}
.toolkit-label--second { margin-top: 28px; }
.toolkit-list { display: flex; flex-wrap: wrap; gap: 10px; }
.toolkit-list span {
    font-size: 13.5px; color: var(--text-dim); border: 1px solid var(--border);
    padding: 7px 13px; border-radius: 8px;
}

@media (max-width: 800px) {
    .about-grid { grid-template-columns: 1fr; gap: 40px; }
}

/* ============ CONTACT ============ */
.contact { padding-bottom: 100px; }
.contact-inner { max-width: 680px; }
.contact-title {
    font-family: var(--font-display); font-weight: 700;
    font-size: clamp(32px, 5vw, 52px); letter-spacing: -0.02em; margin-bottom: 20px;
}
.contact-sub { color: var(--text-dim); font-size: 17px; margin-bottom: 44px; max-width: 480px; }
.contact-channels { display: flex; flex-direction: column; }
.channel {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 0; border-top: 1px solid var(--border);
    transition: padding-left 0.25s var(--ease), color 0.25s;
}
.contact-channels .channel:last-child { border-bottom: 1px solid var(--border); }
.channel:hover { padding-left: 10px; color: var(--accent-text); }
.channel-label { font-family: var(--font-mono); font-size: 13px; color: var(--text-faint); }
.channel-value { font-size: 16px; font-weight: 500; }

/* ============ FOOTER ============ */
.footer { padding: 32px 0; border-top: 1px solid var(--border); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer-copy { font-size: 13.5px; color: var(--text-faint); }
.footer-links { display: flex; gap: 22px; }
.footer-links a { font-size: 13.5px; color: var(--text-dim); }
.footer-links a:hover { color: var(--text); }

/* ============ BACK TO TOP ============ */
.back-to-top {
    position: fixed; bottom: 28px; right: 28px; width: 42px; height: 42px;
    border-radius: 50%; background: var(--bg-elevated); border: 1px solid var(--border-strong);
    color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transform: translateY(10px);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), border-color 0.2s;
    z-index: 500; font-size: 16px;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover { border-color: var(--accent); color: var(--accent-text); }

/* ============ MOBILE NAV ============ */
@media (max-width: 780px) {
    .nav-toggle { display: flex; }
    .nav-links {
        position: fixed; top: 0; right: -100%; height: 100vh; width: 78%; max-width: 320px;
        background: var(--bg-elevated); flex-direction: column; align-items: flex-start;
        padding: 100px 32px 32px; gap: 24px; transition: right 0.4s var(--ease);
        border-left: 1px solid var(--border);
    }
    .nav-links.active { right: 0; }
    .nav-link { font-size: 17px; }
}

@media (max-width: 560px) {
    .container { padding: 0 20px; }
    .hero { padding: 120px 20px 70px; }
    .section { padding: 80px 0; }
    .project-body { padding: 24px 22px; }
    .contact { padding-bottom: 70px; }
}