/* Calendar page (viewer) and calendar view (admin): scene, snow, header, door grid, screens, toast, menus.
   Colours come only from the tokens in theme.css (PLAN.md 1.2). Breakpoints for the grid: 480 / 768 / 1100 (PLAN.md 2.2). */

html.viewer-page, html.viewer-page body { margin: 0; min-height: 100%; }
html.viewer-page body { background: var(--bg); color: var(--on-bg); font-family: var(--font-ui); font-size: 16px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
html.viewer-page *, html.viewer-page *::before, html.viewer-page *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---- scene: art + snow ---- */
.scene { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(var(--bg), var(--bg-2)); }
.scene-art { position: absolute; inset: 0; background: var(--scene-wide) center / cover no-repeat; }
@media (orientation: portrait) { .scene-art { background-image: var(--scene-tall, var(--scene-wide)); } }
.scene-art::after { content: ""; position: absolute; inset: 0; background: rgb(0 0 0 / var(--dim, 0)); }
.snow { position: absolute; inset: 0; pointer-events: none; }
.snow, .snow::before, .snow::after { background-repeat: repeat; }
.snow::before, .snow::after { content: ""; position: absolute; inset: 0; }
.snow::before {
  background-image:
    radial-gradient(circle at 20px 30px, #fff 2px, transparent 3px), radial-gradient(circle at 110px 90px, #fff 1.6px, transparent 2.6px),
    radial-gradient(circle at 200px 40px, #fff 2.2px, transparent 3.2px), radial-gradient(circle at 70px 180px, #fff 1.4px, transparent 2.4px),
    radial-gradient(circle at 160px 230px, #fff 2px, transparent 3px), radial-gradient(circle at 235px 150px, #fff 1.5px, transparent 2.5px);
  background-size: 260px 300px; opacity: .55; animation: snow-a 24s linear infinite;
}
.snow::after {
  background-image:
    radial-gradient(circle at 40px 60px, #fff 3px, transparent 4.5px), radial-gradient(circle at 180px 140px, #fff 2.6px, transparent 4px),
    radial-gradient(circle at 270px 250px, #fff 3.2px, transparent 4.6px), radial-gradient(circle at 100px 320px, #fff 2.4px, transparent 3.8px),
    radial-gradient(circle at 300px 30px, #fff 2.2px, transparent 3.4px);
  background-size: 340px 380px; opacity: .4; animation: snow-b 34s linear infinite;
}
.snow[data-level="heavy"] {
  background-image:
    radial-gradient(circle at 15px 20px, #fff 1.6px, transparent 2.6px), radial-gradient(circle at 75px 100px, #fff 1.4px, transparent 2.4px),
    radial-gradient(circle at 140px 60px, #fff 1.8px, transparent 2.8px), radial-gradient(circle at 50px 150px, #fff 1.4px, transparent 2.4px),
    radial-gradient(circle at 120px 170px, #fff 1.6px, transparent 2.6px);
  background-size: 180px 220px; opacity: .5; animation: snow-c 16s linear infinite;
}
[data-preset="candy"] .snow, [data-preset="market"] .snow, [data-preset="garland"] .snow { filter: drop-shadow(0 0 1px rgb(110 130 160 / .6)); }
@keyframes snow-a { to { background-position: 260px 300px; } }
@keyframes snow-b { to { background-position: -340px 380px; } }
@keyframes snow-c { to { background-position: 180px 220px; } }
@media (prefers-reduced-motion: reduce) { .snow { display: none; } }
html[data-motion="off"] .snow { display: none; }

/* ---- page + header ---- */
.page { position: relative; min-height: 100vh; display: flex; flex-direction: column; padding: 0 12px 28px; }
.cal-head { width: 100%; max-width: 760px; margin: 16px auto 0; padding: 18px 20px 14px; text-align: center; position: relative; background: var(--glass); border: 1px solid var(--glass-line); border-radius: 24px; backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); box-shadow: 0 8px 28px rgb(0 0 0 / .18); }
.cal-title-row { display: flex; align-items: center; justify-content: center; gap: 12px; }
.cal-title { margin: 0; font: 700 clamp(1.8rem, 6vw, 3rem)/1.1 var(--font-display); color: var(--on-bg); overflow-wrap: anywhere; }
.cal-emoji { width: clamp(30px, 6vw, 44px); height: clamp(30px, 6vw, 44px); flex: none; filter: drop-shadow(0 3px 6px rgb(0 0 0 / .35)); }
.cal-emoji.flip { transform: scaleX(-1); }
.cal-welcome { margin: 8px 0 0; color: var(--on-bg); font-size: 1.05rem; }
.cal-intro { margin: 8px auto 0; max-width: 62ch; color: var(--on-bg-soft); }
.cal-intro p { margin: 0 0 .5em; } .cal-intro a { color: var(--on-bg); }
.cal-intro.clamped { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.link-btn { background: none; border: 0; padding: 4px 6px; color: var(--on-bg); font: inherit; text-decoration: underline; cursor: pointer; min-height: 32px; }
.menu-btn { position: absolute; z-index: 20; top: 14px; right: 14px; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--glass-line); background: var(--glass); color: var(--on-bg); cursor: pointer; backdrop-filter: blur(10px); box-shadow: 0 4px 12px rgb(0 0 0 / .2); }
.menu-btn:hover { border-color: var(--accent); }
.status-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; margin: 14px 0 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 5px 14px; border-radius: 999px; border: 1px solid var(--glass-line);
  background: var(--pill); color: var(--on-bg); font-size: .95rem;
}
.pill .icon { color: var(--accent); }
[data-preset="cosy"] .pill .icon, [data-preset="lights"] .pill .icon, [data-preset="night"] .pill .icon, [data-preset="pine"] .pill .icon { color: var(--glow); }
.pill-gold { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 2px 6px rgb(0 0 0 / .25); font-weight: 700; cursor: pointer; font-family: inherit; }
.pill-gold .icon, [data-preset] .pill-gold .icon { color: inherit; }
.pill-gold:hover { filter: brightness(1.07); }
.banner-offline { margin: 0 auto 8px; max-width: 760px; padding: 6px 14px; border-radius: 999px; background: #ffe9a8; color: #4a3a00; text-align: center; font-size: .9rem; }
.cal-main { flex: 1; width: 100%; padding-top: 12px; }
.cal-foot { margin: 20px auto 0; display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; padding: 6px 16px; width: fit-content; max-width: 100%; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line); color: var(--on-bg); font-size: .85rem; backdrop-filter: blur(10px); }

@media (max-width: 599px) { .cal-head { padding-top: 54px; margin-top: 10px; } .menu-btn { top: 10px; right: 10px; width: 42px; height: 42px; } .vmenu { top: 58px; right: 10px; } }

/* ---- door grid: real materials (burlap, kraft, felt, knit, wood, card, vellum, gingerbread) on a soft tray ----
   Art: assets/doors/*.webp (python tools/build_art.py doors). Looks: see DAY_LOOK in js/calendar.js. */
.doors {
  --cols: 3; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--gap); max-width: 1110px; margin: 0 auto; padding: clamp(10px, 2vw, 20px);
  background: color-mix(in srgb, var(--tray) 55%, transparent); border: 1px solid var(--glass-line); border-radius: 24px; backdrop-filter: blur(10px) saturate(1.1); -webkit-backdrop-filter: blur(10px) saturate(1.1); box-shadow: 0 8px 28px rgb(0 0 0 / .16);
}
/* columns, cell size and spans come from js/calendar.js (LAYOUT); the fallback keeps first paint sane */
.doors { grid-auto-rows: var(--cell, 100px); grid-auto-flow: dense; }

.door {
  --r: 4px; --tile: 300px; --base: #a98458; --num: #3a2314; --num-sh: 0 1px 0 rgb(255 240 210 / .3); --shade: .12;
  position: relative; display: block; width: 100%; height: 100%; min-width: 0; padding: 0; border: 0; background: none; color: var(--num); font: inherit; text-align: center; cursor: pointer; perspective: 700px; -webkit-tap-highlight-color: transparent; transition: transform .18s var(--ease-out);
}
.door-face {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: var(--r); transform-origin: left center; backface-visibility: hidden;
  background-color: var(--base);
  background-image: linear-gradient(rgb(35 20 5 / var(--shade)), rgb(35 20 5 / calc(var(--shade) + .06))), var(--tex);
  background-size: auto, var(--tile) var(--tile); background-position: 0 0, var(--ox, 0) var(--oy, 0);
  /* contact shadow + soft lift + darkened edge (no gloss) */
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .16), inset 0 0 16px rgb(30 15 0 / .32), 0 1px 1px rgb(0 0 0 / .45), 0 6px 11px -3px rgb(0 0 0 / .42);
}
.door-face::before, .door-face::after { content: ""; position: absolute; pointer-events: none; }
.door-num { position: relative; z-index: 2; font: 700 calc(var(--cell, 100px) * .36 * var(--k, 1))/1 var(--font-display); color: var(--num); text-shadow: var(--num-sh); }
.door-knob { display: none; }
.door-glow { position: absolute; inset: 0; border-radius: var(--r); opacity: 0; background: radial-gradient(circle, rgb(255 236 180 / .9), var(--glow) 45%, transparent 85%); }
/* "today" label: a little kraft tag */
.door-pill {
  position: absolute; z-index: 4; left: 50%; top: -9px; transform: translateX(-50%); padding: 2px 12px; border-radius: 3px; white-space: nowrap;
  background: #e2c796 url("../assets/doors/tex-kraft.webp") 0 0 / 120px; color: #5b1f1a; font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgb(110 70 30 / .35), 0 2px 4px rgb(0 0 0 / .4); border: 1px dashed rgb(110 70 30 / .45); outline: 2px solid transparent;
}

/* locked: a frosted vellum veil over the material (not grey), the number stays readable */
.door.st-locked { cursor: default; }
.door-veil {
  position: absolute; inset: 0; z-index: 1; border-radius: inherit; background: #f6ecd6 url("../assets/doors/tex-tracing.webp") 0 0 / 260px; opacity: .38;
  -webkit-backdrop-filter: blur(2px) saturate(.9); backdrop-filter: blur(2px) saturate(.9); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .35);
}
.door.st-locked .door-num { opacity: .82; }
.door.st-locked.nolock .door-face { opacity: .5; }
.door-lock { position: absolute; z-index: 3; right: 8%; bottom: 7%; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgb(250 242 226 / .88); color: #5a4630; box-shadow: 0 1px 3px rgb(0 0 0 / .35); }
.door-lock .icon { width: 13px; height: 13px; }

.door.st-ready:hover, .door.st-ready:focus-visible, .door.st-opened:hover, .door.st-opened:focus-visible { transform: translateY(-3px); }
.door.st-ready:hover .door-face { box-shadow: inset 0 0 0 1px rgb(0 0 0 / .16), inset 0 0 16px rgb(30 15 0 / .26), 0 1px 1px rgb(0 0 0 / .45), 0 12px 18px -4px rgb(0 0 0 / .5); }
/* today: a warm, gentle glow */
.door.today .door-face { animation: door-glow 3s ease-in-out infinite; }
@keyframes door-glow {
  0%, 100% { box-shadow: inset 0 0 0 1px rgb(0 0 0 / .16), inset 0 0 16px rgb(30 15 0 / .3), 0 1px 1px rgb(0 0 0 / .45), 0 6px 11px -3px rgb(0 0 0 / .42), 0 0 8px 1px rgb(255 196 110 / .35); }
  50% { box-shadow: inset 0 0 0 1px rgb(0 0 0 / .16), inset 0 0 16px rgb(30 15 0 / .3), 0 1px 1px rgb(0 0 0 / .45), 0 6px 11px -3px rgb(0 0 0 / .42), 0 0 22px 5px rgb(255 196 110 / .6); }
}
@keyframes door-glow-cookie { 0%, 100% { filter: var(--ck-shadow) drop-shadow(0 0 6px rgb(255 196 110 / .4)); } 50% { filter: var(--ck-shadow) drop-shadow(0 0 16px rgb(255 196 110 / .8)); } }
html[data-motion="off"] .door.today .door-face { animation: none; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .16), 0 1px 1px rgb(0 0 0 / .45), 0 0 16px 4px rgb(255 196 110 / .5); }
@media (prefers-reduced-motion: reduce) { .door.today .door-face { animation: none; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .16), 0 1px 1px rgb(0 0 0 / .45), 0 0 16px 4px rgb(255 196 110 / .5); } }

/* opened: the flap folded open (seen at an angle on the left) with the inside peeking out */
.door.st-opened .door-face { transform: scaleX(.14); transform-origin: left center; z-index: 2; box-shadow: 3px 0 8px rgb(0 0 0 / .4), inset 0 0 8px rgb(0 0 0 / .35); }
.door.st-opened .door-face::before, .door.st-opened .door-face::after { display: none; }
.door-inside {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 8px 6px 20%;
  border-radius: var(--r); background-color: var(--inside); color: var(--on-inside); overflow: hidden;
  box-shadow: inset 10px 0 14px -6px rgb(0 0 0 / .45), inset 0 0 22px rgb(0 0 0 / .12), inset 0 0 0 1px rgb(0 0 0 / .12), 0 4px 10px rgb(0 0 0 / .28);
  background-image: url("../assets/doors/paper.webp"); background-blend-mode: multiply;
}
.door-ico .icon { width: calc(var(--cell, 100px) * .26 * var(--k, 1)); height: calc(var(--cell, 100px) * .26 * var(--k, 1)); max-width: 80px; max-height: 80px; min-width: 22px; min-height: 22px; color: var(--accent); }
[data-preset="lights"] .door-ico .icon, [data-preset="cosy"] .door-ico .icon, [data-preset="night"] .door-ico .icon, [data-preset="pine"] .door-ico .icon { color: var(--glow); }
.door-title { font-size: .72rem; line-height: 1.2; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.door-n { position: absolute; top: 5px; right: 8px; font: 700 .8rem/1 var(--font-display); opacity: .7; }
.door-check { position: absolute; bottom: 5px; right: 7px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ok); color: #fff; }
.door-check .icon { width: 11px; height: 11px; }

/* opening animation (PLAN.md 4.1) */
.door.opening { transform: scale(1.05); }
.door.opening .door-glow { opacity: 1; transition: opacity .2s; }
.door.opening .door-face { animation: door-swing .5s .12s var(--ease-out) forwards; }
@keyframes door-swing { to { transform: scaleX(.14); } }
.door.opening.opening-reduced .door-face { animation: none; }
.door.opening-reduced::after { content: ""; position: absolute; z-index: 4; left: calc(50% - 12px); top: calc(50% - 12px); width: 24px; height: 24px; border: 3px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spark { position: absolute; z-index: 4; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 6px var(--glow); animation: spark .62s .12s ease-out forwards; opacity: 0; }
@keyframes spark { 0% { opacity: 1; transform: translate(0, 0); } 100% { opacity: 0; transform: translate(var(--sx), var(--sy)); } }
.door.just-unlocked { animation: wiggle .6s; }
@keyframes wiggle { 20% { transform: rotate(-4deg) scale(1.05); } 40% { transform: rotate(4deg) scale(1.05); } 60% { transform: rotate(-3deg); } 80% { transform: rotate(2deg); } }
@media (prefers-reduced-motion: reduce) { .door, .door.opening, .door.just-unlocked { animation: none; transition: none; } }
html[data-motion="off"] .door.just-unlocked { animation: none; }

/* ---- skeleton (loading) ---- */
.skeleton .door-face { opacity: .25; animation: shimmer 1.6s ease-in-out infinite; }
.skeleton .door-lock, .skeleton .door-veil { display: none; }
@keyframes shimmer { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .skeleton .door-face { animation: none; } }

/* ---- single-card screens ---- */
.screen { min-height: 100vh; display: grid; place-items: center; padding: 20px 14px; }
.screen-card { position: relative; overflow: hidden; width: 100%; max-width: 480px; padding: 30px 24px 26px; text-align: center; background: var(--surface); color: var(--ink); border-radius: 20px; box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.screen-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--foil); }
.screen-card h1, .screen-card h2 { margin: 12px 0 8px; font: 700 clamp(1.5rem, 5vw, 2rem)/1.15 var(--font-display); }
.screen-card p { margin: 0 0 16px; color: var(--ink-soft); }
.screen-card .emoji-row { display: flex; justify-content: center; align-items: flex-end; gap: 6px; }
.screen-card .emoji-row img { width: 112px; height: 112px; filter: drop-shadow(0 6px 10px rgb(0 0 0 / .25)); }
.screen-card .emoji-row img.small { width: 56px; height: 56px; }
.screen-card .signature { margin-top: 6px; font-family: var(--font-display); font-style: italic; color: var(--ink); }
.vbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 22px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.vbtn:hover { filter: brightness(1.07); }
.vbtn.alt { background: none; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }

/* ---- menu, dialogs, toast ---- */
.vmenu { position: absolute; z-index: 30; top: 66px; right: 14px; width: min(320px, calc(100vw - 24px)); padding: 6px; background: var(--surface); color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow), 0 0 0 1px var(--line); text-align: left; }
.vmenu button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: var(--radius-s); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.vmenu button:hover { background: var(--line); }
.vmenu .state { font-weight: 700; color: var(--ink-soft); }
.vdlg { width: min(460px, calc(100vw - 24px)); padding: 0; border: 0; border-radius: calc(var(--radius) + 4px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font: 16px/1.5 var(--font-ui); }
.vdlg::backdrop { background: var(--backdrop); }
.vdlg h2 { margin: 0; padding: 18px 20px 6px; font: 700 1.4rem/1.2 var(--font-display); }
.vdlg .vdlg-body { padding: 4px 20px 14px; } .vdlg .vdlg-body p { margin: 0 0 10px; }
.vdlg .vdlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 18px; }
.vdlg input[type=text] { width: 100%; padding: 9px 10px; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-s); }
.vtoast { position: fixed; z-index: 1300; left: 50%; bottom: 18px; transform: translateX(-50%); width: max-content; max-width: min(420px, calc(100vw - 24px)); display: flex; align-items: flex-start; gap: 10px; padding: 10px 8px 10px 16px; border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: var(--shadow), 0 0 0 1px var(--line); border-left: 5px solid var(--accent); animation: toast-in .2s var(--ease-out); }
.vtoast strong { display: block; } .vtoast small { display: block; color: var(--ink-soft); }
.vtoast .x { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.vtoast .x:hover { background: var(--line); }
.vtoast .retry { margin-top: 6px; min-height: 36px; padding: 4px 14px; font-size: .9rem; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }
@media (prefers-reduced-motion: reduce) { .vtoast { animation: none; } }

/* overlay polish shared with window.css: bright paper card with a gold foil edge */
.win { position: relative; background: linear-gradient(var(--surface), var(--surface)); border-radius: 0; }
.win::before { content: ""; position: absolute; z-index: 3; left: 0; right: 0; top: 0; height: 5px; background: var(--foil); }
@media (min-width: 600px) { .win { border-radius: 18px; } }
.win-head { font-family: var(--font-ui); }

/* ---- door materials (assigned per day by DAY_LOOK in js/calendar.js) ---- */
/* burlap sack: stitched hem + twine bow */
.look-burlap { --tex: url("../assets/doors/tex-burlap.webp"); --tile: 340px; --base: #a8895c; --num: #2b190c; --num-sh: 0 1px 0 rgb(235 210 160 / .4), 0 0 6px rgb(235 210 160 / .35); --r: 2px; }
.look-burlap .door-face::before { inset: 7px; border: 2px dashed rgb(244 226 186 / .78); border-radius: 2px; box-shadow: 0 1px 1px rgb(0 0 0 / .35); }
.look-burlap .door-face::after { z-index: 3; left: 50%; top: calc(var(--cell, 100px) * -.1); width: calc(var(--cell, 100px) * .5); aspect-ratio: 400 / 336; transform: translateX(-50%) rotate(-3deg); background: url("../assets/doors/decor-twine-bow.webp") center / contain no-repeat; filter: drop-shadow(0 2px 2px rgb(0 0 0 / .45)); }

/* kraft parcel paper: crease + clothespin */
.look-kraft { --tex: url("../assets/doors/tex-kraft.webp"); --tile: 420px; --base: #a5805a; --num: #6e1d1d; --num-sh: 0 1px 0 rgb(240 215 170 / .45); --r: 3px; }
.look-kraft .door-face::before { inset: 0; border-radius: inherit; background: linear-gradient(100deg, transparent 38%, rgb(0 0 0 / .10) 49%, rgb(255 240 210 / .10) 52%, transparent 62%); }
.look-kraft .door-face::after { z-index: 3; right: 8%; top: calc(var(--cell, 100px) * -.08); width: calc(var(--cell, 100px) * .42); aspect-ratio: 400 / 375; transform: rotate(12deg); background: url("../assets/doors/decor-clothespin.webp") center / contain no-repeat; filter: drop-shadow(0 2px 2px rgb(0 0 0 / .45)); }

/* felt: blanket-stitch border */
.look-felt-red { --tex: url("../assets/doors/tex-felt-red.webp"); --tile: 300px; --base: #7f2a2a; --num: #f4e6c8; --num-sh: 0 1px 1px rgb(40 8 8 / .75), 0 0 1px rgb(40 8 8 / .6); --r: 5px; --shade: .06; }
.look-felt-green { --tex: url("../assets/doors/tex-felt-green.webp"); --tile: 300px; --base: #2f4c3a; --num: #f1e2b4; --num-sh: 0 1px 1px rgb(5 25 12 / .8), 0 0 1px rgb(5 25 12 / .6); --r: 5px; --shade: .06; }
.look-felt-red .door-face::before, .look-felt-green .door-face::before { inset: 7px; border: 2px dashed rgb(246 232 200 / .85); border-radius: 3px; box-shadow: 0 1px 1px rgb(0 0 0 / .45); }
.look-felt-green .door-face::before { border-color: rgb(236 206 130 / .85); }

/* cable knit: ribbed edge */
.look-knit { --tex: url("../assets/doors/tex-knit.webp"); --tile: 320px; --base: #b8aa8e; --num: #7a2226; --num-sh: 0 1px 0 rgb(250 240 220 / .7), 0 0 5px rgb(250 240 220 / .6); --r: 9px; }
.look-knit .door-face::before {
  inset: 0; border-radius: inherit; border: 8px solid transparent; background: repeating-linear-gradient(90deg, rgb(60 40 15 / .22) 0 2px, rgb(255 245 225 / .16) 2px 5px) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0);
}

/* wooden board with nails, number burned in */
.look-wood { --tex: url("../assets/doors/tex-wood.webp"); --tile: 380px; --base: #a98d66; --num: #46270f; --num-sh: 0 1px 0 rgb(255 236 200 / .35); --r: 3px; }
.look-wood .door-face::before {
  inset: 0; border-radius: inherit;
  background: radial-gradient(circle 3px at 11px 11px, #4a3a2a 0 90%, transparent), radial-gradient(circle 3px at calc(100% - 11px) 11px, #4a3a2a 0 90%, transparent),
    radial-gradient(circle 3px at 11px calc(100% - 11px), #4a3a2a 0 90%, transparent), radial-gradient(circle 3px at calc(100% - 11px) calc(100% - 11px), #4a3a2a 0 90%, transparent);
}

/* corrugated card with a linen label */
.look-corrugated { --tex: url("../assets/doors/tex-corrugated.webp"); --tile: 300px; --base: #a8825a; --num: #6c1c1c; --r: 2px; }
.look-corrugated .door-num { padding: .12em .3em .1em; border-radius: 2px; background: #e6dcc6 url("../assets/doors/tex-linen.webp") 0 0 / 160px; box-shadow: 0 1px 3px rgb(0 0 0 / .45), inset 0 0 0 1px rgb(120 90 50 / .25); text-shadow: none; }

/* vellum envelope sealed with wax */
.look-envelope { --tex: url("../assets/doors/tex-tracing.webp"); --tile: 300px; --base: #dccfae; --num: #f6d9cf; --num-sh: 0 -1px 0 rgb(60 8 8 / .7), 0 1px 0 rgb(255 255 255 / .18); --r: 3px; --shade: .02; }
.look-envelope .door-face { background-blend-mode: normal, multiply; }
.look-envelope .door-face::before { inset: 0; border-radius: inherit; background: linear-gradient(rgb(90 60 20 / .10), rgb(90 60 20 / .02)); clip-path: polygon(0 0, 100% 0, 50% 58%); filter: drop-shadow(0 1px 0 rgb(80 50 15 / .4)); }
.look-envelope .door-face::after { inset: 20%; background: url("../assets/doors/decor-wax-seal.webp") center / contain no-repeat; filter: drop-shadow(0 2px 3px rgb(0 0 0 / .45)); }
.look-envelope .door-num { font-size: calc(var(--cell, 100px) * .26 * var(--k, 1)); }

/* gingerbread cookie: the cookie is the door, the number is piped in icing (square slots only, see relayout in calendar.js) */
.door.ck-house { --ck: url("../assets/doors/cookie-house.webp"); --ny: 9%; }
.door.ck-heart { --ck: url("../assets/doors/cookie-heart.webp"); --ny: -2%; }
.door.ck-star { --ck: url("../assets/doors/cookie-star.webp"); --ny: 2%; }
.door.ck-mitten { --ck: url("../assets/doors/cookie-mitten.webp"); --ny: 6%; }
.door.ck-round { --ck: url("../assets/doors/cookie-round.webp"); --ny: 0%; }
.door.ck-tree { --ck: url("../assets/doors/cookie-tree.webp"); --ny: 14%; }
.door.is-cookie { --r: 0; --ck-shadow: drop-shadow(0 1px 1px rgb(0 0 0 / .45)) drop-shadow(0 6px 6px rgb(0 0 0 / .3)); }
.door.is-cookie .door-face { inset: 2%; background: var(--ck) center / contain no-repeat; box-shadow: none; filter: var(--ck-shadow); }
.door.is-cookie .door-face::before, .door.is-cookie .door-face::after { display: none; }
.door.is-cookie .door-num {
  color: #fffaf0; transform: translateY(var(--ny, 0)); font-size: calc(var(--cell, 100px) * .34 * var(--k, 1)); font-weight: 800; letter-spacing: .01em;
  -webkit-text-stroke: .045em #fffaf0; paint-order: stroke fill; padding: 0; background: none; box-shadow: none;
  text-shadow: 0 .02em 0 #e3d3b6, 0 .045em .02em rgb(120 70 30 / .6), 0 .08em .09em rgb(60 30 10 / .45);
}
.door.is-cookie.today .door-face { animation: door-glow-cookie 3s ease-in-out infinite; }
.door.is-cookie.st-ready:hover .door-face { box-shadow: none; filter: drop-shadow(0 1px 1px rgb(0 0 0 / .45)) drop-shadow(0 11px 9px rgb(0 0 0 / .35)); }
.door.is-cookie .door-veil { inset: 0; border-radius: 0; box-shadow: none; -webkit-mask: var(--ck) center / contain no-repeat; mask: var(--ck) center / contain no-repeat; }
/* opened cookie: the card shows, the cookie lies on its lower left corner */
.door.is-cookie.st-opened .door-face { inset: -4% auto auto -4%; width: 36%; height: 36%; transform: rotate(-14deg); transform-origin: center; box-shadow: none; }
.door.is-cookie .door-inside { inset: 4%; border-radius: 10px; padding-left: 8px; }
.door.is-cookie.opening .door-face { animation-name: cookie-flip; }
@keyframes cookie-flip { to { transform: rotate(-14deg) scale(.5); opacity: 0; } }
html[data-motion="off"] .door.is-cookie.today .door-face { animation: none; }
@media (prefers-reduced-motion: reduce) { .door.is-cookie.today .door-face { animation: none; filter: var(--ck-shadow) drop-shadow(0 0 12px rgb(255 196 110 / .7)); } }

.door.wide .door-title, .door.tall .door-title { font-size: .85rem; }
.door.st-opened .door-n { font-size: 1rem; }
@media (min-width: 768px) { .door .door-title { font-size: .8rem; } }
.door-title { font-size: calc(.62rem + var(--cell, 100px) * .02 * var(--k, 1)); font-weight: 600; }
.door.st-opened .door-inside { gap: calc(var(--cell, 100px) * .04); }

/* local mock only: shown when the clock is overridden with ?now= */
.demo-pill { position: fixed; z-index: 40; left: 10px; bottom: 10px; padding: 4px 12px; border-radius: 999px; background: #fff7dc; color: #5c4300; border: 1px dashed #c9971f; font: 600 .78rem/1.3 var(--font-ui, sans-serif); pointer-events: none; }
