:root {
    --container:    1120px;
    --radius:       12px;
    --font-mono:    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --gutter:       clamp(16px, 4vw, 32px);
    --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
    --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
    --bg:           #faf7f5;
    --surface:      #ffffff;
    --text:         #231c19;
    --text-muted:   #6b5f5a;
    --accent:       #c4573b;
    --accent-solid: #de7356;
    --on-accent:    #ffffff;
    --accent-light: #fdf1ed;
    --accent-mid:   #f5c9bb;
    --border:       #ebe3de;
    --green:        #16a34a;
    --green-light:  #dcfce7;
    --tag-bg:       #f4eeea;
    --tag-text:     #4a3f3a;
    --shadow-sm:    0 1px 2px rgba(35,28,25,.05);
    --shadow:       0 4px 14px rgba(35,28,25,.07);
}
[data-theme="dark"] {
    --bg:           #181311;
    --surface:      #231c19;
    --text:         #f1e9e5;
    --text-muted:   #b3a59e;
    --accent:       #e8896f;
    --accent-solid: #de7356;
    --on-accent:    #231c19;
    --accent-light: #3a1f18;
    --accent-mid:   #8a3f2b;
    --border:       #3a302b;
    --green:        #4ade80;
    --green-light:  #14532d;
    --tag-bg:       #33291f;
    --tag-text:     #e0d3cc;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.3);
    --shadow:       0 4px 12px rgba(0,0,0,.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 16px;
    transition: background .3s, color .3s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent-solid); outline-offset: 2px; }

/* ── Navigation ── */
.site-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}
/* Fixed only after scrolling past the header; body padding replaces its space to avoid a jump */
.site-nav.is-stuck {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    animation: nav-in .25s ease-out;
}
body.nav-stuck { padding-top: var(--nav-h, 72px); }
@keyframes nav-in { from { transform: translateY(-100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .site-nav.is-stuck { animation: none; } }
.nav-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--gutter);
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-brand {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -.2px;
    color: var(--accent);
    white-space: nowrap;
    margin-right: var(--space-4);
}
.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
.nav-links a {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    transition: color .15s, background .15s;
}
.nav-links a:hover {
    color: var(--accent);
    background: var(--accent-light);
    text-decoration: none;
}
.nav-links a:hover { box-shadow: inset 0 -2px 0 var(--accent-solid); }
.theme-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all .2s;
}
.theme-btn:hover { background: var(--tag-bg); color: var(--text); }
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.nav-toggle:hover { background: var(--tag-bg); color: var(--text); }

/* ── Page layout ── */
.page-wrapper {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--gutter);
    box-sizing: border-box;
}
.main-grid {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: var(--space-5);
    padding: var(--space-6) 0 var(--space-8);
}
.content-area p { max-width: 70ch; }
@media (max-width: 800px) {
    .main-grid { grid-template-columns: minmax(0, 1fr); padding: 24px 0 48px; gap: var(--space-4); }
    /* Flatten the wrappers so cards can be reordered; DOM order is unchanged */
    .main-grid > .sidebar, .main-grid > .content-area { display: contents; }
    .internship-banner { order: 1; }
    .profile-card { order: 2; }
    .content-area > section:nth-of-type(1) { order: 3; }
    .sidebar > div:nth-child(2) { order: 4; }
    .sidebar > div:nth-child(3) { order: 5; }
    .content-area > section:nth-of-type(2) { order: 6; }
    .content-area > section:nth-of-type(3) { order: 7; }
    .content-area > section:nth-of-type(4) { order: 8; }
    .nav-toggle { display: flex; }
    .theme-btn { margin-left: auto; margin-right: var(--space-2); width: 40px; height: 40px; font-size: 18px; }
    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 101;
        width: min(280px, 80vw);
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 88px 20px 24px;
        background: var(--surface);
        border-left: 1px solid var(--border);
        box-shadow: var(--shadow);
        transform: translateX(100%);
        visibility: hidden;
        transition: transform .25s ease, visibility .25s;
    }
    .site-nav.nav-open .nav-links { transform: none; visibility: visible; }
    .nav-links a { display: block; padding: 10px 12px; font-size: 15px; }
    .nav-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; }
}

/* ── Sidebar ── */
.sidebar { display: flex; flex-direction: column; gap: var(--space-4); }

