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

:root {
    /* Swiss palette */
    --black: #111111;
    --dark: #222222;
    --grey: #666666;
    --grey-light: #999999;
    --grey-pale: #e8e8e8;
    --grey-wash: #f5f5f5;
    --white: #ffffff;
    --red: #e63225;

    /* Light mode */
    --bg: var(--white);
    --bg-elevated: var(--white);
    --bg-subtle: var(--grey-wash);
    --bg-hover: var(--grey-wash);
    --text: var(--black);
    --text-secondary: var(--grey);
    --text-muted: var(--grey-light);
    --border: var(--grey-pale);
    --border-light: var(--grey-pale);
    --accent: var(--red);
}

.dark {
    --bg: #0e0e0e;
    --bg-elevated: #181818;
    --bg-subtle: #1e1e1e;
    --bg-hover: #242424;
    --text: #e8e8e8;
    --text-secondary: #999999;
    --text-muted: #666666;
    --border: #2a2a2a;
    --border-light: #222222;
    --accent: #e63225;
}

@media (prefers-color-scheme: dark) {
    :root:not(.light) {
        --bg: #0e0e0e;
        --bg-elevated: #181818;
        --bg-subtle: #1e1e1e;
        --bg-hover: #242424;
        --text: #e8e8e8;
        --text-secondary: #999999;
        --text-muted: #666666;
        --border: #2a2a2a;
        --border-light: #222222;
        --accent: #e63225;
    }
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    transition: background-color 0.2s ease, color 0.2s ease;
}

