/* Christmas is opt-in; status colours and light/dark preferences stay semantic. */
body.account-themed.authenticated[data-account-theme="christmas"] {
    --rh-page-bg: #edf3ed;
    --rh-surface-panel: rgba(255, 253, 246, 0.96);
    --rh-surface-solid: #fffdf6;
    --rh-surface-sunken: #f2f5ee;
    --rh-surface-feature: linear-gradient(135deg, #fffdf6, #e6f2e8);
    --rh-border: #a8c3ad;
    --rh-divider: rgba(20, 96, 68, 0.16);
    --rh-text-primary: #153d30;
    --rh-text-secondary: #466052;
    --rh-shadow-panel: 0 14px 42px rgba(19, 67, 46, 0.12), 0 1px 0 rgba(213, 170, 83, 0.3);
    --lg-surface-feature-bg: linear-gradient(150deg, #fffdf6, #e2f0e5);
    --lg-surface-data-bg: linear-gradient(155deg, #f7f7ed, #e7eee4);
    --lg-thead-bg: #e4eee2;
    --account-btn-gradient: linear-gradient(135deg, #a51d38, #81162c);
    --account-btn-gradient-hover: linear-gradient(135deg, #8c1930, #691226);
    background: radial-gradient(ellipse at 12% 0%, rgba(213, 170, 83, 0.2), transparent 45%),
        radial-gradient(ellipse at 95% 85%, rgba(165, 29, 56, 0.09), transparent 48%), var(--rh-page-bg) !important;
}
body.account-themed.authenticated.dark-mode[data-account-theme="christmas"] {
    --rh-page-bg: #081c17;
    --rh-surface-panel: rgba(19, 45, 36, 0.96);
    --rh-surface-solid: #142e25;
    --rh-surface-sunken: #0e241d;
    --rh-surface-feature: linear-gradient(135deg, #1d3d2e, #21372d);
    --rh-border: #49684d;
    --rh-divider: rgba(156, 225, 190, 0.18);
    --rh-text-primary: #f6f5e9;
    --rh-text-secondary: #c3d6c7;
    --rh-shadow-panel: 0 18px 48px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(213, 170, 83, 0.3);
    --lg-surface-feature-bg: linear-gradient(150deg, #223f30, #142e25);
    --lg-surface-data-bg: linear-gradient(155deg, #193529, #10271f);
    --lg-thead-bg: #1d3d2e;
    --account-btn-gradient: linear-gradient(135deg, #a51d38, #81162c);
    --account-btn-gradient-hover: linear-gradient(135deg, #8c1930, #691226);
}
body.account-themed.authenticated[data-account-theme="christmas"] .ambient-mesh { opacity: 0.25; }
body.account-themed.authenticated[data-account-theme="christmas"] .navbar[data-nav-surface] {
    --nav-ink: #102843;
    --nav-ink-hover: #061b32;
    --nav-active-ink: #061b32;
    --nav-veil: linear-gradient(105deg, rgba(239, 250, 255, 0.97), rgba(219, 236, 255, 0.97) 68%, rgba(226, 217, 255, 0.98));
    --nav-border: rgba(139, 179, 215, 0.55);
    --nav-hover-bg: rgba(255, 255, 255, 0.6);
    --nav-active-bg: rgba(164, 191, 235, 0.3);
    --nav-focus: #1d5aa2;
    border: 1px solid rgba(139, 179, 215, 0.55);
    border-radius: 999px !important;
    box-shadow: 0 8px 26px rgba(62, 96, 153, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
    padding: 1rem 0.65rem;
}
body.account-themed.authenticated.dark-mode[data-account-theme="christmas"] .navbar[data-nav-surface] {
    --nav-ink: #eef6ff;
    --nav-ink-hover: #ffffff;
    --nav-active-ink: #ffffff;
    --nav-veil: linear-gradient(105deg, rgba(22, 43, 62, 0.98), rgba(30, 48, 75, 0.98) 68%, rgba(57, 42, 82, 0.98));
    --nav-border: rgba(162, 184, 223, 0.4);
    --nav-hover-bg: rgba(216, 231, 255, 0.14);
    --nav-active-bg: rgba(173, 182, 240, 0.2);
    --nav-focus: #b4d6ff;
}
body.account-themed.authenticated[data-account-theme="christmas"] .navbar .nav-avatar--placeholder {
    background: linear-gradient(145deg, #e6eeff, #c9c3ff);
    color: #334568;
    box-shadow: 0 3px 12px rgba(100, 112, 185, 0.25);
}
body.account-themed.authenticated[data-account-theme="christmas"] .navbar .navbar-toggler-icon {
    filter: none;
}
body.account-themed.authenticated.dark-mode[data-account-theme="christmas"] .navbar .navbar-toggler-icon {
    filter: brightness(0) invert(1);
}
body.account-themed.authenticated[data-account-theme="christmas"] .btn-primary {
    --bs-btn-bg: #a51d38;
    --bs-btn-border-color: #a51d38;
    --bs-btn-color: #ffffff;
    --bs-btn-hover-color: #ffffff;
    --bs-btn-active-color: #ffffff;
    background: var(--account-btn-gradient) !important;
    border-color: #a51d38 !important;
    color: #ffffff !important;
}
body.account-themed.authenticated[data-account-theme="christmas"] .btn-primary:hover,
body.account-themed.authenticated[data-account-theme="christmas"] .btn-primary:active {
    background: var(--account-btn-gradient-hover) !important;
    border-color: #81162c !important;
}
body.account-themed.authenticated[data-account-theme="christmas"] .profile-hero__banner {
    background: radial-gradient(circle at 85% 30%, rgba(255, 229, 156, 0.4), transparent 24%),
        repeating-linear-gradient(120deg, transparent 0 50px, rgba(255, 255, 255, 0.04) 50px 52px),
        linear-gradient(120deg, #103f2c, #1c6544 48%, #8b2433) !important;
    border-bottom: 3px solid #d5aa53;
}
body.account-themed.authenticated[data-account-theme="christmas"] .glass-card,
body.account-themed.authenticated[data-account-theme="christmas"] .card {
    border-top: 2px solid #d5aa53 !important;
}
/* Snow and twinkling lights animate behind every row, so per-row glass blur would re-render each frame and stall painting. */
body.account-themed.authenticated[data-account-theme="christmas"] table .lg-btn {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}
.account-theme-card[data-account-theme="christmas"] .account-theme-card__preview {
    background: radial-gradient(circle at 80% 20%, #ffedb4 0 2px, transparent 3px),
        radial-gradient(circle at 20% 60%, #ffffff 0 2px, transparent 3px),
        linear-gradient(135deg, #103f2c, #1c6544 55%, #a51d38);
}
.account-theme-card[data-account-theme="christmas"] .account-theme-card__preview::after {
    content: '\2744';
    position: absolute;
    right: 12px;
    top: 10px;
    font-size: 30px;
    color: #fff8df;
}
.christmas-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1.25rem;
    color: var(--rh-text-primary);
    border: 1px solid var(--rh-border);
    border-radius: 16px;
    background: var(--rh-surface-feature);
}
.christmas-controls[hidden] { display: none; }
.christmas-controls__header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.christmas-controls__ornament { flex: 0 0 auto; color: var(--account-ink); font-size: 3rem; }
.christmas-controls .form-check-input { flex: 0 0 auto; min-width: 1.2em; min-height: 1.2em; }
.christmas-controls__master { display: flex; align-items: center; gap: .75rem; min-height: 44px; cursor: pointer; }
.christmas-controls__options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}
.christmas-option {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 72px;
    margin: 0;
    padding: .9rem;
    border: 1px solid var(--rh-border);
    border-radius: 12px;
    background: var(--rh-surface-panel);
    cursor: pointer;
}
.christmas-option:has(input:checked) { border-color: var(--account-accent); }
.christmas-option:focus-within, .christmas-controls__master:focus-within { outline: 2px solid var(--account-accent); outline-offset: 3px; }
.christmas-option__content { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.christmas-frame, .christmas-snow, .christmas-burst {
    pointer-events: none;
    user-select: none;
}
.christmas-snow { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; }
/* Nine-slice border: corner artwork stays sharp and side sparkles repeat; it sits just under the sticky navbar. */
.christmas-frame {
    position: fixed;
    inset: 0;
    z-index: 1029;
    border-style: solid;
    border-color: transparent;
    border-width: 118px 171px 99px 165px;
    border-image: url("../images/christmas-frame.628853e3dfcb.webp") 215 310 180 300 round;
}
.christmas-burst { position: fixed; left: var(--burst-x); top: var(--burst-y); z-index: 1090; }
.christmas-burst__flake {
    position: absolute;
    left: -8px;
    top: -8px;
    color: #ffffff;
    text-shadow: 0 1px 3px #28654c, 0 0 6px #9cdded;
    font-size: 18px;
    line-height: 1;
    animation: christmas-burst 900ms cubic-bezier(0.16, 0.7, 0.3, 1) forwards;
}
.christmas-burst__flake:nth-child(3n) { color: #ffdc83; font-size: 14px; }
@keyframes christmas-burst {
    from { opacity: 1; transform: translate(0, 0) scale(0.4); }
    to { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--spin)) scale(1); }
}
/* Light/dark toggle flyover: Santa crosses toward the right into dark mode, toward the left into light mode. */
.christmas-santa {
    position: fixed;
    top: 13vh;
    left: 0;
    z-index: 1035;
    width: clamp(240px, 34vw, 460px);
    aspect-ratio: 640 / 210;
    pointer-events: none;
    user-select: none;
    animation: christmas-santa-to-dark 1.9s cubic-bezier(0.37, 0.12, 0.63, 0.88) forwards;
    view-transition-name: christmas-santa;
}
.christmas-santa--to-light { animation-name: christmas-santa-to-light; }
/* Keep Santa live above the theme-switch reveal snapshot instead of being clipped by it. */
::view-transition-group(christmas-santa) { z-index: 10002; animation: none; }
::view-transition-old(christmas-santa) { display: none; }
::view-transition-new(christmas-santa) { animation: none; }
.christmas-santa__art {
    display: block;
    width: 100%;
    height: 100%;
    background: url("../images/christmas-santa-sleigh.ae6b4d171df6.svg") center / contain no-repeat;
    filter: drop-shadow(0 8px 10px rgba(22, 52, 40, 0.28));
    animation: christmas-santa-gallop 420ms ease-in-out infinite alternate;
}
.christmas-santa--to-light .christmas-santa__art { scale: -1 1; }
body.dark-mode .christmas-santa__art { filter: drop-shadow(0 0 10px rgba(255, 221, 140, 0.55)) drop-shadow(0 0 2px rgba(255, 255, 255, 0.6)); }
.christmas-santa::before {
    content: '';
    position: absolute;
    top: 38%;
    right: 92%;
    width: 60%;
    height: 34%;
    background:
        radial-gradient(circle, #fff3c4 0 1.6px, transparent 2.4px) 0 0 / 22px 16px,
        radial-gradient(circle, #ffd36b 0 1.2px, transparent 2px) 11px 8px / 22px 16px;
    -webkit-mask-image: linear-gradient(to left, #000, transparent);
    mask-image: linear-gradient(to left, #000, transparent);
    animation: christmas-santa-sparkle 360ms steps(2) infinite;
}
.christmas-santa--to-light::before {
    right: auto;
    left: 92%;
    -webkit-mask-image: linear-gradient(to right, #000, transparent);
    mask-image: linear-gradient(to right, #000, transparent);
}
@keyframes christmas-santa-to-dark {
    0% { opacity: 0; transform: translate(-100%, 70px) rotate(-7deg); }
    8%, 92% { opacity: 1; }
    30% { transform: translate(calc(30vw - 50%), 10px) rotate(-2deg); }
    55% { transform: translate(calc(55vw - 50%), 40px) rotate(3deg); }
    80% { transform: translate(calc(80vw - 50%), -10px) rotate(-5deg); }
    100% { opacity: 0; transform: translate(100vw, -60px) rotate(-9deg); }
}
@keyframes christmas-santa-to-light {
    0% { opacity: 0; transform: translate(100vw, 70px) rotate(7deg); }
    8%, 92% { opacity: 1; }
    30% { transform: translate(calc(70vw - 50%), 10px) rotate(2deg); }
    55% { transform: translate(calc(45vw - 50%), 40px) rotate(-3deg); }
    80% { transform: translate(calc(20vw - 50%), -10px) rotate(5deg); }
    100% { opacity: 0; transform: translate(-100%, -60px) rotate(9deg); }
}
@keyframes christmas-santa-gallop { to { translate: 0 -6px; } }
@keyframes christmas-santa-sparkle { 50% { opacity: 0.45; } }
@media (pointer: fine) {
    body[data-account-theme="christmas"].christmas-effects-on:not(.christmas-cursor-off),
    body[data-account-theme="christmas"].christmas-effects-on:not(.christmas-cursor-off) :is(a, button, label, [role="button"], input[type="radio"], input[type="checkbox"], select),
    html.login-christmas body.page-login.christmas-effects-on:not(.christmas-cursor-off),
    html.login-christmas body.page-login.christmas-effects-on:not(.christmas-cursor-off) :is(a, button, label, [role="button"], input[type="radio"], input[type="checkbox"], select) {
        cursor: url("../images/christmas-cursor.92b17c2430a2.svg") 16 16, auto;
    }
    body[data-account-theme="christmas"] :is(input:not([type="radio"]):not([type="checkbox"]), textarea, [contenteditable="true"]),
    html.login-christmas body.page-login :is(input:not([type="radio"]):not([type="checkbox"]), textarea, [contenteditable="true"]) { cursor: text; }
}
@media (max-width: 991px) {
    body.account-themed.authenticated[data-account-theme="christmas"] .navbar[data-nav-surface] { border-radius: 32px !important; }
    .christmas-frame { border-width: 97px 140px 81px 135px; }
}
@media (max-width: 575px) {
    .christmas-frame { border-width: 69px 99px 58px 96px; }
    .christmas-controls { padding: 1rem; gap: 0.75rem; }
    .christmas-controls__options { grid-template-columns: 1fr; }
    .christmas-controls__ornament { font-size: 2rem; }
}
body.pref-reduce-effects .christmas-frame { display: none; }
@media (prefers-reduced-motion: reduce) {
    .christmas-burst, .christmas-snow, .christmas-santa { display: none; }
}
@media print {
    .christmas-frame, .christmas-snow, .christmas-burst, .christmas-santa, .christmas-controls { display: none !important; }
}
