/* Hero holiday decorations. metroHolidayTheme.js sets <html data-holiday-theme="id"> from the user's
   UxPreferences.HolidayTheme and appends .metro-holiday-deco (decor layer, decorative only) and
   .metro-holiday-btn (picker) to every hero. Ids come from HolidayThemeCatalog; every id needs a
   rule here. Decor stays in the top band of the hero so it never sits on hero text. */

/* ---- Host + layer ---- */

:where(.pk-hero, .property-detail-hero, .fire-vbid-hero, .fire-notif-hero, .pc-hero, .insp-focus__hero, .insp-result__hero):has(> .metro-holiday-btn) {
    position: relative;
}

/* Compact status heroes: room for the garland above the first line of text. */
html[data-holiday-theme] .pk-hero:has(> .metro-holiday-deco) {
    padding-top: 1.2rem;
}

.metro-holiday-deco {
    display: none;
}

html[data-holiday-theme] .metro-holiday-deco {
    border-radius: inherit;
    display: block;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    position: absolute;
    z-index: 1;
}

html[data-holiday-theme] .metro-holiday-deco::before,
html[data-holiday-theme] .metro-holiday-deco::after {
    background-repeat: repeat-x;
    content: "";
    height: 18px;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.metro-holiday-deco__fx {
    display: none;
    pointer-events: none;
    position: absolute;
}

/* ---- Picker button ---- */

.metro-holiday-btn {
    align-items: center;
    background: color-mix(in srgb, currentColor 10%, transparent);
    border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
    border-radius: var(--radius-pill);
    bottom: 0.4rem;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.85rem;
    height: 1.65rem;
    justify-content: center;
    line-height: 1;
    opacity: 0.55;
    padding: 0;
    position: absolute;
    right: 0.4rem;
    transition: opacity 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
    width: 1.65rem;
    z-index: 3;
}

html[data-holiday-theme] .metro-holiday-btn {
    opacity: 0.9;
}

.metro-holiday-btn:hover,
.metro-holiday-btn:focus-visible,
.metro-holiday-btn[aria-expanded="true"] {
    background: color-mix(in srgb, currentColor 18%, transparent);
    opacity: 1;
    transform: scale(1.08);
}

.metro-holiday-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.metro-holiday-btn__glyph {
    font-size: 0.95rem;
    line-height: 1;
}

/* ---- Picker menu (appended to <body>) ---- */

.metro-holiday-menu {
    background: var(--metro-surface-float, var(--metro-surface));
    border: 1px solid var(--metro-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--metro-shadow-lg);
    color: var(--metro-text);
    display: flex;
    flex-direction: column;
    max-height: min(80vh, 32rem);
    max-width: calc(100vw - 16px);
    overflow: hidden;
    padding: 0.5rem;
    position: fixed;
    width: 17.5rem;
    z-index: var(--z-popover);
}

.metro-holiday-menu__title {
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem 0;
}

.metro-holiday-menu__hint {
    color: var(--metro-text-muted);
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem 0.4rem;
}

.metro-holiday-menu__list {
    display: grid;
    flex: 1 1 auto;
    gap: 1px;
    min-height: 0;
    overflow-y: auto;
}

.metro-holiday-menu__item {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: var(--radius-md);
    color: inherit;
    display: flex;
    font-size: 0.875rem;
    gap: 0.6rem;
    padding: 0.4rem 0.5rem;
    text-align: left;
    width: 100%;
}

.metro-holiday-menu__item:hover,
.metro-holiday-menu__item:focus-visible {
    background: var(--metro-surface-hover);
    outline: none;
}

.metro-holiday-menu__item[aria-checked="true"] {
    font-weight: 600;
}

.metro-holiday-menu__item:disabled {
    color: var(--metro-text-muted);
    cursor: default;
    opacity: 0.6;
}

.metro-holiday-menu__glyph {
    flex: 0 0 1.4rem;
    font-size: 1.05rem;
    text-align: center;
}

.metro-holiday-menu__label {
    flex: 1 1 auto;
}

.metro-holiday-menu__check {
    color: var(--metro-primary);
}

.metro-holiday-menu__sep {
    border-top: 1px solid var(--metro-border);
    margin: 0.4rem 0.25rem;
}

/* "Make it yours" sections: Holiday, Our city, Banner backdrop, Fun. */
.metro-holiday-menu__heading {
    color: var(--metro-text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 0.45rem 0.5rem 0.15rem;
    text-transform: uppercase;
}

a.metro-holiday-menu__item {
    text-decoration: none;
}

.metro-holiday-menu__label {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.metro-holiday-menu__sub {
    color: var(--metro-text-muted);
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.25;
}

.metro-holiday-menu__colors {
    display: flex;
    gap: 0.5rem;
    padding: 0.15rem 0.5rem 0.4rem 2.5rem;
}

.metro-holiday-menu__color {
    background: transparent;
    border: 1px solid var(--metro-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    height: 2.75rem;
    padding: 0.15rem;
    width: 3.5rem;
}

.metro-holiday-menu__color:focus-visible {
    outline: 2px solid var(--metro-primary);
    outline-offset: 2px;
}

/* ---- Theme palettes (inherited by hero accent bars and decor) ----
   A city's local celebration (data-holiday-theme="city-{id}") gets its three colors as inline
   --hd-c1..3 on <html> from metroHolidayTheme.js and uses the pennant bunting below. */

html[data-holiday-theme="new-year"] { --hd-c1: #f5c542; --hd-c2: #c0c7d2; --hd-c3: #d946ef; --hd-string: #b8962e; }
html[data-holiday-theme="lunar-new-year"] { --hd-c1: #dc2626; --hd-c2: #f5c542; --hd-c3: #b91c1c; --hd-string: #a16207; }
html[data-holiday-theme="valentines"] { --hd-c1: #e11d48; --hd-c2: #f9a8d4; --hd-c3: #fb7185; --hd-string: #be7a8c; }
html[data-holiday-theme="mardi-gras"] { --hd-c1: #7e22ce; --hd-c2: #16a34a; --hd-c3: #eab308; --hd-string: #8b7a3a; }
html[data-holiday-theme="st-patricks"] { --hd-c1: #15803d; --hd-c2: #86efac; --hd-c3: #eab308; --hd-string: #4d7c5a; }
html[data-holiday-theme="easter"] { --hd-c1: #f9a8d4; --hd-c2: #fde68a; --hd-c3: #a7f3d0; --hd-string: #b9a3c9; }
html[data-holiday-theme="independence-day"] { --hd-c1: #b91c1c; --hd-c2: #dbe4ef; --hd-c3: #1d4ed8; --hd-string: #7c8796; }
html[data-holiday-theme="halloween"] { --hd-c1: #f97316; --hd-c2: #1f1f1f; --hd-c3: #7e22ce; --hd-string: #6b5b4b; }
html[data-holiday-theme="thanksgiving"] { --hd-c1: #c2410c; --hd-c2: #92400e; --hd-c3: #eab308; --hd-string: #7c5a3a; }
html[data-holiday-theme="hanukkah"] { --hd-c1: #1d4ed8; --hd-c2: #cbd5e1; --hd-c3: #60a5fa; --hd-string: #7f8ea8; }
html[data-holiday-theme="christmas"] { --hd-c1: #d62828; --hd-c2: #f8fafc; --hd-c3: #15803d; --hd-string: #1e3a2a; }
html[data-holiday-theme="kwanzaa"] { --hd-c1: #b91c1c; --hd-c2: #111827; --hd-c3: #15803d; --hd-string: #6b5b4b; }

/* Dashboard heroes: holiday stripe instead of the flat accent bar. */
html[data-holiday-theme] .dash-v2-hero {
    --dash-hero-accent: repeating-linear-gradient(90deg, var(--hd-c1) 0 18px, var(--hd-c2) 18px 36px, var(--hd-c3) 36px 54px);
}

html[data-holiday-theme="christmas"] .dash-v2-hero {
    --dash-hero-accent: repeating-linear-gradient(45deg, #d62828 0 6px, #f8fafc 6px 12px);
}

/* ---- Pennant bunting (most holidays): string + three-colour triangles ---- */

html:is(
    [data-holiday-theme="valentines"],
    [data-holiday-theme="mardi-gras"],
    [data-holiday-theme="st-patricks"],
    [data-holiday-theme="easter"],
    [data-holiday-theme="independence-day"],
    [data-holiday-theme="halloween"],
    [data-holiday-theme="thanksgiving"],
    [data-holiday-theme="hanukkah"],
    [data-holiday-theme="kwanzaa"],
    [data-holiday-theme^="city-"]
) .metro-holiday-deco::before {
    background:
        linear-gradient(var(--hd-string), var(--hd-string)) 0 2px / 100% 1.5px no-repeat,
        conic-gradient(from -40deg at 9px 100%, var(--hd-c1) 0deg 80deg, transparent 80deg) 0 3px / 54px 11px repeat-x,
        conic-gradient(from -40deg at 27px 100%, var(--hd-c2) 0deg 80deg, transparent 80deg) 0 3px / 54px 11px repeat-x,
        conic-gradient(from -40deg at 45px 100%, var(--hd-c3) 0deg 80deg, transparent 80deg) 0 3px / 54px 11px repeat-x;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

/* ---- Christmas: twinkling string of lights + snow on the dark heroes ---- */

html[data-holiday-theme="christmas"] .metro-holiday-deco {
    background:
        linear-gradient(var(--hd-string), var(--hd-string)) 0 3px / 100% 1.5px no-repeat,
        linear-gradient(90deg, transparent 3px, var(--hd-string) 3px 6px, transparent 6px) 0 3px / 18px 4px repeat-x;
}

html[data-holiday-theme="christmas"] .metro-holiday-deco::before {
    animation: metro-holiday-twinkle 2.4s ease-in-out infinite;
    background:
        radial-gradient(3.2px 4.6px at 4.5px 11px, #ff9b9b 0 12%, #ff2d3a 40% 72%, transparent 100%) 0 0 / 72px 18px repeat-x,
        radial-gradient(3.2px 4.6px at 40.5px 11px, #ffe9a3 0 12%, #ffc21a 40% 72%, transparent 100%) 0 0 / 72px 18px repeat-x;
    filter: drop-shadow(0 0 3px rgba(255, 210, 120, 0.9));
}

html[data-holiday-theme="christmas"] .metro-holiday-deco::after {
    animation: metro-holiday-twinkle 2.4s ease-in-out -1.2s infinite;
    background:
        radial-gradient(3.2px 4.6px at 22.5px 11px, #9ff0bd 0 12%, #22c55e 40% 72%, transparent 100%) 0 0 / 72px 18px repeat-x,
        radial-gradient(3.2px 4.6px at 58.5px 11px, #a9d4ff 0 12%, #3b9bff 40% 72%, transparent 100%) 0 0 / 72px 18px repeat-x;
    filter: drop-shadow(0 0 3px rgba(150, 210, 255, 0.9));
}

html[data-holiday-theme="christmas"] :is(.dash-v2-hero, .portal-hero) > .metro-holiday-deco > .metro-holiday-deco__fx {
    animation: metro-holiday-fall 14s linear infinite;
    background:
        radial-gradient(1.6px 1.6px at 18px 22px, rgba(255, 255, 255, 0.9) 0 55%, transparent 100%),
        radial-gradient(1.2px 1.2px at 64px 74px, rgba(255, 255, 255, 0.8) 0 55%, transparent 100%),
        radial-gradient(2px 2px at 104px 44px, rgba(255, 255, 255, 0.85) 0 55%, transparent 100%),
        radial-gradient(1.4px 1.4px at 132px 100px, rgba(255, 255, 255, 0.75) 0 55%, transparent 100%),
        radial-gradient(1.8px 1.8px at 42px 108px, rgba(255, 255, 255, 0.8) 0 55%, transparent 100%);
    background-size: 150px 120px;
    display: block;
    inset: -120px 0 0 0;
    opacity: 0.55;
}

/* ---- New Year's: gold streamer, twinkling confetti, fireworks ---- */

html[data-holiday-theme="new-year"] .metro-holiday-deco::before {
    background: repeating-linear-gradient(135deg, var(--hd-c1) 0 6px, transparent 6px 12px, var(--hd-c2) 12px 18px, transparent 18px 24px) 0 0 / 100% 4px no-repeat;
}

html[data-holiday-theme="new-year"] .metro-holiday-deco::after {
    animation: metro-holiday-twinkle 1.8s ease-in-out infinite;
    background:
        radial-gradient(1.8px 1.8px at 10px 9px, var(--hd-c1) 0 70%, transparent 100%) 0 0 / 64px 18px repeat-x,
        radial-gradient(1.5px 1.5px at 28px 13px, var(--hd-c3) 0 70%, transparent 100%) 0 0 / 64px 18px repeat-x,
        radial-gradient(1.8px 1.8px at 44px 8px, var(--hd-c2) 0 70%, transparent 100%) 0 0 / 64px 18px repeat-x,
        radial-gradient(1.4px 1.4px at 56px 14px, #22d3ee 0 70%, transparent 100%) 0 0 / 64px 18px repeat-x;
}

/* ---- Lunar New Year: red lanterns ---- */

html[data-holiday-theme="lunar-new-year"] .metro-holiday-deco {
    background: linear-gradient(var(--hd-string), var(--hd-string)) 0 2px / 100% 1.5px no-repeat;
}

html[data-holiday-theme="lunar-new-year"] .metro-holiday-deco::before {
    animation: metro-holiday-sway 4s ease-in-out infinite;
    background:
        linear-gradient(90deg, transparent 11px, var(--hd-c2) 11px 13px, transparent 13px) 0 3px / 48px 3px repeat-x,
        radial-gradient(6px 5.5px at 12px 11px, #ff6b5e 0 25%, var(--hd-c1) 55% 82%, transparent 100%) 0 0 / 48px 18px repeat-x,
        linear-gradient(90deg, transparent 11.4px, var(--hd-c2) 11.4px 12.6px, transparent 12.6px) 0 16px / 48px 2px repeat-x;
    filter: drop-shadow(0 0 3px rgba(255, 120, 80, 0.7));
    transform-origin: 50% 0;
}

/* ---- Halloween: a spider dropping from the top edge ---- */

html[data-holiday-theme="halloween"] .metro-holiday-deco__fx {
    animation: metro-holiday-bob 3.2s ease-in-out infinite;
    background:
        linear-gradient(#9ca3af, #9ca3af) 50% 0 / 1px 62% no-repeat,
        radial-gradient(4px 3.4px at 50% 74%, #1f1f1f 0 78%, transparent 100%),
        radial-gradient(2.6px 2.4px at 50% 64%, #1f1f1f 0 78%, transparent 100%),
        linear-gradient(60deg, transparent 44%, #1f1f1f 44% 52%, transparent 52%) 50% 74% / 16px 8px no-repeat,
        linear-gradient(-60deg, transparent 44%, #1f1f1f 44% 52%, transparent 52%) 50% 74% / 16px 8px no-repeat;
    display: block;
    height: 30px;
    right: 3rem;
    top: 0;
    width: 16px;
}

/* ---- Fourth of July / New Year's: fireworks burst on the dark heroes ---- */

html:is([data-holiday-theme="independence-day"], [data-holiday-theme="new-year"]) :is(.dash-v2-hero, .portal-hero) > .metro-holiday-deco > .metro-holiday-deco__fx {
    --hd-burst: #ffd166;
    animation: metro-holiday-burst 3.6s ease-out infinite;
    background: repeating-conic-gradient(var(--hd-burst) 0deg 5deg, transparent 5deg 30deg);
    border-radius: 50%;
    display: block;
    height: 64px;
    mask: radial-gradient(circle, transparent 38%, #000 42% 62%, transparent 66%);
    right: 22%;
    top: 0.6rem;
    width: 64px;
    -webkit-mask: radial-gradient(circle, transparent 38%, #000 42% 62%, transparent 66%);
}

html[data-holiday-theme="independence-day"] :is(.dash-v2-hero, .portal-hero) > .metro-holiday-deco > .metro-holiday-deco__fx {
    --hd-burst: #ff6b6b;
}

/* ---- Motion ---- */

@keyframes metro-holiday-twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes metro-holiday-fall {
    to { transform: translateY(120px); }
}

@keyframes metro-holiday-sway {
    0%, 100% { transform: translateX(-1px); }
    50% { transform: translateX(1px); }
}

@keyframes metro-holiday-bob {
    0%, 100% { transform: translateY(-6px); }
    50% { transform: translateY(2px); }
}

@keyframes metro-holiday-burst {
    0% { opacity: 0; transform: scale(0.25); }
    15% { opacity: 0.6; }
    55% { opacity: 0; transform: scale(1.15); }
    100% { opacity: 0; transform: scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
    .metro-holiday-deco,
    .metro-holiday-deco::before,
    .metro-holiday-deco::after,
    .metro-holiday-deco__fx,
    .metro-holiday-btn {
        animation: none !important;
        transition: none !important;
    }
}

.metro-reduced-motion .metro-holiday-deco,
.metro-reduced-motion .metro-holiday-deco::before,
.metro-reduced-motion .metro-holiday-deco::after,
.metro-reduced-motion .metro-holiday-deco__fx {
    animation: none !important;
}

/* High contrast keeps the garland but drops the moving overlays. */
:is(.senior-high-contrast, .portal-high-contrast) .metro-holiday-deco__fx {
    display: none !important;
}

@media print {
    .metro-holiday-deco,
    .metro-holiday-btn,
    .metro-holiday-menu {
        display: none !important;
    }
}
