:root {
    --bg: #f8f8f6;
    --surface: rgba(255, 255, 255, 0.78);
    --surface-strong: rgba(255, 255, 255, 0.92);
    --text: #111111;
    --muted: #6e6e73;
    --line: rgba(17, 17, 17, 0.08);
    --soft: #f1f1ee;
    --accent: #111111;

    --sidebar-width: 250px;
    --content-max: 1440px;
    --radius: 28px;
    --radius-sm: 18px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.05);

    --transition: 180ms ease;
}

/* RESET */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
}

body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(0, 0, 0, 0.03), transparent 32%),
        radial-gradient(circle at top right, rgba(0, 0, 0, 0.025), transparent 28%),
        var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* subtle background grid */

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-image:
        linear-gradient(to right, rgba(17, 17, 17, 0.035) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(17, 17, 17, 0.035) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: radial-gradient(circle at center, black 35%, transparent 85%);
    -webkit-mask-image: radial-gradient(circle at center, black 35%, transparent 85%);
}

/* LINKS */

a {
    text-decoration: none;
    color: inherit;
}

button {
    font: inherit;
}

/* LAYOUT */

.layout {
    width: min(calc(100% - 48px), var(--content-max));
    margin: 0 auto;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    gap: 44px;
    padding: 36px 0 72px;
}

/* SIDEBAR */

.sidebar {
    position: sticky;
    top: 28px;
    align-self: start;
    height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
}

.sidebar-name {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    margin-bottom: 10px;
    line-height: 1;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-nav a {
    position: relative;
    color: var(--muted);
    padding: 10px 12px;
    border-radius: 999px;
    transition:
        color var(--transition),
        background var(--transition),
        transform var(--transition),
        box-shadow var(--transition);
}

.sidebar-nav a:hover {
    background: var(--surface-strong);
    color: var(--text);
    transform: translateX(2px);
}

.sidebar-nav a.active {
    background: var(--soft);
    color: var(--text);
}

.sidebar-nav a.active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    width: 4px;
    height: 18px;
    border-radius: 999px;
    background: var(--text);
    transform: translateY(-50%);
    opacity: 0.9;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 20px;
    display: flex;
    align-items: center;
}

/* CONTENT */

.content {
    min-width: 0;
}

/* CARDS */

.hero,
section {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow-md);
}

.hero,
section,
footer {
    opacity: 0;
    transform: translateY(18px);
    transition:
        opacity 0.6s ease,
        transform 0.6s ease;
}

.hero.reveal,
section.reveal,
footer.reveal {
    opacity: 1;
    transform: translateY(0);
}

.hero {
    padding: 52px 44px;
    text-align: center;
    margin-bottom: 18px;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top center, rgba(0, 0, 0, 0.06), transparent 38%);
    pointer-events: none;
    z-index: 0;
}

.hero>* {
    position: relative;
    z-index: 1;
}

section {
    padding: 30px;
    margin-top: 18px;
}

/* HERO */

.hero-avatar {
    width: 160px;
    height: 160px;
    margin: 0 auto 20px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--soft);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.hero-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero-eyebrow {
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.hero-eyebrow::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--accent);
    display: inline-block;
    flex-shrink: 0;
}

.hero-name {
    font-size: clamp(3rem, 6vw, 5.8rem);
    line-height: 0.92;
    letter-spacing: -0.07em;
    margin-bottom: 18px;
}

.hero-description {
    max-width: 58ch;
    margin: 0 auto 24px;
    font-size: 1.08rem;
    color: #2f2f33;
}

/* SOCIAL LINKS */

.hero-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.hero-links a {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    color: var(--muted);
    transition:
        transform 0.18s ease,
        color 0.18s ease,
        opacity 0.18s ease;
}

.hero-links a:hover {
    transform: translateY(-2px);
    color: var(--text);
}

.hero-links a::after {
    content: attr(aria-label);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%) translateY(4px);
    white-space: nowrap;
    font-size: 0.76rem;
    line-height: 1;
    padding: 7px 9px;
    border-radius: 999px;
    background: var(--text);
    color: var(--bg);
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.18s ease,
        transform 0.18s ease;
    box-shadow: var(--shadow-sm);
}

.hero-links a:hover::after,
.hero-links a:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hero-links svg {
    display: block;
}

/* BUTTONS */

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 12px 24px;
    border: 1px solid var(--text);
    background: var(--text);
    color: #fff;
    cursor: pointer;
    transition:
        transform var(--transition),
        opacity var(--transition),
        color var(--transition),
        background var(--transition),
        border-color var(--transition);
}

