/* Free Art, v09: Threshold.
   A dim room with one framed sticker, a double door, and the street outside.
   Opening the door lets the stickers out into daylight, where they fade. */

:root {
  --room: #1d1b1a;
  --room2: #2a2622;
  --warm: #c8b48a;
  --gilt: #dcc290;
  --day: #eef0ee;
  --slate: #6b7b8c;
  --paper: #f5f1e6;
  --ink: #141414;
  --door: #141312;
  --text: #e9e1cf;
  --muted: #b3a891;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: "Overpass Mono", ui-monospace, Menlo, Consolas, monospace;
  --hand: "Covered By Your Grace", "Bradley Hand", "Segoe Print", cursive;
  --open: 0;
  --swing: 0;
  --fw: min(21vw, 34vh);
}

* { box-sizing: border-box; }
html { background: var(--room); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--room);
  color: var(--text);
  font-family: var(--serif);
  font-optical-sizing: auto;
  line-height: 1.45;
}
h1, h2, p, ul, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gilt); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Home: a small brass plaque */
.home {
  position: fixed;
  z-index: 30;
  top: 16px;
  left: 4.5vw;
  padding: 7px 12px 6px;
  font: 600 12px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #241c10;
  text-decoration: none;
  background: linear-gradient(160deg, #e3cd98, #b89a5e 55%, #d8c08a);
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 4px 14px rgba(0, 0, 0, 0.45);
}
.home:hover { filter: brightness(1.08); }

/* ---------- Scene and stage ---------- */
.scene { position: relative; height: 400vh; overflow-x: clip; }
.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
}
.wall {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 34vw 46vh at var(--fx, 16vw) var(--fy, 44vh), rgba(214, 192, 146, 0.16), transparent 70%),
    radial-gradient(ellipse 80vw 60vh at 30% 10%, rgba(255, 240, 210, 0.04), transparent 70%),
    linear-gradient(180deg, #24211e 0%, var(--room) 70%);
}
.wall::after {
  content: "";
  position: absolute; inset: 0;
  background-image: var(--grain, none);
  background-size: 180px 180px;
  opacity: 0.5;
  mix-blend-mode: overlay;
}
.spot {
  position: absolute;
  top: 0;
  left: calc(var(--fx, 16vw) - var(--sw, 20vw) / 2);
  width: var(--sw, 20vw);
  height: var(--sh, 60vh);
  background: linear-gradient(180deg, rgba(240, 222, 180, 0.02), rgba(240, 222, 180, 0.13) 85%, rgba(240, 222, 180, 0));
  clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%);
  filter: blur(6px);
  pointer-events: none;
}
.floor {
  position: absolute; left: 0; right: 0; top: 82%; bottom: 0;
  background:
    repeating-linear-gradient(180deg, transparent 0 21px, rgba(255, 255, 255, 0.025) 21px 22px),
    linear-gradient(180deg, #191613, #0c0b0a);
  box-shadow: 0 -1px 0 #322c26, inset 0 9px 0 #221e1a;
}
.spill {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(240, 243, 240, 0.42), rgba(240, 243, 240, 0.04));
  clip-path: polygon(49% 82%, 95% 82%, 106% 100%, 36% 100%);
  opacity: calc(var(--open) * 0.85);
  pointer-events: none;
  z-index: 1;
}
.wash {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 60vw 70vh at 72% 52%, rgba(236, 240, 238, 0.30), transparent 70%);
  opacity: var(--open);
  pointer-events: none;
  z-index: 1;
}

/* ---------- Room column ---------- */
.roomcol {
  position: absolute;
  z-index: 2;
  left: 4.5vw;
  top: 9vh;
  width: 41vw;
  height: 71vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2vh;
}
.titleblock h1 {
  font-weight: 300;
  font-size: clamp(44px, min(6.4vw, 10vh), 112px);
  line-height: 0.9;
  letter-spacing: -0.02em;
  font-variation-settings: "SOFT" 50, "WONK" 1;
  color: #efe7d4;
}
.tagline {
  margin-top: 1.4vh;
  max-width: 30em;
  font-size: clamp(15px, min(1.2vw, 2vh), 19px);
  font-style: italic;
  color: var(--muted);
}

