/* =============================================================================
   Next Edge Alliance — Inside the Room replay page (/replay)
   Ported from the approved replay developer kit (Andréa's design), with the same
   responsive fixes as the checkout page:
   - every size is fluid (clamp), and the video is limited by screen HEIGHT as well as width,
     so logo + video + "Take your seat." fit above the fold on laptops (1366×768, 1536×864 …);
   - the background art covers the screen without stretching (the kit stretched it to 100% × 100%);
   - title and play button scale with the video frame (container units), not the window.
   Everything is scoped under .rp-root so the checkout styles are untouched. No inline styles anywhere (strict CSP).
   ============================================================================= */

/* ---------- Fonts from the kit (variable WOFF, Latin subset; SIL Open Font License in ../assets/fonts) ----------
   Own family names so they never clash with the checkout's Inter / Playfair Display files. */
@font-face { font-family: "NEA Replay Playfair"; src: url("../assets/fonts/replay-playfair-display-latin-variable.woff") format("woff"); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: "NEA Replay Inter"; src: url("../assets/fonts/replay-inter-latin-variable.woff") format("woff"); font-weight: 100 900; font-style: normal; font-display: swap; }

/* ---------- Page tokens and the size system ---------- */
.rp-root {
    /* Kit palette */
    --rp-navy: #031225;
    --rp-ink: #061326;
    --rp-ivory: #f7f3ea;
    --rp-gold: #d4b25a;
    --rp-gold-light: #f3d28b;
    --rp-editorial: "NEA Replay Playfair", "Playfair Display", Georgia, serif;
    --rp-ui: "NEA Replay Inter", "Inter", Arial, sans-serif;

    /* Usable screen height (small-viewport units where supported, so mobile browser bars never hide the button) */
    --rp-vh: 100vh;

    /* Vertical rhythm: each piece follows width like the kit, but also shrinks on short screens */
    --rp-pad-top: clamp(20px, min(5.2vw, 5.5vh), 80px);
    --rp-logo-w: clamp(190px, min(30.5vw, 40vh), 444px);
    --rp-logo-h: calc(var(--rp-logo-w) * 0.184);            /* logo artwork is 864 × 159 */
    --rp-gap-logo: clamp(18px, min(3.7vw, 3.6vh), 54px);
    --rp-gap-cta: clamp(20px, min(4.2vw, 4vh), 60px);
    --rp-cta-h: clamp(58px, min(6.35vw, 9vh), 92px);
    --rp-cta-font: clamp(22px, min(3vw, 4.4vh), 44px);
    --rp-fold-room: clamp(16px, 3vh, 40px);                  /* breathing room under the button inside the first screen */
    --rp-pad-bottom: clamp(48px, 8vw, 124px);
    --rp-frame-radius: 18px;

    /* Everything above the fold that is not the video (the 4px is the frame's 2px border, twice) */
    --rp-reserved: calc(var(--rp-pad-top) + var(--rp-logo-h) + var(--rp-gap-logo) + 4px + var(--rp-gap-cta) + var(--rp-cta-h) + var(--rp-fold-room));

    /* Column (= video) width: the kit's 77.4% of the window up to 1240px,
       but never so tall (16:9) that the button drops below the fold; never narrower than 320px */
    --rp-col-w: 77.4vw;
    --rp-col: min(var(--rp-col-w), 1240px, max(min(320px, var(--rp-col-w)), calc((var(--rp-vh) - var(--rp-reserved)) * 16 / 9)));

    /* Full-screen page with the kit's art: covers the screen (never stretched), anchored to the golden floor */
    position: relative;
    min-height: 100vh;
    color: var(--rp-ivory);
    font-family: var(--rp-ui);
    background: var(--rp-navy) url("../assets/replay/page-background.webp") center bottom / cover no-repeat;
    -webkit-font-smoothing: antialiased;
}

/* Small-viewport units where supported (iOS/Android browser bars) */
@supports (height: 100svh) {
    .rp-root { --rp-vh: 100svh; min-height: 100svh; }
}

