/* Home page: one black theatre. Title card -> sticky stage where the curtains part on the Silencio scene -> the ten
   most recently reviewed movies -> View All. Grade badge colors come from movies.css. */
:root {
    --night: #050405;
    --ink: #0d0b0d;
    --velvet: #7a0a14;
    --velvet-hi: #b3121f;
    --spot: #5a7bd6;
    --paper: #ece6dc;
    --dim: #8d8590;
    --marquee: "Cinzel", "Trajan Pro", "Times New Roman", serif;
    --display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
    --body: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
    color-scheme: dark;
}

.home {
    margin: 0;
    background: var(--night);
    color: var(--paper);
    font-family: var(--body);
    font-size: 15px;
    line-height: 1.55;
    overflow-x: hidden;
}

/* ---------- Title card ---------- */
.title-card {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100svh;
    padding-inline: 16px;
    text-align: center;
}

.title-card h1 {
    margin: 0;
    font-family: var(--marquee);
    font-weight: 900;
    font-size: clamp(2.6rem, 11vw, 9rem);
    line-height: .95;
    letter-spacing: .02em;
    text-wrap: balance;
    animation: fade-in 2s ease both;
}

.scroll-hint {
    position: absolute;
    bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    justify-items: center;
    gap: .75rem;
    font-family: var(--mono);
    font-size: .7rem;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: var(--dim);
    animation: fade-in 1s 1.6s ease both;
}

