/* Promo popup: colours come from the theme variables, and each seasonal theme
   (body[data-theme]) gets its own entrance, background effect and title animation. */

@property --promo-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

.promo-popup {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    padding: 16px;
}

.promo-popup[hidden] {
    display: none;
}

.promo-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 3, 10, .74);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    opacity: 0;
    transition: opacity .45s ease;
}

.promo-card {
    position: relative;
    width: min(470px, 100%);
    padding: 40px 30px 26px;
    border-radius: 24px;
    text-align: center;
    color: var(--text-main);
    background:
        radial-gradient(ellipse at 50% -10%, color-mix(in srgb, var(--neon-cyan) 26%, transparent), transparent 60%),
        linear-gradient(165deg, color-mix(in srgb, var(--neon-blue) 16%, #050b18), #03070f 75%);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .65), 0 0 46px color-mix(in srgb, var(--neon-cyan) 22%, transparent);
    overflow: hidden;
    isolation: isolate;
    opacity: 0;
    transform: translateY(28px) scale(.9);
    transition: transform .6s cubic-bezier(.2, 1.35, .4, 1), opacity .4s ease;
}

/* Animated neon border. */
.promo-card::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: 2px;
    border-radius: inherit;
    background: conic-gradient(from var(--promo-angle), var(--neon-cyan), var(--neon-purple), var(--neon-blue), var(--neon-cyan));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: promoSpin 4s linear infinite;
    pointer-events: none;
    z-index: 2;
}

.promo-popup.is-open .promo-backdrop {
    opacity: 1;
}

.promo-popup.is-open .promo-card {
    opacity: 1;
    transform: none;
}

.promo-popup.is-closing .promo-card {
    transition: transform .4s ease-in, opacity .35s ease-in;
    transform: translateY(18px) scale(.94);
}

.promo-fx,
.promo-particles {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

/* Default: moving neon scanlines. */
.promo-fx {
    opacity: .35;
    background: repeating-linear-gradient(180deg, transparent 0 3px, color-mix(in srgb, var(--neon-cyan) 14%, transparent) 3px 4px);
    animation: promoScan 6s linear infinite;
}

.promo-particles span {
    position: absolute;
    bottom: -30px;
    left: var(--promo-left);
    font-size: 18px;
    opacity: 0;
    text-shadow: 0 0 14px currentColor;
    color: var(--neon-cyan);
    animation: promoFloat var(--promo-duration) linear var(--promo-delay) infinite;
}

.promo-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    width: 36px;
    height: 36px;
    border: 1px solid var(--panel-border-strong);
    border-radius: 50%;
    background: rgba(255, 255, 255, .05);
    color: var(--text-main);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: transform .3s ease, color .3s ease, border-color .3s ease;
}

.promo-close:hover,
.promo-close:focus-visible {
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    transform: rotate(90deg);
}

.promo-badge {
    display: inline-block;
    margin-bottom: 16px;
    padding: 6px 14px;
    border: 1px solid var(--panel-border-strong);
    border-radius: 999px;
    background: color-mix(in srgb, var(--neon-cyan) 10%, transparent);
    color: var(--neon-cyan);
    font-family: 'Montserrat', sans-serif;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    animation: promoBadge 2.4s ease-in-out infinite;
}

.promo-title {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(1.35rem, 5vw, 1.85rem);
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: .02em;
    text-transform: uppercase;
    animation: promoTitleIn .7s .25s both cubic-bezier(.2, 1.2, .4, 1);
}

.promo-hl {
    display: inline-block;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple), var(--neon-blue), var(--neon-cyan));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: promoShimmer 3s linear infinite;
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--neon-cyan) 45%, transparent));
}

.promo-sub {
    margin-top: 10px;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-main);
    animation: promoTitleIn .7s .4s both cubic-bezier(.2, 1.2, .4, 1);
}

.promo-sub .promo-hl {
    font-size: 1.5em;
}

.promo-claim {
    position: relative;
    display: inline-block;
    margin-top: 26px;
    padding: 17px 62px;
    border-radius: 999px;
    overflow: hidden;
    color: #fff;
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: .24em;
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .35);
    background: linear-gradient(90deg, var(--neon-purple), var(--neon-blue), var(--neon-cyan), var(--neon-purple));
    background-size: 300% 100%;
    animation: promoShimmer 3s linear infinite, promoPulse 1.8s ease-in-out infinite, promoTitleIn .7s .55s both cubic-bezier(.2, 1.2, .4, 1);
    transition: scale .25s ease, translate .25s ease;
}

.promo-claim::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
    transform: skewX(-20deg);
    animation: promoShine 2.6s ease-in-out infinite;
}

.promo-claim:hover,
.promo-claim:focus-visible {
    /* scale/translate, not transform: the entrance animation already owns "transform". */
    translate: 0 -2px;
    scale: 1.06;
    outline: none;
}

.promo-claim-text {
    position: relative;
    z-index: 1;
}

