:root {
  --soot: #1f1915;
  --soot-2: #2a2a2a;
  --walnut: #4a3424;
  --walnut-lo: #33241a;
  --walnut-hi: #5c4230;
  --brass: #ffc654;
  --brass-deep: #b48017;
  --umber: #6a5326;
  --parchment: #f3e8cf;
  --parchment-lo: #e6d6b2;
  --ink: #2b2118;
  --ink-soft: #5a4a38;

  --serif: "Noto Serif", Georgia, serif;
  --cond: "Sofia Sans Extra Condensed", "Arial Narrow", sans-serif;

  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(120% 80% at 50% -10%, #3a2a1d 0%, transparent 60%),
    var(--soot);
  color: var(--parchment);
  font: 400 1.0625rem/1.65 var(--serif);
}
img { max-width: 100%; height: auto; }
a { color: var(--brass); }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 3px; }

/* ---------- masthead ---------- */
.masthead {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 44px) var(--gutter) clamp(24px, 3.5vw, 36px);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  grid-template-areas: "logo logo" "title copy";
  column-gap: clamp(24px, 5vw, 72px);
  align-items: end;
}
.topline {
  grid-area: logo;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}
.logo { display: block; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  min-height: 44px;
  padding: 0 .2em;
  color: #e9dcc0;
  font: 600 1.25rem/1 var(--cond);
  letter-spacing: .03em;
  text-decoration: none;
}
.back-link:hover { color: var(--brass); text-decoration: underline; text-underline-offset: 5px; }
.logo img { width: clamp(150px, 18vw, 200px); display: block; }
.masthead h1 {
  grid-area: title;
  margin: clamp(24px, 4.5vw, 48px) 0 0;
  font: 800 clamp(3rem, 7.4vw, 5.75rem)/0.88 var(--cond);
  letter-spacing: -0.01em;
  color: var(--brass);
  text-wrap: balance;
}
.masthead-copy { grid-area: copy; padding-bottom: .35rem; }
.intro {
  max-width: 44ch;
  margin: 0;
  color: #e9dcc0;
  font-size: clamp(1.0625rem, 1.5vw, 1.1875rem);
}
.next {
  margin: .9rem 0 0;
  min-height: 1.6em;
  color: var(--brass);
  font: 600 1.3125rem/1.3 var(--cond);
  letter-spacing: 0.02em;
}
@media (max-width: 820px) {
  .masthead { grid-template-columns: 1fr; grid-template-areas: "logo" "title" "copy"; }
  .masthead-copy { margin-top: 1.1rem; }
}

/* ---------- cabinet ---------- */
main { padding: 0 var(--gutter); }

.cabinet-wrap {
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='300'%3E%3Cfilter id='g' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0022 0.075' numOctaves='3' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.07 0 0 0 0 0.04 0 0 0 0 0.02 1.25 0 0 0 -0.46'/%3E%3C/filter%3E%3Crect width='600' height='300' filter='url(%23g)'/%3E%3C/svg%3E");
  --sheen: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='300'%3E%3Cfilter id='h' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.004 0.2' numOctaves='2' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 0.86 0 0 0 0 0.66 0 0.5 0 0 -0.27'/%3E%3C/filter%3E%3Crect width='600' height='300' filter='url(%23h)'/%3E%3C/svg%3E");
  --walnut-a: #5b3e29;
  --walnut-b: #3c2819;
  max-width: 1080px;
  margin: 0 auto;
  filter: drop-shadow(0 40px 50px rgba(0,0,0,.55));
}

