:root {
    color-scheme: light dark;
    --bg: #f5f5f5;
    --card-bg: rgba(255, 255, 255, 0.8);
    --text: #1f2933;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.18);
    --shadow: 0 20px 45px rgba(31, 41, 51, 0.15);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #a5b4fc, #93c5fd, #c4f1f9);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    padding: 3.5rem 1.5rem 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    position: relative;
}

.site-nav {
    position: absolute;
    top: 1.4rem;
    right: clamp(1rem, 4vw, 2rem);
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.95rem;
}

.site-nav a {
    text-decoration: none;
    font-weight: 500;
    color: rgba(31, 41, 51, 0.75);
    padding-bottom: 0.2rem;
    border-bottom: 2px solid transparent;
    transition: color 150ms ease, border-color 150ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"] {
    color: var(--text);
    border-color: var(--accent);
}

@media (max-width: 640px) {
    .site-nav {
        position: static;
        order: -1;
        margin-bottom: 0.5rem;
    }
}

.lang-toggle {
    font: inherit;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.65);
    color: var(--text);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.lang-toggle:hover,
.lang-toggle:focus-visible {
    background: var(--accent);
    color: white;
    border-color: transparent;
}

header h1 {
    margin: 0;
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    letter-spacing: -0.03em;
}

header p {
    margin: 0.25rem auto 0;
    max-width: 60ch;
    font-size: 1.15rem;
    line-height: 1.7;
}

main {
    width: min(1120px, 94vw);
    margin: 0 auto 3rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.75rem;
    grid-auto-flow: dense;
}

section {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 1.7rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 16px 36px rgba(31, 41, 51, 0.12);
    transition: transform 150ms ease, box-shadow 150ms ease;
}

section:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 44px rgba(31, 41, 51, 0.18);
}

h2 {
    margin-top: 0;
    font-size: 1.6rem;
}

p {
    line-height: 1.7;
}

ul {
    padding-left: 1.2rem;
    margin: 1rem 0 0;
}

li + li {
    margin-top: 0.6rem;
}

.timeline {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
    position: relative;
}

.timeline li {
    position: relative;
    padding: 0 0 1.45rem 2.35rem;
}

.timeline li::before {
    content: "";
    position: absolute;
    left: 0.9rem;
    top: 0.2rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 5px var(--accent-soft);
    transform: translateX(-50%);
}

.timeline li::after {
    content: "";
    position: absolute;
    left: 0.9rem;
    top: 1.25rem;
    bottom: -1.2rem;
    width: 2px;
    background: var(--accent-soft);
    transform: translateX(-50%);
}

.timeline li:last-child {
    padding-bottom: 0;
}

.timeline li:last-child::after {
    content: none;
}

.timeline h3 {
    margin: 0;
    font-size: 1.1rem;
}

.timeline span {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.95rem;
    color: rgba(31, 41, 51, 0.75);
}

.experience-grid {
    display: grid;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

@media (min-width: 900px) {
    .experience-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.experience-item {
    background: rgba(37, 99, 235, 0.12);
    border-radius: 16px;
    padding: 1.3rem 1.5rem 1.4rem;
    position: relative;
    overflow: hidden;
}

.experience-item::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 16px;
    border: 1px solid rgba(37, 99, 235, 0.22);
    pointer-events: none;
}

.experience-item h3 {
    margin: 0;
    font-size: 1.15rem;
}

.experience-item span {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.95rem;
    color: rgba(31, 41, 51, 0.75);
}

.experience-item ul {
    margin: 0.9rem 0 0;
    padding-left: 1.1rem;
}

.badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 1rem;
}

.intro-card {
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
}

@media (min-width: 880px) {
    .intro-card {
        grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    }
}

@media (max-width: 879px) {
    .intro-card figure {
        order: -1;
    }
}

.intro-copy {
    padding: 2rem 2rem 1.85rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.intro-copy h2 {
    margin: 0;
    font-size: 1.65rem;
}

.intro-copy p {
    margin: 0;
}

.intro-card figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(160deg, rgba(37, 99, 235, 0.1), rgba(147, 197, 253, 0.28));
}

.intro-card img {
    width: 100%;
    display: block;
    flex: 1 1 60%;
    min-height: 280px;
    object-fit: cover;
}

@media (max-width: 600px) {
    .intro-card img {
        min-height: 220px;
    }
}

.intro-card figcaption {
    padding: 1.6rem 1.9rem 1.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.intro-card figcaption h3 {
    margin: 0;
    font-size: 1.25rem;
}

.intro-card figcaption p {
    margin: 0;
}

.intro-card figcaption small {
    font-size: 0.8rem;
    opacity: 0.7;
}

.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.01em;
}

.focus-card {
    display: grid;
    gap: 1rem;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 16px;
    padding: 1.6rem;
    position: relative;
    overflow: hidden;
}

.focus-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 16px;
    border: 1px solid rgba(37, 99, 235, 0.24);
    pointer-events: none;
}