.promo-later {
    display: block;
    margin: 16px auto 0;
    border: 0;
    background: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: .9rem;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.promo-later:hover {
    color: var(--text-main);
}

/* ---- Halloween: swings in, flickering title, rising embers ---- */
body[data-theme="halloween"] .promo-card {
    transform: translateY(40px) rotate(-6deg) scale(.86);
    transform-origin: 50% 0;
}

body[data-theme="halloween"] .promo-popup.is-open .promo-card {
    animation: promoSwing 1.1s ease-out;
}

body[data-theme="halloween"] .promo-fx {
    opacity: .9;
    background:
        radial-gradient(circle, rgba(255, 160, 70, .9) 0 1px, transparent 2px) 0 0 / 60px 70px,
        radial-gradient(circle, rgba(255, 90, 40, .7) 0 2px, transparent 3px) 20px 30px / 110px 120px,
        radial-gradient(ellipse at 50% 120%, rgba(255, 110, 40, .25), transparent 60%);
    animation: promoEmbers 7s linear infinite;
}

body[data-theme="halloween"] .promo-title {
    animation: promoTitleIn .7s .25s both cubic-bezier(.2, 1.2, .4, 1), promoFlicker 4s 1.2s infinite;
}

/* ---- Winter: drops from above, frosty glow, snowfall ---- */
body[data-theme="winter"] .promo-card {
    transform: translateY(-60px) scale(.95);
    transition: transform .9s cubic-bezier(.16, 1.1, .3, 1), opacity .5s ease;
}

body[data-theme="winter"] .promo-fx {
    opacity: .85;
    background:
        radial-gradient(circle, rgba(255, 255, 255, .95) 0 1px, transparent 2px) 0 0 / 46px 52px,
        radial-gradient(circle, rgba(200, 236, 255, .8) 0 1.5px, transparent 3px) 17px 23px / 90px 96px;
    animation: promoSnow 9s linear infinite;
}

body[data-theme="winter"] .promo-title {
    text-shadow: 0 0 18px rgba(190, 235, 255, .55);
    animation: promoTitleIn .7s .25s both cubic-bezier(.2, 1.2, .4, 1), promoFrost 3.5s 1s ease-in-out infinite;
}

/* ---- Summer: bouncy pop, rotating sun rays ---- */
body[data-theme="summer"] .promo-card {
    transform: scale(.55);
    transition: transform .75s cubic-bezier(.3, 1.6, .5, 1), opacity .35s ease;
}

body[data-theme="summer"] .promo-fx {
    inset: -50%;
    opacity: .6;
    background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255, 220, 120, .16) 0 8deg, transparent 8deg 20deg);
    animation: promoRays 18s linear infinite;
}

body[data-theme="summer"] .promo-title {
    animation: promoTitleIn .7s .25s both cubic-bezier(.2, 1.2, .4, 1), promoBob 2.6s 1s ease-in-out infinite;
}

/* ---- Light mode ---- */
body[data-mode="light"] .promo-card {
    background:
        radial-gradient(ellipse at 50% -10%, color-mix(in srgb, var(--neon-cyan) 30%, transparent), transparent 60%),
        linear-gradient(165deg, #ffffff, color-mix(in srgb, var(--neon-blue) 8%, #f2f7ff));
    box-shadow: 0 30px 80px rgba(29, 64, 101, .3);
}

body[data-mode="light"] .promo-backdrop {
    background: rgba(20, 38, 58, .45);
}

body[data-mode="light"] .promo-close {
    background: rgba(0, 0, 0, .04);
}

/* ---- Keyframes ---- */
@keyframes promoSpin { to { --promo-angle: 360deg; } }
@keyframes promoScan { from { background-position: 0 0; } to { background-position: 0 120px; } }
@keyframes promoShimmer { from { background-position: 0% 50%; } to { background-position: 300% 50%; } }
@keyframes promoShine { 0%, 55% { left: -60%; } 100% { left: 130%; } }
@keyframes promoTitleIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes promoBadge { 0%, 100% { box-shadow: 0 0 0 transparent; } 50% { box-shadow: 0 0 18px color-mix(in srgb, var(--neon-cyan) 45%, transparent); } }
@keyframes promoPulse {
    0%, 100% { box-shadow: 0 0 22px color-mix(in srgb, var(--neon-cyan) 40%, transparent), 0 0 50px color-mix(in srgb, var(--neon-purple) 20%, transparent); }
    50% { box-shadow: 0 0 36px color-mix(in srgb, var(--neon-cyan) 65%, transparent), 0 0 80px color-mix(in srgb, var(--neon-purple) 35%, transparent); }
}
@keyframes promoFloat {
    0% { opacity: 0; transform: translateY(0) rotate(0deg); }
    15%, 80% { opacity: .55; }
    100% { opacity: 0; transform: translateY(-420px) rotate(160deg); }
}
@keyframes promoSwing {
    0% { transform: translateY(40px) rotate(-6deg) scale(.86); opacity: 0; }
    45% { transform: rotate(4deg); opacity: 1; }
    70% { transform: rotate(-2deg); }
    100% { transform: none; }
}
@keyframes promoEmbers { from { background-position: 0 0, 20px 30px, 0 0; } to { background-position: 0 -420px, 20px -330px, 0 0; } }
@keyframes promoFlicker {
    0%, 18%, 22%, 62%, 64%, 100% { opacity: 1; text-shadow: 0 0 16px rgba(255, 120, 40, .5); }
    20%, 63% { opacity: .55; text-shadow: none; }
}
@keyframes promoSnow { from { background-position: 0 0, 17px 23px; } to { background-position: 0 520px, 17px 600px; } }
@keyframes promoFrost { 0%, 100% { text-shadow: 0 0 10px rgba(190, 235, 255, .35); } 50% { text-shadow: 0 0 26px rgba(220, 245, 255, .85); } }
@keyframes promoRays { to { transform: rotate(360deg); } }
@keyframes promoBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

@media (max-width: 520px) {
    .promo-card { padding: 36px 18px 22px; }
    .promo-claim { padding: 15px 44px; font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
    .promo-card,
    .promo-backdrop { transition: opacity .2s ease !important; transform: none !important; }
    .promo-card::before,
    .promo-fx,
    .promo-particles span,
    .promo-badge,
    .promo-title,
    .promo-hl,
    .promo-sub,
    .promo-claim,
    .promo-claim::after { animation: none !important; }
}
