/* ==========================================================================
   The Familiar · interactive components
   1. TV face (.tv)            2. channel guide (.tv-guide) + sound pill
   3. spell slip (.spell)      4. tv-stage layout helper
   5. cabinet (.cabinet)       6. reveal panel (.cabinet__panel)
   Uses the tokens in base.css. Phosphor appears only on screens and signals.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TV face
   -------------------------------------------------------------------------- */
.tv {
  --tv-bezel: #0d0b10;
  --tv-glow: 0.4;
  --tv-radius: 12% 11% 11.5% 12.5% / 15.5% 15% 16% 15%;
  container-type: inline-size;
  position: relative;
  width: 100%;
  max-width: 760px;
  min-width: 0;
  color: var(--bone);
}
.tv--small { max-width: 360px; }
.tv--large { max-width: 760px; }

.tv__body {
  position: relative;
  padding: clamp(10px, 4.6cqw, 34px) clamp(10px, 4.6cqw, 34px) 0;
  border-radius: clamp(20px, 6.4cqw, 46px);
  background: var(--tv-bezel);
  box-shadow:
    inset 0 1px 0 rgba(227, 161, 75, 0.28),
    inset 0 0 0 1px rgba(244, 239, 228, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.7);
}
.tv__screen {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--tv-radius);
  background: #050806;
  box-shadow:
    0 0 0 clamp(2px, 0.9cqw, 7px) #060509,
    0 0 0 calc(clamp(2px, 0.9cqw, 7px) + 1px) rgba(244, 239, 228, 0.07),
    0 0 calc(12px + 36px * var(--tv-glow)) rgba(143, 226, 122, calc(0.025 + 0.1 * var(--tv-glow)));
  transition: box-shadow 0.8s var(--ease-soft);
}
.tv__canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.tv__fx,
.tv__fx::before,
.tv__fx::after {
  position: absolute; inset: 0;
  border-radius: var(--tv-radius);
  pointer-events: none;
}
/* scanlines, ~3px period */
.tv__fx::before {
  content: "";
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.22) 2px 3px);
}
/* curved glass: a faint reflection, a vignette and the tube's inner shadow */
.tv__fx::after {
  content: "";
  background:
    radial-gradient(ellipse 70% 52% at 28% 14%, rgba(255, 255, 255, 0.05), transparent 64%),
    radial-gradient(ellipse 112% 104% at 50% 50%, transparent 58%, rgba(0, 0, 0, 0.6) 100%);
  box-shadow:
    inset 0 0 clamp(12px, 5cqw, 42px) rgba(0, 0, 0, 0.88),
    inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.tv__plate {
  display: flex;
  align-items: center;
  gap: 0.95em;
  height: clamp(30px, 9.6cqw, 66px);
  padding: 0 0.2em 0 0.55em;
  font-family: var(--f-body);
  font-size: clamp(9.5px, 1.8cqw, 12.5px);
  font-weight: 720;
  font-variation-settings: "wdth" 125;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}
.tv__led {
  flex: none;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--phosphor);
  box-shadow: 0 0 6px rgba(143, 226, 122, 0.8), 0 0 14px rgba(143, 226, 122, 0.3);
  transition: background-color 0.8s var(--ease-soft), box-shadow 0.8s var(--ease-soft);
}
.tv__ch { color: var(--bone-soft); }
.tv__name { color: var(--bone); overflow: hidden; text-overflow: ellipsis; }
.tv__knobs { margin-left: auto; display: flex; gap: clamp(6px, 1.7cqw, 12px); }
.tv__knobs i {
  display: block;
  width: clamp(10px, 3cqw, 20px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #18151d;
  box-shadow: inset 0 1px 0 rgba(227, 161, 75, 0.24), inset 0 0 0 1px rgba(244, 239, 228, 0.07);
}
.tv.is-asleep .tv__led { background: #34502e; box-shadow: none; }
@media (prefers-reduced-motion: no-preference) {
  .tv.is-asleep .tv__led { animation: tv-led-breathe 4.4s var(--ease-soft) infinite; }
}
@keyframes tv-led-breathe {
  0%, 100% { background: #2a3f25; box-shadow: none; }
  50% { background: #74b463; box-shadow: 0 0 8px rgba(143, 226, 122, 0.45); }
}
@container (max-width: 300px) {
  .tv__knobs i:last-child { display: none; }
}

/* before JavaScript (or without it): a quiet static screen */
.tv:not(.is-mounted) {
  padding: clamp(10px, 4.6cqw, 34px);
  border-radius: clamp(20px, 6.4cqw, 46px);
  background: var(--tv-bezel);
  box-shadow: inset 0 1px 0 rgba(227, 161, 75, 0.28);
}
.tv__fallback {
  margin: 0;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  padding: 8%;
  border-radius: var(--tv-radius);
  background: #050806;
  color: var(--phosphor);
  font-family: var(--f-mono);
  font-size: clamp(14px, 4.6cqw, 30px);
  text-align: center;
  text-shadow: 0 0 12px rgba(143, 226, 122, 0.45);
}
.tv__fallback[hidden] { display: none; }

/* --------------------------------------------------------------------------
   2. channel guide: a printed listings card
   -------------------------------------------------------------------------- */
.tv-guide { min-width: 0; }
.tv-guide__head { color: var(--bone-soft); margin-bottom: 12px; }
.tv-guide__title {
  font-family: var(--f-display);
  font-weight: 380;
  font-size: clamp(1.55rem, 2.1vw, 2rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-variation-settings: "SOFT" 60;
  margin-bottom: 22px;
  text-wrap: balance;
}
.tv-guide__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--hair-night);
}
.tv-guide__row { position: relative; border-bottom: 1px solid var(--hair-night); }
.tv-guide__btn {
  display: grid;
  grid-template-columns: 3.9rem minmax(0, 1fr) 12px;
  column-gap: 14px;
  align-items: baseline;
  width: 100%;
  margin: 0;
  padding: 17px 2px 18px 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
}
button.tv-guide__btn { cursor: pointer; }
.tv-guide__ch {
  font-family: var(--f-body);
  font-size: 0.72rem;
  font-weight: 760;
  font-variation-settings: "wdth" 125;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone-soft);
  white-space: nowrap;
}
.tv-guide__main { display: grid; gap: 4px; min-width: 0; }
.tv-guide__name {
  font-family: var(--f-display);
  font-size: 1.34rem;
  font-weight: 420;
  line-height: 1.15;
  letter-spacing: -0.01em;
  transition: color 0.25s var(--ease-soft);
}
.tv-guide__desc { font-size: 0.95rem; line-height: 1.45; color: var(--bone-soft); }
.tv-guide__dot {
  align-self: center;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--phosphor);
  box-shadow: 0 0 10px rgba(143, 226, 122, 0.65);
  opacity: 0;
  transform: scale(0.3);
  transition: opacity 0.3s var(--ease-soft), transform 0.45s var(--ease);
}
.tv-guide__row.is-on .tv-guide__dot { opacity: 1; transform: none; }
.tv-guide__row.is-on .tv-guide__ch { color: var(--bone); }
button.tv-guide__btn:hover .tv-guide__name { color: #fff; }
.tv-guide__btn:focus-visible { outline-offset: -2px; }
.tv-guide__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tv-guide__chip {
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hair-night);
  background: transparent;
  color: var(--bone-soft);
  font-family: var(--f-body);
  font-size: 0.66rem;
  font-weight: 760;
  font-variation-settings: "wdth" 125;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.25s var(--ease-soft), border-color 0.25s var(--ease-soft);
}
.tv-guide__chip:hover { color: var(--bone); border-color: rgba(244, 239, 228, 0.4); }
.tv-guide__chip[aria-pressed="true"] { color: var(--phosphor); border-color: rgba(143, 226, 122, 0.6); }

/* sound pill */
.tv-sound {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 16px 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hair-night);
  background: transparent;
  color: var(--bone-soft);
  font-family: var(--f-body);
  font-size: 0.7rem;
  font-weight: 760;
  font-variation-settings: "wdth" 125;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  transition: color 0.25s var(--ease-soft), border-color 0.25s var(--ease-soft);
}
.tv-sound:hover { color: var(--bone); border-color: rgba(244, 239, 228, 0.36); }
.tv-sound__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(244, 239, 228, 0.24);
  transition: background-color 0.3s var(--ease-soft), box-shadow 0.3s var(--ease-soft);
}
.tv-sound__state { min-width: 2.2em; color: var(--bone-soft); }
.tv-sound[aria-pressed="true"] { color: var(--bone); border-color: rgba(244, 239, 228, 0.36); }
.tv-sound[aria-pressed="true"] .tv-sound__dot { background: var(--phosphor); box-shadow: 0 0 8px rgba(143, 226, 122, 0.7); }