.focus-card h3 {
    margin: 0;
    font-size: 1.25rem;
}

.focus-card p {
    margin: 0;
}

.focus-card ul {
    margin: 0;
    padding-left: 1.15rem;
}

.focus-card li + li {
    margin-top: 0.45rem;
}

.span-2 {
    grid-column: span 1;
}

@media (min-width: 960px) {
    .span-2 {
        grid-column: 1 / -1;
    }
}

.contact-grid {
    display: grid;
    gap: 0.85rem;
    margin-top: 1.25rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.contact-item span {
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.85;
}

.contact-item .cta {
    margin-top: 0;
}

.highlight {
    font-weight: 600;
    color: var(--accent);
}

.cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    margin-top: 1.5rem;
}

.cta span {
    display: inline-block;
    transition: transform 150ms ease;
}

.cta:hover span {
    transform: translateX(4px);
}

.timeline ul {
    margin-top: 0.75rem;
    padding-left: 1.1rem;
}

footer {
    text-align: center;
    padding: 1.75rem 1.5rem 2.5rem;
    font-size: 0.9rem;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.2rem 1.3rem;
    border-radius: 16px;
    background: rgba(37, 99, 235, 0.12);
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    transition: transform 150ms ease, box-shadow 150ms ease;
    margin-top: 1.25rem;
}

.page-link span:last-child {
    font-size: 1.4rem;
}

.page-link:hover,
.page-link:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 18px 36px rgba(31, 41, 51, 0.16);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --card-bg: rgba(15, 23, 42, 0.88);
        --text: #e2e8f0;
        --accent: #60a5fa;
        --accent-soft: rgba(96, 165, 250, 0.24);
        --shadow: 0 18px 40px rgba(15, 23, 42, 0.65);
    }

    body {
        background: radial-gradient(circle at 15% 15%, #1e293b, #0f172a 55%, #020617);
    }

    .site-nav a {
        color: rgba(226, 232, 240, 0.72);
    }

    .timeline span {
        color: rgba(226, 232, 240, 0.75);
    }

    .intro-card figure {
        background: linear-gradient(160deg, rgba(96, 165, 250, 0.18), rgba(15, 23, 42, 0.6));
    }

    .experience-item,
    .page-link,
    .focus-card {
        background: rgba(96, 165, 250, 0.14);
    }

    .experience-item::before {
        border-color: rgba(96, 165, 250, 0.35);
    }

    .focus-card::before {
        border-color: rgba(96, 165, 250, 0.35);
    }

    .experience-item span {
        color: rgba(226, 232, 240, 0.75);
    }
}

/* Explicit theme overrides take precedence over system preference */
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f5f5f5;
    --card-bg: rgba(255, 255, 255, 0.8);
    --text: #1f2933;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.18);
    --shadow: 0 20px 45px rgba(31, 41, 51, 0.15);
}

:root[data-theme="light"] body {
    background: linear-gradient(135deg, #a5b4fc, #93c5fd, #c4f1f9);
}

:root[data-theme="light"] .site-nav a { color: rgba(31, 41, 51, 0.75); }
:root[data-theme="light"] .timeline span { color: rgba(31, 41, 51, 0.75); }
:root[data-theme="light"] .intro-card figure { background: linear-gradient(160deg, rgba(37, 99, 235, 0.1), rgba(147, 197, 253, 0.28)); }
:root[data-theme="light"] .experience-item,
:root[data-theme="light"] .page-link,
:root[data-theme="light"] .focus-card { background: rgba(37, 99, 235, 0.12); }
:root[data-theme="light"] .experience-item::before,
:root[data-theme="light"] .focus-card::before { border-color: rgba(37, 99, 235, 0.22); }
:root[data-theme="light"] .experience-item span { color: rgba(31, 41, 51, 0.75); }

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f172a;
    --card-bg: rgba(15, 23, 42, 0.88);
    --text: #e2e8f0;
    --accent: #60a5fa;
    --accent-soft: rgba(96, 165, 250, 0.24);
    --shadow: 0 18px 40px rgba(15, 23, 42, 0.65);
}

:root[data-theme="dark"] body { background: radial-gradient(circle at 15% 15%, #1e293b, #0f172a 55%, #020617); }
:root[data-theme="dark"] .site-nav a { color: rgba(226, 232, 240, 0.72); }
:root[data-theme="dark"] .timeline span { color: rgba(226, 232, 240, 0.75); }
:root[data-theme="dark"] .intro-card figure { background: linear-gradient(160deg, rgba(96, 165, 250, 0.18), rgba(15, 23, 42, 0.6)); }
:root[data-theme="dark"] .experience-item,
:root[data-theme="dark"] .page-link,
:root[data-theme="dark"] .focus-card { background: rgba(96, 165, 250, 0.14); }
:root[data-theme="dark"] .experience-item::before,
:root[data-theme="dark"] .focus-card::before { border-color: rgba(96, 165, 250, 0.35); }
:root[data-theme="dark"] .experience-item span { color: rgba(226, 232, 240, 0.75); }
