/* ==========================================================================
   Portfolio — Main Stylesheet
   ========================================================================== */

/* ── Reset & Base ─────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--color-background);
    color: var(--color-black);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

img {
    display: block;
    max-width: 100%;
}

/* ── Page wrapper ─────────────────────────────────────────────────────── */
.page {
    width: 100%;
    max-width: var(--content-max-width);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* ==========================================================================
   Header
   ========================================================================== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    max-width: var(--content-max-width);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px var(--content-padding);
    background: var(--color-header-transparent);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: inset 0 -1px 1px rgba(255, 255, 255, 0.6);
}

/* ── Logo ──────────────────────────────────────────────────────────────── */
.header__brand {
    display: flex;
    align-items: center;
}

.header__logo {
    width: 15px;
    height: 27px;
    flex-shrink: 0;
}

/* ── Navigation ───────────────────────────────────────────────────────── */
.header__nav {
    display: flex;
    align-items: center;
    gap: 40px;
}

.header__nav-link {
    font-size: var(--body3-size);
    font-weight: var(--body3-weight);
    line-height: var(--body3-line-height);
    letter-spacing: -0.0128px;
    color: var(--color-text-secondary);
    transition: color 0.2s ease;
    text-transform: capitalize;
}

.header__nav-link:hover {
    color: var(--color-black);
}

.header__nav-link--active {
    font-weight: var(--h6-weight);
    color: var(--color-black);
}

/* When the selected link changes, the new one fades from grey to black.
   main.js adds the class only when it differs from the previous page's. */
.header__nav-link--entering {
    animation: nav-link-select 0.4s ease;
}

@keyframes nav-link-select {
    from {
        color: var(--color-text-secondary);
    }
}

@media (prefers-reduced-motion: reduce) {
    .header__nav-link--entering {
        animation: none;
    }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
    width: 100%;
    padding: 120px var(--content-padding) 60px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.hero__heading {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hero__name {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.45px;
    color: var(--color-text-secondary);
}

.hero__title {
    font-size: var(--h1-size);
    font-weight: var(--h1-weight);
    line-height: var(--h1-line-height);
    letter-spacing: var(--h1-letter-spacing);
    color: var(--color-black);
}

.hero__description {
    font-size: var(--body1-size);
    font-weight: var(--body1-weight);
    line-height: var(--body1-line-height);
    letter-spacing: -0.02px;
    color: var(--color-text-secondary);
    max-width: 1030px;
}

/* ==========================================================================
   Project Cards
   ========================================================================== */
.projects {
    width: 100%;
    padding: 0 var(--content-padding) 80px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 60px var(--card-gap);
}

.card {
    display: flex;
    flex-direction: column;
    gap: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 300ms ease;
}

.card:hover {
    transform: translateY(-8px);
}

.card__image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 552 / 414;
    border-radius: var(--card-radius);
    overflow: hidden;
}

.card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--card-radius);
}

/* Crops in on artwork that has extra margin around the device */
.card__image--zoomed {
    transform: scale(1.23);
    border-radius: 0;
}

/* Plays over the thumbnail while the card is hovered */
.card__video {
    position: absolute;
    inset: -1px;
    width: calc(100% + 2px);
    height: calc(100% + 2px);
    max-width: none;
    object-fit: cover;
    opacity: 0;
    transition: opacity 300ms ease;
}

.card__video--visible {
    opacity: 1;
}

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

.card__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    white-space: nowrap;
}

.card__title {
    font-size: var(--h5-size);
    font-weight: var(--h5-weight);
    line-height: var(--h5-line-height);
    letter-spacing: var(--h5-letter-spacing);
    color: var(--color-black);
}

.card__year {
    font-size: var(--body3-size);
    font-weight: var(--body3-weight);
    line-height: var(--body3-line-height);
    letter-spacing: -0.0128px;
    color: var(--color-text-secondary);
}

.card__description {
    font-size: var(--body4-size);
    font-weight: var(--body4-weight);
    line-height: var(--body4-line-height);
    letter-spacing: var(--body4-letter-spacing);
    color: var(--color-text-secondary);
    height: 40px;
}

/* ==========================================================================
   Experience Section
   ========================================================================== */
.experience {
    width: 100%;
    padding: 70px 120px;
    overflow: hidden;
}

