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

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #111111;
    background: #ffffff;
    line-height: 1.6;
    overflow-x: hidden;
}

ul  { list-style: none; }
a   { text-decoration: none; color: inherit; }
img, svg { display: block; max-width: 100%; }

/* ================================================================
   DESIGN TOKENS
================================================================ */
:root {
    --black:       #0f0f0f;
    --white:       #ffffff;
    --off-white:   #f8f8f6;
    --gray:        #6b6b6b;
    --light-gray:  #e0e0da;
    --nav-h:       68px;
    --sidebar-pad: 72px;
    --content-max: 1100px;
    --section-pad: 6rem 5rem 6rem calc(var(--sidebar-pad) + 3rem);
}

/* ================================================================
   TYPOGRAPHY
================================================================ */
h1 {
    font-size: clamp(2.6rem, 6vw, 5rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.025em;
}

h2 {
    font-size: clamp(1.3rem, 2.5vw, 1.85rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.015em;
}

h3 {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
}

p {
    font-size: 0.9375rem;
    color: var(--gray);
    line-height: 1.8;
}

/* ================================================================
   NAVIGATION
================================================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.5rem 0 2rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.navbar.scrolled {
    border-bottom-color: var(--light-gray);
}

.logo {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    border: 2px solid var(--black);
    padding: 0.35rem 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
    user-select: none;
}

.logo:hover {
    background: var(--black);
    color: var(--white);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.nav-link {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--gray);
    position: relative;
    transition: color 0.2s ease;
}

.burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    width: 32px;
    height: 32px;
}

.burger span {
    display: block;
    width: 22px;
    height: 1.5px;
    background: var(--black);
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: center;
}

.burger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--black);
    transition: width 0.25s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--black);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* ================================================================
   SOCIAL SIDEBAR
================================================================ */
.social-sidebar {
    position: fixed;
    left: 1.75rem;
    bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    z-index: 900;
}

.social-link {
    color: var(--gray);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, transform 0.2s ease;
}

.social-link:hover {
    color: var(--black);
    transform: translateX(2px);
}

.social-line {
    width: 1px;
    height: 64px;
    background: var(--light-gray);
    margin-bottom: 0.25rem;
}

/* ================================================================
   HERO
================================================================ */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: calc(var(--nav-h) + 3rem) 5rem 4rem calc(var(--sidebar-pad) + 3rem);
}

.hero-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 4rem;
    max-width: var(--content-max);
    margin: 0 auto;
    width: 100%;
}

.hero-text {
    max-width: 580px;
}

.hero-name {
    margin-bottom: 1.5rem;
}

.terminal {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--gray);
    line-height: 1.7;
    margin-bottom: 2.5rem;
    min-height: 3.4em;
}

.terminal-line {
    display: inline;
}

.cursor {
    display: inline-block;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--black);
    animation: blink 1s step-end infinite;
    margin-left: 1px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

.btn-primary {
    display: inline-block;
    background: var(--black);
    color: var(--white);
    padding: 0.9rem 2.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    letter-spacing: 0.02em;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    user-select: none;
}

.btn-primary:hover {
    background: #2a2a2a;
    transform: translateY(-1px);
}

.btn-secondary {
    display: inline-block;
    background: var(--white);
    color: var(--black);
    padding: 0.9rem 2.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    letter-spacing: 0.02em;
    border: 1px solid var(--black);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    user-select: none;
}

.btn-secondary:hover {
    background: var(--black);
    color: var(--white);
    transform: translateY(-1px);
}

.hero-ctas {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.hero-portrait-wrap {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 2rem;
}

/* ================================================================
   PORTRAIT IMAGE
================================================================ */
.portrait {
    display: block;
}

.portrait-sm {
    max-height: 62vh;
    width: auto;
    max-width: 240px;
    object-fit: contain;
    object-position: bottom;
}

.portrait-lg {
    max-height: 75vh;
    width: auto;
    max-width: 320px;
    object-fit: contain;
    object-position: bottom;
}

/* ================================================================
   ABOUT
================================================================ */
.about {
    background: var(--off-white);
    padding: var(--section-pad);
}

.about-quote {
    font-size: clamp(0.95rem, 2.2vw, 1.2rem);
    font-style: italic;
    font-weight: 300;
    color: var(--gray);
    text-align: center;
    max-width: 560px;
    margin: 0 auto 4.5rem;
    line-height: 1.75;
    border: none;
}

.about-quote footer {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    font-style: normal;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gray);
    opacity: 0.65;
}

