/* ---------- Home: full-screen showreel ----------
   One screen over the looping showreel: pill navigation with the logo in the
   middle, the name split across the top, intro / play / reel on the middle line. */

/* Registered so the bar and its handle share one number, 0 until home.js sets it. */
@property --showreel-progress {
    syntax: "<number>";
    inherits: true;
    initial-value: 0;
}

.page-home {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100svh;
    color: var(--c-ink);
}

.page-home [hidden] {
    display: none !important;
}

.page-home :focus-visible {
    outline-color: var(--c-ink);
}

/* ---------- Background reel ---------- */
.hero-media {
    position: fixed;
    z-index: -1;
    inset: 0;
    overflow: hidden;
    background: #000000;
}

.hero-media__cover,
.hero-media__video {
    position: absolute;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    object-fit: cover;
}

/* Fades in over the cover (or the black) once its first frame plays. */
.hero-media__video {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.hero-media__video.is-playing {
    opacity: 1;
}

.hero-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at center, transparent 35%, rgb(0 0 0 / 0.65) 72%, #000000 100%),
        rgb(0 0 0 / 0.75);
}

.page-home .site-header {
    position: sticky;
    width: auto;
    background: none;
}

/* ---------- Hero layout ---------- */
.hero {
    container-type: inline-size;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto 1fr auto 1fr;
    grid-template-areas:
        "name  name  name"
        ".     .     ."
        "intro play  reel"
        ".     .     .";
    column-gap: 2rem;
    min-height: 0;
}

.hero__name {
    grid-area: name;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin: 1rem 0 0;
    font-family: var(--f-display);
    font-weight: 900;
    font-synthesis: none;
    font-size: clamp(3.5rem, 7.6cqi, 10rem);
    line-height: 0.86;
    text-transform: uppercase;
}

/* Small type on footage: a soft shadow keeps it legible on bright frames. */
.hero__intro,
.showreel,
.hero-footer {
    text-shadow: 0 1px 10px rgb(0 0 0 / 0.35);
}

.hero__intro {
    grid-area: intro;
    justify-self: start;
    display: grid;
    grid-template-columns: 8rem minmax(0, 15rem);
    align-items: start;
}

.hero__role {
    margin: 0;
    font: 700 1rem/1.25 var(--f-sans);
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.hero__bio {
    font-family: var(--f-sans);
    font-size: 0.8125rem;
    line-height: 1.4;
    text-transform: uppercase;
}

.hero__bio p {
    margin: 0;
    text-wrap: pretty;
}

.hero__more {
    display: inline-block;
    margin-top: 1.25rem;
}

/* ---------- Play: three nested pills ---------- */
.play {
    grid-area: play;
    position: relative;
    display: grid;
    place-items: center;
    width: 15rem;
    height: 4rem;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: none;
    color: inherit;
    font: 400 0.75rem/1 var(--f-sans);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.25s ease;
}

.play::before {
    content: "";
    position: absolute;
    inset: 0.625rem 2.75rem;
    border: 1px solid var(--line);
    border-radius: inherit;
    transition: inset 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.25s ease;
}

/* The one solid accent fill in the middle of the screen: the main action. */
.play__inner {
    display: grid;
    place-items: center;
    width: 4.75rem;
    height: 2.25rem;
    border-radius: 999px;
    background-color: var(--c-accent);
    color: var(--c-ink);
    transition: background-color 0.2s ease, color 0.2s ease, scale 0.15s ease;
}

/* Hover: the rings close in and take the accent, the core lightens. */
.play:hover,
.play:focus-visible,
.play:hover::before,
.play:focus-visible::before {
    border-color: var(--c-accent);
}

.play:hover::before,
.play:focus-visible::before {
    inset: 0.3125rem 1.5rem;
}

.play:hover .play__inner,
.play:focus-visible .play__inner {
    background-color: var(--c-accent-hi);
}

.play:active .play__inner {
    background-color: var(--c-text);
    color: var(--c-bg);
    scale: 0.95;
}

/* ---------- Reel: label and progress ---------- */
.showreel {
    grid-area: reel;
    justify-self: end;
    width: min(23rem, 100%);
    font-family: var(--f-sans);
    font-size: 0.8125rem;
    text-transform: uppercase;
}

.showreel__label {
    margin: 0 0 0.75rem;
    font-weight: 700;
}

/* --showreel-progress goes 0 → 1 over the showreel: home.js copies it from the
   video's running time every frame, back to 0 at each loop. */
.showreel__track {
    position: relative;
    height: 0.375rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--c-ink) 28%, transparent);
}

