/* Weihnachten theme (1.–26.12.): tokens live in themes.css, this adds the festive extras.
   weihnachten.js adds the fairy lights, the night sky and the Advent calendar banner. */
[data-theme="weihnachten"] {
  --snow: #f4f8f6;
  /* A lumpy layer of snow that sits on top of cards and bars. */
  --snowcap:
    radial-gradient(circle at 6px 6px, var(--snow) 4px, transparent 4.5px) 0 0 / 48px 9px repeat-x,
    radial-gradient(circle at 17px 5px, var(--snow) 5px, transparent 5.5px) 0 0 / 48px 9px repeat-x,
    radial-gradient(circle at 28px 6.5px, var(--snow) 3.5px, transparent 4px) 0 0 / 48px 9px repeat-x,
    radial-gradient(circle at 38px 5px, var(--snow) 4.5px, transparent 5px) 0 0 / 48px 9px repeat-x,
    linear-gradient(var(--snow), var(--snow)) 0 5px / 100% 4px no-repeat;
}
[data-theme="weihnachten"] body {
  background:
    radial-gradient(circle at 90% 0%, var(--bg-glow) 0, transparent 34rem),
    radial-gradient(circle at 0% 100%, rgba(155, 36, 49, .16) 0, transparent 30rem),
    var(--bg);
}
[data-theme="weihnachten"] ::selection { color: var(--on-accent); background: var(--accent); }
[data-theme="weihnachten"] .eyebrow.admin-trigger::after { content: " · FROHE ADVENTSZEIT"; }
[data-theme="weihnachten"] .xmas-eve .eyebrow.admin-trigger::after { content: " · FROHE WEIHNACHTEN"; }

/* Gentle snowfall: a tiled layer of soft dots drifting down. */
[data-theme="weihnachten"] body::after {
  content: "";
  position: fixed;
  inset: -300px 0 0 -300px;
  z-index: 0;
  background-image:
    radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, .5), transparent 60%),
    radial-gradient(1.5px 1.5px at 120px 80px, rgba(255, 255, 255, .35), transparent 60%),
    radial-gradient(2.5px 2.5px at 200px 160px, rgba(255, 255, 255, .4), transparent 60%),
    radial-gradient(1.5px 1.5px at 60px 220px, rgba(255, 255, 255, .3), transparent 60%),
    radial-gradient(2px 2px at 260px 260px, rgba(255, 255, 255, .45), transparent 60%);
  background-size: 300px 300px;
  opacity: .55;
  pointer-events: none;
  animation: xmas-snow 40s linear infinite;
  will-change: transform;
}
[data-theme="weihnachten"] .app-shell { position: relative; z-index: 1; }
/* One full tile per loop keeps the pattern seamless. */
@keyframes xmas-snow { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(300px, 300px, 0); } }

/* Decorations from weihnachten.js stay invisible in every other theme. */
.xmas-lights, .xmas-sky, .xmas-flurry { display: none; }
[data-theme="weihnachten"] .xmas-sky, [data-theme="weihnachten"] .xmas-flurry { display: block; }
[data-theme="weihnachten"] .xmas-lights { display: flex; }

