/* The Advent Cabinet. Designed to css/tokens.css only. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 120px; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 18px/1.55 var(--sans); overflow-x: clip;
}
/* paper grain over everything */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: .14; mix-blend-mode: multiply;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .3  0 0 0 0 .25  0 0 0 0 .2  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 6px var(--snow); border-radius: var(--r-sm); }
.skip { position: absolute; left: var(--s4); top: -60px; z-index: 100; background: var(--snow); padding: var(--s2) var(--s4); border-radius: var(--r-sm); }
.skip:focus { top: var(--s4); left: 50%; translate: -50% 0; } /* centred, clear of the brand tag and the banners */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- header: the garland ---------- */
.garland { position: fixed; inset: 0 0 auto; height: 150px; z-index: 50; pointer-events: none; }
.garland::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 118px; opacity: 0; transition: opacity .3s var(--ease-out);
  background: linear-gradient(var(--hbg, var(--paper)) 62%, transparent);
}
.past-hero .garland::before { opacity: 1; }
.on-night .garland { --hbg: var(--night); }
.garland-svg { position: absolute; inset: 0; width: 100%; height: 160px; overflow: visible; } /* height must match garland.js viewBox (160) or the string scales to .94 and stops short of both edges */
.garland .string { fill: none; stroke: var(--kraft); stroke-width: 2; stroke-linecap: round; }
.garland .brand, .garland .banner {
  position: absolute; top: 0; left: 0; pointer-events: auto; text-decoration: none;
  transform-origin: 50% 0; opacity: 0;
}
.garland.is-hung .brand, .garland.is-hung .banner { opacity: 1; }
/* each hangs from a short loop of string */
.garland .brand::before, .garland .banner::before {
  content: ""; position: absolute; left: calc(50% - 1px); top: -2px; width: 2px; height: 10px; background: var(--kraft);
}
.garland .brand::before { height: 18px; z-index: 1; }
.garland .brand span {
  display: block; margin-top: 8px; padding: 18px 16px 12px; background: var(--paper-2); color: var(--ink);
  font: 18px/1 var(--display); text-align: center; white-space: nowrap;
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%, 0 14px);
  /* punched hole for the string */
  background-image: radial-gradient(circle at 50% 8px, var(--night) 0 3px, transparent 3.5px);
  filter: drop-shadow(0 4px 0 rgb(42 36 32 / .2));
}
.garland .banner span {
  display: block; margin-top: 8px; padding: 10px 18px 24px; color: var(--snow);
  font: 700 16px/1 var(--sans); letter-spacing: .02em; white-space: nowrap;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 12px), 0 100%);
  transition: background-color .2s var(--ease-out);
}
.garland .banner:nth-child(1) span { background: var(--berry); }
.garland .banner:nth-child(2) span { background: var(--pine-2); }
.garland .banner:nth-child(3) span { background: var(--gold); color: var(--ink); }
.garland .banner:hover span { filter: brightness(1.12); }
@media (max-width: 699px) {
  .garland .brand span { font-size: 14px; padding: 15px 10px 9px; }
  .garland .banner span { font-size: 14px; padding: 9px 10px 20px; }
}

