:root {
    color-scheme: dark;
    --background: #0b1120;
    --background-elevated: rgba(15, 23, 42, 0.78);
    --background-soft: #111a2f;
    --surface: #16213a;
    --surface-strong: #1d2b47;
    --text: #e5ecff;
    --text-muted: #97a6c4;
    --border: rgba(148, 163, 184, 0.18);
    --accent: #6ee7f9;
    --accent-strong: #38bdf8;
    --shadow: 0 20px 60px rgba(2, 6, 23, 0.35);
    --max-width: 1180px;
}

body[data-theme="light"] {
    color-scheme: light;
    --background: #f4f7fb;
    --background-elevated: rgba(255, 255, 255, 0.88);
    --background-soft: #ffffff;
    --surface: #ffffff;
    --surface-strong: #eef4ff;
    --text: #10203a;
    --text-muted: #52627e;
    --border: rgba(15, 23, 42, 0.1);
    --accent: #0f766e;
    --accent-strong: #0ea5e9;
    --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top, rgba(56, 189, 248, 0.16), transparent 30%),
        linear-gradient(180deg, var(--background) 0%, #08101d 100%);
    color: var(--text);
    line-height: 1.6;
    transition: background-color 0.25s ease, color 0.25s ease;
}

a {
    color: inherit;
}

img {
    max-width: 100%;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3rem;
    background: var(--surface);
    color: var(--text);
    padding: 0.75rem 1rem;
    border-radius: 999px;
    z-index: 100;
}

.skip-link:focus {
    top: 1rem;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
    background: var(--background-elevated);
    border-bottom: 1px solid var(--border);
}

.site-header__inner,
.section,
.site-footer {
    width: min(calc(100% - 2rem), var(--max-width));
    margin: 0 auto;
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4.75rem;
}

.brand {
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.02em;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.site-nav a,
.hero__links a,
.site-footer a {
    text-decoration: none;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.site-nav a:hover,
.hero__links a:hover,
.site-footer a:hover,
.site-nav a:focus-visible,
.hero__links a:focus-visible,
.site-footer a:focus-visible {
    color: var(--text);
}

.site-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.theme-toggle,
.button,
.back-to-top {
    border: 0;
    border-radius: 999px;
    font: inherit;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 1.3rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #03111f;
    text-decoration: none;
    font-weight: 700;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.button:hover,
.button:focus-visible,
.theme-toggle:hover,
.theme-toggle:focus-visible,
.back-to-top:hover,
.back-to-top:focus-visible {
    transform: translateY(-1px);
}

.button--secondary,
.button--ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.eyebrow {
    margin: 0 0 0.75rem;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.section {
    padding: 5rem 0;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.9fr);
    gap: 2rem;
    align-items: stretch;
    min-height: calc(100vh - 4.75rem);
}

.hero h1,
.section-heading h2 {
    margin: 0;
    line-height: 1.05;
}

.hero h1 {
    font-size: clamp(2.5rem, 4.8vw, 4.7rem);
    max-width: 11ch;
}

.hero__lead,
.about-grid p,
.timeline-card p,
.project-card p,
.contact-card p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

.hero__lead {
    max-width: 62ch;
    font-size: 1.1rem;
}

.hero__actions,
.contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 2rem 0 1.5rem;
}

.hero__links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.hero__panel,
.timeline-card,
.skill-card,
.project-card,
.contact-card {
    background: var(--background-elevated);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    box-shadow: var(--shadow);
}

.hero__panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    align-self: stretch;
    margin: 2rem 0;
}

.hero__panel-photo {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.hero__panel-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.hero__panel-body {
    padding: 1.25rem 1.5rem 1.75rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hero__panel-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.hero__panel-name strong {
    font-size: 1rem;
    color: var(--text);
}

.availability-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
}

.availability-badge::before {
    content: '';
    display: inline-block;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--accent);
}

.hero__panel-label,
.timeline-card__period,
.project-card__tag {
    margin: 0 0 0.75rem;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 700;
}

.stat-list,
.chip-list,
.timeline-card ul,
.project-card ul {
    padding: 0;
    margin: 0;
    list-style: none;
}

.stat-list {
    display: grid;
    gap: 0.65rem;
}

.stat-list li,
.timeline-card li,
.project-card li {
    color: var(--text-muted);
}

.stat-list strong {
    display: block;
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: 0.1rem;
}

.section-heading {
    display: grid;
    gap: 0.65rem;
    margin-bottom: 2rem;
}

.section-heading h2 {
    font-size: clamp(2rem, 4vw, 3.4rem);
    max-width: 15ch;
}

.about-grid,
.skills-grid,
.portfolio-grid,
.contact-card {
    display: grid;
    gap: 1.5rem;
}

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

.about-grid__bio {
    max-width: 72ch;
}

.about-grid__bio p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-top: 0;
}