.hang { display: flex; align-items: flex-start; gap: 2.6vw; }
.frame { flex: none; }
.moulding {
  padding: 9px;
  background: linear-gradient(135deg, #2e2924, #0f0d0c 40%, #3a332c 60%, #141210);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px #4a4037;
}
.mat {
  padding: clamp(10px, 1.3vw, 20px);
  background: #e6dfd0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), inset 0 3px 8px rgba(0, 0, 0, 0.18);
}
.inframe {
  position: relative;
  width: var(--fw);
  aspect-ratio: 3 / 2;
}
.frame.empty .inframe::after {
  content: "";
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.04);
}
.stkwrap { position: absolute; inset: 0; }
.stk { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.18)); }
.stk text { font-family: var(--hand); }

.side { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2.2vh; }
.plate {
  padding: 12px 14px 13px;
  background: #ece4d2;
  color: #2a241c;
  font: 400 12.5px/1.45 var(--mono);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.plate-name { font: italic 600 17px/1.2 var(--serif); margin-bottom: 6px; color: #1d1b1a; }
.plate li { padding: 1px 0; }

.meter { font: 400 12px/1.35 var(--mono); color: #d8ccb2; }
.meter > div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-top: 1px solid rgba(216, 204, 178, 0.16); }
.meter > div:first-child { border-top: 0; }
.meter dt { color: #a2977f; }
.meter dd { text-align: right; font-variant-numeric: tabular-nums; }
.meter dd small { display: block; font-size: 10.5px; color: #8f856f; }
.meter .m-head dt, .meter .m-head dd { font-weight: 600; color: #f1e7cf; letter-spacing: 0.06em; text-transform: uppercase; }

.slot.s1 .sec h2,
.sec h2 { font: italic 500 clamp(19px, min(1.6vw, 2.8vh), 25px)/1.15 var(--serif); margin-bottom: 0.45em; }
.sec p { font-size: clamp(16px, min(1.12vw, 1.9vh), 18px); }
.slot.s1 { max-width: 36em; }

/* ---------- Doorway ---------- */
.doorway {
  position: absolute;
  z-index: 2;
  left: 49vw;
  width: 46vw;
  top: 5%;
  height: 77%;
  display: flex;
  flex-direction: column;
  background: #161412;
  border: clamp(8px, 0.9vw, 16px) solid #2e2a26;
  border-bottom: 0;
  box-shadow: 0 0 0 1px #3f3832, inset 0 0 0 2px #100f0e, 0 30px 70px rgba(0, 0, 0, 0.5);
}
.fanlight {
  flex: none;
  height: 11vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4%;
  background: linear-gradient(180deg, #45433e, #2a2926 60%, #24231f);
  border-bottom: clamp(6px, 0.7vw, 12px) solid #2e2a26;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.lede {
  font: italic 600 clamp(17px, min(1.75vw, 3vh), 30px)/1.15 var(--serif);
  text-align: center;
  letter-spacing: 0.01em;
  color: var(--gilt);
  background: linear-gradient(180deg, #f3e2b4, #c9a764 55%, #e9d39c);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.6));
}
.opening { position: relative; flex: 1 1 auto; overflow: hidden; background: var(--day); }
.street { position: absolute; inset: 0; }
.town { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rain { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.post {
  position: absolute;
  left: 68%;
  top: -4%;
  bottom: 15%;
  width: clamp(18px, 2.4vw, 38px);
  background: linear-gradient(90deg, #5f6564, #a9afae 32%, #8f9493 55%, #5b605f);
  border-radius: 3px 3px 0 0;
}
.post::before {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 26%;
  background: linear-gradient(90deg, #111312, #3b403f 32%, #1c1f1e 60%, #0d0f0e);
}
.post-door {
  position: absolute; left: 22%; right: 22%; bottom: 8%; height: 9%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1px;
}
.post-ref {
  position: absolute; left: 0; right: 0; top: 100%; height: 34%;
  background: linear-gradient(180deg, rgba(28, 31, 30, 0.55), rgba(28, 31, 30, 0));
  filter: blur(2px);
}
.stuck { position: absolute; inset: 0; pointer-events: none; }
.onpost {
  position: absolute;
  width: 17%;
  aspect-ratio: 3 / 2;
  opacity: 0;
}
.onpost.here { opacity: 1; }
.onpost.slap { animation: slap 360ms ease-out; }
@keyframes slap {
  0% { scale: 1.12 0.9; }
  60% { scale: 0.97 1.03; }
  100% { scale: 1 1; }
}

.slot.s3 {
  position: absolute;
  left: 13%;
  top: 6%;
  width: 45%;
  color: #1d2a33;
}
.slot.s3 .sec h2 { color: #10202b; }
.slot.s3 .sec p { font-size: clamp(15.5px, min(1.05vw, 1.85vh), 17.5px); }

.meter.out {
  position: absolute;
  left: 13%;
  bottom: 3.5%;
  width: min(46%, 300px);
  padding: 8px 11px;
  background: rgba(36, 46, 54, 0.82);
  color: #e6ecef;
  border-radius: 2px;
}
.meter.out > div { border-color: rgba(230, 236, 239, 0.16); }
.meter.out dt { color: #aebcc6; }
.meter.out dd small { color: #93a4af; }
.meter.out .m-head dt, .meter.out .m-head dd { color: #ffffff; }

.buyspot {
  position: absolute;
  left: 74.5%;
  top: 38%;
  width: 22%;
  visibility: hidden;
  opacity: 0;
  transition: opacity 600ms ease, visibility 0s linear 600ms;
}
.stage.out .buyspot { visibility: visible; opacity: 1; transition: opacity 600ms ease; }
.buy {
  padding: 10px 10px 11px;
  background: #fbfaf6;
  color: var(--ink);
  rotate: 2deg;
  box-shadow: 0 3px 10px rgba(30, 40, 46, 0.28);
  font-family: var(--mono);
}
.buy-price { font: 600 22px/1 var(--serif); }
.buy-ed { font-size: 12px; margin: 4px 0 9px; color: #3b3b3b; }
.buy-btn {
  display: block;
  width: 100%;
  padding: 8px 6px;
  font: 600 12px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
}
.buy-btn:hover { background: #2c2a27; }
.buy-ok { min-height: 1.3em; margin-top: 6px; font-size: 12px; }

/* Door leaves */
.leaves { position: absolute; inset: 0; perspective: 1500px; perspective-origin: 50% 45%; touch-action: pan-y; }
.leaf {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0) 30%),
    linear-gradient(180deg, #1b1a18, #121110);
  cursor: grab;
  backface-visibility: hidden;
}
.leaf:active { cursor: grabbing; }
.leaf.l { left: 0; transform-origin: 0 50%; transform: rotateY(calc(var(--swing) * -1deg)); box-shadow: inset -1px 0 0 #050505; }
.leaf.r { right: 0; transform-origin: 100% 50%; transform: rotateY(calc(var(--swing) * 1deg)); box-shadow: inset 1px 0 0 #050505; }
.leaf::before, .leaf::after {
  content: "";
  position: absolute;
  left: 14%; right: 14%;
  border-radius: 2px;
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.6), inset -1px -1px 0 rgba(255, 255, 255, 0.06), 0 0 0 6px rgba(255, 255, 255, 0.015);
  background: linear-gradient(180deg, #181716, #101010);
}
.leaf::before { top: 7%; height: 50%; }
.leaf::after { top: 63%; height: 30%; }
.knob {
  position: absolute;
  z-index: 2;
  top: 52%;
  width: clamp(12px, 1.1vw, 18px);
  height: clamp(12px, 1.1vw, 18px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fbe9b8, #b99252 55%, #5a4421);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}
.leaf.l .knob { right: 7%; }
.leaf.r .knob { left: 7%; }
.knob:focus-visible { outline: 2px solid var(--gilt); outline-offset: 4px; }
.leak {
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: calc(1 - var(--open) * 4);
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(255, 255, 255, 0.95) calc(50% - 1px), rgba(255, 255, 255, 0.95) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(0deg, rgba(255, 255, 255, 0.9) 0 2px, transparent 2px);
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.8));
  animation: leak 5s ease-in-out infinite;
}
@keyframes leak { 50% { filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.95)); } }

/* Doormat with the threshold text */
.doormat {
  position: absolute;
  z-index: 2;
  left: 51.5vw;
  width: 41vw;
  top: 84%;
  height: 14.5%;
  padding: 1.6vh 3vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #ead9b4;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 4px),
    #2c251e;
  clip-path: polygon(2.5% 0, 97.5% 0, 100% 100%, 0 100%);
  box-shadow: inset 0 0 0 5px #221c16;
  filter: brightness(calc(1 + var(--open) * 0.4));
}
.doormat .sec h2 { font: 600 11.5px/1.2 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 0.5em; color: #f2e3bf; }
.doormat .sec p { font-size: clamp(14px, min(1vw, 1.75vh), 16.5px); line-height: 1.38; }

.flyer {
  position: absolute;
  z-index: 20;
  display: none;
  transform-origin: 50% 50%;
  pointer-events: none;
}
.flyer.go { display: block; }

/* ---------- Phone cards ---------- */
.beats { display: none; }

/* ---------- Footer ---------- */
.outro {
  position: relative;
  padding: 18vh 4.5vw 14vh;
  background: linear-gradient(180deg, #0f0e0d, var(--room));
  overflow-x: clip;
}
.last {
  max-width: 20em;
  font: italic 300 clamp(26px, 3.4vw, 52px)/1.12 var(--serif);
  color: #efe7d4;
}
.next {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 9vh;
  padding: 16px 20px 18px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid #4a4037;
}
.next span { font: 600 11.5px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.next strong { font: 500 clamp(22px, 2.2vw, 32px)/1.1 var(--serif); }
.next:hover { border-color: var(--gilt); }

/* ---------- Phone and narrow portrait ---------- */
@media (max-width: 820px), (max-aspect-ratio: 4/5) {
  :root { --fw: min(44vw, 30svh); }
  .home { left: 16px; top: 14px; }
  .scene { height: auto; }
  .stage { z-index: 1; }
  .roomcol {
    left: 16px; right: 16px; width: auto;
    top: 52px; height: auto;
    justify-content: flex-start;
    gap: 2svh;
  }
  .titleblock h1 { font-size: clamp(38px, 11vw, 56px); }
  .tagline { font-size: 15px; margin-top: 8px; }
  .hang { gap: 14px; }
  .moulding { padding: 6px; }
  .mat { padding: 9px; }
  .side { gap: 10px; }
  .meter { font-size: 11.5px; }
  .meter > div { flex-direction: column; gap: 0; padding: 3px 0; }
  .meter dd { text-align: left; }
  .meter dd small { font-size: 10px; }
  .slot.s1 { display: none; }

  .doorway { left: 9vw; width: 82vw; top: 45%; height: 45%; }
  .fanlight { height: auto; min-height: 56px; padding: 8px 5%; }
  .lede { font-size: 16px; }
  .floor { top: 90%; }
  .spill { clip-path: polygon(9% 90%, 91% 90%, 100% 100%, 0 100%); }
  .wash { background: radial-gradient(ellipse 90vw 50vh at 50% 70%, rgba(236, 240, 238, 0.32), transparent 70%); }
  .doormat { display: none; }
  .post { left: 70%; width: 16px; }
  .onpost { width: 24%; }
  .meter.out { left: 6%; top: 5%; bottom: auto; width: 54%; padding: 6px 8px; }
  .meter.out > div { flex-direction: row; justify-content: space-between; }
  .meter.out dd { text-align: right; }
  .meter.out > div:last-child { display: none; }
  .slot.s3, .buyspot { display: none; }

  .beats {
    display: block;
    position: relative;
    z-index: 3;
    margin-top: -100vh;
    margin-top: -100svh;
    padding: 92svh 16px 30svh;
    pointer-events: none;
  }
  .beat { min-height: 84svh; }
  .card {
    pointer-events: auto;
    padding: 20px 20px 22px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  }
  .card .sec h2 { font-size: 23px; }
  .card .sec p { font-size: 17px; line-height: 1.5; }
  .c-label { background: #ece4d2; color: #2a241c; }
  .c-label .plate { padding: 0; background: none; box-shadow: none; font-size: 15px; }
  .c-label .plate-name { font-size: 20px; }
  .c-wall { background: #27231f; color: var(--text); border: 1px solid #3d362f; }
  .c-mat {
    color: #ead9b4;
    background:
      repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px),
      #2c251e;
    box-shadow: inset 0 0 0 6px #221c16, 0 18px 50px rgba(0, 0, 0, 0.5);
  }
  .c-mat .sec h2 { font: 600 13px/1.2 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: #f2e3bf; }
  .c-day { background: var(--day); color: #1d2a33; }
  .c-buy { background: none; box-shadow: none; padding: 0; display: flex; justify-content: flex-end; }
  .c-buy .buy { width: min(220px, 64vw); padding: 14px; rotate: -2deg; }
  .c-buy .buy-price { font-size: 28px; }
  .c-buy .buy-ed, .c-buy .buy-ok { font-size: 14px; }
  .c-buy .buy-btn { font-size: 14px; padding: 12px 8px; }

  .outro { padding: 14vh 16px 12vh; }
}

@media (max-width: 820px) and (max-height: 700px), (max-aspect-ratio: 4/5) and (max-height: 700px) {
  :root { --fw: min(40vw, 26svh); }
  .titleblock h1 { font-size: 36px; }
  .tagline { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .leak { animation: none; }
  .onpost.slap { animation: none; }
  .buyspot, .stage.out .buyspot { transition: none; }
}