/* ---------- hero: cut-paper street ---------- */
.hero { position: relative; height: 100svh; min-height: 640px; overflow: hidden; background: var(--night); isolation: isolate; }
.scene, .scene .layer, .snow { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene .layer { will-change: transform; }
/* portrait: the street sits lower and smaller so more of it shows; the sky is the hero background */
@media (max-aspect-ratio: 4/5) { .scene .layer:not([data-depth="0"]) { top: auto; height: 68%; } }
.snow { pointer-events: none; z-index: 2; }
.star { animation: twinkle 2.4s var(--boil) infinite var(--d); }
.lit { animation: lamp 3.2s var(--boil) infinite var(--d); }
@keyframes twinkle { 0%, 100% { opacity: .9; } 40% { opacity: .35; } 70% { opacity: .7; } }
@keyframes lamp { 0%, 100% { opacity: 1; } 48% { opacity: .82; } 52% { opacity: .95; } }
.hero-copy {
  position: absolute; z-index: 3; inset: max(112px, 12svh) var(--s5) auto; text-align: center; color: var(--snow);
  display: grid; justify-items: center; gap: var(--s4);
}
.eyebrow {
  margin: 0; padding: 6px 12px; background: var(--gold); color: var(--ink); border-radius: var(--r-sm);
  font: 700 15px/1.2 var(--sans); letter-spacing: .02em; transform: rotate(-1.5deg);
}
.hero h1 {
  margin: 0; font: clamp(52px, min(11vw, 13svh), 164px)/.88 var(--display); letter-spacing: -.01em;
  /* a second sheet of red paper behind the white letters */
  text-shadow: 0 .045em 0 var(--berry), 0 .1em .12em rgb(0 0 0 / .35);
}
.lede { margin: 0; max-width: 34ch; text-wrap: balance; font-size: clamp(17px, 2.2svh, 20px); color: color-mix(in oklab, var(--snow), var(--night) 8%); text-shadow: 0 1px 2px var(--night), 0 0 12px var(--night), 0 0 28px var(--night), 0 0 44px var(--night); }
.scroll-cue { position: absolute; z-index: 3; left: 50%; bottom: 40px; width: 2px; height: 46px; background: rgb(255 250 242 / .3); }
.scroll-cue span { position: absolute; left: -3px; top: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--snow); animation: cue 1.8s var(--ease-out) infinite; }
@keyframes cue { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(40px); opacity: 0; } }

/* ---------- the cabinet ---------- */
.cabinet-wrap {
  position: relative; height: 260vh; overflow-x: clip;
  /* old striped wallpaper */
  background: repeating-linear-gradient(90deg, var(--paper) 0 34px, var(--paper-2) 34px 36px);
}
.cabinet-pin { position: sticky; top: 0; height: 100svh; display: grid; place-content: center; justify-items: center; gap: var(--s4); padding: 120px var(--s4) var(--s5); }
.cabinet { --open: 0; width: max(min(calc(100vw - 60px), 300px), min(calc(100vw - 60px), 620px, calc((100svh - 230px) * .92))); position: relative; }
.crown {
  height: 34px; margin: 0 -14px -2px; background: var(--wood-dark); border-radius: var(--r-md) var(--r-md) 0 0;
  box-shadow: inset 0 -6px 0 rgb(0 0 0 / .18), var(--lift);
  clip-path: polygon(0 100%, 0 40%, 30% 40%, 38% 0, 62% 0, 70% 40%, 100% 40%, 100% 100%);
}
.carcass {
  position: relative; padding: 14px; border-radius: 0 0 var(--r-sm) var(--r-sm); perspective: 1600px;
  background:
    repeating-linear-gradient(90deg, transparent 0 22px, rgb(94 58 37 / .22) 22px 23px, transparent 23px 61px),
    linear-gradient(var(--wood), color-mix(in oklab, var(--wood), var(--wood-dark) 30%));
  box-shadow: var(--lift-hi), inset 0 0 0 3px rgb(0 0 0 / .12);
}
.plinth { height: 22px; margin: 0 -8px; background: var(--wood-dark); border-radius: 0 0 var(--r-sm) var(--r-sm); box-shadow: var(--lift); }