.experience__inner {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.experience__heading {
    font-size: var(--h3-size);
    font-weight: var(--h3-weight);
    line-height: var(--h3-line-height);
    letter-spacing: var(--h3-letter-spacing);
    color: var(--color-black);
    padding-bottom: 32px;
}

.experience__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 23px;
    border-bottom: 1px solid var(--color-divider);
    transition: transform 300ms ease;
    cursor: pointer;
}

.experience__row:hover {
    transform: translateY(-4px);
}

.experience__details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.experience__title {
    font-size: var(--h5-size);
    font-weight: var(--h5-weight);
    line-height: var(--h5-line-height);
    letter-spacing: var(--h5-letter-spacing);
    color: var(--color-black);
}

.experience__description {
    font-size: var(--body4-size);
    font-weight: var(--body4-weight);
    line-height: var(--body4-line-height);
    letter-spacing: var(--body4-letter-spacing);
    color: var(--color-text-secondary);
}

/* Same size as the years on the project cards */
.experience__year {
    font-size: var(--body3-size);
    font-weight: var(--body3-weight);
    line-height: var(--body3-line-height);
    letter-spacing: -0.0128px;
    color: var(--color-text-secondary);
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
    width: 100%;
    max-width: var(--content-max-width);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 64px var(--content-padding);
    height: 162px;
}

.footer--copyright {
    justify-content: space-between;
}

.footer__copyright {
    font-size: var(--body3-size);
    font-weight: var(--body3-weight);
    line-height: var(--body3-line-height);
    letter-spacing: var(--body3-letter-spacing);
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.footer__links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.footer__link {
    font-size: var(--body3-size);
    font-weight: var(--body3-weight);
    line-height: var(--body3-line-height);
    letter-spacing: var(--body3-letter-spacing);
    color: var(--color-footer-link);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.footer__link:hover {
    color: var(--color-black);
}

/* ==========================================================================
   Scroll-reveal Animation
   ========================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal--visible {
    opacity: 1;
    transform: translateY(0);
}

/* Once the reveal animation finishes, switch to the fast hover transition */
.card.reveal--visible,
.experience__row.reveal--visible {
    transition: transform 300ms ease;
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ==========================================================================
   Tablet / Portrait — max-width: 1279px
   Switches to single-column the moment the viewport is narrower than the
   desktop container, so cards never shrink.
   ========================================================================== */
@media (max-width: 1279px) {
    /* Tablet: full width, like the About page */
    .page {
        max-width: none;
    }

    /* 64px sides so the logo and links line up with the content */
    .header {
        max-width: none;
        padding: 24px 64px;
    }

    .footer {
        max-width: none;
        padding: 64px;
    }

    .header__nav {
        gap: 32px;
    }

    .hero {
        padding: 198px 64px 48px;
    }

    .hero__description {
        max-width: none;
        font-size: 18px;
        letter-spacing: -0.0162px;
    }

    .projects {
        grid-template-columns: 1fr;
        gap: 48px;
        padding: 0 64px 32px;
    }

    .card {
        gap: 16px;
    }

    .card__title {
        font-size: 18px;
        letter-spacing: -0.0648px;
    }

    .card__description {
        font-size: 16px;
        height: auto;
    }

    .experience {
        padding: 104px 64px 48px;
    }

    .experience__heading {
        font-size: 30px;
        letter-spacing: -0.18px;
    }

    .experience__description {
        font-size: 16px;
    }

    .footer {
        padding: 64px;
    }
}

/* ==========================================================================
   Mobile — max-width: 799px
   ========================================================================== */
@media (max-width: 799px) {
    /* Phones: full width with 24px sides, like the About page */
    .page {
        max-width: none;
    }

    .header {
        max-width: none;
        padding: 24px;
    }

    .footer {
        max-width: none;
        padding: 64px 24px;
    }

    .header__nav {
        gap: 24px;
    }

    .hero {
        padding: 80px 24px 40px;
    }

    .hero__title-line {
        display: block;
    }

    .projects {
        padding: 0 24px 32px;
        gap: 40px;
    }

    .experience {
        padding: 72px 24px 16px;
    }

    .experience__heading {
        font-size: 26px;
        letter-spacing: -0.1352px;
    }

    .experience__title {
        font-size: 18px;
        letter-spacing: -0.0648px;
    }

    .footer {
        padding: 64px 24px;
    }
}