:root {
    --accent: #2563eb;
    --dark: #0a0a0a;
    --dark-soft: #111111;
    --light: #ffffff;
    --line: #e5e7eb;
    --text: #111827;
    --muted: #6b7280;
    --mono: "JetBrains Mono", "Fira Code", monospace;
    --sans: "Inter", sans-serif;
    --display: "Playfair Display", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--sans); color: var(--text); background: var(--light); line-height: 1.55; }

.page-shell { width: min(1440px, 100%); margin: 0 auto; padding: 0 1.5rem; }
@media (min-width: 768px) { .page-shell { padding: 0 4rem; } }
@media (min-width: 1024px) { .page-shell { padding: 0 6rem; } }

.navbar {
    position: fixed; top: 0; width: 100%; z-index: 100;
    background: transparent; border-bottom: 1px solid transparent;
    transition: all 0.3s ease-in-out;
}
.navbar.scrolled,
.navbar.past-hero {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}
.nav-inner { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { text-decoration: none; color: #fff; font-weight: 700; font-size: 1.1rem; }
.brand span { color: var(--accent); }
.navbar.scrolled .brand,
.navbar.past-hero .brand { color: #fff; }
.nav-menu { display: flex; list-style: none; gap: 2rem; }
.nav-link {
    font-family: var(--mono); font-size: 0.85rem; text-decoration: none; color: rgba(255, 255, 255, 0.85);
    position: relative; padding-bottom: 0.25rem; transition: color 0.2s ease;
}
/* Directional underline: grows from left on hover-in, shrinks to right on hover-out */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-link:hover::after, .nav-link.active::after {
    transform: scaleX(1);
    transform-origin: left;
}
.navbar.scrolled .nav-link,
.navbar.past-hero .nav-link { color: rgba(229, 231, 235, 0.92); }
.nav-actions { display: flex; align-items: center; gap: 0.6rem; }
.icon-btn { border: 0; background: transparent; color: #e5e7eb; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; transition: all 0.3s ease-in-out; }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.navbar.scrolled .icon-btn,
.navbar.past-hero .icon-btn { color: rgba(229, 231, 235, 0.92); }
.icon-btn:hover { color: var(--accent); }
.nav-resume-link {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: color 0.2s ease;
    white-space: nowrap;
    padding: 0.25rem 0;
}
.nav-resume-link:hover { color: var(--accent); }
.navbar.scrolled .nav-resume-link,
.navbar.past-hero .nav-resume-link { color: rgba(229, 231, 235, 0.92); }
.hamburger { display: none; flex-direction: column; gap: 4px; }
.hamburger span { display: block; width: 20px; height: 2px; background: currentColor; }

.hero {
    position: relative; min-height: 96vh; color: #fff; overflow: hidden;
    display: flex; align-items: center; padding-top: 72px;
    background:
        radial-gradient(600px circle at var(--cursor-x, 50%) var(--cursor-y, 30%), rgba(37, 99, 235, 0.10), transparent 70%),
        var(--dark);
    transition: background 0.05s linear;
}
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 1rem; width: 100%; align-items: center; }
.hero-code {
    position: absolute; right: 5%; top: 22%; color: rgba(255, 255, 255, 0.3);
    font-family: var(--mono); font-size: 0.75rem; line-height: 1.6; pointer-events: none;
    white-space: pre; transition: opacity 0.45s ease;
}
.hero-name { font-family: var(--display); font-size: clamp(2.4rem, 7vw, 5.5rem); line-height: 1; font-weight: 800; margin-bottom: 1rem; white-space: nowrap; }
.hero-role { font-family: var(--mono); color: var(--accent); letter-spacing: 0.2em; font-size: 0.75rem; margin-bottom: 1rem; }
.hero-lede { color: rgba(255, 255, 255, 0.75); max-width: 42ch; margin-bottom: 1.5rem; }
.hero-buttons { display: flex; gap: 0.75rem; margin-bottom: 1.25rem; }
.btn {
    border: 1px solid transparent; border-radius: 10px; padding: 0.72rem 1rem; text-decoration: none; font-weight: 500;
    font-size: 0.92rem; transition: all 0.3s ease-in-out; display: inline-flex; align-items: center; justify-content: center;
    user-select: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); }
/* Tactile press — scale down on mousedown, spring back on release */
.btn.pressing { transform: scale(0.96) !important; transition: transform 80ms cubic-bezier(0.34, 1.56, 0.64, 1) !important; }
.magnetic-btn {
    transform: translate3d(var(--mx, 0), var(--my, 0), 0);
    transition: transform 0.28s cubic-bezier(0.25, 0.1, 0.25, 1), box-shadow 0.2s ease;
    will-change: transform;
}
.btn-ghost { border-color: rgba(255, 255, 255, 0.3); color: #f3f4f6; }
.btn-ghost:hover { border-color: #fff; }
/* Hero stat counters */
.hero-counters { display: flex; gap: 2.5rem; margin-bottom: 1.4rem; }
.hero-counter { display: flex; flex-direction: column; gap: 0.1rem; }
.counter-value { display: flex; align-items: baseline; gap: 0.05rem; }
.counter-num { font-family: var(--display); font-size: 2rem; font-weight: 800; line-height: 1; color: #fff; }
.counter-suffix { font-family: var(--display); font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.counter-desc { font-family: var(--mono); font-size: 0.62rem; color: rgba(255, 255, 255, 0.42); text-transform: uppercase; letter-spacing: 0.1em; }

.hero-stats { font-family: var(--mono); font-size: 0.74rem; color: rgba(255, 255, 255, 0.65); display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sep { color: rgba(255, 255, 255, 0.35); }
.hero-media { justify-self: end; width: min(560px, 46vw); }
.hero-media img { width: 100%; display: block; object-fit: cover; }

.section { padding: 1.5rem 0; }
@media (min-width: 768px) { .section { padding: 2rem 0; } }
.section-light { background: #fff; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.section-label { font-family: var(--mono); font-size: 0.9rem; font-weight: 500; letter-spacing: 0.02em; }
.section-label span { color: var(--accent); margin-right: 0.35rem; }
.project-controls { display: flex; gap: 0.45rem; }
.project-arrow {
    width: 34px; height: 34px; border-radius: 8px; border: 1px solid #d1d5db;
    background: #fff; color: #111827; cursor: pointer; transition: all 0.3s ease-in-out;
}
.project-arrow.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.project-arrow:hover { transform: translateY(-1px); }

/* Drag-to-scroll horizontal project strip */
.projects-grid {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.5rem;
}
.projects-grid::-webkit-scrollbar { display: none; }
.projects-grid.grabbing { cursor: grabbing; user-select: none; }
.project-card {
    border: 1px solid #e5e7eb; border-radius: 14px; overflow: hidden; background: #fff;
    transition: box-shadow 0.3s ease; display: flex; flex-direction: column;
    flex: 0 0 calc(50% - 0.5rem);
    scroll-snap-align: start;
    min-width: 280px;
    position: relative;
    transform-style: preserve-3d;
    will-change: transform;
}
.project-card:hover { box-shadow: 0 12px 25px rgba(15, 23, 42, 0.08); }
/* Glare overlay driven by JS tilt */
.card-glare {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    pointer-events: none;
    z-index: 3;
    transition: background 0.08s ease;
}
.project-thumb { height: 210px; background: #0f172a center/cover no-repeat; position: relative; }
.project-overlay {
    position: absolute; inset: 0; display: flex; gap: 0.5rem; justify-content: center; align-items: center;
    background: rgba(10, 10, 10, 0.48); opacity: 0; transition: all 0.3s ease-in-out;
}
.project-card:hover .project-overlay { opacity: 1; }
.project-link { background: #fff; color: #111827; border-radius: 999px; padding: 0.45rem 0.9rem; text-decoration: none; font-size: 0.8rem; }
.project-body { padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; flex: 1; }
.project-top { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.project-top h3 { font-size: 1.1rem; }
.project-top span { color: #111827; }
.project-body p { color: #4b5563; font-size: 0.93rem; }
.project-tags { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: auto; }
.project-tags span, .skill-tag, .repo-language {
    border: 1px solid #d1d5db; border-radius: 999px; padding: 0.2rem 0.55rem; font-size: 0.72rem;
    color: #374151; font-family: var(--mono);
}

.experience-list {
    max-height: 430px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-right: 0.4rem;
    display: grid;
    gap: 0.85rem;
    position: relative;
}
.experience-list::-webkit-scrollbar { width: 7px; }
.experience-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 999px; }

/* Items are full opacity by default; dim when outside the scroll viewport */
.experience-item {
    display: grid;
    grid-template-columns: 220px 28px 1fr;
    gap: 1rem;
    align-items: start;
    transition: opacity 0.28s ease;
}
.experience-item.exp-dimmed { opacity: 0.25; }

.date-col { color: #6b7280; font-family: var(--mono); font-size: 0.8rem; padding-top: 0.2rem; }

/* timeline-col stretches to the full row height so the line spans every row */
.timeline-col {
    position: relative;
    align-self: stretch;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* The connecting line — extends through the gap (0.85rem) to the next row */
.timeline-col::before {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    top: 0;
    bottom: -0.85rem;
    background: #dbeafe;
}
/* First item: don't draw line above the dot */
.experience-item:first-child .timeline-col::before { top: 9px; }
/* Last item: stop the line at the dot */
.experience-item:last-child .timeline-col::before { bottom: auto; height: 9px; }

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--accent);
    margin-top: 0.32rem;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}
.exp-header { display: flex; gap: 0.8rem; align-items: flex-start; }
.exp-icon {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    font-family: var(--mono); font-size: 0.85rem; background: #111827; color: #fff; flex-shrink: 0;
}
.exp-content h3 { font-size: 1.15rem; margin-bottom: 0.75rem; }
.exp-content h3 span { color: var(--accent); }
.exp-content p { color: #4b5563; margin-bottom: 0.75rem; }

.stack-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
}
.stack-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.stack-label {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: #9ca3af;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.stack-sep {
    color: #d1d5db;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0 1rem;
    align-self: center;
    margin-top: 0.5rem;
}
.icon-row { display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: center; }
.icon-row img { width: 44px; height: 44px; }
.stack-group .icon-row { transition: gap 0.16s ease; }
.stack-group .icon-row:has(.stack-icon:hover) { gap: 0.75rem; }
.stack-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
    cursor: pointer;
}
.stack-icon:hover { transform: scale(1.2); }
.stack-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(17, 24, 39, 0.96);
    color: #fff;
    font-family: var(--mono);
    font-size: 0.65rem;
    line-height: 1;
    border-radius: 6px;
    padding: 0.3rem 0.4rem;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.stack-icon:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.cta-strip { background: var(--dark-soft); color: #fff; padding: 2.2rem 0 2rem; }
.cta-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-bottom: 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.cta-inner h2 { font-size: 1.5rem; margin-bottom: 0.2rem; }
.cta-inner p { color: rgba(255, 255, 255, 0.7); font-size: 0.95rem; }
.contact-grid { padding-top: 1.25rem; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; }
.contact-item h3 { font-family: var(--mono); font-size: 0.75rem; color: rgba(255, 255, 255, 0.55); margin-bottom: 0.3rem; }
.contact-item a { color: #fff; font-size: 0.9rem; text-decoration: none; }
.contact-form { display: grid; gap: 0.55rem; }
.contact-form input, .contact-form textarea {
    border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.02); color: #fff;
    border-radius: 8px; padding: 0.55rem 0.6rem; font-family: var(--sans);
}
.contact-form textarea { resize: vertical; }

/* Copy-email clip animation */
.copy-email { position: relative; overflow: hidden; display: inline-block; cursor: pointer; }
.copy-email .copy-label { display: block; transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease; }
.copy-email .copy-default { transform: translateY(0); opacity: 1; }
.copy-email .copy-confirm { position: absolute; top: 0; left: 0; transform: translateY(110%); opacity: 0; color: #4ade80; white-space: nowrap; }
.copy-email.copied .copy-default { transform: translateY(-110%); opacity: 0; }
.copy-email.copied .copy-confirm { transform: translateY(0); opacity: 1; }

.footer { background: #0a0a0a; color: rgba(255, 255, 255, 0.65); border-top: 1px solid rgba(255, 255, 255, 0.08); }
.footer-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; font-size: 0.75rem; }
.footer-links { display: flex; gap: 1rem; }
.footer-links a { color: rgba(255, 255, 255, 0.75); text-decoration: none; }
.footer-links a:hover { color: #fff; }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ── Dual-mode portfolio toggle ───────────────────────────── */
.mode-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}
.mode-btn {
    font-family: var(--mono);
    font-size: 0.78rem;
    padding: 0.42rem 1.05rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
    line-height: 1;
    white-space: nowrap;
}
.mode-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.mode-btn:active { transform: scale(0.97); }

/* Protocol text badges for embedded stack */
.proto-tag {
    font-family: var(--mono);
    font-size: 0.72rem;
    padding: 0.28rem 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    color: #374151;
    white-space: nowrap;
    cursor: default;
    line-height: 1.4;
}

/* Mode swap crossfade on hero bio */
.hero-lede {
    transition: opacity 0.15s ease, transform 0.15s ease;
}

@media (max-width: 1024px) {
    .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
    .hero-media { justify-self: center; width: min(460px, 92vw); }
    .hero-code { display: none; }
    .stack-row { gap: 0; }
    .contact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed; top: 72px; left: -100%; width: 100%; flex-direction: column; gap: 0;
        padding: 1rem 1.5rem; background: #111827; transition: all 0.3s ease-in-out;
    }
    .nav-menu li { border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
    .nav-menu .nav-link { display: block; padding: 0.8rem 0; border-bottom: 0; color: #e5e7eb; }
    .nav-menu.active { left: 0; }
    .hamburger { display: flex; color: inherit; border: 0; background: transparent; }
    .projects-grid, .contact-grid { grid-template-columns: 1fr; }
    .stack-row { flex-direction: column; align-items: flex-start; }
    .stack-sep { display: none; }
    .experience-item { grid-template-columns: 1fr; }
    .experience-progress-track { display: none; }
    .timeline-col, .timeline-col::before { display: none; }
    .hero-buttons { flex-wrap: wrap; }
    .cta-inner, .footer-inner { flex-direction: column; align-items: flex-start; }
}