.drawers { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: clamp(5px, 1.4vw, 9px); }
.cabinet:not(.is-ready) .drawers { pointer-events: none; }
.drawer {
  position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1 / .92; padding: 0; border: 0; cursor: pointer;
  border-radius: var(--r-sm); color: var(--ink); font: inherit;
  background: linear-gradient(color-mix(in oklab, var(--kraft), var(--wood) 35%), color-mix(in oklab, var(--kraft), var(--wood) 60%));
  box-shadow: inset 0 2px 0 rgb(255 250 242 / .25), inset 0 -3px 0 rgb(0 0 0 / .22), 0 2px 3px rgb(0 0 0 / .35);
  transition: transform .45s var(--ease-spring), box-shadow .3s var(--ease-out);
}
/* brass card holder with the day number */
.drawer .label {
  position: relative; display: grid; place-items: center; width: 56%; aspect-ratio: 1.45; margin-top: -14%;
  background: var(--paper); border: 2px solid var(--gold); border-radius: 2px;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / .25);
}
.drawer { container-type: inline-size; }
/* sized to the drawer, not the viewport: two digits always clear the holder's screws */
.drawer .num { font: min(26px, max(12px, 19cqi))/1 var(--display); }
/* brass pull */
.drawer .pull {
  position: absolute; left: 33%; right: 33%; bottom: 16%; height: 9%; min-height: 6px;
  border: 3px solid var(--gold); border-top: 0; border-radius: 0 0 99px 99px;
}
/* locked: a keyhole instead of a pull */
.drawer:not(.is-open) .pull { left: calc(50% - 4px); right: auto; width: 8px; height: 12px; border: 0; border-radius: 4px 4px 1px 1px; background: var(--wood-dark); }
.drawer:not(.is-open) .num { color: var(--ink-2); }
.drawer.is-open:hover, .drawer.is-open:focus-visible { transform: translateY(-3px); box-shadow: inset 0 2px 0 rgb(255 250 242 / .25), inset 0 -3px 0 rgb(0 0 0 / .22), var(--lift-hi); }
.drawer.is-open:active { transform: translateY(-1px) scale(.98); }
.drawer.pulling { transform: translateY(-8px) scale(1.08); z-index: 2; box-shadow: var(--lift-hi); }
.drawer:focus-visible { outline: 3px solid var(--snow); outline-offset: 2px; box-shadow: 0 0 0 6px var(--ink); }
/* today: felt bow and a slow warm glow */
.drawer.is-today { animation: glow 2.4s var(--ease-out) infinite alternate; }
@keyframes glow { to { box-shadow: inset 0 2px 0 rgb(255 250 242 / .25), inset 0 -3px 0 rgb(0 0 0 / .22), 0 0 0 3px var(--gold), 0 0 22px 4px rgb(201 154 59 / .55); } }
.bow { position: absolute; top: -7px; right: -7px; width: 30px; height: 20px; filter: drop-shadow(0 2px 0 rgb(0 0 0 / .25)); }
.bow::before, .bow::after { content: ""; position: absolute; top: 2px; width: 15px; height: 14px; background: var(--berry); border-radius: 50% 10% 50% 10%; }
.bow::before { left: 0; } .bow::after { right: 0; transform: scaleX(-1); }
/* opened before: a gold star sticker */
.drawer.is-seen .label::after {
  content: ""; position: absolute; right: -7px; top: -7px; width: 14px; height: 14px; background: var(--gold);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.drawer.rattle { animation: rattle .42s var(--boil) 1; }
@keyframes rattle { 0% { transform: translateX(0); } 14% { transform: translateX(-3px) rotate(-1.5deg); } 28% { transform: translateX(3px) rotate(1.2deg); } 42% { transform: translateX(-2px); } 57% { transform: translateX(2px); } 71% { transform: translateX(-1px); } 100% { transform: none; } }

/* doors: swing open with scroll (--open 0..1 from js) */
.door {
  position: absolute; top: 8px; bottom: 8px; width: calc(50% - 8px); z-index: 3; display: grid; padding: 14px;
  background: linear-gradient(color-mix(in oklab, var(--wood), var(--kraft) 18%), var(--wood));
  box-shadow: inset 0 0 0 2px rgb(0 0 0 / .15), var(--lift);
  border-radius: var(--r-sm); backface-visibility: visible;
  filter: brightness(calc(1 - var(--open) * .18));
}
.door-l { left: 8px; transform-origin: 0 50%; transform: rotateY(calc(var(--open) * var(--swing, 118deg) * -1)); }
.door-r { right: 8px; transform-origin: 100% 50%; transform: rotateY(calc(var(--open) * var(--swing, 118deg))); }
/* phones: the doors stop near edge-on, so the cabinet keeps its full size (drawers stay >= 44 px) */
@media (max-width: 1023px) { .cabinet { --swing: 96deg; } }
.cabinet.is-ready .door { pointer-events: none; }
.door .panel > * { grid-area: 1 / 1; opacity: clamp(0, (.76 - var(--open)) * 100, 1); }
/* the back of the left door: a tally card, flipped so it reads the right way round */
.door .panel > .inside {
  opacity: clamp(0, (var(--open) - .76) * 100, 1); transform: scaleX(-1) rotate(3deg);
  margin: 0; padding: 8px 10px; max-width: 80%; background: var(--paper); border-radius: var(--r-sm); box-shadow: var(--lift);
  font: 700 clamp(12px, 1.8vw, 15px)/1.25 var(--sans); text-align: center;
}
.panel {
  display: grid; place-items: center; border-radius: var(--r-sm);
  background: color-mix(in oklab, var(--wood), var(--kraft) 30%);
  box-shadow: inset 0 3px 6px rgb(0 0 0 / .3), inset 0 -1px 0 rgb(255 250 242 / .2);
}
.wreath {
  position: relative; width: 62%; aspect-ratio: 1; border-radius: 50%;
  border: clamp(9px, 3vw, 18px) solid var(--pine); box-shadow: var(--lift), inset 0 0 0 2px var(--pine-2);
  outline: 2px dashed rgb(255 250 242 / .45); outline-offset: calc(clamp(9px, 3vw, 18px) * -.55);
}
.wreath::after {
  content: ""; position: absolute; left: 50%; bottom: calc(clamp(9px, 3vw, 18px) * -1.4); width: 44%; height: 26%; translate: -50% 0;
  background: radial-gradient(ellipse 30% 45% at 25% 50%, var(--berry) 96%, transparent), radial-gradient(ellipse 30% 45% at 75% 50%, var(--berry) 96%, transparent), radial-gradient(circle at 50% 50%, var(--berry-2) 14%, transparent 15%);
}
.door-note {
  margin: 0; padding: 10px 12px; background: var(--paper); border-radius: var(--r-sm); box-shadow: var(--lift);
  font: clamp(14px, 2.6vw, 21px)/1.05 var(--display); text-align: center; transform: rotate(-4deg);
}
.knob { position: absolute; top: calc(50% - 7px); width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--snow), var(--gold) 45%, var(--wood-dark)); }
.door-l .knob { right: 8px; } .door-r .knob { left: 8px; }
.cabinet-status { min-height: 1.55em; margin: 0; color: var(--ink-2); text-align: center; }