.about-inner {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 5rem;
    align-items: start;
    max-width: var(--content-max);
    margin: 0 auto;
}

.about-portrait {
    display: flex;
    justify-content: flex-end;
    padding-top: 2rem;
}

.about-content {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.about-content p {
    text-align: justify;
}

.section-title {
    margin-bottom: 1.75rem;
}

.section-title.centered {
    text-align: center;
    margin-bottom: 3.5rem;
}

.about-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.skill-tag {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    border: 1px solid var(--light-gray);
    padding: 0.3rem 0.85rem;
    background: var(--white);
    color: var(--black);
    transition: background 0.2s ease, color 0.2s ease;
}

.skill-tag:hover {
    background: var(--black);
    color: var(--white);
    border-color: var(--black);
}

/* ================================================================
   EXPERIENCE
================================================================ */
.experience {
    padding: var(--section-pad);
}

.experience-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
    max-width: var(--content-max);
    margin: 0 auto;
}

.exp-list {
    display: flex;
    flex-direction: column;
}

.exp-item {
    padding: 1.35rem 0;
    border-bottom: 1px solid var(--light-gray);
}

.exp-item:first-child {
    border-top: 1px solid var(--light-gray);
}

.exp-role {
    color: var(--black);
    margin-bottom: 0.25rem;
    text-align: left;
}

.exp-meta {
    font-size: 0.85rem;
    color: var(--gray);
    line-height: 1.5;
}

.exp-sub {
    font-size: 0.8rem;
    color: var(--gray);
    font-style: italic;
    margin-top: 0.15rem;
    line-height: 1.5;
}