::selection {
    background-color: var(--accent);
    color: var(--white);
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Header ─── */
.container {
    min-height: 100vh;
    padding-top: 60px;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.5rem;
    z-index: 100;
    transition: background-color 0.2s ease;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.name {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    white-space: nowrap;
    line-height: 1.2;
}

.title {
    font-size: 0.625rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.header-nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-link {
    padding: 0.375rem 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
    font-weight: 400;
    font-size: 0.8125rem;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.nav-link:hover {
    color: var(--text);
}

.nav-link.active {
    color: var(--text);
    font-weight: 500;
}

.dark .nav-link.active {
    color: var(--text);
}

@media (prefers-color-scheme: dark) {
    :root:not(.light) .nav-link.active {
        color: var(--text);
    }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.social-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.social-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem;
}

.social-links a:hover {
    color: var(--text);
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    width: 32px;
    height: 32px;
    border-radius: 0;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.15s ease, border-color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.theme-toggle:hover {
    color: var(--text);
    border-color: var(--text);
}

.sun-icon { display: block; }
.moon-icon { display: none; }
.dark .sun-icon { display: none; }
.dark .moon-icon { display: block; }

@media (prefers-color-scheme: dark) {
    :root:not(.light) .sun-icon { display: none; }
    :root:not(.light) .moon-icon { display: block; }
}
.light .sun-icon { display: block; }
.light .moon-icon { display: none; }

/* ─── Main Content ─── */
.main-content {
    overflow-y: visible;
    background-color: var(--bg);
    transition: background-color 0.2s ease;
}

.content-wrapper {
    max-width: 780px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

/* ─── Sections ─── */
.section {
    margin-bottom: 3.5rem;
}

.main-content .section {
    scroll-margin-top: 80px;
}

.section-title {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.6875rem;
    font-weight: 500;
    margin-bottom: 2rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.section-title::before {
    display: none;
}

.section-title::after {
    display: none;
}

.section-content {
    color: var(--text);
}

.section-content p {
    margin-bottom: 1.25rem;
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 300;
}

/* ─── About ─── */
.about-card {
    padding: 0;
    background-color: transparent;
    border: none;
    box-shadow: none;
}

.section-content .about-intro {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 1.75rem;
    font-weight: 300;
    color: var(--text);
    margin-bottom: 1.5rem;
    line-height: 1.4;
    letter-spacing: -0.02em;
}

.about-expandable {
    margin-top: 0.5rem;
}

.about-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    border-bottom: 1px solid var(--text-muted);
    border-radius: 0;
    padding: 0.25rem 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8125rem;
    color: var(--text-muted);
    transition: color 0.15s ease, border-color 0.15s ease;
    font-weight: 400;
    letter-spacing: 0.02em;
    box-shadow: none;
}

.about-toggle:hover {
    color: var(--text);
    border-color: var(--text);
    background: none;
    transform: none;
    box-shadow: none;
}

.about-toggle:active {
    transform: none;
    box-shadow: none;
}

.about-toggle-text {
    font-style: normal;
}

.about-toggle-icon {
    font-size: 0.75rem;
    font-weight: 300;
    font-style: normal;
    transition: transform 0.3s ease;
}

.about-expandable.expanded .about-toggle-icon {
    transform: rotate(45deg);
}

.about-expanded-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-top: 0;
}

.about-expandable.expanded .about-expanded-content {
    max-height: 2000px;
    opacity: 1;
    margin-top: 2rem;
}

.about-expanded-content p {
    font-size: 0.9375rem;
    line-height: 1.8;
    font-weight: 300;
}

.about-expanded-content p:last-child {
    margin-bottom: 0;
}

/* ─── Card Grid ─── */
.card-grid {
    display: grid;
    gap: 1px;
    background-color: var(--border);
}

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

.card {
    padding: 1.5rem;
    background-color: var(--bg);
    border: none;
    border-radius: 0;
    transition: background-color 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: none;
}

.card:hover {
    background-color: var(--bg-hover);
    transform: none;
    box-shadow: none;
}

.card-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 0;
    margin-bottom: 0.75rem;
}

.card-title {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0 0 0.25rem 0;
    color: var(--text);
}

.card-subtitle {
    font-size: 0.8125rem;
    font-weight: 300;
    margin: 0 0 0.5rem 0;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
}

.card-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 300;
}

/* ─── Table Rows (Career / Education) ─── */
.table-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.table-row {
    display: grid;
    grid-template-columns: 40px 90px 100px 1fr;
    column-gap: 1.5rem;
    padding: 1.25rem 0;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    align-items: center;
    background-color: transparent;
    transition: background-color 0.15s ease;
    box-shadow: none;
}

.table-row:first-child {
    border-top: none;
}

.table-row:hover {
    transform: none;
    box-shadow: none;
    background-color: transparent;
}

.table-row:last-child {
    border-bottom: 1px solid var(--border);
}

.table-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 0;
    justify-self: start;
    opacity: 0.85;
}

.table-title {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    justify-self: start;
    white-space: nowrap;
}

.table-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 300;
    justify-self: start;
    text-align: left;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.table-detail {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    justify-self: start;
    line-height: 1.5;
    font-weight: 300;
}

@media (max-width: 600px) {
    .table-row {
        grid-template-columns: 36px 1fr;
        gap: 0.25rem 1rem;
        padding: 1rem 0;
    }

    .table-logo { grid-row: span 3; width: 36px; height: 36px; }
    .table-date { grid-column: 2; }
    .table-title { grid-column: 2; }
    .table-detail { grid-column: 2; }
}

#experience .section-title,
#education .section-title {
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .card-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .card-grid-3,
    .card-grid-2 { grid-template-columns: 1fr; }
}

/* ─── Projects ─── */
.project-item {
    padding: 1.75rem;
    background-color: var(--bg);
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.15s ease;
    box-shadow: none;
}

.card-grid .project-item {
    border-bottom: none;
}

.project-title {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    margin: 0;
    color: var(--text);
}

.project-description {
    margin-bottom: 0;
    line-height: 1.75;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 300;
}

.project-tech {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tech-tag {
    background-color: transparent;
    color: var(--text-muted);
    padding: 0.125rem 0;
    border-radius: 0;
    font-size: 0.6875rem;
    font-weight: 400;
    border: none;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: color 0.15s ease;
}

.tech-tag:hover {
    color: var(--text);
    background-color: transparent;
    box-shadow: none;
}

/* ─── Miscellaneous ─── */
.misc-item {
    margin-bottom: 2.5rem;
}

.misc-item h3 {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--text);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1px;
    background-color: var(--border);
}

.skill-category {
    padding: 1.25rem;
    background-color: var(--bg);
    border-radius: 0;
    border: none;
    transition: background-color 0.15s ease;
    box-shadow: none;
}

.skill-category:hover {
    transform: none;
    box-shadow: none;
    background-color: var(--bg-hover);
}

.skill-category h4 {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.skill-category p {
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin: 0;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
}

/* ─── Strava ─── */
.strava-card {
    position: relative;
}

.strava-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.strava-link {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    transition: color 0.15s ease;
}

.strava-link:hover {
    color: var(--accent);
    border-color: transparent;
    background-color: transparent;
    box-shadow: none;
}

.strava-find-me {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
    letter-spacing: 0.02em;
}

.strava-find-me:hover {
    color: var(--accent);
}

/* ─── Footer ─── */
.site-footer {
    text-align: center;
    padding: 2.5rem;
    color: var(--text-muted);
    font-size: 0.6875rem;
    border-top: 1px solid var(--border);
    background-color: var(--bg);
    letter-spacing: 0.05em;
    font-weight: 300;
}

.site-footer p { margin: 0; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .site-header {
        padding: 0 1.25rem;
        height: 52px;
    }

    .container { padding-top: 52px; }
    .name { font-size: 1rem; }
    .header-nav { display: none; }
    .social-links { gap: 0.125rem; }

    .social-links a { padding: 0.25rem; }
    .social-links svg { width: 18px; height: 18px; }
    .theme-toggle { width: 28px; height: 28px; }
    .theme-toggle svg { width: 14px; height: 14px; }

    .content-wrapper { padding: 3rem 1.25rem; }
    .section { margin-bottom: 4rem; }
    .main-content .section { scroll-margin-top: 68px; }
    .section-content .about-intro { font-size: 1.375rem; }

    .project-item {
        padding: 1rem 1.25rem;
    }

    .project-item[data-gallery] .project-arrow {
        opacity: 1;
        margin-top: 0.5rem;
    }
}

/* ─── Buttons ─── */
.btn-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.25rem;
    border-radius: 0;
    font-size: 0.8125rem;
    font-weight: 400;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
    border: 1px solid var(--border);
    font-family: inherit;
    box-shadow: none;
    letter-spacing: 0.02em;
}

.btn-pill:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--text);
    color: var(--text);
}