/* --------------------------------------------------------------------------
   3. spell slip: a sheet in the typewriter
   -------------------------------------------------------------------------- */
.spell { display: grid; gap: 12px; width: 100%; max-width: 760px; margin: 0; }
.spell__label { color: var(--bone-soft); }
.spell__row { display: flex; gap: 10px; align-items: stretch; }
.spell__slip {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
}
.spell__slip::after {
  content: "";
  position: absolute;
  left: 20px; right: 20px; bottom: 14px;
  height: 1px;
  background: var(--hair-paper);
  pointer-events: none;
}
.spell__input {
  width: 100%;
  min-width: 0;
  min-height: 62px;
  padding: 0 20px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  caret-color: var(--coral-ink);
}
.spell__input:focus { outline: none; }
.spell__input::placeholder { color: var(--ink-soft); opacity: 1; font-style: italic; }
.spell__slip:focus-within { outline: 2px solid var(--coral); outline-offset: 3px; }
.spell__go { flex: none; min-height: 62px; padding: 0 26px; color: var(--bone); }
.spell__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 2px;
}
.spell__note { color: var(--bone-soft); }
@media (max-width: 480px) {
  .spell__input { font-size: 1.1rem; padding: 0 16px; }
  .spell__slip::after { left: 16px; right: 16px; }
  .spell__go { padding: 0 20px; }
}