/* ---------- about ---------- */
.about { padding: var(--s9) var(--s4); }
.note {
  position: relative; max-width: 660px; margin: 0 auto; padding: var(--s7) var(--s7) var(--s6);
  background: var(--snow); box-shadow: var(--lift-hi); transform: rotate(-.6deg);
}
/* washi tape */
.note::before { content: ""; position: absolute; top: -14px; left: calc(50% - 60px); width: 120px; height: 28px; background: rgb(178 51 46 / .72); transform: rotate(2deg); }
.note h2 { margin: 0 0 var(--s4); font: clamp(36px, 5vw, 54px)/1 var(--display); color: var(--pine); }
.note p { margin: 0 0 var(--s4); max-width: 56ch; }
.facts { list-style: none; margin: var(--s5) 0 0; padding: var(--s5) 0 0; border-top: 2px dashed var(--paper-2); display: grid; gap: var(--s3); }
.facts li { position: relative; padding-left: var(--s5); }
.facts li::before { content: ""; position: absolute; left: 0; top: .5em; width: 10px; height: 10px; border-radius: 50%; background: var(--berry); }
.facts li:nth-child(2)::before { background: var(--pine-2); }
.facts li:nth-child(3)::before { background: var(--gold); }
@media (max-width: 599px) { .note { padding: var(--s6) var(--s5) var(--s5); } }