.scroll-hint::after {
    content: "";
    width: 1px;
    height: 2.5rem;
    background: linear-gradient(var(--dim), transparent);
    transform-origin: top;
    animation: drip 2s 3s ease-in-out infinite;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes drip { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

/* ---------- Stage: --p runs 0 -> 1 as you scroll through the track (set in home.html) ---------- */
.stage-track {
    position: relative;
    height: 260vh;
}

.stage {
    --p: 0;
    /* Curtains are fully open at --p = 0.7, when the video starts */
    --open: clamp(0, calc((var(--p) - .15) / .55), 1);
    position: sticky;
    top: 0;
    display: grid;
    place-items: center;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
}

.screen {
    position: relative;
    width: min(92vw, calc(82svh * 16 / 9));
    max-width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--ink);
    transform: scale(calc(.55 + .45 * var(--p)));
    /* Edges dissolve into the black instead of ending in a hard rectangle */
    --fade: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent),
            linear-gradient(to bottom, transparent, #000 16%, #000 84%, transparent);
    -webkit-mask-image: var(--fade);
    -webkit-mask-composite: source-in;
    mask-image: var(--fade);
    mask-composite: intersect;
}

/* The YouTube video is a 16:9 picture letterboxed inside 4:3. Sizing the player a little wider than the screen at 4:3
   pushes the black bars (and YouTube's title strip) outside the screen's edges. */
.player {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 104%;
    aspect-ratio: 4 / 3;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Tapping the video pauses and resumes it (see home.html); no visible controls */
.stage.playing .screen {
    cursor: pointer;
}

.player iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* The video's first frame, shown until the video is actually playing, so YouTube's cover image never shows */
.still {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 1.2s ease;
}

.stage.playing .still {
    opacity: 0;
}

/* Bottom middle of the viewport, below the video (inside the screen it would be caught by the edge fade) */
.sound-btn {
    position: absolute;
    left: 50%;
    bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 3;
    padding: .55rem .9rem;
    font: 500 .75rem/1 var(--body);
    letter-spacing: .04em;
    color: var(--paper);
    background: rgba(0, 0, 0, .55);
    border: 1px solid rgba(236, 230, 220, .25);
    border-radius: 999px;
    backdrop-filter: blur(6px);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .6s;
}

.stage.playing .sound-btn {
    opacity: 1;
    pointer-events: auto;
}

.sound-btn:hover {
    border-color: var(--paper);
}

.sound-btn:focus-visible {
    outline: 2px solid var(--spot);
    outline-offset: 3px;
}

.curtain {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 2;
    width: 51%;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, .55), transparent 20%, rgba(0, 0, 0, .35) 50%, transparent 70%, rgba(0, 0, 0, .5)) 0 0 / 14% 100%,
        linear-gradient(180deg, var(--velvet-hi), var(--velvet) 60%, #3d0409);
    box-shadow: inset 0 -40px 60px rgba(0, 0, 0, .6);
}

.curtain-left { left: 0; transform: translateX(calc(-102% * var(--open))); }
.curtain-right { right: 0; transform: translateX(calc(102% * var(--open))); }

/* ---------- Latest reviews ---------- */
.programme {
    max-width: 1180px;
    margin: 0 auto;
    padding-inline: 16px;
    padding-block: 8rem 4rem;
}

.programme-head {
    display: grid;
    gap: .5rem;
    margin-bottom: 3rem;
    text-align: center;
}

.eyebrow {
    font-family: var(--mono);
    font-size: .72rem;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: var(--dim);
}

.programme-head h2 {
    margin: 0;
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(2.2rem, 6vw, 4rem);
    line-height: 1;
    text-wrap: balance;
}

.programme-head h2 i {
    color: var(--velvet-hi);
}

.home-reviews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
    gap: 2.5rem 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Two across on phones, like the reviews page (movies.css) */
@media (max-width: 576px) {
    .home-reviews {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem;
    }
}

.home-review {
    min-width: 0;
    animation: rise .8s cubic-bezier(.2, .7, .2, 1) both;
    animation-timeline: view();
    animation-range: entry 0% entry 60%;
}

@keyframes rise { from { transform: translateY(40px); opacity: .2; } to { transform: none; opacity: 1; } }

.home-review a {
    display: grid;
    gap: .75rem;
    color: inherit;
    text-decoration: none;
    border-radius: 4px;
}

.home-review a:focus-visible {
    outline: 2px solid var(--spot);
    outline-offset: 4px;
}

.home-poster {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    padding: 1rem;
    background: linear-gradient(160deg, #1a1f4a, #000);
    border-radius: 3px;
    transition: transform .4s cubic-bezier(.2, .7, .2, 1), box-shadow .4s;
}

.home-review a:hover .home-poster {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .6);
}

.home-poster img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Shown when there's no poster image */
.home-poster-title {
    font-family: var(--display);
    font-size: 1.35rem;
    line-height: 1.05;
    text-wrap: balance;
}

.home-poster-year {
    margin-top: .35rem;
    font-family: var(--mono);
    font-size: .7rem;
    letter-spacing: .15em;
    color: var(--dim);
}

/* Grades sit in the poster's top-right corner, laid out like the reviews page (movies.css) */
.home-poster .grade-list {
    position: absolute;
    top: .6rem;
    right: .6rem;
    flex-wrap: nowrap;
}

.home-poster .grade {
    box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}

.home-poster .grade-initials {
    font-weight: 400;
    color: #f6f1ea;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .9);
}

.home-age {
    justify-self: end;
    font-family: var(--mono);
    font-size: .7rem;
    letter-spacing: .08em;
    color: var(--dim);
    white-space: nowrap;
}

.home-empty {
    text-align: center;
    color: var(--dim);
}

/* ---------- View All ---------- */
.exit {
    display: grid;
    justify-items: center;
    padding-inline: 16px;
    padding-block: 5rem calc(5rem + env(safe-area-inset-bottom, 0px));
}

.cta {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    padding: 1rem 2.4rem;
    font-family: var(--body);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: .04em;
    color: var(--paper);
    text-decoration: none;
    background: var(--velvet);
    border: 1px solid var(--velvet-hi);
    border-radius: 999px;
    transition: background .2s, box-shadow .3s, transform .2s;
}

.cta:hover {
    color: var(--paper);
    background: var(--velvet-hi);
    box-shadow: 0 0 40px 4px rgba(179, 18, 31, .35);
    transform: translateY(-1px);
}

.cta:focus-visible {
    outline: 2px solid var(--spot);
    outline-offset: 4px;
}

.cta span {
    transition: transform .2s;
}

.cta:hover span {
    transform: translateX(4px);
}

@media (prefers-reduced-motion: reduce) {
    .home *, .home *::before, .home *::after {
        animation: none !important;
        transition: none !important;
    }
}