/* --------------------------------------------------------------------------
   4. tv-stage: the big TV + slip on one side, words + guide on the other
   -------------------------------------------------------------------------- */
.tv-stage {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  column-gap: clamp(36px, 5.5vw, 104px);
  row-gap: 56px;
  align-items: start;
}
.tv-stage__screen { display: grid; gap: clamp(24px, 2.6vw, 36px); justify-items: start; min-width: 0; }
.tv-stage__side { display: grid; gap: clamp(28px, 3vw, 44px); min-width: 0; }
@media (max-width: 1020px) {
  .tv-stage { grid-template-columns: minmax(0, 1fr); }
}
/* heading spacing for the two homepage sections (restyle freely) */
.cabinet-head { max-width: 50rem; margin-bottom: clamp(48px, 6vw, 88px); }
.cabinet-head .h2 { margin-top: 18px; }
.cabinet-head .lede { margin-top: 22px; max-width: 46ch; }
.tv-stage__side .h2 { margin-top: 16px; }
.tv-stage__side .lede { margin-top: 20px; max-width: 34ch; }

/* --------------------------------------------------------------------------
   5. cabinet: three dressers and an armoire, piled up by a giant
      Mid-century gouache / screen-print poster & Dr. Seuss storybook style
   -------------------------------------------------------------------------- */
.cabinet {
  --wood-gap: #110d16;
  --wood-ink: #120e16;
  --wood-carcass: #281e24;
  --wood-panel: #4f2f25;
  --wood-face: #a85136;
  --wood-lift: #d4874c;
  --hair-wood: rgba(247, 232, 206, 0.28);
  --brass: #efe0c2;
  --brass-hi: #fbf0da;
  --brass-ink: #1b1411;
  --knob: #f2dec0;
  --lamp: 235, 168, 78;
  --wood-tex: url("../img/familiar/midcentury-grain.svg");
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  column-gap: clamp(32px, 5.5vw, 104px);
  row-gap: 40px;
  align-items: start;
}
.cabinet__stack {
  container-type: inline-size;
  width: 100%;
  max-width: 540px;
  justify-self: center;
  padding-bottom: 4%;
}
.cab { position: relative; display: flex; flex-direction: column; }

.cab__row {
  position: relative;
  display: flex;
  align-items: flex-end;
  transform-origin: 50% 100%;
}
.cab__row.is-open { z-index: 3; }
/* Playful Dr. Seuss / mid-century storybook stack tilts */
.cab__row--1 { padding-left: 3.5cqw; transform: rotate(-1.05deg); margin-bottom: -0.15cqw; }
.cab__row--2 { padding-left: 6.5cqw; transform: rotate(0.75deg); }
.cab__row--3 { transform: rotate(-0.5deg); }
.cab__row--4 { padding-left: 4cqw; transform: rotate(0.85deg); }
.cab__row--5 { transform: rotate(-0.3deg); }

.cab__box {
  position: relative;
  display: grid;
  gap: 1.25cqw;
  padding: 1.8cqw;
  border-radius: 0.9cqw;
  background-color: var(--wood-carcass);
  background-image:
    linear-gradient(108deg, rgba(244, 198, 148, 0.1) 0 36%, transparent 36.2% 100%),
    var(--wood-tex);
  background-size: 100% 100%, 42cqw auto;
  border: 2px solid var(--wood-ink);
  box-shadow:
    inset 0 2px 0 rgba(248, 218, 182, 0.22),
    4px 5px 0 var(--wood-ink);
}
.cab__box--armoire {
  width: 66cqw; height: 33cqw;
  grid-template-columns: 1.25fr 1fr;
  background-color: #2f2123;
}
.cab__col { display: grid; grid-template-rows: 1fr 1fr; gap: 1.25cqw; min-height: 0; }
.cab__box--tiny {
  width: 11.8cqw; height: 11.4cqw;
  margin-left: 1.6cqw;
  padding: 1.25cqw;
  display: block;
  background-color: #382524;
  transform: rotate(2.2deg);
}
.cab__box--2 {
  width: 90cqw; height: 18cqw;
  grid-template-columns: 2.45fr 0.8fr 1.3fr;
  background-color: #252029;
}
.cab__box--3 {
  width: 100cqw; height: 29cqw;
  grid-template-columns: 1fr 2.1fr 1fr;
  background-color: #312122;
}
.cab__box--4 {
  width: 94cqw; height: 23cqw;
  grid-template-columns: 2fr 0.82fr;
  background-color: #26212a;
}
.cab__box--base {
  width: 100cqw; height: 13cqw;
  grid-template-columns: 1fr 23cqw 1fr;
  padding: 2.3cqw 1.7cqw 2.1cqw;
  background-color: #2d1f21;
}

