/* Christmas theme, 1 December to 2 January. The Worker (worker/seasons/christmas.ts) adds the
   .christmas class, this stylesheet, the lights, the snow and the holly only while it's on.
   Cosy, not costume: the brand palette stays (Slate and Gorse already read as a winter evening
   with gold lights), pine takes over the second board and berry red appears only in the
   holly and the lights.
   Every page: holly by the logo, snow on and through the footer.
   Homepage: fairy lights, snowfall, snow on the dark boards, the price roundel as a bauble. */

:root.christmas{
  --xm-snow:255,255,255;
  --xm-pine:#1B4D39;
}

/* ---------- Every page: holly by the logo ---------- */
.xm-sprite{position:absolute;width:0;height:0;overflow:hidden}
:root.christmas .brand{position:relative}
.xm-holly{position:absolute;left:-12px;top:-11px;width:28px;height:20px;transform:rotate(-14deg);pointer-events:none;filter:drop-shadow(0 1px 1px rgba(0,0,0,.25))}

/* ---------- Snow ---------- */
.xm-night{position:absolute;inset:0;overflow:hidden;border-radius:inherit;pointer-events:none;z-index:0}
/* Each layer is a tile of flakes, taller than its box by one tile, so moving it down by one
   tile loops without a jump. */
.xm-snow{position:absolute;left:0;right:0;bottom:0;top:calc(-1 * var(--tile));background-size:var(--tile) var(--tile)}
.xm-snow-1{--tile:240px;opacity:.7;background-image:
  radial-gradient(circle at 22px 34px,rgba(var(--xm-snow),.95) 0 1.3px,transparent 3.6px),
  radial-gradient(circle at 128px 18px,rgba(var(--xm-snow),.8) 0 1.0px,transparent 3.0px),
  radial-gradient(circle at 196px 92px,rgba(var(--xm-snow),.9) 0 1.5px,transparent 4.0px),
  radial-gradient(circle at 74px 132px,rgba(var(--xm-snow),.75) 0 0.9px,transparent 2.8px),
  radial-gradient(circle at 160px 176px,rgba(var(--xm-snow),.9) 0 1.2px,transparent 3.4px),
  radial-gradient(circle at 36px 210px,rgba(var(--xm-snow),.8) 0 1.1px,transparent 3.2px),
  radial-gradient(circle at 222px 226px,rgba(var(--xm-snow),.7) 0 0.8px,transparent 2.6px)}
.xm-snow-2{--tile:170px;opacity:.45;background-image:
  radial-gradient(circle at 40px 20px,rgba(var(--xm-snow),.9) 0 0.7px,transparent 2.4px),
  radial-gradient(circle at 120px 64px,rgba(var(--xm-snow),.9) 0 0.6px,transparent 2.2px),
  radial-gradient(circle at 18px 104px,rgba(var(--xm-snow),.9) 0 0.8px,transparent 2.5px),
  radial-gradient(circle at 94px 142px,rgba(var(--xm-snow),.9) 0 0.6px,transparent 2.1px),
  radial-gradient(circle at 150px 120px,rgba(var(--xm-snow),.9) 0 0.7px,transparent 2.3px)}