.button:hover {
    transform: translateY(-1px);
    opacity: 0.92;
}

.theme-button {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        transform var(--transition),
        opacity var(--transition),
        color var(--transition),
        background var(--transition),
        border-color var(--transition);
}

.theme-button:hover {
    transform: translateY(-1px);
}

/* SECTIONS */

section h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    margin-bottom: 20px;
}

.experience-item,
.education-item,
.project {
    border-top: 1px solid var(--line);
    padding: 18px 0;
}

.project:first-of-type,
.experience-item:first-of-type,
.education-item:first-of-type {
    border-top: none;
}

.project h4,
.experience-item h4,
.education-item h4 {
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.company {
    color: var(--muted);
    margin-bottom: 10px;
}

section p {
    max-width: 70ch;
}

/* TECH PILLS */

.project-meta,
.item-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    background: var(--soft);
    color: var(--muted);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    line-height: 1;
}

/* EXPANDABLE */

.expandable-project {
    border-radius: 18px;
}

.project-toggle {
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.project-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.project-icon {
    font-size: 18px;
    color: var(--muted);
    transition: transform 0.2s ease;
}

.project-toggle[aria-expanded="true"] .project-icon {
    transform: rotate(45deg);
}

.project-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    margin-top: 6px;
}

.experience-date {
    font-size: 0.9rem;
    color: var(--muted);
    white-space: nowrap;
}

/* FOOTER */

footer {
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--muted);
}

/* SCROLL PROGRESS */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 999;
}

.scroll-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--text);
}

/* DARK MODE */

[data-theme="dark"] {
    --bg: #0a0a0b;
    --surface: rgba(17, 17, 19, 0.82);
    --surface-strong: rgba(22, 22, 24, 0.92);
    --text: #f5f5f4;
    --muted: #a1a1a8;
    --line: rgba(255, 255, 255, 0.08);
    --soft: #17171a;
    --accent: #f5f5f4;
}

[data-theme="dark"] body::before {
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
}

[data-theme="dark"] .button {
    background: #f5f5f4;
    color: #111;
    border-color: #f5f5f4;
}

[data-theme="dark"] .scroll-progress-bar {
    background: #f5f5f5;
}

[data-theme="dark"] .hero-links a::after {
    background: #f5f5f4;
    color: #111111;
}

[data-theme="dark"] .theme-button {
    background: var(--surface-strong);
    color: var(--text);
}

[data-theme="dark"] .sidebar-nav a.active {
    background: var(--soft);
}

/* RESPONSIVE */

@media (max-width: 980px) {
    .layout {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px 12px;
    }

    .sidebar-bottom {
        margin-top: 20px;
    }

    .sidebar-nav a.active::before {
        display: none;
    }
}

@media (max-width: 720px) {

    .hero,
    section {
        padding: 22px;
    }

    .hero-avatar {
        width: 120px;
        height: 120px;
    }

    .hero-name {
        font-size: clamp(2.5rem, 12vw, 3.9rem);
    }

    .hero-description {
        font-size: 1rem;
    }

    .hero-links {
        gap: 16px;
    }

    .project-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .project-header-right {
        margin-top: 10px;
    }

    .experience-date {
        white-space: normal;
    }
}

/* ---------- DARK MODE CONTRAST FIXES ---------- */

[data-theme="dark"] .hero-description,
[data-theme="dark"] section p,
[data-theme="dark"] .project-content p {
    color: #d7d7dc;
}

[data-theme="dark"] .project h4,
[data-theme="dark"] .experience-item h4,
[data-theme="dark"] .education-item h4,
[data-theme="dark"] .project-toggle h4 {
    color: #f3f3f5;
}

[data-theme="dark"] .company,
[data-theme="dark"] .experience-date,
[data-theme="dark"] .meta-pill,
[data-theme="dark"] .hero-eyebrow,
[data-theme="dark"] section h3,
[data-theme="dark"] footer {
    color: #b4b4bc;
}

[data-theme="dark"] .meta-pill {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.10);
}

[data-theme="dark"] .project-icon {
    color: #c8c8cf;
}

[data-theme="dark"] .theme-button {
    border-color: rgba(255, 255, 255, 0.10);
}

[data-theme="dark"] .sidebar-nav a {
    color: #b0b0b8;
}

[data-theme="dark"] .sidebar-nav a:hover,
[data-theme="dark"] .sidebar-nav a.active {
    color: #f5f5f5;
}

[data-theme="dark"] .sidebar-nav a.active::before {
    background: #f5f5f5;
}