/* A card's own page (/card/<id>): one card filling the window, with a row of controls under it.
   Markup: Components/Pages/CardView.razor (the box) and wwwroot/js/xmas/player.js (everything in it). */

.cp-page {
    --cp-gold: #ffd76a;
    --cp-red: #c8102e;
    --cp-night: #0a1430;
    --cp-festive: "Mountains of Christmas", "Segoe Script", "Comic Sans MS", cursive;
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
    color: #fff;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background:
        radial-gradient(ellipse at 50% -10%, rgba(255, 215, 106, .18), transparent 55%),
        radial-gradient(ellipse at 50% 0, #1d3a7a, var(--cp-night) 62%, #050a1a);
}

/* ---------- the picture: as big as fits, its shape kept ---------- */
.cp-frame {
    display: grid;
    place-items: center;
    min-height: 0;
    padding: clamp(.5rem, 2vw, 1.25rem) clamp(.5rem, 2vw, 1.25rem) 0;
}

.cp-stage {
    position: relative;
    width: min(100%, calc((100dvh - 5.5rem) * var(--ar, 1.7778)));
    aspect-ratio: var(--ar, 1.7778);
    container-type: inline-size;
    border-radius: 12px;
    overflow: hidden;
    background: #0b1b4a;
    box-shadow: 0 0 0 3px var(--cp-gold), 0 14px 44px rgba(0, 0, 0, .6);
}

.cp-canvas,
.cp-canvas canvas { display: block; width: 100%; height: 100%; }

/* ---------- the cover: the card's words and the Play button ---------- */
.cp-cover {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: .6rem;
    padding: 6cqi;
    text-align: center;
    background:
        radial-gradient(circle at 50% 38%, rgba(255, 215, 106, .25), transparent 55%),
        linear-gradient(160deg, #b30f2a, #6d0a1c 70%, #3e0611);
}

.cp-cover[hidden] { display: none; }

/* while the card is being turned to the screen's shape (full screen), a note over the picture */
.cp-wait {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    padding: 1rem;
    text-align: center;
    font-weight: 700;
    color: var(--cp-gold);
    background: rgba(5, 10, 26, .82);
}
.cp-wait[hidden] { display: none; }

.cp-kicker {
    margin: 0;
    font-size: clamp(.75rem, 2.4cqi, 1.05rem);
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .8);
}

.cp-headline {
    margin: 0;
    font-family: var(--cp-festive);
    font-size: clamp(1.8rem, 9cqi, 5.5rem);
    font-weight: 700;
    line-height: 1.05;
    color: var(--cp-gold);
    text-shadow: 0 3px 0 #5a0715, 0 8px 24px rgba(0, 0, 0, .45);
    overflow-wrap: anywhere;
}

.cp-message {
    margin: 0 0 .6rem;
    max-width: 40ch;
    font-size: clamp(.95rem, 3.4cqi, 1.6rem);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.cp-play {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .7rem 1.6rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffe39a, var(--cp-gold));
    color: #5a0715;
    font: inherit;
    font-size: clamp(1rem, 3.2cqi, 1.45rem);
    font-weight: 800;
    box-shadow: 0 5px 0 #b8902a, 0 12px 26px rgba(0, 0, 0, .35);
    cursor: pointer;
}

.cp-play:hover,
.cp-play:focus-visible { transform: translateY(-1px); box-shadow: 0 6px 0 #b8902a, 0 14px 30px rgba(0, 0, 0, .4); }
.cp-play:disabled { opacity: .75; cursor: progress; transform: none; }

.cp-status { margin: 0; min-height: 1.3em; font-weight: 600; color: rgba(255, 255, 255, .85); }

/* ---------- the controls ---------- */
.cp-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
    padding: .75rem 1rem;
    transition: opacity .45s;
}

.cp-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .38rem 1rem;
    border: 2px solid rgba(255, 255, 255, .55);
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.cp-btn[hidden] { display: none; }
.cp-btn:hover,
.cp-btn:focus-visible { background: #fff; color: var(--cp-night); border-color: #fff; }

/* ---------- full screen: the picture edge to edge, the controls floating over it and fading when not wanted ---------- */
.cp-page.is-full { grid-template-rows: minmax(0, 1fr); background: #000; }
.cp-page.is-full .cp-frame { padding: 0; }
.cp-page.is-full .cp-stage { width: min(100vw, calc(100vh * var(--ar, 1.7778))); border-radius: 0; box-shadow: none; }

.cp-page.is-full .cp-controls {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100vw - 24px);
    padding: .45rem .6rem;
    border-radius: 999px;
    background: rgba(8, 14, 36, .74);
}

.cp-page.is-full.is-playing.is-idle { cursor: none; }
.cp-page.is-full.is-playing.is-idle .cp-controls { opacity: 0; pointer-events: none; }

/* ---------- a link that leads nowhere ---------- */
.cp-missing { place-items: center; grid-template-rows: auto; padding: 1rem; }
.cp-missing > p { font-weight: 600; opacity: .8; }

.cp-missing-box {
    max-width: 32rem;
    padding: 2rem 1.5rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, .08);
    box-shadow: 0 0 0 2px rgba(255, 215, 106, .5);
    text-align: center;
}

.cp-missing-box h1 { margin: 0 0 .8rem; font-family: var(--cp-festive); font-size: clamp(1.8rem, 6vw, 2.6rem); color: var(--cp-gold); }
.cp-missing-box p { line-height: 1.5; }