/* Clipped, not scaled: scaling would squash the rounded left end into a near-square. */
.showreel__bar {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--c-accent);
    clip-path: inset(0 calc(100% - var(--showreel-progress) * 100%) 0 0 round 999px);
}

/* Handle at the end of the bar. */
.showreel__track::after {
    content: "";
    position: absolute;
    top: 50%;
    left: calc(var(--showreel-progress) * 100%);
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 50%;
    background: var(--c-ink);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-accent) 55%, transparent);
    translate: -50% -50%;
}

/* ---------- Footer: the reel turns while the showreel plays ---------- */
.page-home:has(.showreel[data-state="playing"]) .hero-footer__mark::before {
    animation-play-state: running;
}

/* ---------- Player ---------- */
html:has(.player[open]) {
    overflow: hidden;
}

/* 16:9, leaving room above the film for the close button. */
.player {
    width: min(92vw, (100svh - 8rem) * 16 / 9);
    max-width: none;
    max-height: none;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
    opacity: 0;
    scale: 0.97;
    transition: opacity 0.3s ease, scale 0.3s ease, overlay 0.3s allow-discrete, display 0.3s allow-discrete;
}

.player[open] {
    opacity: 1;
    scale: 1;
}

@starting-style {
    .player[open] {
        opacity: 0;
        scale: 0.97;
    }
}

.player::backdrop {
    background: rgb(10 11 16 / 0);
    transition: background-color 0.3s ease, overlay 0.3s allow-discrete, display 0.3s allow-discrete;
}

.player[open]::backdrop {
    background: rgb(10 11 16 / 0.94);
}

@starting-style {
    .player[open]::backdrop {
        background: rgb(10 11 16 / 0);
    }
}

.player__frame {
    aspect-ratio: 16 / 9;
    background: black;
}

.player__frame > iframe,
.player__frame > video {
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
    border: 0;
    object-fit: contain;
}

/* Above the film, so it never covers YouTube's own controls. */
.player__close {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.75rem);
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--c-accent);
    color: var(--c-ink);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.player__close:hover {
    background: var(--c-accent-hi);
}

.player__close:active {
    background: var(--c-text);
    color: var(--c-bg);
}

.player__close svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

/* ---------- Medium screens: play on its own line ---------- */
@media (max-width: 69.99em) {
    .hero {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto 1fr auto 1fr auto;
        grid-template-areas:
            "name  name"
            ".     ."
            "play  play"
            ".     ."
            "intro reel";
    }

    .play {
        justify-self: center;
    }

    .showreel {
        align-self: end;
    }

    .hero__intro {
        grid-template-columns: 6.5rem minmax(0, 13.5rem);
    }
}

/* ---------- Small screens: one column ---------- */
@media (max-width: 47.99em) {
    .hero {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 2rem;
        padding-top: 0.5rem;
    }

    /* First name on the left, surname on the right of the next line. */
    .hero__name {
        flex-direction: column;
        /* "TUMBIOLO" is ~5.33em wide in Creato Display Black: 18.7cqi fills the column without clipping. */
        font-size: 18.7cqi;
    }

    .hero__last {
        align-self: flex-end;
    }

    .hero__intro {
        grid-template-columns: minmax(0, 18rem);
        row-gap: 0.75rem;
    }

    .play {
        align-self: center;
    }

    .showreel {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-media__video,
    .play::before,
    .player,
    .player::backdrop {
        transition-duration: 0.01s;
    }
}