/* ---------- footer: the mantel ---------- */
.mantel { background: var(--night); color: var(--snow); padding: var(--s8) 30px var(--s6); } /* 30 = 16 + the shelf overhang */
.fireplace { position: relative; max-width: 940px; margin: 0 auto; }
.fireplace .stockings { position: absolute; top: 24px; left: 0; right: 0; margin: 0; }
.shelf {
  position: relative; z-index: 2; height: 30px; margin: 0 -14px; border-radius: var(--r-sm);
  background: linear-gradient(var(--wood), var(--wood-dark)); box-shadow: var(--lift-hi);
}
.stockings {
  position: relative; z-index: 3; list-style: none; margin: -6px 0 0; padding: 0 var(--s4);
  display: flex; justify-content: space-between; gap: var(--s3);
}
.stocking {
  --c: var(--berry); position: relative; display: block; width: 116px; height: 180px; text-decoration: none; color: var(--ink);
  transform-origin: 50% 0;
}
.stocking::before {
  content: ""; position: absolute; inset: 30px 0 0; background: var(--c);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 150'><path d='M14 0H78V82Q78 100 92 110Q104 120 98 136Q90 152 66 148L32 142Q4 136 8 110Q12 92 14 82Z'/></svg>") no-repeat 0 0 / 100% 100%;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 150'><path d='M14 0H78V82Q78 100 92 110Q104 120 98 136Q90 152 66 148L32 142Q4 136 8 110Q12 92 14 82Z'/></svg>") no-repeat 0 0 / 100% 100%;
  filter: drop-shadow(-2px 4px 0 rgb(0 0 0 / .3));
}
.stockings li { position: relative; }
.stockings li::before { content: ""; position: absolute; z-index: 1; left: calc(47% - 5px); top: -10px; width: 10px; height: 16px; border: 3px solid var(--gold); border-top: 0; border-radius: 0 0 6px 6px; }
.s-pine { --c: var(--pine-2); } .s-gold { --c: var(--gold); } .s-snow { --c: var(--paper-2); }
.stocking .name {
  position: absolute; top: 8px; left: 4%; width: 86%; min-height: 40px; padding: 4px 6px; display: grid; place-items: center;
  background: var(--snow); border-radius: 6px 6px 10px 10px; box-shadow: var(--lift);
  outline: 1.5px dashed rgb(42 36 32 / .25); outline-offset: -5px;
  font: 700 15px/1.05 var(--sans); text-align: center;
}
.stocking:hover, .stocking:focus-visible { animation: swing 1.3s var(--ease-out) 1; }
.stocking:focus-visible { outline: 3px solid var(--snow); outline-offset: 4px; box-shadow: none; }
@keyframes swing { 0% { rotate: 0deg; } 15% { rotate: 8deg; } 35% { rotate: -5deg; } 55% { rotate: 3deg; } 75% { rotate: -1.5deg; } 100% { rotate: 0deg; } }
.hearth {
  position: relative; z-index: 1; margin: 0 auto; height: 290px; width: 100%;
  background: color-mix(in oklab, var(--wood-dark), var(--night) 35%); border-radius: 0 0 var(--r-sm) var(--r-sm);
  display: grid; place-items: end center;
  box-shadow: inset 0 0 0 12px color-mix(in oklab, var(--wood-dark), var(--night) 20%);
}
.hearth::after { content: ""; position: absolute; left: -14px; right: -14px; bottom: -16px; height: 16px; background: var(--paper-2); border-radius: var(--r-sm); box-shadow: var(--lift); }
.firebox {
  position: relative; width: min(54%, 420px); height: 190px; overflow: hidden;
  background: radial-gradient(ellipse 70% 60% at 50% 100%, rgb(201 154 59 / .5), transparent 70%), color-mix(in oklab, var(--ink), #000 45%);
  border-radius: 999px 999px 0 0; box-shadow: inset 0 0 0 10px color-mix(in oklab, var(--wood-dark), var(--night) 15%);
}
/* stop-motion flames: shapes swap pose at 12 fps instead of tweening */
.fire { position: absolute; left: 50%; bottom: 30px; width: 0; height: 0; }
/* teardrop flames: a rounded square turned 45deg; scale swaps pose at 12 fps */
.fire i { position: absolute; bottom: 0; width: var(--w); aspect-ratio: 1; margin-left: calc(var(--x) - var(--w) / 2); border-radius: 0 50% 50% 50%; rotate: 45deg; transform-origin: 50% 100%; animation: flame .5s var(--boil) infinite; }
.fire i:nth-child(1) { --w: 58px; --x: -38px; background: var(--berry); animation-delay: -.08s; }
.fire i:nth-child(2) { --w: 74px; --x: 4px; background: var(--berry-2); animation-delay: -.25s; }
.fire i:nth-child(3) { --w: 54px; --x: 40px; background: var(--berry); animation-delay: -.17s; }
.fire i:nth-child(4) { --w: 36px; --x: 2px; background: var(--gold); animation-delay: -.33s; }
@keyframes flame { 0% { scale: 1 1; } 17% { scale: .9 1.1; } 33% { scale: 1.06 .94; } 50% { scale: .94 1.12; } 67% { scale: 1.04 .96; } 83% { scale: .96 1.06; } }
.logs { position: absolute; left: 22%; right: 22%; bottom: 10px; height: 26px; background: linear-gradient(170deg, var(--wood) 0 48%, transparent 48%), linear-gradient(10deg, var(--wood-dark) 0 52%, transparent 52%); border-radius: 12px; }
.colophon { max-width: 940px; margin: var(--s6) auto 0; text-align: center; font-size: 15px; color: color-mix(in oklab, var(--snow), var(--night) 30%); }
@media (max-width: 599px) {
  .stockings { padding: 0 var(--s1); gap: var(--s2); }
  .stocking { width: 78px; height: 128px; }
  .stocking::before { inset: 26px 0 0; }
  .stocking .name { font-size: 12px; min-height: 34px; width: 100%; left: 0; padding: 3px 5px; }
  .stockings li::before { left: calc(50% - 5px); }
  .hearth { height: 220px; }
  .stockings { justify-content: space-around; }
  .firebox { width: 72%; height: 140px; }
}

/* ---------- the tray (dialog) ---------- */
.tray {
  width: min(94vw, 640px); max-width: none; max-height: 94svh; padding: 0; border: 0; border-radius: var(--r-md); color: var(--ink);
  background: var(--paper); box-shadow: 0 30px 60px -20px rgb(0 0 0 / .6);
}
.tray::backdrop { background: rgb(28 36 51 / .72); }
.tray-inner { display: grid; justify-items: center; gap: var(--s3); padding: var(--s5) var(--s5) var(--s5); }
.tray-head { width: var(--stage-w); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--s4); }
.tray-day { margin: 0; grid-column: 1; font: 700 14px/1.2 var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--berry); }
.tray-head h2 { margin: 0; grid-column: 1; font: clamp(28px, 6vw, 40px)/1 var(--display); }
.tag-btn {
  grid-column: 2; grid-row: 1 / 3; min-height: 44px; padding: 0 var(--s4); border: 0; border-radius: var(--r-sm); cursor: pointer;
  background: var(--paper-2); color: var(--ink); font: 700 16px/1 var(--sans); box-shadow: var(--lift);
}
.tag-btn:hover { background: var(--kraft); }
:root { --stage-w: min(86vw, 560px, calc(100svh - 190px)); }
.stage { width: var(--stage-w); aspect-ratio: 1; position: relative; }
.tray-hint { margin: 0; color: var(--ink-2); text-align: center; }
::view-transition-group(drawer) { animation-duration: .5s; animation-timing-function: var(--ease-out); }
@media (max-width: 599px) {
  .tray-inner { padding: var(--s5); }
  :root { --stage-w: min(100%, calc(100svh - 190px)); }
  .tag-btn { padding: 0 var(--s3); font-size: 15px; }
}

