/* The handmade layer. Loads after site.css. Textures come from js/handmade.js as CSS variables;
   until they arrive the page simply shows the plain colours underneath. */
@font-face { font-family: "Reenie Beanie"; src: url("../fonts/reenie-beanie.woff2") format("woff2"); font-display: swap; }
:root { --hand: "Reenie Beanie", "Comic Sans MS", cursive; /* asides only, never for anything you must read */ }

/* ---------- walls ---------- */
/* one continuous wall behind the cabinet and the note, so no tile restarts between sections */
main { background: var(--tex-paper, none) 0 0 / 512px, var(--wallpaper, none) 0 0 / 720px, var(--paper); }
.cabinet-wrap, .about { background: none; }
.mantel { background: var(--tex-night, none) 0 0 / 512px, var(--wallpaper-night, none) 0 0 / 624px, var(--night); }
/* construction-paper fibres over the whole night street (copy sits above this) */
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: var(--tex-night, none) 0 0 / 512px; mix-blend-mode: soft-light; opacity: .9;
}
.tray { background: var(--tex-paper, none) 0 0 / 512px, var(--paper); }

/* ---------- wood with a hand-rubbed finish ---------- */
.carcass::before, .door::after, .shelf::after, .hearth::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: var(--tex-felt, none) 0 0 / 300px; mix-blend-mode: overlay; opacity: .55;
}
.carcass::before { z-index: 1; }
.door::after { z-index: 0; }
.hearth::before { z-index: 0; }
.hearth { background: var(--bricks, none) 0 0 / 480px 240px, color-mix(in oklab, var(--wood-dark), var(--night) 35%); }

/* ---------- small, deliberate crookedness (seeded, so it never jumps) ---------- */
.drawer { rotate: var(--tilt, 0deg); }
.drawer .label { rotate: var(--label-tilt, 0deg); }
.drawer.is-open:hover, .drawer.is-open:focus-visible { rotate: 0deg; } /* picking one up straightens it */

/* ---------- the about note: torn paper, held up with tape ---------- */
.note-wrap {
  position: relative; max-width: 660px; margin: 0 auto; transform: rotate(-.6deg);
  filter: drop-shadow(0 2px 0 rgb(42 36 32 / .16)) drop-shadow(0 16px 18px rgb(42 36 32 / .28));
}
.note-wrap .note { max-width: none; margin: 0; transform: none; box-shadow: none; clip-path: var(--deckle, none); background: var(--tex-paper, none) 0 0 / 512px, var(--snow); }
.note-wrap .note::before { display: none; }
.tape {
  position: absolute; z-index: 1; top: -14px; width: 118px; height: 30px; background: rgb(178 51 46 / .62);
  /* torn tape ends */
  clip-path: polygon(3% 0, 97% 0, 100% 22%, 96% 46%, 99% 72%, 96% 100%, 4% 100%, 1% 76%, 4% 50%, 0 24%);
}
.tape-l { left: 14%; transform: rotate(-4deg); }
.tape-r { right: 12%; transform: rotate(3deg); background: rgb(201 154 59 / .7); }

/* ---------- pencil notes ---------- */
.pencil { position: relative; display: flex; align-items: flex-end; gap: var(--s1); color: var(--ink); pointer-events: none; }
.scrawl { font: 34px/1 var(--hand); transform: rotate(-3deg); white-space: nowrap; }
.pencil svg { flex: none; overflow: visible; }
.pencil path { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: .85;
  stroke-dasharray: var(--len, 400); stroke-dashoffset: var(--len, 400); }