/* ---------- Column ---------- */
.rp-page {
    width: var(--rp-col);
    margin: 0 auto;
    padding: var(--rp-pad-top) 0 var(--rp-pad-bottom);
    /* On tall screens (phones, big monitors) the group sits in the middle instead of hanging at the top;
       where the content already fills the screen (laptops) this changes nothing */
    min-height: var(--rp-vh);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Logo: original transparent artwork, original proportions */
.rp-brand {
    width: var(--rp-logo-w);
    max-width: 100%;
    margin: 0 auto var(--rp-gap-logo);
}
.rp-brand img { display: block; width: 100%; height: auto; }

/* ---------- Video frame: strict 16:9, fine champagne outline ---------- */
.rp-shell {
    container-type: inline-size;                 /* title and play button size from the frame width */
    width: 100%;
    aspect-ratio: 16 / 9;
    position: relative;
    overflow: hidden;
    border: 2px solid var(--rp-gold-light);
    border-radius: var(--rp-frame-radius);
    background: #020c19;
    isolation: isolate;
}
.rp-poster, .rp-media, .rp-poster-art { position: absolute; inset: 0; }
.rp-poster { overflow: hidden; }
.rp-poster-art { display: block; pointer-events: none; }
.rp-poster-art img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* "Inside the Room": live text over the cover art, about 20.5% down the frame */
.rp-title {
    position: absolute;
    inset: 20.5% 0 auto;
    margin: 0;
    text-align: center;
    font-family: var(--rp-editorial);
    font-weight: 400;
    font-size: clamp(22px, 8.7cqi, 108px);       /* 108px on a 1240px frame, as in the kit */
    line-height: 1.15;
    letter-spacing: -0.035em;
    color: var(--rp-ivory);
    white-space: nowrap;
    pointer-events: none;
}

/* Play control: thin gold ring, ivory triangle, centre at 57.8% of the frame */
.rp-play {
    position: absolute;
    top: 57.8%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(50px, 12.1cqi, 150px);           /* 150px on a 1240px frame; never below a comfortable tap size */
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    padding: 0;
    border: clamp(2px, 0.25cqi, 3px) solid var(--rp-gold-light);
    border-radius: 50%;
    background: rgba(3, 18, 37, 0.28);
    color: var(--rp-ivory);
    cursor: pointer;
    appearance: none;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}
.rp-play svg { width: 51%; height: 51%; transform: translateX(-3%); display: block; }
.rp-play:hover:not(:disabled) { background: rgba(212, 178, 90, 0.13); border-color: var(--rp-ivory); }
.rp-play:disabled { opacity: 1; cursor: default; }
.rp-play:focus-visible { outline: 3px solid var(--rp-ivory); outline-offset: 8px; }

/* Player area (shown after the click) */
.rp-media { background: #000; }
.rp-video, .rp-embed { display: block; width: 100%; height: 100%; border: 0; object-fit: contain; background: #000; }
/* YouTube needs at least 200px of height while loading/playing (very narrow phones only) */
.rp-shell[data-provider="youtube"][data-state="loading"],
.rp-shell[data-provider="youtube"][data-state="playing"] { min-height: 200px; }

/* "Could not be loaded" message over the cover */
.rp-status {
    position: absolute;
    z-index: 3;
    bottom: 2%;
    left: 5%;
    right: 5%;
    margin: 0;
    padding: 12px 16px;
    border: 1px solid rgba(212, 178, 90, 0.55);
    border-radius: 8px;
    background: rgba(3, 18, 37, 0.95);
    font-size: clamp(14px, 1.5cqi, 18px);
    line-height: 1.4;
    text-align: center;
}

/* ---------- "Take your seat." — the kit's satin gold anchor ---------- */
.rp-action { display: flex; justify-content: center; margin-top: var(--rp-gap-cta); }
.rp-seat {
    /* About 55.6% of the video width as in the kit, but never cramped on narrow frames */
    width: min(620px, 100%, max(calc(var(--rp-col) * 0.556), 280px));
    min-height: var(--rp-cta-h);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 14px 24px;
    border: 1px solid #f0c577;
    border-radius: 14px;
    background: linear-gradient(108deg, #daa348 0%, #edc475 25%, #f2cf8a 42%, #dca649 73%, #e5b65e 100%);
    box-shadow: inset 0 1px 0 rgba(255, 244, 211, 0.6), inset 0 -2px 0 rgba(132, 81, 24, 0.25);
    /* Same typeface as the checkout page's "Take my seat" button: Playfair Display 600
       (the checkout's own font file, declared in checkout.css), normal letter spacing */
    font-family: "Playfair Display", Georgia, "Times New Roman", serif;
    font-size: var(--rp-cta-font);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: normal;
    text-decoration: none;
    text-align: center;
    color: var(--rp-ink);
    cursor: pointer;
    transition: filter 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
/* Fine brushed texture */
.rp-seat::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(255, 245, 215, 0.045) 0, rgba(255, 245, 215, 0.045) 1px, rgba(89, 49, 10, 0.025) 1px, rgba(89, 49, 10, 0.025) 2px);
    opacity: 0.7;
}
/* The checkout's global link hover colour must not recolour the button text */
.rp-seat:hover, .rp-seat:visited { color: var(--rp-ink); }
.rp-seat:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 250, 225, 0.8), inset 0 -2px 0 rgba(132, 81, 24, 0.18); }
.rp-seat:active { transform: translateY(1px); filter: brightness(0.97); }
.rp-seat:focus-visible { outline: 3px solid var(--rp-ivory); outline-offset: 6px; }

/* Visitors without JavaScript */
.rp-noscript { margin: 28px auto 0; max-width: 38rem; text-align: center; font-size: 16px; line-height: 1.5; }

/* ---------- Tablets and small laptops: wider column (kit: 86% below 900px) ---------- */
@media (max-width: 900px) {
    .rp-root { --rp-col-w: 86vw; }
}

/* ---------- Phones (kit: viewport minus 36px below 600px) ---------- */
@media (max-width: 600px) {
    .rp-root {
        --rp-col-w: calc(100vw - 36px);
        --rp-pad-top: 36px;
        --rp-logo-w: min(230px, 62vw);
        --rp-gap-logo: 32px;
        --rp-gap-cta: 28px;
        --rp-cta-h: 66px;
        --rp-cta-font: 26px;
        --rp-pad-bottom: 112px;
        --rp-frame-radius: 12px;
        /* Portrait phones: let the art fill the height and crop at the sides (kit direction) */
        background-size: auto 100%;
    }
    .rp-seat { width: 100%; border-radius: 10px; padding: 16px 20px; }
    .rp-status { font-size: 14px; padding: 7px 10px; bottom: 3%; }
}

/* Very small phones: the title must still fit on one line */
@media (max-width: 360px) {
    .rp-root { --rp-cta-font: 24px; }
}

/* ---------- Accessibility preferences ---------- */
@media (prefers-reduced-motion: reduce) {
    .rp-root *, .rp-root *::before, .rp-root *::after { transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
    .rp-seat, .rp-play { border: 2px solid ButtonText; }
    .rp-seat::after { display: none; }
    .rp-shell { border: 2px solid CanvasText; }
}