.exp-subroles {
    list-style: none;
    margin-top: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.exp-subrole {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.exp-subrole::before {
    content: "•";
    color: var(--light-gray);
    flex-shrink: 0;
}

.exp-subrole-title {
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--black);
    flex: 1;
}

.exp-subrole-dates {
    font-size: 0.775rem;
    color: var(--gray);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ================================================================
   PORTFOLIO
================================================================ */
.portfolio {
    background: var(--off-white);
    padding: var(--section-pad);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: var(--content-max);
    margin: 0 auto;
}

.project-card {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--white);
    border: 1px solid var(--light-gray);
    overflow: hidden;
    cursor: pointer;
    outline: none;
}

.project-card:focus-visible {
    outline: 2px solid var(--black);
    outline-offset: 2px;
}

.project-thumb {
    width: 100%;
    height: 100%;
    background: var(--light-gray);
    transition: transform 0.45s ease;
}

.project-overlay {
    position: absolute;
    inset: 0;
    background: var(--black);
    color: var(--white);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.project-card:hover .project-overlay,
.project-card:focus-visible .project-overlay {
    opacity: 1;
    transform: translateY(0);
}

.project-card:hover .project-thumb {
    transform: scale(1.05);
}

.project-title {
    font-size: 0.975rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 0.3rem;
}

.project-tech {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.project-cta {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--white);
    letter-spacing: 0.04em;
}

/* ================================================================
   CONTACT / FOOTER
================================================================ */
.contact {
    padding: 7rem 5rem 0 calc(var(--sidebar-pad) + 3rem);
}

.contact-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
    max-width: 580px;
    margin: 0 auto;
    padding-bottom: 5rem;
}

.contact-title {
    font-size: clamp(1.8rem, 4vw, 3.2rem);
}

.contact-sub {
    max-width: 420px;
}

.contact-phone {
    font-size: 0.875rem;
    color: var(--gray);
}

.footer-social {
    display: none;
}

.footer-bottom {
    border-top: 1px solid var(--light-gray);
    padding: 1.5rem 0;
    font-size: 0.8rem;
    color: var(--gray);
}

/* ================================================================
   MODAL
================================================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.open {
    opacity: 1;
    pointer-events: all;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.modal-panel {
    position: relative;
    background: var(--white);
    width: min(700px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    padding: 3rem;
    transform: translateY(18px);
    transition: transform 0.3s ease;
}

.modal.open .modal-panel {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--gray);
    transition: color 0.2s ease;
    padding: 0.25rem 0.5rem;
}

.modal-close:hover {
    color: var(--black);
}

.modal-title-row {
    display: flex;
    align-items: center;
    gap: 3rem;
    margin-bottom: 0.4rem;
}

.modal-title-row #modal-title {
    margin-bottom: 0;
}

.modal-github {
    display: flex;
    align-items: center;
    color: var(--gray);
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.modal-github:hover {
    color: var(--black);
}

#modal-title {
    font-size: 1.5rem;
    margin-bottom: 0.4rem;
}

.modal-tech {
    font-size: 0.8rem;
    color: var(--gray);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.modal-description {
    margin-bottom: 1rem;
}

.modal-media {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.75rem 0;
}

.modal-media-item {
    aspect-ratio: 16 / 9;
    background: var(--off-white);
    border: 1px solid var(--light-gray);
}

.modal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--black);
    border-bottom: 1px solid var(--black);
    padding-bottom: 2px;
    transition: opacity 0.2s ease;
}

.modal-link:hover {
    opacity: 0.5;
}

/* ================================================================
   SCROLL REVEAL
================================================================ */
.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger siblings within lists */
.exp-item.reveal:nth-child(2)  { transition-delay: 0.07s; }
.exp-item.reveal:nth-child(3)  { transition-delay: 0.14s; }
.exp-item.reveal:nth-child(4)  { transition-delay: 0.21s; }
.exp-item.reveal:nth-child(5)  { transition-delay: 0.28s; }
.exp-item.reveal:nth-child(6)  { transition-delay: 0.35s; }
.exp-item.reveal:nth-child(7)  { transition-delay: 0.42s; }
.exp-item.reveal:nth-child(8)  { transition-delay: 0.49s; }
.exp-item.reveal:nth-child(9)  { transition-delay: 0.56s; }

.project-card.reveal:nth-child(2) { transition-delay: 0.08s; }
.project-card.reveal:nth-child(3) { transition-delay: 0.16s; }
.project-card.reveal:nth-child(4) { transition-delay: 0.08s; }
.project-card.reveal:nth-child(5) { transition-delay: 0.16s; }
.project-card.reveal:nth-child(6) { transition-delay: 0.24s; }

/* ================================================================
   RESPONSIVE — TABLET
================================================================ */
@media (max-width: 960px) {
    :root {
        --section-pad: 5rem 2.5rem 5rem 2.5rem;
    }

    .burger {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-h);
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--light-gray);
        padding: 0.5rem 2.5rem 1.5rem;
    }

    .nav-links.open {
        display: flex;
    }

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

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-link {
        display: block;
        padding: 1rem 0;
        font-size: 1rem;
    }

    .social-sidebar {
        display: none;
    }

    .hero {
        padding: calc(var(--nav-h) + 3rem) 2.5rem 4rem;
        text-align: center;
    }

    .hero-inner {
        grid-template-columns: 1fr;
    }

    .hero-text {
        max-width: 100%;
    }

    .hero-ctas {
        justify-content: center;
    }

    .btn-primary {
        display: inline-block;
    }

    .hero-portrait-wrap {
        order: -1;
        justify-content: center;
        padding-bottom: 0;
    }

    .portrait-sm {
        max-height: 220px;
        max-width: 160px;
    }

    .about {
        padding: 5rem 2.5rem;
    }

    .about-inner {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .about-portrait {
        display: none;
    }

    .about-quote {
        margin-bottom: 3rem;
    }

    .footer-social {
        display: flex;
        justify-content: center;
        gap: 1.75rem;
        padding-bottom: 1.75rem;
    }

    .experience {
        padding: 5rem 2.5rem;
    }

    .experience-inner {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .portfolio {
        padding: 5rem 2.5rem;
    }

    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .contact {
        padding: 5rem 2.5rem 0;
    }
}

/* ================================================================
   404 PAGE
================================================================ */
.notfound-logo {
    position: fixed;
    top: 1.5rem;
    left: 2rem;
    z-index: 1000;
    text-decoration: none;
}

.notfound {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.notfound-inner {
    max-width: 520px;
}

.notfound-code {
    font-size: clamp(4rem, 12vw, 7rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--black);
    margin-bottom: 1.5rem;
}

.notfound-terminal {
    display: inline-block;
    text-align: left;
    margin-bottom: 2rem;
}

.notfound-sub {
    max-width: 420px;
    margin: 0 auto 2.5rem;
}

.notfound-ctas {
    justify-content: center;
}

/* ================================================================
   RESPONSIVE — MOBILE
================================================================ */
@media (max-width: 600px) {
    .navbar {
        padding: 0 1.5rem;
    }

    .nav-links {
        gap: 1.5rem;
    }

    .nav-link {
        font-size: 0.8rem;
    }

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

    .modal-panel {
        padding: 2rem 1.5rem;
    }

    .modal-media {
        grid-template-columns: 1fr;
    }
}
