/* Styles for index.html, on top of base.css. */


/* ==========================================================================
   1. HERO
   ========================================================================== */
#hero {
    --hero-rotate-time: 8s;
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: center;
    gap: clamp(2rem, 3.6vw, 4.8rem);
    padding: 4rem var(--page-gutter) 1.4rem;
}
.hero-intro,
.hero-showcase {
    position: relative;
    z-index: 1;   /* above the backdrop */
}

/* Left column */
.hero-intro {
    display: grid;
    gap: 1.4rem;
    align-content: center;
}
.hero-name {
    margin: 0;
    font: 700 clamp(3.4rem, 5vw, 5.8rem)/1.02 var(--font-display);
    letter-spacing: -.025em;
    text-wrap: balance;
}
.hero-title {
    width: fit-content;
    margin: 0;
    font: 500 clamp(1.7rem, 2vw, 2.2rem)/1.3 var(--font-display);
    background-image: var(--gradient-title);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.hero-skills {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
}
.hero-links {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin-top: .8rem;
}

/* Right column: stage */
.hero-stage {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid var(--color-line);
    border-radius: 1.4rem;
    background-color: var(--color-surface);
}
.hero-stage-link {
    position: absolute;
    inset: 0;
    display: block;
}
.hero-stage-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hero-stage-caption {
    position: absolute;
    inset: auto 0 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.6rem;
    padding: 7rem 2rem 1.6rem;
    background-image: linear-gradient(transparent, rgba(0, 0, 0, .88));
    pointer-events: none;   /* clicks on the caption go through to the video link */
}
.hero-stage-title {
    margin: 0;
    color: var(--color-text);
    font: 600 clamp(1.8rem, 2.2vw, 2.6rem)/1.1 var(--font-display);
    letter-spacing: -.01em;
}
.hero-stage-blurb {
    margin: .5rem 0 0;
    color: rgba(255, 255, 255, .82);
    font-size: 1.4rem;
    line-height: 1.4;
}
.hero-stage-button {
    flex: none;
    pointer-events: auto;
}
.hero-stage-toggle {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 3.4rem;
    height: 3.4rem;
    padding: 0;
    border: 1px solid var(--color-line);
    border-radius: 50%;
    background-color: rgba(21, 18, 16, .6);
    color: var(--color-text);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}
.hero-stage-toggle:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}
.hero-stage-toggle .icon {
    width: 1.3rem;
    height: 1.3rem;
}
.hero-stage-toggle-play,
.is-paused-by-visitor .hero-stage-toggle-pause {
    display: none;
}
.is-paused-by-visitor .hero-stage-toggle-play {
    display: block;
}

/* Right column: rail */
.hero-rail {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .6rem;
    margin-top: .8rem;
}
.hero-rail-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    padding: 0;
    border: 0;
    border-radius: .5rem;
    background-color: var(--color-surface);
    opacity: .5;
    cursor: pointer;
    transition: opacity .2s ease;
}
.hero-rail-thumb:hover {
    opacity: .85;
}
.hero-rail-thumb.is-active {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
    opacity: 1;
}
.hero-rail-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hero-rail-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: .3rem;
    background-image: var(--gradient-title);
}
.hero-rail-thumb.is-active .hero-rail-progress {
    animation: hero-rail-progress var(--hero-rotate-time) linear forwards;
}
/* The selector is as specific as the rule above, otherwise that rule's animation would win */
.is-rotation-paused .hero-rail-thumb.is-active .hero-rail-progress {
    animation-play-state: paused;
}
.is-static .hero-rail-progress {
    display: none;
}
@keyframes hero-rail-progress {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* Background */
.hero-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(#000 62%, transparent 100%);
    mask-image: linear-gradient(#000 62%, transparent 100%);
}
.hero-backdrop-grid,
.hero-backdrop-glow {
    position: absolute;
    inset: 0;
    transition: opacity 500ms ease;
}
.hero-backdrop-grid {
    background-image:
        linear-gradient(rgba(255, 235, 220, .19) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 235, 220, .19) 1px, transparent 1px);
    background-size: 3.6rem 3.6rem;
    -webkit-mask-image: linear-gradient(#000 15%, transparent 95%);
    mask-image: linear-gradient(#000 15%, transparent 95%);
}
.hero-backdrop-glow {
    opacity: 0;
    background-image:
        radial-gradient(64rem 34rem at 6% 0%, color-mix(in srgb, #ff7a1a 54%, transparent), transparent 70%),
        radial-gradient(64rem 36rem at 100% 30%, color-mix(in srgb, var(--color-accent-2) 47%, transparent), transparent 70%);
}

/* Phone layout */
@media (max-width: 760px) {
    #hero {
        grid-template-columns: 1fr;
    }
    .hero-stage-caption {
        padding: 4rem 1.2rem 1.2rem;
    }
    .hero-stage-blurb {
        display: none;
    }
    .hero-backdrop-grid {
        opacity: 0;
    }
    .hero-backdrop-glow {
        opacity: 1;
    }
}
@media (prefers-reduced-motion: reduce) {
    .hero-backdrop-grid,
    .hero-backdrop-glow {
        transition: none;
    }
}


/* ==========================================================================
   2. PROJECTS
   ========================================================================== */
#projects {
    scroll-margin-top: var(--nav-height);
}
#project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 30rem), 1fr));
    gap: 1.8rem;
}
.project-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-card);
    background-color: var(--color-surface);
    scroll-margin-top: calc(var(--nav-height) + 1.6rem);
    position: relative;   /* the hover lift moves the card with top, not transform, so its text stays sharp */
    top: 0;
    transition: top .25s ease-out, border-color .25s ease-out, box-shadow .25s ease-out;
}
.project-card:hover {
    top: -3px;   /* px on purpose: .3rem is 3.6px at some widths, and a fractional offset blurs the text */
    border-color: color-mix(in srgb, var(--color-accent-2) 70%, transparent);
    box-shadow: 0 1.2rem 4rem -1.4rem color-mix(in srgb, var(--color-accent-2) 30%, transparent);
}