.btn-pill:active {
    transform: none;
    box-shadow: none;
}

.btn-pill-primary {
    background-color: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.btn-pill-primary:hover {
    background-color: transparent;
    color: var(--text);
}

.btn-pill-secondary {
    background-color: transparent;
    color: var(--text);
}

.btn-pill-brand {
    background-color: var(--accent);
    color: var(--white);
    border-color: var(--accent);
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

/* ─── Project Gallery ─── */
.project-item[data-gallery] {
    cursor: pointer;
}

.project-item[data-gallery]:hover {
    transform: none;
    box-shadow: none;
    background-color: var(--bg-hover);
}

.project-title {
    margin-bottom: 0.5rem;
}

.project-arrow {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.6875rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.15s ease;
}

.project-item[data-gallery]:hover .project-arrow {
    opacity: 1;
    color: var(--text);
}

/* ─── Gallery Modal ─── */
.gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gallery-modal.active {
    opacity: 1;
    visibility: visible;
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.96);
}

.gallery-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.gallery-close {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0;
    color: #666;
    font-size: 1.125rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: all 0.15s ease;
    z-index: 10;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 300;
}

.gallery-close:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}

.gallery-title {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.6875rem;
    font-weight: 500;
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #999;
}

.filmstrip-wrapper {
    width: 100%;
    overflow: hidden;
    cursor: grab;
    padding: 2rem 0;
}

.filmstrip-wrapper:active { cursor: grabbing; }

.filmstrip {
    display: flex;
    gap: 1.5rem;
    padding: 0 calc(50vw - 300px);
    transition: transform 0.1s ease-out;
    will-change: transform;
}

.filmstrip-item {
    flex-shrink: 0;
    width: 600px;
    height: 70vh;
    max-height: 600px;
    border-radius: 0;
    overflow: hidden;
    opacity: 0.15;
    transform: scale(0.94);
    transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.3s ease;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.filmstrip-item.active {
    opacity: 1;
    transform: scale(1);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: none;
}

.filmstrip-item img,
.filmstrip-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
}

.filmstrip-item video {
    object-fit: contain;
    background: black;
}

.gallery-counter {
    margin-top: 1.5rem;
    color: #444;
    font-size: 0.75rem;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    letter-spacing: 0.1em;
}

.gallery-hint {
    position: absolute;
    bottom: 2rem;
    color: #333;
    font-size: 0.625rem;
    letter-spacing: 0.15em;
    opacity: 1;
    transition: opacity 0.5s ease;
    text-transform: uppercase;
    font-weight: 400;
}

.gallery-hint.hidden { opacity: 0; }

@media (max-width: 768px) {
    .filmstrip {
        gap: 1rem;
        padding: 0 calc(50vw - 140px);
    }

    .filmstrip-item {
        width: 280px;
        height: 50vh;
    }

    .gallery-close {
        top: 1rem;
        right: 1rem;
    }

    .gallery-title {
        margin-bottom: 1rem;
    }
}