/* Fairy lights: a sagging wire with twinkling bulbs along the top edge. */
.xmas-lights {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  justify-content: space-between;
  height: 24px;
  padding: 0 8px;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(ellipse 22px 10px at 50% -2px, transparent 9px, #33463b 9.5px 10.5px, transparent 11px) -1px 0 / 38px 14px repeat-x;
}
.xmas-lights i {
  --bulb: var(--accent);
  position: relative;
  flex: 0 0 auto;
  width: 7px;
  height: 11px;
  margin-top: 6px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  background: var(--bulb);
  box-shadow: 0 0 6px 1px var(--bulb), 0 0 14px 2px color-mix(in srgb, var(--bulb) 45%, transparent);
  animation: xmas-twinkle var(--speed, 2.4s) ease-in-out var(--delay, 0s) infinite alternate;
}
.xmas-lights i:nth-child(even) { margin-top: 9px; }
.xmas-lights i::before { content: ""; position: absolute; left: 1px; top: -3px; width: 5px; height: 4px; border-radius: 1px; background: #4d5a52; }
.xmas-lights i.red { --bulb: var(--xmas-red); }
.xmas-lights i.green { --bulb: var(--xmas-green); }
.xmas-lights i.blue { --bulb: #6fb3ff; }
@keyframes xmas-twinkle { from { opacity: 1; } 70% { opacity: .9; } to { opacity: .35; box-shadow: 0 0 2px 0 var(--bulb); } }

/* Behind everything: a second, slower layer of bigger flakes, twinkling stars and a snowdrift. */
.xmas-sky { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.xmas-snow-far {
  position: absolute;
  inset: -420px 0 0 0;
  background-image:
    radial-gradient(3.5px 3.5px at 70px 60px, rgba(255, 255, 255, .55), transparent 60%),
    radial-gradient(3px 3px at 300px 190px, rgba(255, 255, 255, .45), transparent 60%),
    radial-gradient(4px 4px at 190px 330px, rgba(255, 255, 255, .4), transparent 60%),
    radial-gradient(2.5px 2.5px at 380px 380px, rgba(255, 255, 255, .5), transparent 60%);
  background-size: 420px 420px;
  opacity: .5;
  filter: blur(.4px);
  animation: xmas-snow-far 70s linear infinite;
  will-change: transform;
}
@keyframes xmas-snow-far { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-140px, 420px, 0); } }
.xmas-star {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff8dc;
  box-shadow: 0 0 6px 1px rgba(255, 236, 170, .7);
  animation: xmas-star var(--speed, 4s) ease-in-out var(--delay, 0s) infinite;
}
.xmas-star.sparkle { width: 9px; height: 9px; border-radius: 0; background: none; box-shadow: none; }
.xmas-star.sparkle::before { content: "\e6a2"; font-family: "Phosphor"; font-size: 9px; line-height: 1; color: #ffe9a8; text-shadow: 0 0 6px rgba(255, 220, 140, .8); }
@keyframes xmas-star { 0%, 100% { opacity: .15; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.15); } }
.xmas-drift {
  position: absolute;
  inset: auto -5vw 0;
  height: 70px;
  opacity: .1;
  background:
    radial-gradient(ellipse 30vw 46px at 18% 100%, var(--snow) 98%, transparent 100%),
    radial-gradient(ellipse 26vw 34px at 55% 100%, var(--snow) 98%, transparent 100%),
    radial-gradient(ellipse 34vw 52px at 92% 100%, var(--snow) 98%, transparent 100%);
}

/* Snow caps on the bars and cards. */
[data-theme="weihnachten"] .top-actions, [data-theme="weihnachten"] .view-tabs, [data-theme="weihnachten"] .today-overview { position: relative; }
[data-theme="weihnachten"] .top-actions::after,
[data-theme="weihnachten"] .view-tabs::after,
[data-theme="weihnachten"] .today-overview::after,
[data-theme="weihnachten"] .lesson::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 14px;
  right: 14px;
  height: 9px;
  border-radius: 6px 6px 3px 3px;
  background: var(--snowcap);
  filter: drop-shadow(0 1.5px 1px rgba(0, 0, 0, .35));
  opacity: .93;
  pointer-events: none;
}
[data-theme="weihnachten"] .view-tabs::after { z-index: 1; right: auto; width: min(60%, 180px); }
[data-theme="weihnachten"] .lesson::after { top: -4px; left: 10px; right: 10px; height: 8px; opacity: .85; }
[data-theme="weihnachten"] .lesson.cancelled::after { opacity: .35; }

/* Today is wrapped like a present: red paper, a gold ribbon and a bow. */
[data-theme="weihnachten"] .day-heading.today {
  position: relative;
  background:
    linear-gradient(90deg, transparent calc(100% - 30px), var(--accent) calc(100% - 30px) calc(100% - 22px), transparent calc(100% - 22px)),
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, .07) 0 1.5px, transparent 2px) 0 0 / 14px 14px,
    var(--accent-deep);
}
[data-theme="weihnachten"] .day-heading.today::before,
[data-theme="weihnachten"] .day-heading.today::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 25px;
  width: 9px;
  height: 7px;
  border: 2.5px solid var(--accent);
  border-radius: 50% 0 50% 50%;
  transform: rotate(-20deg);
  transform-origin: 100% 50%;
}
[data-theme="weihnachten"] .day-heading.today::after { right: auto; left: calc(100% - 27px); border-radius: 0 50% 50% 50%; transform: rotate(20deg); transform-origin: 0 50%; }
[data-theme="weihnachten"] .day-heading.today small { color: #ffe9a8; }
[data-theme="weihnachten"] .day-tab.today { position: relative; overflow: hidden; }
[data-theme="weihnachten"] .day-tab.today::after { content: ""; position: absolute; inset: 0 auto 0 calc(50% - 3px); width: 6px; background: var(--accent); opacity: .22; }

/* The "now" line is a candy cane, its dot a Christmas bauble. */
[data-theme="weihnachten"] .current-time-needle {
  height: 5px;
  margin-top: -2px;
  border-radius: 3px;
  background: repeating-linear-gradient(-45deg, #fff 0 4px, var(--xmas-red) 4px 8px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
[data-theme="weihnachten"] .current-time-dot {
  left: -7px;
  top: -4px;
  width: 13px;
  height: 13px;
  background: radial-gradient(circle at 35% 32%, rgba(255, 255, 255, .85) 0 1.5px, transparent 2.5px), radial-gradient(circle at 50% 50%, #ffe08a, var(--accent) 55%, #b98a24);
  box-shadow: 0 0 8px rgba(242, 196, 90, .6);
}
[data-theme="weihnachten"] .current-time-dot::before { content: ""; position: absolute; left: 4px; top: -3px; width: 5px; height: 3px; border-radius: 1px; background: #c9ced0; }
[data-theme="weihnachten"] .current-time-badge { background: var(--xmas-red); }

/* Seasonal icons: cookies for the break, a star for "Heute", snowflakes for free days. */
[data-theme="weihnachten"] .ph.ph-coffee::before { content: "\e6ca"; }
[data-theme="weihnachten"] .today-button .ph.ph-calendar-dot::before { content: "\e46a"; }
[data-theme="weihnachten"] .ph.ph-sun::before, [data-theme="weihnachten"] .ph.ph-sun-horizon::before { content: "\e5aa"; }
[data-theme="weihnachten"] .corner-cell::before { content: "\e6dc"; margin-right: 7px; color: var(--accent); font: 17px/1 "Phosphor"; }
[data-theme="weihnachten"] .break-band i { color: #d9a066; }

/* A ribbon of red, gold and green on every dialog. */
[data-theme="weihnachten"] .modal { background: linear-gradient(90deg, var(--xmas-red), var(--accent) 50%, var(--xmas-green)) top / 100% 3px no-repeat, var(--modal-bg); }
[data-theme="weihnachten"] .app-footer p::after { content: " Frohe Festtage!"; color: var(--accent-ink); }

/* Advent calendar banner. */
.xmas-banner { position: relative; display: flex; align-items: center; gap: 15px; margin: 0 0 24px; padding: 14px; border: 1px solid #3a5546; border-radius: 18px; background: linear-gradient(100deg, rgba(155, 36, 49, .35), rgba(19, 33, 27, .8) 55%, rgba(47, 158, 92, .18)); }
.xmas-banner[hidden] { display: none; }
.xmas-banner::after { content: ""; position: absolute; top: -5px; left: 22px; width: min(40%, 220px); height: 9px; border-radius: 6px 6px 3px 3px; background: var(--snowcap); filter: drop-shadow(0 1.5px 1px rgba(0, 0, 0, .35)); pointer-events: none; }
.xmas-banner-icon { display: grid; place-items: center; flex: 0 0 auto; width: 46px; height: 46px; padding: 0; color: var(--on-accent); border: 0; border-radius: 14px; background: radial-gradient(circle at 35% 30%, #ffe9a8, var(--accent) 70%); box-shadow: 0 0 18px rgba(242, 196, 90, .35); font-size: 25px; cursor: pointer; animation: xmas-glow 3s ease-in-out infinite alternate; }
.xmas-banner-icon:active { transform: scale(.94); }
.xmas-banner-icon:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.xmas-banner-copy { flex: 1; min-width: 0; }
.xmas-kicker { margin: 0; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .07em; }
.xmas-banner h2 { margin: 3px 0 2px; font-size: 17px; }
.xmas-banner p:not(.xmas-kicker) { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.4; }
.xmas-banner.eve, .xmas-banner.feast { border-color: var(--accent); background: linear-gradient(100deg, #8a1f2b, #5d1620 60%, #2a1a12); }
.xmas-banner.eve .xmas-kicker, .xmas-banner.feast .xmas-kicker { color: #ffe9a8; }
.xmas-banner.eve p:not(.xmas-kicker), .xmas-banner.feast p:not(.xmas-kicker) { color: #f3dcdc; }
@keyframes xmas-glow { from { box-shadow: 0 0 10px rgba(242, 196, 90, .25); } to { box-shadow: 0 0 24px rgba(242, 196, 90, .55); } }

/* Advent wreath: one candle lights up each Advent Sunday. */
.xmas-wreath { position: relative; display: flex; align-items: flex-end; gap: 6px; flex: 0 0 auto; height: 46px; padding: 0 9px 7px; }
.xmas-wreath::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 12px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 22% 45%, var(--xmas-red) 0 2px, transparent 2.5px),
    radial-gradient(circle at 58% 60%, var(--xmas-red) 0 2px, transparent 2.5px),
    radial-gradient(circle at 84% 40%, var(--xmas-red) 0 2px, transparent 2.5px),
    radial-gradient(ellipse at 50% 50%, #2f7a4c 0 55%, #1d4d31 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .35);
}
.xmas-candle { position: relative; z-index: 1; width: 8px; height: 22px; border-radius: 2px 2px 1px 1px; background: linear-gradient(90deg, #b82c3a, #e24d5b 45%, #a02533); }
.xmas-candle:nth-child(2), .xmas-candle:nth-child(3) { height: 26px; }
.xmas-candle::before { content: ""; position: absolute; left: 3.5px; top: -4px; width: 1px; height: 4px; background: #2c2a26; }
.xmas-candle i { position: absolute; left: 0; top: -15px; width: 8px; height: 12px; border-radius: 50% 50% 45% 45% / 65% 65% 35% 35%; background: radial-gradient(ellipse at 50% 70%, #fff 0 18%, #ffd65a 40%, #ff8a2a 75%, transparent 78%); opacity: 0; transform-origin: 50% 100%; }
.xmas-candle.lit i { opacity: 1; filter: drop-shadow(0 0 5px rgba(255, 190, 80, .9)); animation: xmas-flame 1.4s ease-in-out infinite alternate; }
.xmas-candle.lit:nth-child(2) i { animation-delay: -.5s; }
.xmas-candle.lit:nth-child(3) i { animation-delay: -.9s; }
.xmas-candle.lit:nth-child(4) i { animation-delay: -.2s; }
@keyframes xmas-flame { 0% { transform: scale(1, 1) rotate(-2deg); } 50% { transform: scale(.92, 1.08) rotate(2deg); } 100% { transform: scale(1.04, .94) rotate(-1deg); } }

/* Snow flurry on Christmas Eve, or when the banner star is tapped. */
.xmas-flurry { position: fixed; inset: 0; z-index: 1000; overflow: hidden; pointer-events: none; }
.xmas-flurry i { position: absolute; top: -20px; left: var(--x); width: var(--size); height: var(--size); border-radius: 50%; background: #fff; box-shadow: 0 0 4px rgba(255, 255, 255, .8); opacity: 0; animation: xmas-fall var(--duration) cubic-bezier(.3, .2, .6, 1) var(--delay) forwards; }
.xmas-flurry i.ph { width: auto; height: auto; color: #fff; background: none; box-shadow: none; font-size: calc(var(--size) * 2.4); text-shadow: 0 0 6px rgba(255, 255, 255, .7); }
@keyframes xmas-fall {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0); }
  8% { opacity: 1; }
  50% { transform: translate3d(var(--sway), 52vh, 0) rotate(180deg); }
  90% { opacity: .9; }
  100% { opacity: 0; transform: translate3d(calc(var(--sway) * -.4), 105vh, 0) rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  [data-theme="weihnachten"] body::after, .xmas-snow-far, .xmas-lights i, .xmas-star, .xmas-banner-icon, .xmas-candle.lit i { animation: none; }
}
@media (max-width: 760px) {
  /* On phones the settings button sits in the header corner, so the snow cap moves onto "Heute". */
  [data-theme="weihnachten"] .top-actions { position: static; }
  [data-theme="weihnachten"] .top-actions::after { display: none; }
  [data-theme="weihnachten"] .today-button { position: relative; }
  [data-theme="weihnachten"] .today-button::after { content: ""; position: absolute; top: -5px; left: 14px; right: 14px; height: 9px; border-radius: 6px 6px 3px 3px; background: var(--snowcap); filter: drop-shadow(0 1.5px 1px rgba(0, 0, 0, .35)); opacity: .93; pointer-events: none; }
  .xmas-banner { margin-bottom: 18px; padding: 12px; gap: 12px; flex-wrap: wrap; }
  .xmas-banner-copy { flex-basis: calc(100% - 100px); }
  .xmas-banner h2 { font-size: 16px; }
  .xmas-wreath { order: 3; margin-left: 58px; height: 40px; }
  .xmas-dismiss { position: absolute; top: 8px; right: 8px; }
}