/* Snow settled along a top edge, with soft lumps hanging over. */
.xm-cap{position:absolute;left:0;right:0;top:-3px;height:17px;z-index:2;pointer-events:none;border-radius:7px 7px 0 0;
  background:linear-gradient(#FFFFFF,#E9F0F3);
  -webkit-mask:linear-gradient(#000,#000) top/100% 8px no-repeat,radial-gradient(9px 7px at 50% 6px,#000 98%,transparent) 0 0/17px 100% repeat-x,radial-gradient(7px 9px at 50% 6px,#000 98%,transparent) 9px 0/41px 100% repeat-x;
  mask:linear-gradient(#000,#000) top/100% 8px no-repeat,radial-gradient(9px 7px at 50% 6px,#000 98%,transparent) 0 0/17px 100% repeat-x,radial-gradient(7px 9px at 50% 6px,#000 98%,transparent) 9px 0/41px 100% repeat-x;
  filter:drop-shadow(0 2px 2px rgba(9,22,27,.18))}

/* Footer: snow on the top edge and a light fall through it. */
:root.christmas .studio-footer .studio-footer-wrap{position:relative;z-index:1}
.xm-night-footer{border-radius:0}
.xm-night-footer .xm-snow-1{opacity:.45}
.xm-night-footer .xm-snow-2{opacity:.3}
.studio-footer>.xm-cap{top:0;border-radius:0}

/* ---------- Homepage ---------- */
:root.christmas .home{--paint-estuary:var(--xm-pine)}
:root.christmas .fascia-inner{position:relative;z-index:1}
.xm-greeting{grid-column:1/-1;grid-row:1;align-self:end;margin:0 0 clamp(14px,1.8vw,24px);color:var(--gorse-paint)}

/* Fairy lights strung inside the hero's lining. */
.xm-lights{position:absolute;top:calc(var(--inset,10px) + 8px);left:calc(var(--inset,10px) + 22px);right:calc(var(--inset,10px) + 22px);height:clamp(30px,3vw,44px)}
.xm-wire{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.xm-wire path{fill:none;stroke:#0B171C;stroke-width:1.6;vector-effect:non-scaling-stroke;opacity:.9}
.xm-bulb{position:absolute;left:var(--x);top:var(--y);width:9px;height:13px;margin-left:-4.5px;margin-top:1px;border-radius:50% 50% 46% 46%/42% 42% 58% 58%;background:var(--bulb);box-shadow:0 0 8px 2px var(--glow),0 0 22px 4px var(--glow)}
.xm-bulb::before{content:"";position:absolute;left:2px;top:-3px;width:5px;height:4px;border-radius:1px;background:#3C4A50}
.xm-bulb-0{--bulb:#F5C451;--glow:rgba(245,196,81,.45)}
.xm-bulb-1{--bulb:#E5484D;--glow:rgba(229,72,77,.42)}
.xm-bulb-2{--bulb:#57C26A;--glow:rgba(87,194,106,.4)}
.xm-bulb-3{--bulb:#FFF0CF;--glow:rgba(255,240,207,.45)}

/* The price roundel hangs like a bauble: a gold cap and a short ribbon. */
:root.christmas .roundel{--string:clamp(22px,3vw,48px);overflow:visible;transform-origin:50% calc(-1 * var(--string))}
:root.christmas .roundel::before{content:"";position:absolute;left:50%;bottom:calc(100% + 6px);width:2px;height:var(--string);margin-left:-1px;background:linear-gradient(var(--gorse-paint),rgba(226,179,64,.55))}
.xm-bauble-cap{position:absolute;left:50%;top:-7px;width:20%;height:13px;transform:translateX(-50%);border-radius:3px 3px 2px 2px;background:linear-gradient(90deg,#B98A25,#F2CF72 45%,#C99830);box-shadow:inset 0 -2px 0 rgba(0,0,0,.18)}
.xm-bauble-cap::before{content:"";position:absolute;left:50%;top:-6px;width:9px;height:8px;margin-left:-4.5px;border:2px solid #E2B340;border-bottom:0;border-radius:6px 6px 0 0}

@media(max-width:900px){
  :root.christmas .xm-greeting{grid-row:1;margin:30px 0 14px}
  :root.christmas .fascia-title{grid-row:2}
  :root.christmas .fascia-line{grid-row:3}
  :root.christmas .fascia-actions .plate{grid-row:4}
  :root.christmas .fascia-actions .sign-link{grid-row:5}
  :root.christmas .roundel{grid-row:5;--string:14px}
  .xm-lights{left:calc(var(--inset,10px) + 14px);right:calc(var(--inset,10px) + 14px);height:26px}
  .xm-bulb{width:7px;height:10px;margin-left:-3.5px}
  .xm-bulb::before{left:1.5px;width:4px;height:3px;top:-2px}
  .xm-holly{left:-10px;top:-9px;width:24px;height:17px}
}
@media(max-width:600px){
  /* Fewer, larger gaps on a phone: every other bulb. */
  .xm-bulb:nth-of-type(even){display:none}
}

/* ---------- Motion: snow falls, lights twinkle, the bauble sways ---------- */
@media(prefers-reduced-motion:no-preference){
  .xm-snow-1{animation:xm-fall 22s linear infinite}
  .xm-snow-2{animation:xm-fall 15s linear infinite}
  .xm-bulb{animation:xm-twinkle 2.4s ease-in-out var(--d,0s) infinite alternate}
  :root.christmas .roundel{animation:roundel-in .8s var(--ease-out,ease-out) 1.2s backwards,xm-sway 6s ease-in-out 2s infinite}
  .xm-greeting{animation:settle .7s var(--ease-out,ease-out) .8s backwards}
}
@keyframes xm-fall{to{transform:translateY(var(--tile))}}
@keyframes xm-twinkle{from{opacity:1}70%{opacity:.85}to{opacity:.45;box-shadow:0 0 4px 1px var(--glow)}}
@keyframes xm-sway{0%,100%{rotate:0deg}25%{rotate:2.2deg}75%{rotate:-2.2deg}}