.about-grid__extras {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.tag-group {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--background-elevated);
}

.tag-group__label {
    margin: 0 0 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.timeline {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.timeline-card--wide {
    grid-column: 1 / -1;
}

.timeline-sub {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.timeline-sub__title {
    margin: 0 0 0.75rem;
    font-weight: 700;
    color: var(--text);
    font-size: 0.95rem;
}

.skills-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.timeline-card,
.skill-card,
.project-card,
.contact-card {
    padding: 1.6rem;
}

.project-card--showcase {
    display: grid;
    grid-template-columns: minmax(320px, 1.05fr) minmax(0, 1fr);
    gap: 0;
    padding: 0;
    overflow: hidden;
}

.project-card--showcase .project-card__body {
    padding: 1.6rem;
}

.project-card__media {
    background: var(--background-soft);
    border-right: 1px solid var(--border);
}

.project-card__media--carousel {
    display: grid;
    grid-template-rows: 1fr auto;
}

.carousel__viewport {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 10;
}

.carousel__track {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel__slide {
    position: absolute;
    inset: 0;
    height: 100%;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.carousel__slide.is-active {
    opacity: 1;
    visibility: visible;
}

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

.carousel__controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem 1rem;
}

.carousel__button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    line-height: 1;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.carousel__button:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.carousel__button svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.carousel__dots {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 0.45rem;
}

.carousel__dot {
    width: 0.6rem;
    height: 0.6rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.35);
    cursor: pointer;
}

.carousel__dot.is-active {
    background: var(--accent);
}

.project-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.timeline-card h3,
.skill-card h3,
.project-card h3,
.contact-card h2 {
    margin-top: 0;
}

.timeline-card ul,
.project-card ul {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.timeline-card li,
.project-card li {
    padding-left: 1rem;
    position: relative;
}

.timeline-card li::before,
.project-card li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent);
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.chip-list li {
    padding: 0.65rem 0.9rem;
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--text);
    border: 1px solid var(--border);
}

.section--contact {
    padding-bottom: 6rem;
}

.contact-card {
    align-items: center;
    grid-template-columns: 1.5fr 1fr;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 0 2.5rem;
    color: var(--text-muted);
}

.back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 980px) {
    .hero,
    .about-grid,
    .timeline,
    .skills-grid,
    .portfolio-grid,
    .contact-card {
        grid-template-columns: 1fr;
    }

    .timeline-sub,
    .project-card--showcase {
        grid-template-columns: 1fr;
    }

    .project-card__media {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .carousel__viewport {
        max-height: 240px;
    }

    .hero {
        min-height: auto;
        padding-top: 2rem;
    }

    .hero__panel {
        margin: 0 0 1rem;
    }

    .hero__panel-photo {
        height: 260px;
        flex: none;
    }

    .site-header__inner {
        flex-wrap: wrap;
        padding: 0.85rem 0;
    }

    .about-grid__extras {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .site-nav {
        order: 3;
        width: 100%;
        justify-content: space-between;
        gap: 0.75rem;
        overflow-x: auto;
        padding-bottom: 0.25rem;
    }

    .site-header__inner,
    .section,
    .site-footer {
        width: min(calc(100% - 1.25rem), var(--max-width));
    }

    .section {
        padding: 4rem 0;
    }

    .hero h1 {
        max-width: none;
    }

    .site-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .about-grid__extras {
        grid-template-columns: 1fr;
    }
}