/* ---------- reduced motion ---------- */
.rm .cabinet-wrap { height: auto; }
.rm .cabinet-pin { position: static; height: auto; min-height: 100svh; }
.rm .door { display: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

@media (max-width: 379px) { .stocking { width: 64px; height: 110px; } .stocking .name { font-size: 12px; } }

/* short screens (phone landscape, heavy zoom): no pinned scroll scene; the cabinet stands open */
@media (max-height: 600px) {
  .cabinet-wrap { height: auto; }
  .cabinet-pin { position: static; height: auto; padding-top: 120px; }
  .door { display: none; }
  .cabinet { width: min(92vw, 520px); }
  .tray-head { width: 100%; }
}
/* the tally card on the door only shows where the open door is on screen */
@media (max-width: 1023px) { .door .panel > .inside { display: none; } } /* doors stop edge-on there */
.door .panel > .inside { text-wrap: balance; }
.note p { text-wrap: pretty; }

/* ---------- QA round 3 ---------- */
/* header tags: the ring wraps the painted tag, not the string above it */
.garland .brand:focus-visible, .garland .banner:focus-visible { outline: none; box-shadow: none; }
.garland .brand:focus-visible::after, .garland .banner:focus-visible::after {
  content: ""; position: absolute; inset: 3px -5px -5px; border: 3px solid var(--snow); border-radius: var(--r-sm); box-shadow: 0 0 0 2px var(--ink); pointer-events: none;
}
/* the tray fits short desktop windows (1280x720) with room for the hint */
:root { --stage-w: min(86vw, 560px, calc(100svh - 214px)); }
@media (max-width: 599px) { :root { --stage-w: min(100%, calc(100svh - 214px)); } }
/* phones and tablets: the cabinet sits low in its pinned scene so no blank paper opens up before the mantel */
@media (max-width: 1023px) and (min-height: 601px) { .cabinet-pin { height: auto; padding-top: 174px; padding-bottom: var(--s5); } }
/* an empty tally card paints nothing */
.door .panel > .inside:empty { display: none; }
@media (max-width: 599px) { .pencil-mantel .scrawl { white-space: nowrap; font-size: 24px; } }
/* the header scrim only covers the bunting, so the top drawers stay clear under it */
.garland::before { height: 84px; background: linear-gradient(var(--hbg, var(--paper)) 45%, transparent); }
@media (max-width: 768px) { .garland::before { height: 84px; } }
/* the close tag weighs no more than the toy tags */
.tray .close { border: 0; outline-offset: 3px; box-shadow: var(--lift); }

/* ---------- the fire: layered flames, an ember bed, warm light on the brick and the stockings ---------- */
.firebox { background:
  radial-gradient(ellipse 60% 45% at 50% 100%, rgb(255 190 90 / .55), transparent 70%),
  radial-gradient(ellipse 90% 70% at 50% 100%, rgb(178 51 46 / .35), transparent 75%),
  color-mix(in oklab, var(--ink), #000 45%); }
.fire i { filter: blur(.4px); mix-blend-mode: screen; }
.fire i:nth-child(1) { --w: 62px; --x: -42px; background: linear-gradient(45deg, var(--berry) 30%, var(--berry-2)); }
.fire i:nth-child(2) { --w: 82px; --x: 2px; background: linear-gradient(45deg, var(--berry-2), var(--berry) 70%); }
.fire i:nth-child(3) { --w: 58px; --x: 44px; background: linear-gradient(45deg, var(--berry) 30%, var(--berry-2)); }
.fire i:nth-child(4) { --w: 52px; --x: -16px; background: linear-gradient(45deg, var(--gold), color-mix(in oklab, var(--gold), var(--berry) 40%)); animation-delay: -.33s; }
.fire i:nth-child(5) { --w: 46px; --x: 22px; background: linear-gradient(45deg, var(--gold), color-mix(in oklab, var(--gold), var(--berry) 40%)); animation-delay: -.12s; }
.fire i:nth-child(6) { --w: 30px; --x: 0px; background: linear-gradient(45deg, #fff3cf, var(--gold)); animation-delay: -.4s; }
.fire i:nth-child(7) { --w: 18px; --x: -30px; background: var(--gold); animation-delay: -.21s; }
.embers { position: absolute; left: 20%; right: 20%; bottom: 0; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 20% 40%, #ffcf7a 0 2px, transparent 3px), radial-gradient(circle at 46% 60%, #ff9b4a 0 2px, transparent 3px),
    radial-gradient(circle at 70% 35%, #ffcf7a 0 1.5px, transparent 2.5px), radial-gradient(circle at 85% 65%, #ff9b4a 0 2px, transparent 3px),
    radial-gradient(ellipse at 50% 50%, rgb(255 140 60 / .8), rgb(178 51 46 / .5) 55%, transparent 75%);
  animation: embers 1.3s var(--boil) infinite; }
@keyframes embers { 0%, 100% { opacity: 1; } 40% { opacity: .75; } 70% { opacity: .92; } }
.logs { background:
  repeating-linear-gradient(90deg, transparent 0 9px, rgb(0 0 0 / .18) 9px 10px),
  linear-gradient(170deg, var(--wood) 0 48%, transparent 48%), linear-gradient(10deg, var(--wood-dark) 0 52%, transparent 52%); }
/* firelight reaches out onto the hearth and up the stockings */
.hearth { box-shadow: inset 0 0 0 12px color-mix(in oklab, var(--wood-dark), var(--night) 20%), inset 0 -60px 90px -30px rgb(255 150 60 / .28), 0 0 120px 10px rgb(255 160 70 / .14); }
.stockings li { filter: drop-shadow(0 10px 18px rgb(255 150 60 / .12)); }
@media (prefers-reduced-motion: reduce) { .embers { animation: none; } }

/* door tally: hand-drawn tally marks, gates of five */
.tally-marks { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; }
.tally-marks svg { height: 22px; width: auto; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }

/* small card holders: the screws read as dots beside the digits, so they go */
@container (max-width: 90px) { .drawers .drawer .label { background: var(--paper); } } /* outranks handmade.css, which loads later */