/* a flared storybook cornice on the armoire */
.cab__crown {
  position: absolute;
  left: -2.8cqw; right: -2.8cqw; bottom: 100%;
  height: 3.1cqw;
  border-radius: 0.7cqw 0.7cqw 0.2cqw 0.2cqw;
  background-color: #c2573b;
  background-image:
    linear-gradient(100deg, #d76b4c 0 58%, #9e432b 58.2% 100%),
    var(--wood-tex);
  background-size: 100% 100%, 40cqw auto;
  border: 2px solid var(--wood-ink);
  clip-path: polygon(0 12%, 100% 0, 97.5% 100%, 2.5% 100%);
}
.cab__feet {
  position: absolute;
  left: 3cqw; right: 3cqw; top: 100%;
  height: 4cqw;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.cab__feet i {
  display: block;
  width: 9.5cqw;
  height: 100%;
  background: linear-gradient(95deg, #b85338 0 52%, #7d3624 52.5% 100%);
  clip-path: polygon(6% 0, 94% 0, 76% 100%, 22% 100%);
}
.cab__feet i:first-child { transform: rotate(4deg); }
.cab__feet i:last-child { transform: rotate(-4deg); }
.cab-apron {
  display: block;
  align-self: end;
  height: 46%;
  border-top: 2px solid rgba(247, 232, 206, 0.24);
}
.cab-panel {
  display: block;
  border-radius: 0.5cqw;
  background-color: var(--wood-panel);
  background-image: var(--wood-tex);
  background-size: 40cqw auto;
  border: 1.5px solid var(--wood-ink);
}

/* doors that are only doors: flat gouache shapes with hard-edge two-tone shadow */
.cab-doors { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75cqw; min-height: 0; }
.cab-door {
  position: relative;
  display: block;
  min-height: 0;
  border-radius: 0.55cqw;
  background-color: #793d2c;
  background-image:
    var(--wood-tex),
    linear-gradient(115deg, #8e4935 0 56%, #683324 56.3% 100%);
  background-size: 38cqw auto, 100% 100%;
  border: 1.5px solid var(--wood-ink);
  box-shadow: inset 0 1.5px 0 rgba(252, 224, 188, 0.28);
}
.cab-door--r {
  background-image:
    var(--wood-tex),
    linear-gradient(115deg, #844330 0 44%, #612f21 44.3% 100%);
}
.cab-door--single {
  background-image:
    var(--wood-tex),
    linear-gradient(112deg, #475965 0 54%, #35444e 54.3% 100%);
}
.cab-door::before {
  content: "";
  position: absolute;
  inset: 12% 16%;
  border: 1.5px solid rgba(24, 18, 16, 0.55);
  border-radius: 0.4cqw;
  background: rgba(18, 12, 14, 0.16);
}
.cab-door::after {
  content: "";
  position: absolute;
  top: 15%; bottom: 15%;
  left: 0;
  width: 0.55cqw;
  background:
    linear-gradient(#181210, #181210) 0 0 / 100% 15% no-repeat,
    linear-gradient(#181210, #181210) 0 100% / 100% 15% no-repeat;
}
.cab-door--r::after,
.cab-door--single::after { left: auto; right: 0; }
.cab-door--tiny::after { display: none; }
.cab-door--arch::before { border-radius: 48% 48% 0.35cqw 0.35cqw / 22% 22% 0.35cqw 0.35cqw; }
.cab-door--single::before { inset: 14% 20% 14% 18%; }
.cab-door__knob {
  position: absolute;
  top: 50%;
  right: 9%;
  width: clamp(5px, 1.35cqw, 8px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--knob);
  border: 1.5px solid var(--wood-ink);
  box-shadow: 1.5px 1.5px 0 var(--wood-ink);
  translate: 0 -50%;
}
.cab-door--r .cab-door__knob { right: auto; left: 9%; }
.cab-door--single .cab-door__knob { right: auto; left: 10%; }
.cab-door--tiny {
  width: 100%; height: 100%;
  background-image:
    var(--wood-tex),
    linear-gradient(120deg, #b85438 0 58%, #8f3d28 58.3% 100%);
}
.cab-door--tiny::before { inset: 16% 18%; }
.cab-door--tiny .cab-door__knob { right: 16%; width: clamp(4px, 1cqw, 6px); }

/* one tiny door says do not open */
.cab-tag {
  position: absolute;
  left: 70%;
  top: 52%;
  display: flex;
  align-items: flex-start;
  transform-origin: 0 0;
  rotate: 9deg;
  pointer-events: none;
}
.cab-tag__string {
  display: block;
  width: 2.6cqw;
  height: 1.5px;
  margin-top: 0.85em;
  background: #e9dec8;
  font-size: clamp(8.5px, 1.75cqw, 11px);
}
.cab-tag__card {
  display: block;
  padding: 0.34em 0.68em 0.38em 0.95em;
  border-radius: 0 0.3cqw 0.3cqw 0;
  background: #f3e6cf;
  color: var(--brass-ink);
  font-family: var(--f-display);
  font-style: italic;
  font-size: clamp(8.5px, 1.75cqw, 11px);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  line-height: 1;
  white-space: nowrap;
  clip-path: polygon(0.5em 0, 100% 0, 100% 100%, 0.5em 100%, 0 50%);
}

/* a little mid-century clock that is always a little wrong */
.cab-clock {
  display: grid;
  place-items: center;
  min-width: 0;
  border-radius: 0.55cqw;
  background-color: #384752;
  background-image:
    var(--wood-tex),
    linear-gradient(120deg, #465865 0 52%, #313e48 52.3% 100%);
  background-size: 36cqw auto, 100% 100%;
  border: 1.5px solid var(--wood-ink);
}
.cab-clock__face {
  position: relative;
  width: min(76%, 11.6cqw);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    linear-gradient(#1b1411, #1b1411) 50% 8% / 0.5cqw 13% no-repeat,
    linear-gradient(#1b1411, #1b1411) 50% 92% / 0.5cqw 13% no-repeat,
    linear-gradient(#1b1411, #1b1411) 8% 50% / 13% 0.5cqw no-repeat,
    linear-gradient(#1b1411, #1b1411) 92% 50% / 13% 0.5cqw no-repeat,
    linear-gradient(125deg, #f5e8d0 0 62%, #e2cfb0 62.5% 100%);
  border: 2px solid var(--wood-ink);
  box-shadow: 2px 2px 0 var(--wood-ink);
}
.cab-clock__h,
.cab-clock__m {
  position: absolute;
  left: 50%;
  bottom: 50%;
  border-radius: 1cqw;
  background: #1b1411;
  transform-origin: 50% 100%;
}
.cab-clock__h { width: 0.65cqw; height: 25%; margin-left: -0.32cqw; transform: rotate(var(--clock-h, 290deg)); }
.cab-clock__m { width: 0.45cqw; height: 37%; margin-left: -0.22cqw; transform: rotate(var(--clock-m, 50deg)); }
.cab-clock__face::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 1.2cqw; height: 1.2cqw;
  margin: -0.6cqw 0 0 -0.6cqw;
  border-radius: 50%;
  background: #c8583b;
}

/* drawers (the buttons): flat mid-century screen-print blocks with subtle vector grain */
.drawer {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0.55cqw;
  background: var(--wood-gap);
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* the hollow behind the front: warm flat amber glow when the drawer is out */
.drawer::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: transparent;
  transition: background-color 0.5s var(--ease-soft);
}
.drawer[aria-expanded="true"]::before {
  background: #e69d45;
}
.drawer__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1cqw;
  border-radius: inherit;
  background-color: var(--face, var(--wood-face));
  background-image:
    var(--wood-tex),
    linear-gradient(var(--cut-angle, 114deg), var(--face-hi, #bf5e40) 0 var(--cut-stop, 58%), var(--face, #9e472f) calc(var(--cut-stop, 58%) + 0.3%) 100%);
  background-size: var(--grain-size, 44cqw auto), 100% 100%;
  background-position: var(--grain-pos, 0 0), 0 0;
  border: 1.5px solid var(--wood-ink);
  box-shadow:
    inset 0 2px 0 rgba(255, 235, 204, 0.32),
    2px 2.5px 0 var(--wood-ink);
  transform-origin: 50% 100%;
  transition:
    transform 0.5s var(--ease),
    box-shadow 0.5s var(--ease),
    filter 0.25s var(--ease-soft);
}
/* the inside of the drawer, seen over its front once it is pulled */
.drawer__face::before {
  content: "";
  position: absolute;
  left: 3.5%; right: 3.5%;
  bottom: 100%;
  height: 0;
  border-radius: 0.45cqw 0.45cqw 0 0;
  border: 1.5px solid var(--wood-ink);
  border-bottom: 0;
  background: linear-gradient(90deg, #d88b48 0 12%, #f4c67a 12% 88%, #b56b32 88% 100%);
  opacity: 0;
  transition: height 0.5s var(--ease), opacity 0.3s var(--ease-soft);
}
.drawer:hover .drawer__face {
  filter: brightness(1.06);
  transform: translateY(0.32cqw) rotate(var(--hover-tilt, -0.35deg));
  box-shadow:
    inset 0 2px 0 rgba(255, 238, 210, 0.4),
    3px 4px 0 var(--wood-ink);
}
.drawer[aria-expanded="true"] .drawer__face {
  filter: brightness(1.08);
  transform: translateY(1.55cqw) scale(1.03) rotate(-0.4deg);
  box-shadow:
    inset 0 2px 0 rgba(255, 240, 214, 0.45),
    4px 7px 0 var(--wood-ink);
}
.drawer[aria-expanded="true"] .drawer__face::before {
  height: 1.45cqw;
  opacity: 1;
}
.drawer:focus-visible { outline-offset: 2px; }

/* flat screen-printed cream/sand label plates with hard-edge shadow */
.drawer__plate {
  position: relative;
  display: inline-block;
  padding: 0.58cqw calc(1.25cqw - 0.13em) 0.48cqw 1.25cqw;
  border-radius: 0.28cqw;
  background: var(--brass);
  color: var(--brass-ink);
  font-family: var(--f-body);
  font-size: clamp(8.5px, 2.05cqw, 11.5px);
  font-weight: 800;
  font-variation-settings: "wdth" 125;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  border: 1.5px solid var(--wood-ink);
  box-shadow: 2px 2px 0 var(--wood-ink);
  transform: rotate(var(--plate-tilt, -0.6deg));
  transition: background-color 0.25s var(--ease-soft), transform 0.3s var(--ease);
}
.drawer:hover .drawer__plate,
.drawer[aria-expanded="true"] .drawer__plate {
  background: var(--brass-hi);
  transform: rotate(0deg);
}
.drawer__knob {
  display: block;
  width: clamp(6px, 1.65cqw, 9.5px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--knob);
  border: 1.5px solid var(--wood-ink);
  box-shadow: 1.5px 2px 0 var(--wood-ink);
}
.drawer__knob--l,
.drawer__knob--r { position: absolute; top: 50%; translate: 0 -50%; }
.drawer__knob--l { left: 11%; }
.drawer__knob--r { right: 11%; }
/* the typewriter drawer is the mouth: a crisp slot across its front */
.drawer__slot {
  position: absolute;
  left: 17%; right: 17%;
  top: 22%;
  height: max(3px, 0.8cqw);
  border-radius: 1cqw;
  background: var(--wood-ink);
  box-shadow: 0 1.5px 0 rgba(255, 232, 198, 0.28);
}
.drawer[aria-expanded="true"] .drawer__slot { background: #e69d45; }
.drawer--typewriter .drawer__plate { font-size: clamp(9px, 2.3cqw, 13px); }
.drawer--typewriter .drawer__face { justify-content: center; padding-top: 4%; }
/* the smallest drawer: plate and knob side by side */
.drawer--mirror .drawer__face { flex-direction: row; gap: 1.2cqw; }
.drawer--mirror .drawer__plate { font-size: clamp(8px, 1.8cqw, 10.5px); padding: 0.48cqw calc(1cqw - 0.13em) 0.4cqw 1cqw; }
.drawer--mirror .drawer__knob { width: clamp(5px, 1.3cqw, 7.5px); }

/* Mid-century gouache palette: warm terracotta, ochre, burnt sienna, and dusty slate */
.drawer--ember      { --face: #a94930; --face-hi: #c4593c; --cut-angle: 112deg; --cut-stop: 60%; --grain-pos: 0% 10%;  --plate-tilt: -0.9deg; }
.drawer--loom       { --face: #b37840; --face-hi: #cc8d50; --cut-angle: 118deg; --cut-stop: 52%; --grain-pos: 40% 55%; --plate-tilt: 0.7deg; }
.drawer--wire       { --face: #883d2b; --face-hi: #a14b36; --cut-angle: 106deg; --cut-stop: 64%; --grain-pos: 15% 80%; --plate-tilt: -0.5deg; }
.drawer--static     { --face: #3d4f5b; --face-hi: #4c616f; --cut-angle: 120deg; --cut-stop: 56%; --grain-pos: 70% 20%; --plate-tilt: 0.8deg; }
.drawer--garage     { --face: #9b5533; --face-hi: #b5663f; --cut-angle: 115deg; --cut-stop: 58%; --grain-pos: 30% 40%; --plate-tilt: 0.6deg; }
.drawer--typewriter { --face: #b84832; --face-hi: #d1583e; --cut-angle: 108deg; --cut-stop: 62%; --grain-pos: 50% 25%; --plate-tilt: -0.4deg; }
.drawer--feed       { --face: #36444f; --face-hi: #445562; --cut-angle: 116deg; --cut-stop: 50%; --grain-pos: 20% 70%; --plate-tilt: -0.8deg; }
.drawer--grove      { --face: #9e6b3b; --face-hi: #b87e47; --cut-angle: 110deg; --cut-stop: 57%; --grain-pos: 60% 15%; --plate-tilt: 0.5deg; }
.drawer--mirror     { --face: #c08649; --face-hi: #d89b59; --cut-angle: 114deg; --cut-stop: 55%; --grain-pos: 35% 50%; --plate-tilt: -0.7deg; }

/* crisp screen-printed inset frame line on the wide drawers */
.drawer--wire .drawer__face::after,
.drawer--grove .drawer__face::after,
.drawer--typewriter .drawer__face::after {
  content: "";
  position: absolute;
  inset: 13% 2.8%;
  border: 1.5px solid rgba(24, 18, 16, 0.42);
  border-radius: 0.35cqw;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   6. the reveal panel
   -------------------------------------------------------------------------- */
.cabinet__panel {
  container-type: inline-size;
  display: grid;
  gap: clamp(20px, 2.2vw, 30px);
  min-width: 0;
  width: 100%;
  max-width: 640px;
  scroll-margin-top: 92px;
}
.cabinet__stage {
  position: relative;
  aspect-ratio: 5 / 4;
  border-radius: var(--r-img);
  overflow: hidden;
  isolation: isolate;
  background: var(--night-2);
}
.cabinet__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.7s var(--ease-soft);
}
.cabinet__img.is-in { opacity: 1; }
.cabinet__img-caption {
  position: absolute;
  left: 14px; bottom: 12px; z-index: 2;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: rgba(21, 18, 27, 0.72);
  color: rgba(244, 239, 228, 0.86);
  font-size: 0.8125rem;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s var(--ease-soft);
}
.cabinet__stage[data-state="image"] .cabinet__img-caption { opacity: 1; }
.cabinet__invite,
.cabinet__workshop {
  position: absolute;
  inset: 0;
  display: grid;
  padding: clamp(22px, 7cqw, 52px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s var(--ease-soft), visibility 0s linear 0.5s;
}
.cabinet__stage[data-state="invite"] .cabinet__invite,
.cabinet__stage[data-state="workshop"] .cabinet__workshop {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s var(--ease-soft) 0.1s, visibility 0s;
}
.cabinet__invite { align-content: start; gap: 14px; }
.cabinet__invite-kicker {
  color: var(--bone-soft);
  font-family: var(--f-body);
  font-size: var(--t-label);
  font-weight: 760;
  font-variation-settings: "wdth" 125;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  line-height: 1.3;
}
.cabinet__invite-title {
  position: relative;
  z-index: 1;
  font-family: var(--f-display);
  font-weight: 360;
  font-size: clamp(2rem, 9cqw, 3.5rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  font-variation-settings: "SOFT" 80, "WONK" 0;
  text-wrap: balance;
  max-width: 12ch;
}
.cabinet__invite-title em { font-style: italic; font-variation-settings: "SOFT" 100, "WONK" 1; }
/* the invitation: the top of a dresser, one drawer pulled a finger's width, light leaking out */
.cabinet__invite-art {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 56%;
  pointer-events: none;
}
.cabinet__invite-art::before {
  content: "";
  position: absolute;
  left: 6%; right: 6%;
  top: -10%;
  height: 70%;
  background: radial-gradient(ellipse 44% 56% at 50% 100%, rgba(var(--lamp), 0.16), rgba(var(--lamp), 0.05) 55%, transparent 76%);
}
.cabinet__invite-art::after {
  content: "";
  position: absolute;
  left: 17%; right: 17%;
  top: 38%; bottom: -4%;
  border-radius: 12px 12px 0 0;
  background-color: var(--wood-carcass);
  background-image: var(--wood-tex);
  background-size: 240px auto;
  border: 2px solid var(--wood-ink);
  box-shadow: inset 0 2px 0 rgba(248, 218, 182, 0.22);
}
.cabinet__invite-slot,
.cabinet__invite-drawer { position: absolute; z-index: 1; }
.cabinet__invite-slot {
  left: 21%; right: 21%;
  top: 46%;
  height: 30%;
  border-radius: 6px;
  background: #e69d45;
  border: 1.5px solid var(--wood-ink);
}
.cabinet__invite-drawer {
  left: 20%; right: 20%;
  top: 53%;
  height: 32%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10%;
  border-radius: 6px;
  background-color: #b84832;
  background-image:
    var(--wood-tex),
    linear-gradient(112deg, #d1583e 0 58%, #a94930 58.3% 100%);
  background-size: 220px auto, 100% 100%;
  border: 1.5px solid var(--wood-ink);
  box-shadow:
    inset 0 2px 0 rgba(255, 238, 210, 0.35),
    3px 5px 0 var(--wood-ink);
}
.cabinet__invite-drawer::before {
  content: "";
  position: absolute;
  left: 3%; right: 3%;
  bottom: 100%;
  height: 20%;
  border-radius: 5px 5px 0 0;
  border-inline: 4px solid var(--wood-lift);
  background: linear-gradient(to top, rgba(var(--lamp), 0.5), rgba(var(--lamp), 0.1));
}
.cabinet__invite-plate {
  width: 28%;
  height: 18%;
  border-radius: 3px;
  background: var(--brass);
  box-shadow: inset 0 0 0 1px rgba(40, 26, 14, 0.35), 0 2px 0 rgba(0, 0, 0, 0.3);
}
.cabinet__invite-knob {
  width: 4.2%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--knob);
  box-shadow: inset 0 1px 0 rgba(255, 230, 190, 0.32), 0 1px 1px rgba(0, 0, 0, 0.55);
}
@media (prefers-reduced-motion: no-preference) {
  .cabinet__invite-art::before { animation: cabinet-lamp 10s var(--ease-soft) infinite; }
}
@keyframes cabinet-lamp {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}
.cabinet__workshop { place-content: center; text-align: center; }
.cabinet__workshop p {
  max-width: 22ch;
  font-family: var(--f-display);
  font-style: italic;
  font-size: clamp(1.25rem, 4.6cqw, 1.7rem);
  line-height: 1.3;
  color: var(--bone-soft);
  font-variation-settings: "SOFT" 100;
}
.cabinet__workshop p::before {
  content: "";
  display: block;
  width: 26px; height: 1px;
  margin: 0 auto 18px;
  background: rgba(var(--lamp), 0.6);
}

.cabinet__info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 300px);
  column-gap: clamp(20px, 3cqw, 36px);
  row-gap: 22px;
  align-items: start;
}
.cabinet__copy { min-width: 0; padding-top: 4px; }
.cabinet__text { transition: opacity 0.18s var(--ease-soft), transform 0.3s var(--ease); }
.cabinet__text.is-swapping { opacity: 0; transform: translateY(6px); }
.cabinet__title {
  font-family: var(--f-display);
  font-weight: 380;
  font-size: clamp(2.1rem, 3vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variation-settings: "SOFT" 50;
}
.cabinet__title[hidden] { display: none; }
.cabinet__sub {
  margin-top: 10px;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.22rem;
  line-height: 1.35;
  color: var(--bone-soft);
  font-variation-settings: "SOFT" 100;
}
.cabinet__panel:not(.is-open) .cabinet__sub { margin-top: 0; font-size: clamp(1.2rem, 1.6vw, 1.4rem); color: var(--bone); max-width: 22ch; }
.cabinet__inside {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--hair-night);
  max-width: 34ch;
  font-size: var(--t-small);
  line-height: 1.55;
}
.cabinet__inside[hidden] { display: none; }
.cabinet__inside-label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--t-label);
  font-weight: 760;
  font-variation-settings: "wdth" 125;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--bone-soft);
}
.cabinet__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 24px;
}
.cabinet__actions[hidden],
.cabinet__spell[hidden] { display: none; }
.cabinet__spell { color: var(--bone); }
.cabinet__link {
  min-height: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--bone-soft);
  font-family: var(--f-body);
  font-size: 0.72rem;
  font-weight: 760;
  font-variation-settings: "wdth" 125;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.45em;
  text-decoration-color: rgba(244, 239, 228, 0.3);
  cursor: pointer;
  transition: color 0.25s var(--ease-soft), text-decoration-color 0.25s var(--ease-soft);
}
.cabinet__link:hover { color: var(--bone); text-decoration-color: currentColor; }
.cabinet__tv { min-width: 0; }

@container (max-width: 560px) {
  .cabinet__info { grid-template-columns: minmax(0, 1fr); }
  .cabinet__tv .tv { max-width: 340px; }
}

@media (max-width: 760px) {
  .cabinet { grid-template-columns: minmax(0, 1fr); row-gap: 48px; }
  .cabinet__stack { max-width: 460px; }
  .cabinet__panel { max-width: none; scroll-margin-top: 84px; }
}
