/* Christmas festive theme (pine green accent).
   Loaded only while the theme is on: <html data-festive="christmas"> in base.html.
   Switched from Admin Insights -> Manage Themes (site_themes app). The navy
   background, text colours and the gold site name stay as they are. */

/* ---- Accent: pine green replaces cinnamon ---- */
:root[data-theme][data-festive="christmas"] {
  --clr-accent: #5BB37E;       --clr-accent-rgb: 91, 179, 126;
  --clr-accent-hover: #8FD3A8; --clr-accent-hover-rgb: 143, 211, 168;
  --clr-on-accent: #0A2415;
}

/* ---- Greeting: "Merry Christmas" after the time-of-day greeting ---- */
:root[data-festive="christmas"] #sidebar-greeting:not(:empty)::after,
:root[data-festive="christmas"] #mobile-greeting:not(:empty)::after {
  content: " \00B7  Merry Christmas \1F384";
  color: var(--clr-accent-hover);
  font-style: normal;
  font-weight: 600;
}

/* ---- Decoration layer (lights, baubles, snow) ---- */
.fx-xmas {
  position: relative;
  height: 0;              /* takes no space: the page layout is untouched */
  z-index: 50;
  pointer-events: none;
}

/* Christmas lights hanging under the ticker */
.fx-lights {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 28px;
  overflow: hidden;
  display: flex;
}
.fx-wire {
  flex: none;
  width: 58px;
  height: 14px;
  position: relative;
  border: 1.5px solid transparent;
  border-bottom-color: rgba(91, 179, 126, 0.45);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.fx-bulb {
  --c: #E5484D;
  position: absolute;
  left: 50%; bottom: -10px;
  width: 7px; height: 10px;
  margin-left: -3.5px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  background: var(--c);
  box-shadow: 0 0 6px 2px var(--c);
  animation: fx-twinkle 2.6s ease-in-out infinite;
}
.fx-bulb::before {
  content: "";
  position: absolute;
  top: -3px; left: 1.5px;
  width: 4px; height: 3px;
  border-radius: 1px;
  background: #3E5A4A;
}
.fx-wire:nth-child(4n+2) .fx-bulb { --c: #F3D27A; }
.fx-wire:nth-child(4n+3) .fx-bulb { --c: #46B97A; }
.fx-wire:nth-child(4n)   .fx-bulb { --c: #6CB6FF; }
.fx-wire:nth-child(5n+1) .fx-bulb { animation-delay: 0s; }
.fx-wire:nth-child(5n+2) .fx-bulb { animation-delay: .5s; }
.fx-wire:nth-child(5n+3) .fx-bulb { animation-delay: 1s; }
.fx-wire:nth-child(5n+4) .fx-bulb { animation-delay: 1.5s; }
.fx-wire:nth-child(5n)   .fx-bulb { animation-delay: 2s; }
@keyframes fx-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* Hanging baubles, top right */
.fx-baubles {
  position: absolute;
  top: 0;
  right: clamp(10px, 3vw, 48px);
  width: 54px;
  height: auto;
  transform-origin: 50% 0;
  animation: fx-swing 5s ease-in-out infinite;
}
@keyframes fx-swing { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }

/* Falling snow. Front flakes are small and see-through so text stays easy to read;
   the bigger ones fall behind the page (.fx-snow-back). */
.fx-snow { position: fixed; inset: 0; overflow: hidden; }
.fx-snow i {
  position: absolute;
  top: 0;
  width: var(--s); height: var(--s);
  border-radius: 50%;
  background: #F4F8FC;
  opacity: var(--o);
  animation: fx-fall 14s linear infinite;
  will-change: transform;
}
.fx-snow-back i { filter: blur(.6px); }
@keyframes fx-fall {
  0%   { transform: translate(0, -12px); }
  25%  { transform: translate(var(--sx), 25vh); }
  50%  { transform: translate(0, 50vh); }
  75%  { transform: translate(calc(var(--sx) * -1), 75vh); }
  100% { transform: translate(0, calc(100vh + 12px)); }
}
.fx-snow i:nth-child(1) { left: 2.4%; --s: 2.8px; --o: 0.65; --sx: 32px; animation-duration: 11.5s; animation-delay: -6.2s; }
.fx-snow i:nth-child(2) { left: 7.6%; --s: 3.4px; --o: 0.46; --sx: -31px; animation-duration: 14.0s; animation-delay: -1.0s; }
.fx-snow i:nth-child(3) { left: 15.3%; --s: 3.9px; --o: 0.49; --sx: -32px; animation-duration: 12.6s; animation-delay: -7.9s; }
.fx-snow i:nth-child(4) { left: 22.2%; --s: 2.6px; --o: 0.52; --sx: 18px; animation-duration: 14.9s; animation-delay: -2.0s; }
.fx-snow i:nth-child(5) { left: 28.3%; --s: 3.5px; --o: 0.62; --sx: -25px; animation-duration: 15.8s; animation-delay: -1.6s; }
.fx-snow i:nth-child(6) { left: 32.8%; --s: 3.7px; --o: 0.62; --sx: 38px; animation-duration: 15.3s; animation-delay: -7.6s; }
.fx-snow i:nth-child(7) { left: 39.9%; --s: 3.5px; --o: 0.59; --sx: -16px; animation-duration: 13.1s; animation-delay: -10.4s; }
.fx-snow i:nth-child(8) { left: 47.2%; --s: 3.4px; --o: 0.71; --sx: -17px; animation-duration: 16.1s; animation-delay: -4.6s; }
.fx-snow i:nth-child(9) { left: 53.2%; --s: 2.8px; --o: 0.55; --sx: -38px; animation-duration: 17.5s; animation-delay: -7.4s; }
.fx-snow i:nth-child(10) { left: 59.6%; --s: 3.8px; --o: 0.7; --sx: 32px; animation-duration: 13.4s; animation-delay: -4.7s; }
.fx-snow i:nth-child(11) { left: 66.8%; --s: 2.6px; --o: 0.48; --sx: -15px; animation-duration: 12.9s; animation-delay: -9.0s; }
.fx-snow i:nth-child(12) { left: 72.8%; --s: 3.0px; --o: 0.62; --sx: 35px; animation-duration: 15.8s; animation-delay: -7.0s; }
.fx-snow i:nth-child(13) { left: 77.5%; --s: 4.1px; --o: 0.56; --sx: -38px; animation-duration: 15.3s; animation-delay: -7.6s; }
.fx-snow i:nth-child(14) { left: 83.5%; --s: 3.8px; --o: 0.57; --sx: -28px; animation-duration: 17.4s; animation-delay: -8.6s; }
.fx-snow i:nth-child(15) { left: 90.2%; --s: 3.0px; --o: 0.49; --sx: 25px; animation-duration: 14.0s; animation-delay: -7.7s; }
.fx-snow i:nth-child(16) { left: 97.6%; --s: 3.1px; --o: 0.52; --sx: -14px; animation-duration: 11.6s; animation-delay: -1.8s; }
.fx-snow-back i:nth-child(1) { left: 2.0%; --s: 5.4px; --o: 0.38; --sx: 33px; animation-duration: 14.0s; animation-delay: -5.9s; }
.fx-snow-back i:nth-child(2) { left: 6.5%; --s: 6.8px; --o: 0.51; --sx: -28px; animation-duration: 19.2s; animation-delay: -11.9s; }
.fx-snow-back i:nth-child(3) { left: 12.0%; --s: 6.1px; --o: 0.56; --sx: 26px; animation-duration: 22.0s; animation-delay: -8.6s; }
.fx-snow-back i:nth-child(4) { left: 13.0%; --s: 5.5px; --o: 0.32; --sx: -17px; animation-duration: 14.7s; animation-delay: -3.1s; }
.fx-snow-back i:nth-child(5) { left: 18.1%; --s: 3.2px; --o: 0.3; --sx: 33px; animation-duration: 15.5s; animation-delay: -1.6s; }
.fx-snow-back i:nth-child(6) { left: 21.0%; --s: 6.5px; --o: 0.48; --sx: 33px; animation-duration: 15.5s; animation-delay: -3.9s; }
.fx-snow-back i:nth-child(7) { left: 26.5%; --s: 3.5px; --o: 0.55; --sx: 23px; animation-duration: 23.9s; animation-delay: -11.1s; }
.fx-snow-back i:nth-child(8) { left: 29.6%; --s: 3.4px; --o: 0.4; --sx: -30px; animation-duration: 16.6s; animation-delay: -13.8s; }
.fx-snow-back i:nth-child(9) { left: 33.5%; --s: 6.8px; --o: 0.46; --sx: -38px; animation-duration: 15.5s; animation-delay: -8.4s; }
.fx-snow-back i:nth-child(10) { left: 39.7%; --s: 6.9px; --o: 0.56; --sx: 19px; animation-duration: 21.0s; animation-delay: -5.5s; }
.fx-snow-back i:nth-child(11) { left: 43.2%; --s: 3.9px; --o: 0.46; --sx: -39px; animation-duration: 19.0s; animation-delay: -12.1s; }
.fx-snow-back i:nth-child(12) { left: 46.9%; --s: 4.6px; --o: 0.54; --sx: -14px; animation-duration: 16.0s; animation-delay: -7.9s; }
.fx-snow-back i:nth-child(13) { left: 53.2%; --s: 4.9px; --o: 0.36; --sx: 25px; animation-duration: 20.1s; animation-delay: -6.9s; }
.fx-snow-back i:nth-child(14) { left: 54.6%; --s: 3.4px; --o: 0.44; --sx: -29px; animation-duration: 17.4s; animation-delay: -8.4s; }
.fx-snow-back i:nth-child(15) { left: 62.1%; --s: 4.4px; --o: 0.49; --sx: 39px; animation-duration: 22.3s; animation-delay: -2.7s; }
.fx-snow-back i:nth-child(16) { left: 65.4%; --s: 3.8px; --o: 0.57; --sx: -39px; animation-duration: 18.3s; animation-delay: -11.6s; }
.fx-snow-back i:nth-child(17) { left: 70.5%; --s: 5.9px; --o: 0.44; --sx: -19px; animation-duration: 21.4s; animation-delay: -1.8s; }
.fx-snow-back i:nth-child(18) { left: 74.9%; --s: 3.1px; --o: 0.48; --sx: 35px; animation-duration: 18.7s; animation-delay: -12.3s; }
.fx-snow-back i:nth-child(19) { left: 78.8%; --s: 3.6px; --o: 0.46; --sx: -30px; animation-duration: 14.2s; animation-delay: -11.4s; }
.fx-snow-back i:nth-child(20) { left: 82.2%; --s: 3.6px; --o: 0.6; --sx: -22px; animation-duration: 15.9s; animation-delay: -13.9s; }
.fx-snow-back i:nth-child(21) { left: 84.3%; --s: 5.0px; --o: 0.53; --sx: -15px; animation-duration: 17.3s; animation-delay: -9.4s; }
.fx-snow-back i:nth-child(22) { left: 91.2%; --s: 4.4px; --o: 0.44; --sx: 40px; animation-duration: 19.8s; animation-delay: -17.9s; }
.fx-snow-back i:nth-child(23) { left: 95.4%; --s: 5.0px; --o: 0.46; --sx: 38px; animation-duration: 19.2s; animation-delay: -0.4s; }
.fx-snow-back i:nth-child(24) { left: 96.6%; --s: 3.0px; --o: 0.54; --sx: -31px; animation-duration: 15.7s; animation-delay: -7.4s; }

/* ---- Behind the page: back snow + small stars ----
   z-index -1 keeps them under cards, sidebar and text. */
.fx-night {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.fx-stars i {
  position: absolute;
  width: 6px; height: 6px;
  background: #FFF4D6;
  opacity: .3;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: fx-spark 4s ease-in-out infinite;
}
.fx-stars i:nth-child(3n) { background: #F3D27A; width: 8px; height: 8px; }
.fx-stars i:nth-child(1)  { left: 5%;  top: 22%; animation-delay: .2s; }
.fx-stars i:nth-child(2)  { left: 12%; top: 52%; animation-delay: 1.4s; }
.fx-stars i:nth-child(3)  { left: 4%;  top: 74%; animation-delay: 2.6s; }
.fx-stars i:nth-child(4)  { left: 18%; top: 88%; animation-delay: .8s; }
.fx-stars i:nth-child(5)  { left: 30%; top: 40%; animation-delay: 3.1s; }
.fx-stars i:nth-child(6)  { left: 47%; top: 30%; animation-delay: 1.9s; }
.fx-stars i:nth-child(7)  { left: 58%; top: 92%; animation-delay: .5s; }
.fx-stars i:nth-child(8)  { left: 71%; top: 20%; animation-delay: 2.2s; }
.fx-stars i:nth-child(9)  { left: 83%; top: 62%; animation-delay: 3.5s; }
.fx-stars i:nth-child(10) { left: 96%; top: 40%; animation-delay: 1.1s; }
.fx-stars i:nth-child(11) { left: 97%; top: 80%; animation-delay: 2.9s; }
.fx-stars i:nth-child(12) { left: 38%; top: 70%; animation-delay: .3s; }
@keyframes fx-spark { 0%, 100% { opacity: .12; transform: scale(.7); } 50% { opacity: .6; transform: scale(1); } }

/* Cards get their colour from `.content a` (white at 10% opacity), which would let
   the back snow show through. Same colour, made solid, while this theme is on.
   Hover keeps its own background. */
:root[data-festive="christmas"] .content a.post-card:not(:hover),
:root[data-festive="christmas"] .content a.related-card:not(:hover) {
  background-color: #25323F;
}

/* ---- Santa's sleigh: crosses the top of the page about every 30s ----
   Scrolls with the page (only seen near the top) and sits behind the content. */
.fx-sky {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 200px;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}
.fx-sleigh {
  position: absolute;
  top: 58px;
  left: 0;
  width: 230px;
  transform: translateX(-270px);
  animation: fx-fly 30s linear infinite;
  animation-delay: 1.5s;
}
.fx-sleigh svg { display: block; width: 100%; height: auto; animation: fx-glide 2.4s ease-in-out infinite alternate; }
@keyframes fx-fly {
  0%        { transform: translate(-270px, 26px); }
  50%       { transform: translate(calc(100vw + 20px), -6px); }
  50.01%, 100% { transform: translate(calc(100vw + 20px), -6px); }
}
@keyframes fx-glide { from { transform: translateY(-3px) rotate(-1deg); } to { transform: translateY(3px) rotate(1deg); } }
.fx-deer-bob { animation: fx-bob .5s ease-in-out infinite alternate; }
@keyframes fx-bob { from { transform: translateY(-1.2px); } to { transform: translateY(1.2px); } }
.fx-leg { transform-box: fill-box; transform-origin: 50% 0; animation: fx-gallop .5s ease-in-out infinite alternate; }
.fx-leg-b { animation-direction: alternate-reverse; }
@keyframes fx-gallop { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }
.fx-rudolph { animation: fx-nose 1.2s ease-in-out infinite; filter: drop-shadow(0 0 3px #FF4D4D); }
@keyframes fx-nose { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.fx-trail circle { fill: #F3D27A; animation: fx-twinkle 1s ease-in-out infinite; }
.fx-trail circle:nth-child(2n) { fill: #FFF4D6; animation-delay: .5s; }

/* ---- Pine garland in place of the line under page titles ---- */
:root[data-festive="christmas"] .title-separator {
  height: 18px;
  background: url("christmas-garland.svg") repeat-x left center / 120px 18px;
}

/* ---- Christmas tree and presents on top of the subscribe bar ---- */
:root[data-festive="christmas"] .footer-subscribe-bar { position: relative; }
:root[data-festive="christmas"] .footer-subscribe-bar::before {
  content: "";
  position: absolute;
  left: 24px;
  bottom: 100%;
  width: 150px;
  height: 90px;
  background: url("christmas-tree.svg") no-repeat center bottom / contain;
  pointer-events: none;
}

/* ---- Snowman in the footer corner ---- */
:root[data-festive="christmas"] .site-footer {
  background-image: url("christmas-snowman.svg");
  background-repeat: no-repeat;
  background-position: right 14px bottom 4px;
  background-size: 46px 55px;
}

/* ---- Tablets and phones ---- */
@media (max-width: 900px) {
  .fx-baubles { width: 32px; right: 4px; }   /* clears the full-width mobile badge */
  .fx-wire { width: 48px; }
  .fx-sleigh { width: 180px; top: 62px; animation-duration: 22s; }
  /* No empty column above the subscribe bar here, so the tree moves into the footer beside the snowman */
  :root[data-festive="christmas"] .footer-subscribe-bar::before { display: none; }
  :root[data-festive="christmas"] .site-footer {
    background-image: url("christmas-snowman.svg"), url("christmas-tree.svg");
    background-position: right 10px bottom 4px, right 58px bottom 0;
    background-size: 46px 55px, 80px 48px;
  }
}
@media (max-width: 480px) {
  .fx-baubles { width: 28px; right: 3px; }
  .fx-wire { width: 40px; }
  .fx-snow i:nth-child(n+11) { display: none; }   /* less snow on small screens */
  .fx-snow-back i:nth-child(n+15) { display: none; }
  .fx-stars i:nth-child(n+9) { display: none; }
  .fx-sleigh { width: 150px; top: 66px; animation-duration: 18s; }
  :root[data-festive="christmas"] .site-footer { background-position: right 8px bottom 4px, right 50px bottom 0; background-size: 42px 50px, 56px 34px; }
}
/* Short screens (phones in landscape) */
@media (max-height: 500px) and (orientation: landscape) {
  .fx-baubles { width: 28px; }
  .fx-snow i:nth-child(n+11) { display: none; }
  .fx-sleigh { width: 150px; }
}

/* ---- Visitors who turn on reduced motion: no falling snow or flying sleigh ---- */
@media (prefers-reduced-motion: reduce) {
  .fx-bulb, .fx-baubles, .fx-stars i, .fx-trail circle, .fx-rudolph { animation: none; }
  .fx-snow, .fx-sky { display: none; }
  :root[data-festive="christmas"] .footer-subscribe-bar::before { background-image: url("christmas-tree-still.svg"); }
}
@media (prefers-reduced-motion: reduce) and (max-width: 900px) {
  :root[data-festive="christmas"] .site-footer { background-image: url("christmas-snowman.svg"), url("christmas-tree-still.svg"); }
}