.social-icon[aria-label="Email"]          { --brand: #c4573b; }
.social-icon[aria-label="GitHub"]         { --brand: #24292f; }
.social-icon[aria-label="LinkedIn"]       { --brand: #0a66c2; }
[data-theme="dark"] .social-icon[aria-label="GitHub"] { --brand: #f0f6fc; }
[data-theme="dark"] .social-icon[aria-label="LinkedIn"] { --brand: #4c9ee8; }

.profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 20px 22px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.profile-photo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    margin-bottom: 14px;
}
.profile-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}
.profile-role {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

/* Pulsing status badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--green-light);
    color: var(--green);
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 13px;
    border-radius: 20px;
    margin-top: 14px;
    border: 1px solid var(--green);
    letter-spacing: .1px;
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .45; transform: scale(.8); }
}

.social-row {
    display: flex;
    justify-content: center;
    gap: 7px;
    margin-top: 18px;
}
.social-icon {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
    transition: all .2s;
}
.social-icon:hover {
    color: var(--brand, var(--accent));
    border-color: var(--brand, var(--accent));
    background: color-mix(in srgb, var(--brand, var(--accent)) 12%, var(--surface));
    text-decoration: none;
}

.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.card-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .9px;
    color: var(--text-muted);
    margin-bottom: 13px;
}

.contact-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.contact-row:last-child { margin-bottom: 0; }
.contact-row i {
    color: var(--accent);
    width: 14px;
    margin-top: 3px;
    flex-shrink: 0;
    font-size: 12px;
}

.tags-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    background: var(--tag-bg);
    color: var(--tag-text);
    font-size: 11.5px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

/* ── Content ── */
.content-area { display: flex; flex-direction: column; gap: var(--space-4); }

/* Internship banner */
.internship-banner {
    background: var(--accent-light);
    border: 1px solid var(--accent-mid);
    border-left: 4px solid var(--accent-solid);
    border-radius: 12px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
@media (max-width: 600px) { .internship-banner { flex-direction: column; align-items: flex-start; } }
.banner-headline {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}
.banner-sub {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.5;
}
.cv-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 13px;
    font-weight: 600;
    padding: 9px 20px;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity .2s;
}
.cv-btn:hover { opacity: .85; color: var(--on-accent); text-decoration: none; }

/* Generic section card */
.section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 26px 22px;
    box-shadow: var(--shadow-sm);
}
.section-hdr {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.sec-num {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    font-weight: 500;
    opacity: .65;
}
.sec-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.15px;
}

/* Research */
.body-p {
    font-size: 14px;
    color: var(--text);
    line-height: 1.75;
    margin-bottom: 12px;
}
.body-p:last-child { margin-bottom: 0; }

/* Projects */
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.project-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}
.project-title { font-size: 14.5px; font-weight: 600; color: var(--text); }
.project-date { font-family: var(--font-mono); font-size: 11.5px; color: var(--accent); }
.project-desc { font-size: 13px; color: var(--text-muted); line-height: 1.6; flex: 1; margin-bottom: 4px; }

.skill-icons { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--text-muted);
    background: var(--tag-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: transform .15s, border-color .15s;
}
.skill-icon:hover { transform: translateY(-2px); border-color: var(--accent-mid); }
.skill-group {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 12px 0 6px;
}
.skill-group:first-of-type { margin-top: 0; }
.exp-bullets { margin: 6px 0 0 18px; padding: 0; font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.exp-bullets li + li { margin-top: 3px; }

/* Education */
.edu-list { display: flex; flex-direction: column; gap: 18px; }
.edu-item { display: flex; gap: 14px; align-items: flex-start; position: relative; }
.edu-item:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 18px;
    bottom: -18px;
    width: 2px;
    background: var(--border);
}
.edu-line { display: flex; flex-direction: column; gap: 4px; }
.edu-dot-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 5px;
    gap: 0;
}
.edu-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    margin-top: 5px;
}
.edu-dot.muted { background: var(--text-muted); opacity: .45; }
.edu-degree { font-size: 14px; font-weight: 600; color: var(--text); }
.edu-school { font-size: 13px; color: var(--text-muted); }
.edu-year {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--accent);
    opacity: .8;
}

/* Back to top */
#topper {
    position: fixed;
    bottom: 92px;
    right: 24px;
    background: var(--accent);
    color: var(--on-accent);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    box-shadow: var(--shadow);
    text-decoration: none;
    transition: opacity .2s;
    z-index: 99;
}
#topper:hover { opacity: .82; color: var(--on-accent); text-decoration: none; }
@media (max-width: 800px) { #topper { right: var(--gutter); bottom: 80px; } }

/* Footer */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 20px 0;
}
.footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.footer-text { font-size: 12.5px; color: var(--text-muted); }
.footer-social { display: flex; gap: 7px; }

/* Skip link */
.skip-link {
    position: absolute;
    top: -50px;
    left: 0;
    background: var(--accent);
    color: var(--on-accent);
    padding: 8px 16px;
    border-radius: 0 0 8px 0;
    font-size: 13px;
    z-index: 200;
}
.skip-link:focus { top: 0; }

/* ── Smooth scroll + section offset for sticky nav ── */
html { scroll-behavior: smooth; }
.section { scroll-margin-top: 88px; }

/* ── Experience timeline ── */
.exp-list { display: flex; flex-direction: column; gap: 22px; }
.exp-item { display: flex; gap: 14px; align-items: flex-start; position: relative; }
.exp-item:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 18px;
    bottom: -22px;
    width: 2px;
    background: var(--border);
}
.exp-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    margin-top: 5px;
}
.exp-dot.muted { background: var(--text-muted); opacity: .45; }
.exp-line { display: flex; flex-direction: column; gap: 3px; }
.exp-role { font-size: 14px; font-weight: 600; color: var(--text); }
.exp-org  { font-size: 13px; color: var(--text-muted); }
.exp-year {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--accent);
    opacity: .8;
}
.exp-desc { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-top: 3px; }

/* ── Nav overflow on small screens ── */
@media (max-width: 700px) {
    .nav-brand { font-size: 15px; }
}