/* Card image */
.project-card-image {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}
.project-card-image a {
    display: block;
    height: 100%;
}
.project-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    will-change: transform;   /* keeps the image on its own layer so the zoom does not jump at its start and end */
    transition: transform .25s ease-out;   /* the same time as the card, so both stop together */
}
.project-card:hover .project-card-image img {
    transform: scale(1.05);
}
.project-card-image .tag-pill-kind,
.project-card-image .tag-pill-published {
    position: absolute;
    top: 1rem;
    z-index: 1;
    pointer-events: none;   /* clicks go through to the image link */
}
.project-card-image .tag-pill-kind {
    left: 1rem;
}
.project-card-image .tag-pill-published {
    right: 1rem;
}
.tag-pill-keywords {
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin: 0;
    padding: 0;
    list-style: none;
    pointer-events: none;   /* clicks go through to the image link */
}

/* Card body */
.project-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.4rem 1.6rem 1.6rem;
}
.project-card-title {
    margin: 0 0 .6rem;
    font: 600 1.7rem/1.25 var(--font-display);
}
.project-card-blurb {
    margin: 0 0 1.4rem;
    color: var(--color-text-muted);
    font-size: 1.4rem;
    line-height: 1.45;
}
.project-card-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: .8rem;
    margin-top: auto;
}
.project-card .button {
    padding: .8rem 1.2rem;
    font-size: 1.3rem;
}

@media (prefers-reduced-motion: reduce) {
    .project-card:hover {
        top: 0;
    }
    .project-card:hover .project-card-image img {
        transform: none;
    }
}


/* ==========================================================================
   3. ABOUT
   ========================================================================== */
#about {
    scroll-margin-top: var(--nav-height);
}
.about-layout {
    display: grid;
    grid-template-columns: 21rem minmax(0, 1fr);
    align-items: start;
    gap: 3.6rem;
}
.about-photo {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border: 1px solid var(--color-line);
    border-radius: 2rem;
}
.about-text {
    max-width: 66ch;
    margin: 0 0 3rem;
    font-size: 1.7rem;
    line-height: 1.65;
}

/* Spec sheet */
.spec-sheet {
    margin: 0;
    border-top: 1px solid var(--color-line);
}
.spec-row {
    display: grid;
    grid-template-columns: 18rem minmax(0, 1fr);
    align-items: center;
    gap: 1.4rem;
    padding: 1.4rem 0;
    border-bottom: 1px solid var(--color-line);
}
.spec-label {
    color: var(--color-accent);
    font: 600 1.25rem/1.3 var(--font-mono);
    letter-spacing: .08em;
    text-transform: uppercase;
}
.spec-row dd {
    margin: 0;
}
.spec-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.spec-text {
    margin: 0;
    font-size: 1.45rem;
}

/* Tablet layout */
@media (max-width: 960px) {
    .about-layout {
        grid-template-columns: clamp(12rem, 24vw, 21rem) minmax(0, 1fr);
    }
    .spec-row {
        grid-template-columns: 1fr;
        gap: .8rem;
    }
}
/* Phone layout */
@media (max-width: 760px) {
    .about-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .about-photo {
        width: 13rem;
    }
}


/* ==========================================================================
   4. LARGE SCREENS (1500px and wider, then 2400px and wider)
   ========================================================================== */
@media (min-width: 1500px) {
    /* Hero */
    #hero {
        grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    }
    .hero-rail {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
    }
    .hero-name {
        font-size: 6.6rem;
    }
    .hero-title {
        font-size: 2.5rem;
    }
    .hero-stage-title {
        font-size: 2.8rem;
    }

    /* Projects */
    #project-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    /* About */
    .about-layout {
        grid-template-columns: 34rem minmax(0, 1fr);
        gap: 4.8rem;
    }
    .about-body {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: start;
        gap: 4rem;
    }
    .about-text {
        max-width: none;
        margin: 0;
        font-size: 1.55rem;
    }
    .spec-row {
        grid-template-columns: 1fr;
        gap: .8rem;
    }
}
@media (min-width: 2400px) {
    .about-layout {
        grid-template-columns: 42rem minmax(0, 1fr);
    }
}
