body[data-view="village"]{--north-ink:#e8f5ff;--north-panel:#14265bea;--north-edge:#70c1ed78;--north-hover:#254482;background:#0a1435}
body[data-view="village"] main{width:100%;margin:0}
body[data-view="village"] footer{display:none}
body[data-view="village"] .topbar{position:relative;z-index:5;background:#101d45;border-bottom:1px solid #527db07a;color:var(--north-ink)}
body[data-view="village"] .topbar-inner{width:calc(100% - 40px)}

.north-village{position:relative;isolation:isolate;color:var(--north-ink)}
.north-village :focus-visible{outline:3px solid #a7f3ff;outline-offset:5px}
.north-scroll{scrollbar-color:#5f85bc #14265a}
.north-stage{
  --post-x:50%;
  --post-ground:55%;
  --office-size:clamp(175px,22vw,308px);
  --oven-x:21.6%;--oven-y:38.8%;
  --chimney-x:16.6%;--chimney-y:12.6%;
  --workshop-x:88%;--workshop-y:38%;
  --rink-x:20%;--rink-y:57.5%;
  --tree-x:80%;--tree-y:68%;
  --rail-y:80.5%;
  --train-width:clamp(108px,15vw,224px);
  position:relative;isolation:isolate;overflow:clip;
  background:#152453;
}
.north-backdrop,.north-rail-foreground,.north-elf-foreground{position:absolute;inset:0;object-fit:contain;user-select:none}
.north-backdrop{z-index:-1}
.north-ambient{position:absolute;inset:0;pointer-events:none;z-index:1}
.north-ambient .flakes{z-index:5}
.north-ambient .flakes i{animation-name:north-snow}
@keyframes north-snow{10%{opacity:.78}82%{opacity:.62}100%{transform:translate(32px,110svh);opacity:0}}

.north-actor{position:absolute;z-index:2;pointer-events:none;transform:translate(-50%,-75%);user-select:none}
/* Restore the two foreground trees where the railway passes behind them. */
.north-rail-foreground{
  z-index:4;
  clip-path:polygon(
    0.00% 56.67%, 0.89% 54.33%, 1.44% 52.17%, 1.89% 51.67%, 2.33% 52.17%,
    3.11% 54.17%, 3.89% 56.33%, 4.33% 58.00%, 4.22% 58.83%, 4.89% 60.67%,
    5.67% 63.00%, 6.44% 64.33%, 7.00% 66.17%, 7.22% 67.17%, 7.11% 68.17%,
    6.89% 68.17%, 7.67% 70.00%, 8.33% 71.83%, 8.67% 73.33%, 8.44% 74.00%,
    8.33% 74.00%, 9.00% 75.50%, 9.44% 77.33%, 9.56% 78.17%, 9.11% 78.67%,
    9.78% 80.33%, 10.67% 82.33%, 11.33% 85.17%, 11.56% 87.17%,
    91.00% 87.17%, 91.00% 85.17%, 91.56% 83.17%, 92.67% 80.50%, 93.78% 78.00%,
    93.44% 78.33%, 92.44% 78.33%, 92.33% 77.67%, 92.89% 75.83%, 93.67% 74.17%,
    94.00% 73.33%, 93.78% 73.33%, 93.67% 72.83%, 94.22% 71.00%, 95.11% 68.50%,
    95.89% 66.50%, 95.33% 67.50%, 95.11% 67.50%, 95.11% 66.83%, 95.56% 65.33%,
    96.56% 63.17%, 97.56% 60.83%, 98.11% 59.17%, 98.56% 58.83%, 99.00% 59.50%,
    99.56% 60.50%, 100.00% 62.00%, 100.00% 100.00%, 0.00% 100.00%
  );
}
.north-actor img{width:100%;height:auto;display:block;filter:drop-shadow(0 3px 2px #3852724d)}
/* The northern path passes behind the decorated tree and ends at the office. */
.north-elf-foreground {
  z-index: 3;
  clip-path: polygon(79.8% 34.7%,81.4% 40%,84% 45%,85.8% 49%,85.5% 51%,
    88% 55%,89.6% 58.6%,89.3% 60.2%,91.2% 64.7%,91% 66.4%,87.7% 68%,
    74.8% 68%,70.7% 66.7%,70.5% 64.8%,72.5% 59.9%,72.2% 58.5%,
    74.2% 54.6%,74% 52.9%,76.2% 48.4%,76.4% 45.5%,78.2% 40.8%);
}
.north-elf{
  left:var(--workshop-x);top:var(--workshop-y);width:4.1cqw;
  transform:translate(-50%,-100%);
  animation:north-delivery 26s linear -7s infinite;
}
.north-elf img{animation:north-step 26s linear -7s infinite}
@keyframes north-delivery{
  0%,11%{left:88%;top:39.3%;opacity:0;width:2.35cqw}
  15%{left:86.8%;top:40.6%;opacity:1;width:2.55cqw}
  26%{left:74%;top:43%;opacity:1;width:3.05cqw}
  36%{left:62%;top:51.8%;opacity:1;width:3.6cqw}
  45%{left:52%;top:53%;opacity:1;width:3.85cqw}
  51%,100%{left:50%;top:51.7%;opacity:0;width:3.4cqw}
}
@keyframes north-step{
  0%,15%,42%,100%{transform:translateY(0) rotate(0)}
  17%,23%,29%,35%,39%{transform:translateY(-6%) rotate(-4deg)}
  20%,26%,32%,37%{transform:translateY(1%) rotate(3deg)}
}
.north-parcel{left:calc(var(--post-x) + 4%);top:calc(var(--post-ground) + 2%);width:clamp(26px,3vw,51px);opacity:0;animation:north-loading 26s linear -7s infinite}
@keyframes north-loading{
  0%,38%{left:calc(var(--post-x) + 4%);top:calc(var(--post-ground) + 2%);opacity:0}
  43%,48%{opacity:1}
  51%,100%{opacity:0}
}
.north-railway{position:absolute;inset:0;z-index:8;pointer-events:none}
.north-train{z-index:3;left:var(--post-x);top:var(--rail-y);transform:translate(-50%,-94%);width:var(--train-width);animation:north-train 26s linear -7s infinite}
/* The carriage acquires each load as the matching elf reaches the track. */
.north-train .north-fresh-cargo{
  position:absolute;top:22%;width:16%;opacity:0;filter:none;
  animation:north-cargo-loaded 26s steps(1,end) -7s infinite;
}
.north-cargo-first{left:64%}
.north-train .north-cargo-second{left:78%;top:19%;animation-delay:-5.8s}
@keyframes north-cargo-loaded{0%{opacity:0}71%,100%{opacity:1}}
.north-train::after{content:"";position:absolute;top:6%;left:11%;width:12px;height:8px;border-radius:50%;background:#fff3e5;animation:north-steam .9s ease-out infinite}
@keyframes north-steam{from{opacity:.85;transform:scale(.3)}to{opacity:0;transform:translate(24px,-24px) scale(2.8)}}
@keyframes north-train{
  0%,44%{left:117%}
  59%,77%{left:var(--post-x)}
  98%,100%{left:-17%}
}
.north-skate{left:var(--rink-x);top:var(--rink-y);width:clamp(43px,5.4vw,82px);animation:north-skating 9s ease-in-out -2s infinite}
.north-skate img{animation:north-skate-turn 9s ease-in-out -2s infinite}
@keyframes north-skating{
  0%,100%{left:calc(var(--rink-x) - 3%);top:var(--rink-y)}
  25%{left:var(--rink-x);top:calc(var(--rink-y) + 3%)}
  50%{left:calc(var(--rink-x) + 4%);top:calc(var(--rink-y) + 1%)}
  75%{left:var(--rink-x);top:calc(var(--rink-y) - 3%)}
}
@keyframes north-skate-turn{
  0%,100%{transform:scaleX(1) rotate(4deg)}
  25%{transform:scaleX(1) rotate(-6deg)}
  57%{transform:scaleX(1) rotate(5deg)}
  60%,88%{transform:scaleX(-1) rotate(-4deg)}
  92%{transform:scaleX(1) rotate(4deg)}
}
.north-smoke{position:absolute;left:var(--chimney-x);top:var(--chimney-y)}
.north-smoke i{position:absolute;width:15px;height:12px;border-radius:50%;filter:blur(1px);background:#eee7f6;animation:north-smoke 4.8s ease-out infinite;opacity:0}
.north-smoke i:nth-child(2){animation-delay:-1.6s}
.north-smoke i:nth-child(3){animation-delay:-3.2s}
@keyframes north-smoke{10%{opacity:.74}100%{transform:translate(26px,-60px) scale(3);opacity:0}}
.north-workshop-glow{position:absolute;left:var(--workshop-x);top:calc(var(--workshop-y) - 2%);width:9%;aspect-ratio:1.45;transform:translate(-50%,-75%);background:radial-gradient(ellipse,#ffdb808c,transparent 70%);mix-blend-mode:screen;opacity:.15;animation:north-workshop 26s linear -7s infinite}
@keyframes north-workshop{0%,18%{opacity:.85}32%,85%{opacity:.13}100%{opacity:.85}}

.north-tree-lights{position:absolute;inset:0;z-index:2;pointer-events:none;opacity:1;transition:opacity .25s}
.north-lights-off .north-tree-lights{opacity:0}
.north-tree-lights i{position:absolute;left:var(--x);top:var(--y);width:clamp(4px,.63vw,10px);aspect-ratio:1;border-radius:50%;background:#fffbb8;box-shadow:0 0 7px 3px #ffc957,0 0 18px 6px #fbaa6d84;animation:north-twinkle 1.8s calc(var(--bulb) * -0.55s) ease-in-out infinite alternate}
.north-tree-lights i:nth-child(3n){background:#fff3f1;box-shadow:0 0 7px 3px #ff8397,0 0 18px 6px #fc6b8f8c}
.north-tree-lights i:nth-child(3n + 1){background:#e4ffef;box-shadow:0 0 7px 3px #98efbe,0 0 18px 6px #73dfaf84}
@keyframes north-twinkle{from{opacity:.57;transform:scale(.8)}to{opacity:1;transform:scale(1.17)}}
.north-cookie,.north-sleigh{opacity:0;z-index:4}
.north-cookie{left:var(--oven-x);top:var(--oven-y);width:clamp(48px,5vw,82px)}
.north-cookie.north-play{animation:north-cookie-run 3.45s ease-in-out both}
@keyframes north-cookie-run{
  0%{opacity:0;transform:translate(-50%,-55%) rotate(-13deg) scale(.5)}
  14%{opacity:1;transform:translate(-42%,-102%) rotate(14deg) scale(1.04)}
  34%{opacity:1;transform:translate(-15%,-52%) rotate(-10deg)}
  54%{opacity:1;transform:translate(55%,-86%) rotate(12deg)}
  76%{opacity:.9;transform:translate(105%,-60%) rotate(-9deg)}
  100%{opacity:0;transform:translate(225%,-72%) rotate(10deg)}
}
.north-sleigh{left:95%;top:18%;width:clamp(130px,22vw,306px)}
.north-sleigh.north-play{animation:north-fly 4.2s ease-in-out both}
@keyframes north-fly{
  0%{left:111%;top:23%;opacity:0;transform:translate(-50%,-50%) rotate(-5deg)}
  13%{opacity:1}
  47%{left:56%;top:14%;transform:translate(-50%,-50%) rotate(6deg)}
  86%{opacity:1}
  100%{left:-13%;top:22%;opacity:0;transform:translate(-50%,-50%) rotate(-4deg)}
}
@keyframes north-still{0%,85%{opacity:1}100%{opacity:0}}

.north-post-office{position:absolute;z-index:6;left:var(--post-x);top:var(--post-ground);transform:translate(-50%,-100%);display:grid}
.north-post-office .building{width:var(--office-size);height:auto;aspect-ratio:auto;transition:transform .22s ease}
.north-office-sign{
  position:absolute;right:calc(100% - 15px);bottom:-9px;
  width:clamp(57px,5.8cqw,83px);
  filter:drop-shadow(1px 3px 3px #121b4e90);
}
.north-office-sign img{display:block;width:100%;height:auto}
.north-office-plank{
  position:absolute;top:44%;left:45%;transform:translate(-50%,-50%);text-align:center;white-space:nowrap;
  color:#692843;font:700 clamp(8px,.77cqw,11px)/1 Georgia,serif;
}
.north-bakery-button{
  position:absolute;z-index:5;left:9%;top:17%;width:25%;height:23%;
  border:0;border-radius:28% 28% 12% 12%;background:transparent;
}
.north-bakery-button:hover{background:#ffe4a314}
.north-mobile-hint{position:absolute;left:12px;bottom:16px;z-index:6}
.north-message{display:block;position:absolute;z-index:7;bottom:13px;left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100% - 25px);border:1px solid var(--north-edge);border-radius:12px;padding:6px 12px;background:var(--north-panel);box-shadow:0 4px 11px #0c163780;text-align:center;font-size:.83rem;pointer-events:none}
.north-message:empty{padding:0;border:0;box-shadow:none}
.paused .north-ambient *,.paused .north-ambient *::after,.paused .north-railway *,.paused .north-railway *::after,.paused .north-loader,.paused .north-loader img,.paused .north-tree-lights i{animation-play-state:paused}
.paused .north-cookie.north-play,.paused .north-sleigh.north-play{animation:north-still 2s both}

@media(max-width:700px){
  body[data-view="village"] .topbar-inner{width:calc(100% - 24px)}
  .north-stage{--office-size:195px}
}
@media(prefers-reduced-motion:reduce){
  .north-ambient *,.north-ambient *::after,.north-railway *,.north-railway *::after,.north-loader,.north-loader img,.north-tree-lights i{animation:none!important}
  .north-elf{left:calc(var(--post-x) + 10%);top:calc(var(--post-ground) + 2%)}
  .north-cookie.north-play,.north-sleigh.north-play{animation:north-still 2s both!important}
  .north-sleigh{left:75%;top:20%}
}

.north-backdrop,.north-rail-foreground,.north-elf-foreground,.north-post-office .building{transition-property:filter,transform;transition-duration:.25s}
.north-lights-off .north-backdrop,.north-lights-off .north-rail-foreground,.north-lights-off .north-elf-foreground,.north-lights-off .north-post-office .building{filter:brightness(.66) saturate(.73)}
.north-lights-off .north-workshop-glow{visibility:hidden}
.north-window-shades,.north-office-windows{position:absolute;inset:0;pointer-events:none;opacity:0;transition:opacity .25s}
.north-lights-off .north-window-shades,.north-lights-off .north-office-windows{opacity:1}
.north-window-shades i,.north-office-windows i{
  position:absolute;background:#202a389c;border-radius:35% 35% 12% 12%;
}
.north-window-shades i{left:var(--x);top:var(--y);width:var(--w);height:var(--h);transform:translate(-50%,-50%)}
.north-office-windows i:nth-child(1){left:14%;top:71%;width:19%;height:16%}
.north-office-windows i:nth-child(2){right:14%;top:71%;width:18%;height:16%}
.north-office-windows i:nth-child(3){left:45%;top:73%;width:10%;height:10%}
.north-office-windows i:nth-child(4){left:45%;top:29%;width:10%;height:12%}
.north-office-windows i:nth-child(5){left:24%;top:15%;width:8%;height:10%}

.north-loader{
  --lane:0%;--carriage-spot:.18;--foot-delay:-7s;
  transform:translate(-50%,-100%);
  left:calc(var(--post-x) + 8%);top:calc(var(--post-ground) + 3%);width:4.4cqw;
  opacity:0;animation:north-elf-load 26s linear var(--foot-delay) infinite;
}
.north-loader-second{--lane:3.5%;--carriage-spot:.36;--foot-delay:-5.8s}
.north-loader img{animation:north-loader-steps .53s ease-in-out infinite alternate}
.north-loader-second img{filter:drop-shadow(0 3px 2px #3852724d) hue-rotate(-23deg);animation-delay:-.23s}
@keyframes north-elf-load{
  0%,44%{left:var(--post-x);top:calc(var(--post-ground) - 2%);width:3.2cqw;opacity:0;z-index:2}
  46%{left:var(--post-x);top:calc(var(--post-ground) - .5%);width:3.4cqw;opacity:0;z-index:7}
  49%{left:calc(var(--post-x) + 1.4%);top:calc(var(--post-ground) + 2.3%);width:3.7cqw;opacity:1;z-index:7}
  57%{left:calc(var(--post-x) + 4.5% + var(--lane));top:calc(var(--post-ground) + 12%);width:4.1cqw;opacity:1;z-index:7}
  65%,69%{left:calc(var(--post-x) + var(--train-width) * var(--carriage-spot));top:calc(var(--rail-y) - 5%);opacity:1;z-index:7}
  73%,100%{left:calc(var(--post-x) + var(--train-width) * var(--carriage-spot));top:calc(var(--rail-y) - 5%);opacity:0;z-index:7}
}
@keyframes north-loader-steps{from{transform:translateY(0) scaleX(-1) rotate(-3deg)}to{transform:translateY(-8%) scaleX(-1) rotate(4deg)}}

/* The door texture is cropped from each building, with the hinge at the left jamb. */
.north-door {
  --arch: polygon(0 100%,0 35%,6% 21%,17% 10%,34% 2%,50% 0%,66% 2%,83% 10%,94% 21%,100% 35%,100% 100%);
  --visit-time: 6.2s;
  position:absolute;pointer-events:none;
  visibility:hidden;
}
.north-door-bakery{
  left:20.0521%;top:32.3242%;width:3.3854%;height:6.0547%;z-index:3;
  --step-x:72%;--step-y:28%;
  --panel:url("north-village/bakery-door.webp");
}
.north-door-office{
  left:43.6526%;top:68.8636%;width:15.3675%;height:24.0909%;
  --step-x:-69%;--step-y:21%;
  --panel:url("north-village/office-door.webp");
}
.north-door.north-play {
  visibility:visible;
  animation:north-visit var(--visit-time) linear both;
}
@keyframes north-visit { from { --visiting:0; } to { --visiting:1; } }
.north-door-interior,.north-door-panel {
  position:absolute;inset:0;clip-path:var(--arch);
}
.north-door-interior {
  background:radial-gradient(ellipse at 55% 80%,#946b48,#342533 68%);
}
.north-door-panel {
  z-index:3;
  background:var(--panel) center/100% 100% no-repeat;
  transform-origin:0 50%;
}
.north-play .north-door-panel {
  animation:north-door-swing var(--visit-time) ease-in-out both;
}
.north-door .north-santa {
  left:50%;top:100%;width:auto;height:82%;opacity:0;
  transform:translate(-50%,-100%);
}
.north-door.north-play .north-santa {
  animation:north-santa-visit var(--visit-time) ease-in-out both;
}
.north-door .north-santa img { height:100%;width:auto;max-width:none; }
.north-door-office .north-santa { height:86%; }
.north-lights-off .north-door-interior,.north-lights-off .north-door-panel {
  filter:brightness(.66) saturate(.73);
}
@keyframes north-door-swing {
  0%,4%,97%,100% { transform:scaleX(1); }
  16%,86% { transform:scaleX(.16); }
}
@keyframes north-santa-visit {
  0%,12% { opacity:0;transform:translate(-50%,-105%) scale(.76); }
  23% { opacity:1;transform:translate(-50%,-97%) scale(.88); }
  36%,67% { opacity:1;transform:translate(calc(-50% + var(--step-x)),calc(-100% + var(--step-y))); }
  82% { opacity:1;transform:translate(-50%,-97%) scale(.88); }
  90%,100% { opacity:0;transform:translate(-50%,-105%) scale(.76); }
}
.north-stars { position:absolute;inset:0;z-index:0;pointer-events:none; }
.north-stars i {
  position:absolute;left:var(--x);top:var(--y);width:var(--star-size);aspect-ratio:1;
  border-radius:50%;background:#e4f7ff;box-shadow:0 0 4px 1px #80b9ff99;
  opacity:.42;animation:north-star var(--period) var(--phase) ease-in-out infinite;
}
.north-stars i:nth-child(4n) { background:#fff2df;box-shadow:0 0 5px 1px #ffbfac88; }
@keyframes north-star {
  0%,100% { opacity:.22;transform:scale(.75); }
  45% { opacity:.93;transform:scale(1.12); }
}
.paused .north-sleigh{left:74%}
@media(prefers-reduced-motion:reduce){
  .north-stars i { animation:none; }
  .north-door.north-play { animation-duration:2.5s; }
  .north-play .north-door-panel { animation:none;transform:scaleX(.16); }
  .north-door.north-play .north-santa {
    animation:none;opacity:1;
    transform:translate(calc(-50% + var(--step-x)),calc(-100% + var(--step-y)));
  }
}

.north-stage { container-type: inline-size; }
.north-village { background: #152453; }
.north-message { bottom: calc(var(--village-control-size) + 26px); }
.north-switch-mechanism {
  position:relative;display:block;width:78%;height:64%;border-radius:30%;
  background:linear-gradient(145deg,#407c82,#174654 74%);
  border:1px solid #b9d7bd;
  box-shadow:inset 1px 2px 1px #c8f7e98a,inset 0 -3px #112f3d,0 3px 2px #0a163b85;
}
.north-switch-mechanism::before{
  content:"";position:absolute;inset:42% 19% 23%;border-radius:50%;background:#112b3b;
}
.north-lever{
  position:absolute;left:44%;bottom:31%;width:14%;height:63%;
  border-radius:8px;background:linear-gradient(90deg,#82704c,#fff5ce 55%,#b29358);
  transform-origin:50% 90%;transform:rotate(38deg);transition:transform .28s cubic-bezier(.2,.85,.4,1.2);
}
.north-lever::before{
  content:"";position:absolute;top:-25%;left:-92%;width:285%;aspect-ratio:1;
  border-radius:50%;background:radial-gradient(circle at 33% 27%,#fff3b4,#ffc965 34%,#b3582c 84%);
  box-shadow:0 2px 2px #311531aa;
}
.north-light-switch[aria-checked="false"] .north-lever{transform:rotate(-38deg)}
.north-switch-light{
  position:absolute;bottom:13%;right:12%;width:16%;aspect-ratio:1;border-radius:50%;
  background:#a3ffd5;box-shadow:0 0 5px #52ffab;
}
.north-light-switch[aria-checked="false"] .north-switch-light{background:#ff969f;box-shadow:0 0 5px #ff596d}
.north-bell-button.north-play .village-icon{animation:north-bell-swing .72s ease-out}
@keyframes north-bell-swing{
  0%,100%{transform:rotate(0)}
  20%{transform:rotate(-25deg)}
  43%{transform:rotate(19deg)}
  66%{transform:rotate(-11deg)}
  83%{transform:rotate(6deg)}
}