.pencil .scrawl { opacity: 0; transition: opacity .5s var(--ease-out); }
.pencil.is-drawn .scrawl { opacity: 1; }
.pencil.is-drawn path.line { animation: draw .7s var(--ease-out) .25s forwards; }
.pencil.is-drawn path.head { animation: draw .25s var(--ease-out) .9s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* under the cabinet, pointing up at it */
.pencil-cab { margin-top: calc(var(--s2) * -1); }
/* signed at the foot of the note */
.pencil-sign { justify-content: flex-end; margin-top: var(--s3); }
.pencil-sign .scrawl { font-size: 38px; }
/* over the mantel, pointing down at the stockings */
.pencil-mantel .scrawl { white-space: normal; text-wrap: balance; }
.pencil-mantel { color: var(--snow); max-width: 940px; margin: 0 auto var(--s2); padding-left: var(--s6); }
.pencil-mantel path { stroke: var(--snow); }
@media (max-width: 599px) {
  .scrawl { font-size: 26px; }
  .pencil-mantel { padding-left: var(--s3); }
}
@media (prefers-reduced-motion: reduce) { .pencil path { stroke-dashoffset: 0; } .pencil .scrawl { opacity: 1; } }

/* ---------- hero extras: string lights twinkle, smoke rises, both at 12 fps ---------- */
.bulb { animation: bulb 1.6s var(--boil) infinite var(--d); }
@keyframes bulb { 0%, 100% { opacity: 1; } 30% { opacity: .55; } 60% { opacity: .9; } }
.puff { transform-box: fill-box; transform-origin: center; opacity: 0; animation: puff 3.3s steps(16) infinite var(--d); }
@keyframes puff { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 15% { opacity: .55; } 100% { opacity: 0; transform: translate(14px, -70px) scale(1.8); } }

/* ---------- stitching ---------- */
/* felt banners: a running stitch inside the top and sides */
.garland .banner span { position: relative; }
.garland .banner span::after {
  content: ""; position: absolute; inset: 4px 5px 10px; pointer-events: none;
  border: 1.5px dashed rgb(255 250 242 / .6); border-bottom: 0;
}
.garland .banner:nth-child(3) span::after { border-color: rgb(42 36 32 / .4); }
/* paper tag: a card ring around the punched hole */
.garland .brand span {
  background-image: radial-gradient(circle at 50% 8px, var(--night) 0 3px, var(--kraft) 3.5px 6px, transparent 6.5px);
}
/* stockings are drawn as felt in js; the old mask shape steps aside */
.stocking::before { display: none; }
.stocking .felt { position: absolute; inset: 30px 0 0; width: 100%; height: calc(100% - 30px); overflow: visible; filter: drop-shadow(-2px 4px 0 rgb(0 0 0 / .3)); }
.stocking .name { z-index: 1; }
/* fuzzy cuff edge */
.stocking .name::after {
  content: ""; position: absolute; left: 3px; right: 3px; bottom: -4px; height: 6px;
  background: radial-gradient(circle at 4px 1px, var(--snow) 3px, transparent 3.5px) 0 0 / 8px 6px repeat-x;
}
@media (max-width: 599px) { .stocking .felt { inset: 26px 0 0; height: calc(100% - 26px); } }

/* ---------- cabinet detail ---------- */
.drawer {
  background-image:
    repeating-linear-gradient(92deg, transparent 0 9px, rgb(94 58 37 / .12) 9px 10px, transparent 10px 23px, rgb(94 58 37 / .08) 23px 24px),
    linear-gradient(color-mix(in oklab, var(--kraft), var(--wood) 35%), color-mix(in oklab, var(--kraft), var(--wood) 60%));
  background-position: var(--grain, 0) 0, 0 0;
}
/* two brass screws hold each card holder */
.drawer .label {
  background:
    radial-gradient(circle at 5px 50%, var(--gold) 0 1.7px, transparent 2.2px),
    radial-gradient(circle at calc(100% - 5px) 50%, var(--gold) 0 1.7px, transparent 2.2px),
    var(--paper);
}
.hinge { position: absolute; top: 14%; width: 9px; height: 34px; border-radius: 2px; pointer-events: none;
  background: repeating-linear-gradient(transparent 0 10px, rgb(94 58 37 / .5) 10px 11px), linear-gradient(90deg, color-mix(in oklab, var(--gold), var(--snow) 30%), var(--gold) 45%, color-mix(in oklab, var(--gold), var(--wood-dark) 35%));
  box-shadow: 0 1px 0 rgb(0 0 0 / .25); }
.hinge + .hinge { top: auto; bottom: 14%; }
.door-l .hinge { left: -3px; } .door-r .hinge { right: -3px; }
/* turned bun feet under the plinth */
.plinth { position: relative; }
.plinth::before, .plinth::after { content: ""; position: absolute; top: 100%; width: 34px; height: 14px; background: var(--wood-dark); border-radius: 0 0 50% 50%; box-shadow: inset 0 -3px 0 rgb(0 0 0 / .2); }
.plinth::before { left: 18px; } .plinth::after { right: 18px; }
@media (max-width: 599px) { .pencil-sign { flex-wrap: wrap; } }
/* the drawer tray is sewn like the banners: a running stitch just inside the edge */
.tray { outline: 1.5px dashed rgb(42 36 32 / .22); outline-offset: -11px; }

/* ---------- review round 2 ---------- */
/* card-holder screws crowd two-digit numerals on phones */
@media (max-width: 479px) { .drawer .label { background: var(--paper); } }
@media (max-width: 768px) { .garland::before { height: 96px; } }
/* the caption and the arrow wait for the doors */
.pencil-cab, .cabinet-status { opacity: clamp(0, (var(--open, 1) - .75) * 6, 1); }
/* stockings hang from brass tacks, not hooks */
.stockings li::before { width: 10px; height: 10px; top: -8px; border: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--snow), var(--gold) 45%, var(--wood-dark)); box-shadow: 0 1px 0 rgb(0 0 0 / .35); }