/* crown molding with a brass nameplate */
.cornice {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(40px, 5vw, 54px);
  margin: 0 clamp(-14px, -1.4vw, -6px);
  border-radius: 3px 3px 0 0;
  background:
    var(--sheen) 0 -40px / 600px 300px,
    var(--grain) -220px -80px / 600px 300px,
    linear-gradient(180deg, #6a4930 0%, #4d3321 38%, #3a2617 39%, #4a3120 100%);
  box-shadow:
    inset 0 2px 0 rgba(255,226,180,.22),
    inset 0 -3px 0 #22150c,
    inset 0 -4px 0 rgba(255,226,180,.10),
    0 1px 0 #120a05;
}
.nameplate {
  padding: .18em .9em .14em;
  border-radius: 2px;
  background: linear-gradient(180deg, #ffeeb0, #e8b84e 35%, #b8841f 80%, #d9a744);
  box-shadow: inset 0 0 0 1px #5c3f0e, inset 0 0 0 2.5px rgba(255,244,200,.45), 0 2px 3px rgba(0,0,0,.5);
  color: #3b280a;
  font: 700 clamp(.95rem, 1.6vw, 1.15rem)/1.1 var(--cond);
  letter-spacing: .08em;
  text-shadow: 0 1px 0 rgba(255,245,210,.55);
}
.nameplate:empty { display: none; }

/* carcass: the frame the drawers sit in */
.cabinet {
  padding: clamp(10px, 1.6vw, 18px);
  background:
    var(--grain) -90px -140px / 600px 300px,
    linear-gradient(90deg, #3a2517, #4a3020 12%, #4a3020 88%, #3a2517);
  box-shadow:
    inset 0 0 0 1px #150d07,
    inset 0 6px 10px -4px rgba(0,0,0,.6);
}
.drawers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(8px, 1.3vw, 14px);
}
@media (max-width: 820px) { .drawers { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 480px) { .drawers { grid-template-columns: repeat(3, 1fr); } }

/* base with two feet */
.plinth {
  position: relative;
  height: clamp(18px, 2.2vw, 26px);
  margin: 0 clamp(-8px, -.8vw, -4px);
  background:
    var(--grain) -300px -10px / 600px 300px,
    linear-gradient(180deg, #4c3220, #32200f);
  box-shadow: inset 0 2px 0 rgba(255,226,180,.12), inset 0 -2px 0 rgba(0,0,0,.45);
}
.plinth::before, .plinth::after {
  content: "";
  position: absolute;
  top: 100%;
  width: clamp(36px, 6vw, 70px);
  height: clamp(10px, 1.4vw, 16px);
  background: linear-gradient(180deg, #3d2716, #24160b);
  box-shadow: inset 0 1px 0 rgba(255,226,180,.08);
  border-radius: 0 0 3px 3px;
}
.plinth::before { left: 4%; }
.plinth::after { right: 4%; }

/* ---------- drawer ---------- */
.drawers li { perspective: 800px; }

.drawer {
  --pull: 0px;
  --gx: 0px;
  --gy: 0px;
  --tone: 20%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7%;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 6% 6% 5%;
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  font: inherit;
  background:
    var(--sheen) var(--gx) var(--gy) / 600px 300px,
    var(--grain) var(--gx) var(--gy) / 600px 300px,
    linear-gradient(180deg,
      color-mix(in oklab, var(--walnut-a), #2a1a0e var(--tone)),
      color-mix(in oklab, var(--walnut-b), #1e1209 var(--tone)));
  /* seam = the gap around the drawer (light leaks through it when the drawer is ready);
     drop = shadow cast on the cabinet when the drawer is pulled out */
  --seam: 0 0 0 1.5px rgba(255,200,100,.8), 0 0 16px 3px rgba(255,170,50,.36);
  --drop: 0 0 0 0 transparent;
  box-shadow:
    var(--seam),
    var(--drop),
    inset 0 1px 0 rgba(255,228,185,.22),
    inset 1px 0 0 rgba(255,228,185,.08),
    inset 0 -2px 0 rgba(0,0,0,.45),
    inset -1px 0 0 rgba(0,0,0,.3);
  transform: translateZ(var(--pull));
  transition:
    transform .5s cubic-bezier(.34,1.5,.5,1),
    box-shadow .35s ease,
    filter .3s ease;
}
/* routed groove a few mm in from the edge */
.drawer::before {
  content: "";
  position: absolute;
  inset: clamp(5px, .7vw, 8px);
  border-radius: 1px;
  box-shadow:
    inset 0 1px 0 rgba(0,0,0,.4),
    inset 1px 0 0 rgba(0,0,0,.25),
    0 1px 0 rgba(255,228,185,.12),
    1px 0 0 rgba(255,228,185,.06);
  pointer-events: none;
}

.drawer svg { display: block; overflow: visible; }
.label { width: 74%; filter: drop-shadow(0 1.5px 1.5px rgba(0,0,0,.55)); }
.pull, .keyhole { width: 58%; filter: drop-shadow(0 3px 2px rgba(0,0,0,.6)); }
.label-num {
  font: 600 31px var(--serif);
  fill: #2b2118;
  letter-spacing: -.5px;
}

/* pulsing light for today's drawer, on its own layer so only opacity animates */
.drawer::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 2px;
  box-shadow: 0 0 0 2px rgba(255,220,140,.95), 0 0 30px 8px rgba(255,180,60,.55);
  opacity: 0;
  pointer-events: none;
}
.drawer.is-today:not(.is-opened)::after { animation: seam-pulse 2.6s ease-in-out infinite; }
@keyframes seam-pulse { 50% { opacity: 1; } }

/* the cup pull tilts up as if someone grabbed it */
.cup {
  transform-box: fill-box;
  transform-origin: 50% 0;
  transition: transform .45s cubic-bezier(.34,1.5,.5,1);
}

/* ready to open: hover slides the drawer out and the light gets brighter */
.drawer:not(.is-locked):is(:hover, :focus-visible) {
  --pull: 30px;
  --seam: 0 0 0 1.5px rgba(255,214,130,.95), 0 0 26px 6px rgba(255,176,60,.5);
  --drop: 0 22px 24px -12px rgba(0,0,0,.9);
}
.drawer:not(.is-locked):is(:hover, :focus-visible) .cup { transform: scaleY(.7); }

/* already opened by this visitor: pulled out, light gone, stamped */
.drawer.is-opened {
  --pull: 12px;
  --seam: 0 0 0 2px #0d0804;
  --drop: 0 12px 14px -8px rgba(0,0,0,.9);
  filter: saturate(.75) brightness(.8);
}
.drawer.is-opened:is(:hover, :focus-visible) {
  --pull: 22px;
  --seam: 0 0 0 2px #0d0804;
  filter: none;
}
.stamp { opacity: 0; }
.drawer.is-opened .stamp { opacity: .9; }
.drawer.is-opened .label-num { fill: #6b5a44; }

/* locked: dark, tarnished, no light inside */
.drawer.is-locked {
  --seam: 0 0 0 2px #0d0804;
  cursor: not-allowed;
  filter: brightness(.62) saturate(.7);
}
.drawer.is-locked:hover { filter: brightness(.7) saturate(.7); }

.drawer.is-pulling { --pull: 70px; }
.drawer.is-rattling { animation: rattle .45s cubic-bezier(.36,.07,.19,.97); }
@keyframes rattle {
  10%, 90% { transform: translateX(-1px) rotate(-.3deg); }
  20%, 80% { transform: translateX(2px) rotate(.5deg); }
  30%, 50%, 70% { transform: translateX(-3px) rotate(-.7deg); }
  40%, 60% { transform: translateX(3px) rotate(.7deg); }
}

/* ---------- key above the cabinet ---------- */
.cabinet-key {
  max-width: 1080px;
  margin: 0 auto clamp(16px, 2.4vw, 24px);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 28px;
}
.progress {
  margin: 0;
  color: var(--parchment);
  font: 700 clamp(1.35rem, 2.4vw, 1.7rem)/1.1 var(--cond);
  letter-spacing: .02em;
}

.cabinet[aria-busy="true"] .drawers { min-height: 320px; }

/* ---------- footer, toast, admin bar ---------- */
.foot {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px var(--gutter) 56px;
  font: 600 1.125rem var(--cond);
  letter-spacing: .03em;
}
.foot a { color: #c9b48a; text-decoration-color: rgba(201,180,138,.4); text-underline-offset: 4px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  max-width: calc(100% - 32px);
  padding: .7em 1.1em;
  border-radius: 4px;
  background: var(--parchment);
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(0,0,0,.5);
  font-size: 1rem;
  transform: translate(-50%, 150%);
  opacity: 0;
  transition: transform .3s, opacity .3s;
  pointer-events: none;
  z-index: 20;
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

.admin-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5em 1em;
  align-items: center;
  padding: .55em var(--gutter);
  background: var(--brass);
  color: #3d2c10;
  font: 600 1.0625rem/1.3 var(--cond);
  letter-spacing: .02em;
}
.admin-bar a { color: inherit; }

/* ---------- card dialog ---------- */
.card-dialog {
  width: min(640px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
.card-dialog::backdrop { background: rgba(14, 10, 7, .78); backdrop-filter: blur(3px); }
.card-dialog[open] { animation: rise .42s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { transform: translateY(40px) rotate(-1.2deg); opacity: 0; } }

.card {
  position: relative;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: clamp(24px, 5vw, 44px);
  border-radius: 3px;
  background:
    radial-gradient(130% 90% at 50% 0%, transparent 60%, rgba(140,100,40,.18)),
    linear-gradient(180deg, var(--parchment), var(--parchment-lo));
  box-shadow: 0 0 0 1px rgba(106,83,38,.5), inset 0 0 0 6px var(--parchment), inset 0 0 0 7px rgba(180,128,23,.55), 0 30px 80px rgba(0,0,0,.6);
}
.card-close {
  position: absolute;
  top: 10px; right: 10px;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.card-close:hover { background: rgba(106,83,38,.12); color: var(--ink); }
.card-day {
  margin: 0;
  color: var(--brass-deep);
  font: 700 1.25rem/1 var(--cond);
  letter-spacing: .03em;
}
.card-title:focus { outline: none; }
.card-title {
  margin: .35rem 2.5rem 1rem 0;
  font: 600 clamp(1.6rem, 4.4vw, 2.1rem)/1.15 var(--serif);
  text-wrap: balance;
}
.card-body p { margin: 0 0 1em; max-width: 60ch; }
.card-body > :last-child { margin-bottom: 0; }
.card-body .muted { color: var(--ink-soft); font-style: italic; }

.frame {
  position: relative;
  margin: 0 0 1.25rem;
  aspect-ratio: 16 / 9;
  border-radius: 2px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 1px rgba(43,33,24,.3);
}
.frame iframe, .frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.card-image { display: block; width: 100%; margin: 0 0 1.25rem; border-radius: 2px; }

/* voucher: a ticket with punched notches */
.voucher {
  --notch: 12px;
  position: relative;
  margin: 1.5rem 0;
  padding: 1.1rem 1.25rem 1.1rem 1.5rem;
  background: var(--soot);
  color: var(--parchment);
  border-radius: 3px;
  -webkit-mask: radial-gradient(circle var(--notch) at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle var(--notch) at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle var(--notch) at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle var(--notch) at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat;
}
.voucher-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; }
.voucher-code {
  font: 800 clamp(1.9rem, 6vw, 2.6rem)/1 var(--cond);
  letter-spacing: .06em;
  color: var(--brass);
  word-break: break-all;
  user-select: all;
}
.voucher-terms { margin: .7rem 0 0; color: #cdbd9c; font-size: .9375rem; line-height: 1.5; }

/* countdown, styled like the clock on an escape-room wall */
.timer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
  margin-top: .9rem;
  padding-top: .85rem;
  border-top: 1px dashed rgba(255,198,84,.28);
}
.timer-label { color: #cdbd9c; font-size: .9375rem; }
.timer-digits { display: flex; gap: 6px; }
.seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 2.9em;
  padding: .35em .4em .3em;
  border-radius: 3px;
  background: #0e0a07;
  box-shadow: inset 0 0 0 1px rgba(255,198,84,.22), inset 0 2px 6px rgba(0,0,0,.7);
}
.seg b {
  font: 800 1.7rem/1 var(--cond);
  font-variant-numeric: tabular-nums;
  color: var(--brass);
  text-shadow: 0 0 10px rgba(255,198,84,.45);
}
.seg i {
  margin-top: .2em;
  font: 600 .8125rem/1.1 var(--cond);
  font-style: normal;
  letter-spacing: .04em;
  color: #a8977a;
}
.timer.is-urgent .seg b { color: #ff7a5c; text-shadow: 0 0 10px rgba(255,100,70,.55); }

.voucher.is-expired .voucher-code { color: #8a7b62; text-decoration: line-through; text-decoration-thickness: 2px; }
.voucher-expired { margin: .7rem 0 0; color: #ff9a85; font-size: .9375rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: .5em 1.1em;
  border: 0;
  border-radius: 3px;
  background: var(--brass);
  color: #2b1f0a;
  font: 700 1.1875rem/1 var(--cond);
  letter-spacing: .03em;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: #ffd57d; }
.btn-ghost { background: transparent; color: var(--brass); box-shadow: inset 0 0 0 1.5px var(--brass); }
.btn-ghost:hover { background: rgba(255,198,84,.12); }
/* the day's one call to action sits bottom right, like a "next" button */
.card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(106,83,38,.28);
}
.card-actions .btn { min-height: 48px; padding-inline: 1.4em; font-size: 1.3125rem; }
@media (max-width: 480px) { .card-actions .btn { width: 100%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
