/* Program themes change surfaces and decoration. The homepage stylesheet owns layout. */
.home-pearl[data-program-theme] {
    --pearl-paper: var(--theme-paper);
    --pearl-ink: var(--theme-ink);
    --pearl-quiet: var(--theme-quiet);
    --pearl-line: var(--theme-line);
    --pearl-accent: var(--theme-focus);
    color-scheme: var(--theme-scheme);
    background: var(--theme-pattern) center top / max(100%, 760px) auto no-repeat, var(--theme-sky), var(--theme-paper);
}

.home-pearl[data-program-theme="space"] {
    --theme-pattern: url('../images/pearl/space-sky.webp');
    --theme-halo: url('../images/pearl/space-halo.webp');
    --theme-scheme: dark;
    --theme-paper: #0b1229;
    --theme-sky:
        radial-gradient(ellipse 730px 490px at 85% 410px, #303574b8, transparent 85%),
        radial-gradient(ellipse 720px 340px at 17% 740px, #30356c7a, transparent 85%),
        radial-gradient(ellipse 670px 470px at 95% 1220px, #223763a6, transparent 83%),
        linear-gradient(148deg, #090f24 6%, #151a37 43%, #0d1730 74%, #0a1225);
    --theme-ink: #f3f6ff;
    --theme-quiet: #b7c2e3;
    --theme-text: #dce4fb;
    --theme-line: #8a9cdc39;
    --theme-focus: #97b4ff;
    --theme-heading: #b3c4ff;
    --theme-ribbon: linear-gradient(90deg, #78cdea, #a1b2ff 49%, #bc92f5);
    --theme-button: linear-gradient(115deg, #3452ac, #6045a9);
    --theme-button-hot: linear-gradient(115deg, #3a5ebf, #6850b2);
    --theme-card: #171e3a;
    --theme-card-edge: #8397db41;
    --theme-card-shadow: 0 12px 27px #0409145c;
    --theme-pill: #2b3769;
    --theme-pill-ink: #e0e8ff;
    --theme-invite: linear-gradient(107deg, #242b55, #242348 58%, #20365d);
    --theme-portrait-edge: #c9d5ff;
    --theme-portrait-shadow: 0 0 0 6px #8d9afa2b, 0 0 75px #5d77ff42;
    --theme-active-shadow: 0 0 0 2px #9ab6ff, 0 0 32px #6c8bfa65;
    --theme-film:
        radial-gradient(ellipse at 29% 17%, #fff9 0 2%, transparent 25%),
        radial-gradient(ellipse at 69% 83%, #6be0fc3b, transparent 48%),
        conic-gradient(from 180deg, #6b85dd8c, #abccfb46, #7665bf35, #b2a1f78f, #71a3eb56, #6b85dd8c);
    --theme-film-edge: #cddaffc2;
    --theme-film-cool: #86dcff96;
    --theme-film-warm: #ac98fbb8;
    --theme-film-shadow: inset 3px 5px 14px #d2deff7a, inset -4px -5px 14px #7d75ed86, 0 0 29px #8a9dfa48;
}

.home-pearl[data-program-theme="dream"] {
    --theme-pattern: url('../images/pearl/dream-sky.webp');
    --theme-halo: url('../images/pearl/dream-halo.webp');
    --theme-scheme: light;
    --theme-paper: #f6f5ed;
    --theme-sky:
        radial-gradient(ellipse 570px 420px at 14% 220px, #fff9e8d9, transparent 91%),
        radial-gradient(ellipse 610px 500px at 84% 400px, #b5dfc3cc, transparent 89%),
        radial-gradient(ellipse 620px 390px at 104% 800px, #f0cce467, transparent 86%),
        radial-gradient(ellipse 680px 420px at 12% 1210px, #cae7ceba, transparent 88%),
        radial-gradient(ellipse 730px 420px at 80% 1610px, #e8d6f3aa, transparent 86%),
        linear-gradient(154deg, #f9f5e9, #edf6ec 50%, #fbf6ef);
    --theme-ink: #244638;
    --theme-quiet: #4b695a;
    --theme-text: #36594a;
    --theme-line: #426d5638;
    --theme-focus: #397a5d;
    --theme-heading: #50856b;
    --theme-ribbon: linear-gradient(90deg, #8fc9a4, #a1c4af 30%, #dcc4a0 61%, #cf9bc9);
    --theme-button: linear-gradient(115deg, #245e49, #327455);
    --theme-button-hot: linear-gradient(115deg, #2a6a52, #397c5d);
    --theme-card: #fffdf6;
    --theme-card-edge: #b2c8b28a;
    --theme-card-shadow: 0 8px 26px #46644b16;
    --theme-pill: #eee7d2;
    --theme-pill-ink: #355847;
    --theme-invite: linear-gradient(108deg, #d9edda, #edf0d8 51%, #eadcf1);
    --theme-portrait-edge: #ffffef;
    --theme-portrait-shadow: 0 0 0 7px #fff6c75c, 0 0 62px #fff1b7a6, 0 15px 50px #4e815f44;
    --theme-active-shadow: 0 0 0 2px #5a9f7a, 0 0 30px #69ad8875;
    --theme-film:
        radial-gradient(ellipse at 28% 17%, #fffff4dd 0 2%, #fff7 8%, transparent 30%),
        radial-gradient(ellipse at 73% 83%, #ddffdfa8, transparent 48%),
        conic-gradient(from 201deg, #e7b0d36b, #f8e3ab95, #b9e9ccaa, #eed2ed7a, #fff4d991, #e7b0d36b);
    --theme-film-edge: #fffff0ed;
    --theme-film-cool: #bef3d3dc;
    --theme-film-warm: #efd3e8ed;
    --theme-film-shadow: inset 3px 5px 14px #fff9, inset -5px -7px 15px #e2b9d5a8, 0 5px 25px #e4c88945;
}

.home-pearl[data-program-theme="neon"] {
    --theme-pattern: url('../images/pearl/neon-sky.webp');
    --theme-halo: url('../images/pearl/neon-halo.webp');
    --theme-scheme: dark;
    --theme-paper: #120a19;
    --theme-sky:
        radial-gradient(ellipse 590px 490px at 94% 335px, #7d237466, transparent 91%),
        radial-gradient(ellipse 680px 340px at 12% 690px, #00717343, transparent 88%),
        radial-gradient(ellipse 720px 470px at 103% 1280px, #6c21685c, transparent 88%),
        radial-gradient(ellipse 490px 370px at 2% 1660px, #1d68533d, transparent 90%),
        linear-gradient(150deg, #130a1a 5%, #1a0d24 48%, #160e20 74%, #130b1b);
    --theme-ink: #fff3ff;
    --theme-quiet: #d3b4d9;
    --theme-text: #f0daed;
    --theme-line: #e98cec4a;
    --theme-focus: #f89ce7;
    --theme-heading: #f8a9ed;
    --theme-ribbon: linear-gradient(90deg, #66f9dc, #9b8cff 48%, #ff73e0);
    --theme-button: linear-gradient(115deg, #812798, #a32b8b);
    --theme-button-hot: linear-gradient(115deg, #9630af, #aa338d);
    --theme-card: #21132c;
    --theme-card-edge: #d17bd747;
    --theme-card-shadow: 0 12px 27px #09050e99;
    --theme-pill: #392147;
    --theme-pill-ink: #f9d7f2;
    --theme-invite: linear-gradient(109deg, #23323b, #322043 52%, #3f2149);
    --theme-portrait-edge: #ffd0fa;
    --theme-portrait-shadow: 0 0 9px #ffc8fb9e, 0 0 32px #ff72df68, 0 0 82px #9f49ff5e;
    --theme-active-shadow: 0 0 0 2px #ff96e9, 0 0 14px #ff61d9a1, 0 0 35px #d936d347;
    --theme-film:
        radial-gradient(ellipse at 28% 17%, #fff9 0 1%, #b4f3f76e 7%, transparent 28%),
        radial-gradient(ellipse at 73% 83%, #cb6be43b, transparent 48%),
        conic-gradient(from 180deg, #8a45b674, #61ffe332, #a04dba20, #ec5ace85, #9f73ff61, #8a45b674);
    --theme-film-edge: #ffe5ffd9;
    --theme-film-cool: #78ffeedb;
    --theme-film-warm: #ff85e7f0;
    --theme-film-shadow: inset 2px 4px 12px #6cffdf69, inset -5px -5px 15px #ff60e497, 0 0 23px #b557f286;
}

.home-pearl[data-program-theme] .pearl-brand > span,
.home-pearl[data-program-theme] .pearl-seasonal span,
.home-pearl[data-program-theme] .pearl-benefit svg { color: var(--theme-focus); }
.home-pearl[data-program-theme] .pearl-hero h1 em { color: var(--theme-heading); }
.home-pearl[data-program-theme] .pearl-hero h1 em::after,
.home-pearl[data-program-theme] .pearl-catalog-title::after,
.home-pearl[data-program-theme] .pearl-invite-rule { background: var(--theme-ribbon); }
.home-pearl[data-program-theme] .pearl-lead { color: var(--theme-text); }
.home-pearl[data-program-theme] .pearl-subactions,
.home-pearl[data-program-theme] .pearl-socials,
.home-pearl[data-program-theme] .pearl-card-caption { color: var(--theme-quiet); }
.home-pearl[data-program-theme] .pearl-subactions strong { color: var(--theme-ink); }
.home-pearl[data-program-theme] .pearl-subactions a,
.home-pearl[data-program-theme] .pearl-subactions > span,
.home-pearl[data-program-theme] .pearl-benefit + .pearl-benefit,
.home-pearl[data-program-theme] .pearl-invite-actions { border-color: var(--theme-line); }
.home-pearl[data-program-theme] .pearl-button,
.home-pearl[data-program-theme] .birthday-closing .btn,
.home-pearl[data-program-theme] #contact button { background: var(--theme-button); }
.home-pearl[data-program-theme] :is(.pearl-button, .birthday-closing .btn, #contact button):hover { background: var(--theme-button-hot); }
.home-pearl[data-program-theme] .pearl-visual { isolation: isolate; }
.home-pearl[data-program-theme] .pearl-visual::before {
    content: '';
    position: absolute;
    inset: -18%;
    z-index: 0;
    background: var(--theme-halo) center / contain no-repeat;
    pointer-events: none;
}
.home-pearl[data-program-theme] .pearl-portrait {
    position: relative;
    z-index: 1;
    border-color: var(--theme-portrait-edge);
    box-shadow: var(--theme-portrait-shadow);
}
.home-pearl[data-program-theme] .pearl-bubble {
    background: var(--theme-film);
    border-color: var(--theme-film-edge);
    box-shadow: var(--theme-film-shadow);
}
.home-pearl[data-program-theme] .pearl-bubble::before {
    border-top-color: var(--theme-film-edge);
    border-left-color: var(--theme-film-cool);
    border-right-color: var(--theme-film-warm);
    border-bottom-color: var(--theme-film-cool);
}
.home-pearl[data-program-theme] .pearl-card,
.home-pearl[data-program-theme] .pearl-program-panel,
.home-pearl[data-program-theme] .pearl-program-included,
.home-pearl[data-program-theme] #contact :is(input, textarea) {
    background: var(--theme-card);
    border-color: var(--theme-card-edge);
    color: var(--theme-ink);
}
.home-pearl[data-program-theme] .pearl-card { box-shadow: var(--theme-card-shadow); }
.home-pearl[data-program-theme] .pearl-card-price {
    color: var(--theme-pill-ink);
    background: var(--theme-pill);
}
.home-pearl[data-program-theme] .pearl-card-link { color: var(--theme-ink); border-color: var(--theme-card-edge); }
.home-pearl[data-program-theme] .pearl-card-link:hover {
    background: var(--theme-pill);
    border-color: var(--theme-focus);
}
.home-pearl[data-program-theme] .pearl-card:has(.pearl-card-link[aria-expanded="true"]) {
    border-color: var(--theme-focus);
    box-shadow: var(--theme-active-shadow);
}
.home-pearl[data-program-theme] .pearl-card-link[aria-expanded="true"] {
    color: white;
    background: var(--theme-button);
    border-color: transparent;
}
.home-pearl[data-program-theme] .pearl-invite { background: var(--theme-invite); box-shadow: inset 0 0 0 1px var(--theme-line); }
.home-pearl[data-program-theme] .home-version-switch {
    border-color: var(--theme-card-edge);
    background: var(--theme-card);
    color: var(--theme-quiet);
    box-shadow: var(--theme-card-shadow);
}

.home-pearl[data-program-theme] :is(.pearl-gallery-cover, .pearl-neon-cover) > span {
    background: var(--theme-card);
    color: var(--theme-ink);
}
.home-pearl[data-program-theme] .pearl-gallery-cover:hover > span { background: var(--theme-pill); }
.home-pearl[data-program-theme] #contact :is(input, textarea)::placeholder { color: var(--theme-quiet); }
.home-pearl[data-program-theme] .home-version-switch:hover {
    background: var(--theme-pill);
    color: var(--theme-ink);
    border-color: var(--theme-focus);
}
.home-pearl[data-program-theme] .home-version-switch:focus-visible { outline-color: var(--theme-focus); }

/* Let the existing details link respond anywhere on its card. */
.home-pearl.pearl-enhanced .pearl-card {
    position: relative;
    scroll-margin-top: 28px;
}
.home-pearl.pearl-enhanced .pearl-card-link::after {
    content: '';
    position: absolute;
    inset: 0;
}

.home-pearl.pearl-enhanced,
.home-pearl.pearl-enhanced :is(.pearl-button, .pearl-invite) {
    position: relative;
    isolation: isolate;
}

.home-pearl .pearl-theme-fade {
    display: none;
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
    .home-pearl.pearl-enhanced {
        --pearl-theme-duration: 560ms;
        transition: color var(--pearl-theme-duration) ease-in-out;
    }

    .home-pearl.pearl-enhanced :is(
        .pearl-brand > span, .pearl-seasonal > span, .pearl-hero h1 em, .pearl-lead,
        .pearl-subactions, .pearl-subactions > span, .pearl-subactions strong,
        .pearl-benefit svg, .pearl-socials, .pearl-portrait, .pearl-bubble, .pearl-card,
        .pearl-card-caption, .pearl-card-price, .pearl-card-link, .pearl-program-panel,
        .pearl-program-included, .pearl-price, .pearl-category, .pearl-invite,
        .pearl-invite-actions, .home-version-switch
    ) {
        transition-property: color, background-color, border-color, box-shadow;
        transition-duration: var(--pearl-theme-duration);
        transition-timing-function: ease-in-out;
    }

    .home-pearl.pearl-enhanced .pearl-bubble::before {
        transition: border-color var(--pearl-theme-duration) ease-in-out;
    }

    .home-pearl .pearl-theme-fade {
        display: block;
        animation: pearl-theme-fade var(--pearl-theme-duration) ease-in-out both;
    }
}

@keyframes pearl-theme-fade {
    from { opacity: 1; }
    to { opacity: 0; }
}
