/* style.css — the drawing room. Stone fireplace, walnut wainscot, deep green
   wallpaper, an oval rug, a log basket, and the keepsake box, all CSS. The
   room's light follows the fire: fire.js writes --fire (0..1) on <html> and
   the glow and dim overlays key off it. Every item he holds is drawn here
   too; app.js only assembles the right spans. */

:root {
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --parchment: #e8dcc0;
  --ink: #2a2118;
  --fire: 0.55;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: #14100c;
  overflow: hidden;
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

button { font-family: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid #e8dcc088; outline-offset: 3px; }

#room { position: fixed; inset: 0; }

/* ---------- the wall ---------- */

#wall {
  position: absolute; inset: 0;
  background:
    radial-gradient(1.6px 1.6px at 22% 30%, #ffffff06, transparent 60%),
    radial-gradient(ellipse 120% 90% at 50% 110%, #3b3226 0%, transparent 60%),
    repeating-linear-gradient(90deg, #26312a 0 3px, #222c26 3px 90px),
    linear-gradient(#1d2620, #232e26 55%, #1a2019);
}

/* damask hint: sparse dots, barely there */
#wall::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(14px 20px at 50% 50%, #34413733 30%, transparent 70%);
  background-size: 130px 150px;
  opacity: .5;
}

/* wainscot: dark walnut paneling on the lower wall */
#wall::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 42vh;
  background:
    linear-gradient(#00000000 0 6px, #00000055 6px 8px, #00000000 8px),
    repeating-linear-gradient(90deg, #2b1e12 0 6px, #241a10 6px 210px, #1c1309 210px 216px),
    linear-gradient(#2a1d11, #1e150c);
  border-top: 5px solid #3a2a18;
  box-shadow: 0 -8px 24px #00000066;
}

.panel-rail {
  position: absolute; left: 0; right: 0; bottom: calc(42vh + 5px); height: 3px;
  background: #171f19; opacity: .8;
}

.painting {
  position: absolute; left: 7%; top: 9%;
  width: min(170px, 16vw); height: min(210px, 20vw);
  background: linear-gradient(135deg, #6a5326, #8f7434 30%, #5c471f);
  padding: 10px;
  box-shadow: 0 6px 18px #000a, inset 0 0 0 2px #3f3115;
}
.painting-scene {
  width: 100%; height: 100%;
  background:
    radial-gradient(60% 40% at 50% 42%, #a89a7c22, transparent 70%),
    linear-gradient(#3a4148 0%, #2c3338 46%, #23282a 47%, #191d1c 100%);
}

/* ---------- the fireplace ---------- */

#fireplace {
  position: absolute; left: 50%; bottom: 21vh;
  width: min(620px, 96vw); height: min(52vh, 470px);
  transform: translateX(-50%);
}

.mantel {
  position: absolute; left: 3%; right: 3%; bottom: 100%; height: 74px;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 9%;
}

.mantel-shelf {
  position: absolute; left: -2%; right: -2%; top: -14px; height: 18px;
  background: linear-gradient(#cdbfa4, #a3957b 60%, #756a56);
  border-radius: 3px;
  box-shadow: 0 5px 10px #00000088;
  z-index: 2; /* the shelf protrudes; it eclipses the fireplace face, never the reverse */
}

.candlestick { position: relative; width: 14px; height: 52px; }
.candlestick::before { /* the stick */
  content: ''; position: absolute; left: 3px; bottom: 0; width: 8px; height: 34px;
  background: linear-gradient(90deg, #6f5a2b, #c2a556 40%, #6f5a2b);
  border-radius: 2px;
}
.candlestick::after { /* the candle */
  content: ''; position: absolute; left: 4px; bottom: 32px; width: 6px; height: 16px;
  background: #e8dcc0;
  border-radius: 2px 2px 0 0;
}
.candlestick i { /* the small unbothered flame */
  position: absolute; left: 4.5px; bottom: 47px; width: 5px; height: 9px;
  background: radial-gradient(circle at 50% 80%, #ffdf9e, #ff9d3a 65%, transparent 75%);
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  animation: candle 2.7s ease-in-out infinite;
  opacity: calc(.35 + var(--fire) * .65);
}
.candlestick.right i { animation-delay: -1.3s; }
@keyframes candle {
  0%, 100% { transform: scaleY(1) translateX(0); }
  38% { transform: scaleY(1.15) translateX(.4px); }
  70% { transform: scaleY(.92) translateX(-.4px); }
}

.clock {
  position: relative; width: 74px; height: 58px;
  background: linear-gradient(#4a3320, #2e1f10);
  border-radius: 37px 37px 5px 5px;
  box-shadow: inset 0 2px 3px #ffffff22, 0 3px 8px #0009;
}
.clock i {
  position: absolute; left: 50%; top: 52%; width: 44px; height: 44px;
  transform: translate(-50%, -50%);
  background: radial-gradient(#f2e9d4, #d9cba8);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px #23180c;
}
.clock i::before, .clock i::after {
  content: ''; position: absolute; left: 50%; top: 50%; background: #23180c;
  transform-origin: 0 0;
}
.clock i::before { width: 13px; height: 2px; transform: rotate(-64deg); } /* it is late */
.clock i::after { width: 17px; height: 1.6px; transform: rotate(38deg); }

.surround {
  position: absolute; inset: 0;
  background:
    linear-gradient(#00000000 0 49%, #00000038 50%, #00000000 51%),
    repeating-linear-gradient(0deg, #b1a288 0 2px, transparent 2px 88px),
    repeating-linear-gradient(90deg, #b1a288 0 2px, transparent 2px 150px),
    linear-gradient(160deg, #b8a98f, #9c8e75 55%, #857863);
  border-radius: 6px 6px 0 0;
  box-shadow: inset 0 0 0 2px #cbbda211, 0 10px 30px #000a;
}

.plinth {
  position: absolute; bottom: -10px; width: 21%; height: 26px;
  background: linear-gradient(#c3b499, #8f8269);
  border-radius: 3px;
  box-shadow: 0 4px 8px #0008;
}
.plinth.left { left: -2%; }
.plinth.right { right: -2%; }

.firebox {
  position: absolute; left: 50%; bottom: 0;
  width: 60%; height: 68%;
  transform: translateX(-50%);
  background: radial-gradient(120% 100% at 50% 100%, #201108 0%, #0d0703 55%, #060302 100%);
  border-radius: 46% 46% 0 0 / 26% 26% 0 0;
  box-shadow: inset 0 14px 28px #000000e0, inset 0 0 0 6px #00000066;
  overflow: hidden;
}

#fire { position: absolute; inset: 0; width: 100%; height: 100%; }

.grate {
  position: absolute; left: 8%; right: 8%; bottom: 4%; height: 14%;
  background:
    repeating-linear-gradient(90deg, #17110b 0 8px, transparent 8px 34px),
    linear-gradient(#00000000, #00000088);
  border-bottom: 4px solid #1a130c;
  border-radius: 0 0 8px 8px;
  opacity: .9;
}

#target-fire {
  position: absolute; left: 50%; bottom: 21vh;
  width: min(380px, 60vw); height: min(36vh, 330px);
  transform: translateX(-50%);
  background: none; border: none; border-radius: 40% 40% 0 0;
  z-index: 5;
}

/* ---------- the hearth ---------- */

#hearth {
  position: absolute; left: 0; right: 0; bottom: 0; height: 22vh;
  background:
    repeating-linear-gradient(90deg, #00000022 0 2px, transparent 2px 120px),
    linear-gradient(#6e6353, #57503f 40%, #3f3a2d);
  box-shadow: inset 0 6px 14px #00000088;
}

#rug {
  position: absolute; left: 50%; bottom: 2.5vh;
  width: min(430px, 74vw); height: 11vh;
  transform: translateX(-50%);
  background:
    radial-gradient(60% 55% at 50% 50%, #7c2f2a 0%, #6b2823 46%, #55201d 66%, #4a1c1a 67%, #56241f 100%);
  border-radius: 50%;
  box-shadow: inset 0 0 0 5px #8f5a3455, inset 0 0 30px #00000066, 0 4px 10px #00000055;
  z-index: 2;
}
#rug i { /* the medallion */
  position: absolute; left: 50%; top: 50%; width: 34%; height: 40%;
  transform: translate(-50%, -50%);
  border: 2px solid #a5714177; border-radius: 50%;
}
#rug.live { cursor: pointer; animation: ruglow 2.2s ease-in-out infinite; }
@keyframes ruglow {
  0%, 100% { box-shadow: inset 0 0 0 5px #8f5a3455, inset 0 0 30px #00000066, 0 0 0px #e8dcc000; }
  50% { box-shadow: inset 0 0 0 5px #c99a5f99, inset 0 0 30px #00000044, 0 0 22px #e8dcc02e; }
}

/* the log basket. Always there. Always free. */
#basket {
  position: absolute; bottom: 9vh;
  left: max(1.5vw, calc(50% - 460px));
  width: min(150px, 17vw); height: min(110px, 13vw);
  background: none; border: none; z-index: 5;
}
.basket-weave {
  position: absolute; left: 0; right: 0; bottom: 0; height: 68%;
  background:
    repeating-linear-gradient(90deg, #00000030 0 4px, transparent 4px 16px),
    repeating-linear-gradient(0deg, #00000022 0 3px, transparent 3px 12px),
    linear-gradient(170deg, #8a6a42, #5e4527);
  border-radius: 10px 10px 16px 16px;
  box-shadow: inset 0 4px 6px #00000066, 0 4px 10px #00000077;
}
#basket .log {
  position: absolute; width: 62%; height: 20%;
  background: linear-gradient(#7a5a3a, #4e3722);
  border-radius: 999px;
  box-shadow: inset 0 -3px 5px #00000055;
}
#basket .log::before {
  /* the cut face, seen from the side: the growth rings foreshorten to ovals */
  content: ''; position: absolute; right: -2px; top: 50%; width: 17%; height: 74%;
  transform: translateY(-50%);
  background: repeating-radial-gradient(ellipse, #c9a06a 0 2px, #8a6a42 2px 4.5px);
  border-radius: 50%;
}
#basket .l1 { left: 6%; top: 14%; transform: rotate(-10deg); }
#basket .l2 { left: 26%; top: 26%; transform: rotate(7deg); }
#basket .l3 { left: 12%; top: 2%; transform: rotate(3deg); }
#basket:hover .basket-weave, #basket:focus-visible .basket-weave { box-shadow: inset 0 4px 6px #00000066, 0 0 16px #e8dcc02a; }

/* the keepsake box. It preserves without comment. */
#box {
  position: absolute; bottom: 8.5vh;
  right: max(1.5vw, calc(50% - 460px));
  width: min(170px, 19vw); height: min(120px, 14vw);
  background: none; border: none; z-index: 5;
  perspective: 500px;
}
.box-back {
  position: absolute; left: 4%; right: 4%; bottom: 26%; height: 46%;
  background: #1c120a;
  border-radius: 4px 4px 0 0;
}
.box-contents {
  position: absolute; left: 8%; right: 8%; bottom: 30%; height: 0;
  display: flex; flex-direction: column-reverse; overflow: hidden;
  transition: height .6s ease;
}
.box-contents i {
  height: 7px; flex: none; border-radius: 2px; margin-top: 1px;
  box-shadow: 0 1px 1px #00000066;
}
.box-front {
  position: absolute; left: 0; right: 0; bottom: 0; height: 58%;
  background:
    linear-gradient(#00000000 0 8%, #00000044 9% 10%, #00000000 11%),
    linear-gradient(165deg, #5b3d22, #40291364 40%, #351f0e),
    linear-gradient(#4e3319, #2e1c0b);
  border-radius: 5px;
  box-shadow: inset 0 2px 3px #ffffff1c, 0 6px 14px #000a;
}
.box-front::before { /* a quiet inlay, not hardware. The box has no lock. */
  content: ''; position: absolute; left: 15%; right: 15%; top: 24%; bottom: 22%;
  border: 1.5px solid #7a55309a;
  border-radius: 3px;
}
.box-front::after { /* the inner rim of the open front wall */
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: #8a6234;
  border-radius: 5px 5px 0 0;
  opacity: .85;
}
.box-lid {
  /* open: hinged at the back rim, leaning away like a trunk lid */
  position: absolute; left: 2%; right: 2%; bottom: 72%; height: 36%;
  background: linear-gradient(#6a4826, #40270f 70%, #301c09);
  border: 2px solid #5b3d22;
  border-radius: 5px 5px 2px 2px;
  box-shadow: inset 0 2px 3px #ffffff18, 0 3px 8px #0007;
  transform-origin: 50% 100%;
  transform: rotateX(-34deg);
  transition: transform 1.4s cubic-bezier(.35, 0, .25, 1);
}
#box.closed .box-lid { transform: rotateX(82deg); }
#box:hover .box-lid, #box:focus-visible .box-lid { box-shadow: inset 0 2px 3px #ffffff22, 0 0 18px #e8dcc030; }

/* ---------- light ---------- */

#glow {
  position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: radial-gradient(ellipse 62% 52% at 50% 66%, rgba(255, 148, 54, .5), rgba(255, 120, 30, .12) 55%, transparent 75%);
  opacity: calc(.08 + var(--fire) * .95);
}
#glow::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 40% 32% at 50% 70%, rgba(255, 170, 80, .35), transparent 70%);
  animation: flicker 3.1s ease-in-out infinite;
}
@keyframes flicker {
  0%, 100% { opacity: .5; } 23% { opacity: .8; } 41% { opacity: .45; }
  62% { opacity: .75; } 84% { opacity: .55; }
}
#dim {
  position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: #07050a;
  opacity: calc(.6 - var(--fire) * .56);
}

/* ---------- the hands (implied) ---------- */

#held {
  position: absolute; left: 50%; bottom: 0; width: 0; height: 0; z-index: 6;
}
#item {
  position: absolute; left: 0; bottom: 2vh;
  transform: translate(-50%, 130%);
  transition: transform 1.3s cubic-bezier(.2, .8, .25, 1);
  filter: drop-shadow(0 10px 14px #000000b0);
  will-change: transform;
}
#held.up #item { transform: translate(-50%, 0); }
#held.up.away #item { transition: transform 1.15s cubic-bezier(.5, 0, .8, .4); }
#held.up #item .it { animation: sway 5.2s ease-in-out infinite; }
#held.tremble #item .it { animation: sway 5.2s ease-in-out infinite, tremble 1.9s ease-in-out infinite; }
@keyframes sway {
  0%, 100% { transform: rotate(-1deg) translateY(0); }
  50% { transform: rotate(1.1deg) translateY(-4px); }
}
@keyframes tremble {
  0%, 100% { translate: 0 0; } 18% { translate: .7px -.4px; } 39% { translate: -.6px .5px; }
  57% { translate: .5px .3px; } 80% { translate: -.7px -.3px; }
}
/* the recoil: his hands start toward the fire, and stop */
#held.refuse #item { animation: refuse .9s ease-out; }
@keyframes refuse {
  0% { translate: 0 0; } 30% { translate: 0 -7vh; } 55% { translate: 0 -5.5vh; } 100% { translate: 0 0; }
}

/* ---------- captions ---------- */

#caption {
  position: fixed; left: 50%; bottom: 31vh; z-index: 7;
  transform: translateX(-50%);
  width: min(620px, 92vw);
  text-align: center;
  font-size: clamp(16px, 2.3vmin, 21px);
  line-height: 1.5;
  color: var(--parchment);
  text-shadow: 0 2px 8px #000c, 0 0 2px #000;
  opacity: 0;
  transition: opacity .9s ease;
  pointer-events: none;
}
#caption.show { opacity: 1; }
#subcaption {
  position: fixed; left: 50%; bottom: 27vh; z-index: 7;
  transform: translateX(-50%);
  width: min(620px, 92vw);
  text-align: center;
  font-size: clamp(12px, 1.7vmin, 15px);
  font-style: italic;
  color: #e8dcc0aa;
  text-shadow: 0 2px 6px #000c;
  opacity: 0;
  transition: opacity .8s ease;
  pointer-events: none;
}
#subcaption.show { opacity: 1; }

#snd {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: 14px; z-index: 8;
  background: none;
  border: 1px solid #e8dcc03d;
  color: #e8dcc09d;
  font-size: 11px; letter-spacing: .18em;
  padding: 6px 10px;
  border-radius: 3px;
}
#snd.off { color: #e8dcc04d; border-color: #e8dcc01f; text-decoration: line-through; }

/* ---------- intro & epilogue ---------- */

#intro, #epilogue {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  color: var(--parchment);
}
#intro {
  background: radial-gradient(ellipse 90% 70% at 50% 45%, #201a12, #0e0b07 75%);
  transition: opacity 1.6s ease;
}
#intro.gone { opacity: 0; pointer-events: none; }
#intro h1 {
  font-size: clamp(34px, 7vmin, 58px);
  font-weight: 500;
  letter-spacing: .34em;
  text-indent: .34em;
}
.rule {
  width: 130px; height: 1px; margin: 22px auto;
  background: #e8dcc055;
  box-shadow: 0 3px 0 #e8dcc022;
}
#intro p { font-size: clamp(15px, 2.2vmin, 19px); line-height: 1.7; }
#intro .small { margin-top: 26px; font-size: 13px; font-style: italic; color: #e8dcc077; }
#begin, #again {
  margin-top: 34px;
  background: none;
  border: 1px solid #e8dcc060;
  color: var(--parchment);
  font-size: clamp(15px, 2.1vmin, 18px);
  letter-spacing: .12em;
  padding: 12px 34px;
  border-radius: 2px;
  transition: background .4s, border-color .4s;
}
#begin:hover, #again:hover { background: #e8dcc014; border-color: #e8dcc0a0; }

#epilogue {
  background: linear-gradient(rgba(26, 30, 37, .88), rgba(38, 42, 48, .93));
  opacity: 0;
  transition: opacity 2.4s ease;
  z-index: 9;
  pointer-events: none;
}
#epilogue[hidden] { display: none; }
#epilogue.show { pointer-events: auto; }
#epilogue.show { opacity: 1; }
#epilogue h2 {
  font-size: clamp(26px, 4.6vmin, 40px);
  font-weight: 500;
  letter-spacing: .2em; text-indent: .2em;
  margin-bottom: 30px;
}
.ep-lines { max-width: min(560px, 88vw); margin: 0 auto; }
.ep-lines p {
  font-size: clamp(15px, 2.2vmin, 19px);
  line-height: 1.75;
  margin: 10px 0;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.ep-lines p.on { opacity: 1; }
#again { margin-top: 38px; opacity: 0; transition: opacity 1.4s ease, background .4s, border-color .4s; }
#again.on { opacity: 1; }

/* =========================================================
   the items
   ========================================================= */

.it { position: relative; display: block; }

/* --- letters --- */
.it-letter {
  width: 200px; height: 142px;
  background: linear-gradient(170deg, #f6ecd4, #e9dcba);
  border-radius: 2px;
  box-shadow: inset 0 0 24px #b39a6c33, 0 1px 2px #0007;
  padding: 18px 20px 14px;
}
.it-letter .crease {
  position: absolute; left: 0; right: 0; top: 34%; height: 2px;
  background: linear-gradient(90deg, #0000000e, #00000022, #0000000e);
}
.it-letter .crease::after {
  content: ''; position: absolute; left: 0; right: 0; top: 34px; height: 2px;
  background: linear-gradient(90deg, #0000000a, #0000001d, #0000000a);
}
.ln { display: block; height: 2px; margin: 9px 0; background: #4a3a2a66; border-radius: 1px; }
.it-letter .sig {
  position: absolute; right: 24px; bottom: 14px; width: 58px; height: 12px;
  border-bottom: 2px solid #4a3a2a88;
  transform: rotate(-5deg);
}
.it-letter .sig::before {
  content: ''; position: absolute; left: 6px; bottom: -1px; width: 16px; height: 10px;
  border: 2px solid #4a3a2a77; border-radius: 60% 100% 40% 80%;
  border-bottom: none; transform: rotate(-12deg);
}

/* --- the photograph --- */
.it-photo {
  width: 190px; height: 152px;
  background: #f7f3e9;
  padding: 9px 9px 26px;
  box-shadow: 0 1px 3px #0008;
  transform: rotate(.5deg);
}
.it-photo .scene {
  position: relative; display: block; width: 100%; height: 100%; overflow: hidden;
  background:
    linear-gradient(#d8a86a 0%, #c98d58 34%, #6e8391 40%, #37505c 41%, #22333c 100%);
  filter: saturate(.8) contrast(.94);
}
.it-photo .fig {
  /* him, small and far off. She is holding the camera. */
  position: absolute; left: 58%; bottom: 37%; width: 8px; height: 21px;
  background: #1d1712; border-radius: 4px 4px 0 0;
}
.it-photo .thumb {
  /* the only part of her in it. Inside .scene, so the print's frame clips it. */
  position: absolute; left: -26px; bottom: -26px; width: 84px; height: 84px;
  background: #241b14; border-radius: 50%;
  filter: blur(4px);
}

/* --- the corsage --- */
.it-corsage { width: 122px; height: 132px; }
.it-corsage .p {
  position: absolute; left: 38px; top: 30px; width: 48px; height: 48px;
  background: radial-gradient(circle at 40% 35%, #e3c0b6, #b08379 70%, #92655c);
  border-radius: 58% 58% 58% 4%;
  transform-origin: 8% 92%;
  filter: saturate(.55) brightness(.94);
}
.it-corsage .p1 { transform: rotate(-8deg); }
.it-corsage .p2 { transform: rotate(64deg); }
.it-corsage .p3 { transform: rotate(136deg); }
.it-corsage .p4 { transform: rotate(208deg); }
.it-corsage .p5 { transform: rotate(280deg); }
.it-corsage .cc {
  position: absolute; left: 36px; top: 62px; width: 15px; height: 15px;
  background: radial-gradient(#8a6a52, #5e4536);
  border-radius: 50%;
}
.it-corsage .leaf {
  position: absolute; left: 62px; top: 78px; width: 40px; height: 18px;
  background: linear-gradient(100deg, #7a7d62, #565c44);
  border-radius: 0 100% 0 100%;
  transform: rotate(24deg);
  filter: saturate(.5);
}
.it-corsage .rib {
  position: absolute; left: 40px; top: 84px; width: 9px; height: 46px;
  background: linear-gradient(#ded0ae, #bcab84);
  transform: rotate(9deg);
}
.it-corsage .rib.r2 { left: 52px; transform: rotate(-11deg); height: 40px; }

/* --- the cassette --- */
.it-cassette {
  width: 200px; height: 126px;
  background: linear-gradient(#33323a, #1b1a20);
  border-radius: 9px;
  box-shadow: inset 0 1px 2px #ffffff2a, 0 2px 4px #0009;
}
.it-cassette .label {
  position: absolute; left: 9px; right: 9px; top: 9px; height: 72px;
  background: linear-gradient(#f2e8cf, #e4d7b6);
  border-radius: 5px;
  display: block;
}
.it-cassette .hand {
  position: absolute; left: 12px; top: 7px;
  font-style: italic; font-size: 14px; color: #43395c;
  letter-spacing: .02em;
  transform: rotate(-1.2deg);
}
.it-cassette .win {
  position: absolute; left: 50%; bottom: 8px; width: 96px; height: 30px;
  transform: translateX(-50%);
  background: #141318;
  border-radius: 15px;
  box-shadow: inset 0 0 0 2px #00000066;
  display: block;
}
.it-cassette .reel {
  position: absolute; top: 4px; width: 22px; height: 22px;
  border-radius: 50%;
  background:
    repeating-conic-gradient(#d9d4c6 0 22deg, #8f8a7c 22deg 44deg);
  box-shadow: inset 0 0 0 4px #141318;
}
.it-cassette .reel.rl { left: 6px; }
.it-cassette .reel.rr { right: 6px; }
.it-cassette .screw {
  position: absolute; width: 5px; height: 5px; background: #6a6875; border-radius: 50%;
}
.it-cassette .screw.s1 { left: 5px; top: 5px; }
.it-cassette .screw.s2 { right: 5px; top: 5px; }
.it-cassette .screw.s3 { left: 5px; bottom: 5px; }
.it-cassette .screw.s4 { right: 5px; bottom: 5px; }

/* --- bills --- */
.it-bill {
  width: 178px; height: 222px;
  background: #fbf8ef;
  padding: 12px 14px;
  box-shadow: 0 1px 3px #0008;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}
.bill-head {
  font-size: 10px; font-weight: 700; letter-spacing: .09em; color: #22201c;
  border-bottom: 2px solid #22201c;
  padding-bottom: 5px; margin-bottom: 10px;
}
.it-bill .row, .it-ticket .row, .it-lease .row {
  display: block; height: 4px; margin: 8px 0; background: #c6c0af; border-radius: 1px;
}
.w60 { width: 60%; } .w75 { width: 75%; } .w85 { width: 85%; } .w45 { width: 45%; }
.amt {
  display: inline-block; margin-top: 10px;
  font-size: 15px; font-weight: 700; color: #22201c;
  border: 2px solid #22201c;
  padding: 3px 8px;
}
.stamp {
  position: absolute; right: 8px; top: 46%;
  color: #a32014; border: 3px solid #a32014;
  font-size: 12px; font-weight: 800; letter-spacing: .13em;
  padding: 3px 8px;
  transform: rotate(-11deg);
  opacity: .82;
}

/* --- the parking ticket --- */
.it-ticket {
  width: 112px; height: 212px;
  background: #fdf7e2;
  padding: 0 10px 10px;
  box-shadow: 0 1px 3px #0008;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  border-top: 2px dashed #b5ad95;
}
.tik-head {
  margin: 0 -10px 8px;
  background: #23211c; color: #fdf7e2;
  font-size: 8.5px; font-weight: 800; letter-spacing: .13em;
  text-align: center; padding: 5px 0;
}
.tik-amt {
  margin-top: 10px; text-align: center;
  font-size: 14px; font-weight: 800; color: #23211c;
}

/* --- the tax folder --- */
.it-folder {
  width: 212px; height: 148px;
  background: linear-gradient(170deg, #dcbc7c, #c2a05c);
  border-radius: 4px;
  box-shadow: inset 0 -6px 14px #00000022, 0 2px 4px #0008;
}
.it-folder .tab {
  position: absolute; left: 16px; top: -15px; width: 82px; height: 17px;
  background: inherit;
  border-radius: 5px 5px 0 0;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 8.5px; font-weight: 700; letter-spacing: .12em; color: #5e4a22;
  text-align: center; line-height: 17px;
}
.it-folder .peek {
  position: absolute; right: 12px; top: -8px; width: 150px; height: 9px;
  background: #f5efdf;
  border-radius: 2px 2px 0 0;
  box-shadow: 0 -3px 0 -1px #e7dfc8;
}

/* --- the lease --- */
.it-lease {
  width: 178px; height: 228px;
  background: #f8f4e8;
  padding: 14px 16px;
  box-shadow: 3px 3px 0 -1px #efe9d6, 4px 4px 3px #0007;
  font-family: 'Times New Roman', serif;
}
.doc-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  text-align: center; color: #2c2820;
  margin-bottom: 8px;
}
.sigline {
  position: relative; height: 20px; margin-top: 12px;
  border-bottom: 1.5px solid #4a453a;
}
.sigline::after {
  content: ''; position: absolute; left: 8px; bottom: 1px; width: 52px; height: 11px;
  border-bottom: 2px solid #35306699;
  transform: rotate(-3deg);
  border-radius: 0 0 40% 20%;
}
.sigline.s2::after { width: 64px; transform: rotate(2deg); left: 14px; }

/* --- the book --- */
.it-book {
  width: 168px; height: 224px;
  background: linear-gradient(100deg, #37435d 0%, #2a3348 60%, #232b3d 100%);
  border-radius: 3px 10px 10px 3px;
  box-shadow: inset 10px 0 14px -8px #000c, 0 3px 6px #0009;
  text-align: center;
}
.it-book::after { /* page block */
  content: ''; position: absolute; right: 2px; top: 4px; bottom: 4px; width: 5px;
  background: repeating-linear-gradient(#eae2cc 0 2px, #cfc6ae 2px 3px);
  border-radius: 0 4px 4px 0;
}
.it-book .bt {
  margin-top: 62px;
  font-style: italic; font-size: 24px; color: #cfa94f;
  text-shadow: 0 1px 1px #0008;
}
.it-book .bs {
  margin-top: 14px;
  font-size: 8.5px; font-weight: 600; letter-spacing: .26em; color: #cfa94fa8;
}

/* --- her key --- */
.it-key { width: 158px; height: 82px; }
.it-key .bow {
  position: absolute; left: 0; top: 14px; width: 46px; height: 46px;
  border: 11px solid #a98c46;
  border-radius: 50%;
  box-shadow: inset 0 1px 2px #ffffff55, 0 1px 2px #0008;
  background: transparent;
}
.it-key .stem {
  position: absolute; left: 44px; top: 32px; width: 82px; height: 10px;
  background: linear-gradient(#c9ab5e, #8a6f33);
  border-radius: 0 4px 4px 0;
}
.it-key .t1, .it-key .t2 {
  position: absolute; top: 42px; width: 9px; height: 16px;
  background: linear-gradient(#c9ab5e, #8a6f33);
}
.it-key .t1 { left: 108px; }
.it-key .t2 { left: 94px; height: 11px; }
.it-key .tag {
  position: absolute; left: 26px; top: 54px; width: 48px; height: 30px;
  background: #efe6cf;
  border-radius: 3px;
  transform: rotate(9deg);
  box-shadow: 0 1px 2px #0007;
}
.it-key .tag::before { /* the string */
  content: ''; position: absolute; left: -12px; top: -13px; width: 22px; height: 18px;
  border: 1.5px solid #b8a988; border-radius: 50%;
  border-right-color: transparent;
}
.it-key .tag .scr {
  position: absolute; left: 9px; top: 12px; width: 30px; height: 2px;
  background: #4a4a4a77;
  border-radius: 1px;
  transform: rotate(-2deg);
}

/* --- the ring --- */
.it-ring { width: 84px; height: 96px; }
.it-ring .band {
  position: absolute; left: 12px; top: 28px; width: 56px; height: 56px;
  border: 8px solid #d9b95c;
  border-radius: 50%;
  box-shadow: inset 0 1px 3px #fff8, 0 1px 2px #0008, inset 0 -2px 3px #8a6f3388;
}
.it-ring .stone {
  position: absolute; left: 50%; top: 10px; width: 17px; height: 17px;
  transform: translateX(-50%) rotate(45deg);
  background: linear-gradient(135deg, #ffffff, #d5e6ef 55%, #9db8c8);
  box-shadow: 0 0 8px #cfe3ef99, 0 1px 2px #0006;
}

/* --- the box of kittens --- */
/* Layering, back to front: side flaps, the standing back flap, the box
   body, the ears, then the raised FRONT flap. The front flap is what
   makes the bit work: the ears rise from behind it, and only the ears. */
.it-kittens { width: 212px; height: 150px; }
.it-kittens .bx {
  position: absolute; left: 0; right: 0; bottom: 0; height: 96px;
  background: linear-gradient(168deg, #c89a5f, #9a6f3c);
  border-radius: 4px;
  box-shadow: inset 0 14px 16px -10px #000000aa, 0 3px 6px #0009;
  display: block;
}
.it-kittens .flap {
  position: absolute;
  background: linear-gradient(#b8894f, #8f6636);
  box-shadow: 0 1px 2px #0007;
}
.it-kittens .flap.fl {
  left: -12px; bottom: 74px; width: 44px; height: 30px;
  transform: rotate(-16deg) skewY(8deg);
}
.it-kittens .flap.fr {
  right: -12px; bottom: 74px; width: 44px; height: 30px;
  transform: rotate(16deg) skewY(-8deg);
}
.it-kittens .flap.fb { /* the back flap, standing tall: the inner face, in shadow */
  left: 28px; bottom: 90px; width: 156px; height: 46px;
  background: linear-gradient(#7e5a30, #9a7040);
  border-radius: 2px 2px 0 0;
  transform: rotate(-1deg);
  box-shadow: none;
}
.it-kittens .flap.ff { /* the front flap, raised. Ears only. */
  left: 5px; right: 5px; bottom: 92px; width: auto; height: 34px;
  background: linear-gradient(#d2a76c, #b8894f);
  border-radius: 3px 3px 0 0;
  transform: rotate(.6deg);
  box-shadow: 0 -1px 2px #00000055;
}
.it-kittens .ears { position: absolute; display: block; animation: peek 3.4s ease-in-out infinite; }
.it-kittens .ears i {
  position: absolute; bottom: 0; width: 0; height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 18px solid #3a2f28;
}
.it-kittens .ears i + i { left: 26px; }
.it-kittens .ears.e1 { left: 56px; bottom: 119px; }
.it-kittens .ears.e2 { left: 126px; bottom: 116px; animation-delay: -1.9s; }
.it-kittens .ears.e2 i { border-bottom-color: #705744; }
@keyframes peek {
  0%, 100% { transform: translateY(14px); }
  16%, 54% { transform: translateY(0); }
  70% { transform: translateY(16px); }
}
#held.up #item .it-kittens { animation: sway 5.2s ease-in-out infinite, rock 2.6s ease-in-out infinite; }
@keyframes rock {
  0%, 100% { rotate: 0deg; } 30% { rotate: .9deg; } 70% { rotate: -.9deg; }
}

/* the kittens, settled on the rug */
.kittens-settled { position: absolute; width: 240px; height: 110px; pointer-events: none; }
.kittens-settled .sbox {
  position: absolute; left: 0; bottom: 6px; width: 108px; height: 62px;
  background: linear-gradient(168deg, #b78a52, #8a6234);
  border-radius: 4px;
  box-shadow: inset 0 10px 12px -8px #000000aa, 0 3px 6px #0009;
  transform: rotate(-3deg);
  display: block;
}
.kittens-settled .cat {
  position: absolute; bottom: 8px; width: 62px; height: 32px;
  background: radial-gradient(circle at 68% 30%, #4a3d33, #332a23 70%);
  border-radius: 55% 60% 48% 48%;
  animation: breathe 4.4s ease-in-out infinite;
  transform-origin: bottom;
}
.kittens-settled .cat::before { /* the tucked tail */
  content: ''; position: absolute; left: -8px; bottom: 0; width: 30px; height: 18px;
  border: 5px solid; border-color: inherit;
  border-radius: 50%;
  border-top-color: transparent; border-right-color: transparent;
  transform: rotate(24deg);
}
.kittens-settled .cat::after { /* an ear */
  content: ''; position: absolute; right: 8px; top: -6px; width: 0; height: 0;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-bottom: 9px solid;
  border-bottom-color: inherit;
}
.kittens-settled .cat.c1 { left: 96px; color: #4a3d33; border-color: #4a3d33; border-bottom-color: #4a3d33; }
.kittens-settled .cat.c2 {
  left: 152px; bottom: 12px; width: 56px;
  background: radial-gradient(circle at 68% 30%, #8a6a4a, #6b503a 70%);
  color: #6b503a; border-color: #6b503a; border-bottom-color: #6b503a;
  animation-delay: -1.6s;
}
.kittens-settled .cat.c3 {
  left: 122px; bottom: 34px; width: 50px; height: 26px;
  background: radial-gradient(circle at 68% 30%, #767065, #5a554c 70%);
  color: #5a554c; border-color: #5a554c; border-bottom-color: #5a554c;
  animation-delay: -3.1s;
}
@keyframes breathe {
  0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.06); }
}

/* --- the last letter --- */
.it-envelope {
  width: 212px; height: 134px;
  background: linear-gradient(#f0e5c9, #e4d6b2);
  border-radius: 3px;
  box-shadow: 0 1px 3px #0008;
  overflow: hidden;
}
.it-envelope .flap-v {
  position: absolute; left: 0; top: 0; width: 0; height: 0;
  border-left: 106px solid transparent;
  border-right: 106px solid transparent;
  border-top: 64px solid #dcCDa6;
  filter: drop-shadow(0 2px 1px #00000022);
}
.it-envelope .addr { position: absolute; display: block; height: 2px; background: #4a3a2a77; border-radius: 1px; }
.it-envelope .addr.a1 { left: 66px; top: 84px; width: 82px; }
.it-envelope .addr.a2 { left: 78px; top: 98px; width: 58px; }
.it-envelope .seal {
  position: absolute; left: 50%; top: 46px; width: 36px; height: 36px;
  transform: translateX(-50%);
  background: radial-gradient(circle at 38% 32%, #b04431, #71241a 70%);
  border-radius: 50%;
  box-shadow: 0 2px 4px #00000066, inset 0 1px 2px #ffffff33;
  display: block;
}
.it-envelope .seal::after {
  content: ''; position: absolute; inset: 7px;
  border: 1.5px solid #d88a7255;
  border-radius: 50%;
}

/* --- a log, in flight --- */
.it-log {
  width: 150px; height: 46px;
  background: linear-gradient(#7a5a3a, #4e3722);
  border-radius: 999px;
  box-shadow: inset 0 -4px 6px #00000055, 0 2px 4px #0008;
}
.it-log::before {
  content: ''; position: absolute; right: 2px; top: 50%; width: 22px; height: 40px;
  transform: translateY(-50%);
  background: repeating-radial-gradient(ellipse, #c9a06a 0 2.5px, #8a6a42 2.5px 6px);
  border-radius: 50%;
}

/* =========================================================
   burning
   ========================================================= */

.it.burning { --p: 0; }
.it.burn-mask {
  -webkit-mask-image: linear-gradient(to top, transparent calc(var(--p) * 1%), #000 calc((var(--p) + 16) * 1%));
  mask-image: linear-gradient(to top, transparent calc(var(--p) * 1%), #000 calc((var(--p) + 16) * 1%));
}
.it.burn-mask-center {
  -webkit-mask-image: radial-gradient(circle at 55% 45%, transparent calc(var(--p) * 1%), #000 calc((var(--p) + 14) * 1%));
  mask-image: radial-gradient(circle at 55% 45%, transparent calc(var(--p) * 1%), #000 calc((var(--p) + 14) * 1%));
}
.it.charring { animation: charring 1.2s ease-in forwards; }
@keyframes charring {
  to { filter: brightness(.24) saturate(.35) sepia(.5); }
}
.it.curl { animation: charring 1.2s ease-in forwards, curl 3s ease-in-out infinite; }
@keyframes curl {
  0%, 100% { transform: rotate(0) skewX(0); }
  36% { transform: rotate(1.8deg) skewX(-2.4deg) scaleY(.985); }
  74% { transform: rotate(-1.5deg) skewX(2deg) scaleY(.97); }
}
.it.melt { animation: charring 1.4s ease-in forwards, melt 3.2s ease-in forwards; transform-origin: 50% 100%; }
@keyframes melt {
  40% { transform: scaleY(.92) skewX(-1deg); }
  100% { transform: scaleY(.62) skewX(-5deg) scaleX(1.07); }
}
.it.flashburn { animation: flashburn .85s ease-in forwards; }
@keyframes flashburn {
  0% { filter: brightness(1); opacity: 1; }
  22% { filter: brightness(2.6) saturate(1.4); }
  100% { filter: brightness(.2); opacity: 0; }
}
.it.metal-glow { animation: metalglow 2.6s ease-in forwards; }
@keyframes metalglow {
  0% { filter: none; }
  45% { filter: sepia(.9) saturate(4) hue-rotate(-28deg) brightness(1.5) drop-shadow(0 0 10px #ff7a2a); }
  100% { filter: sepia(1) saturate(5) hue-rotate(-32deg) brightness(1.7) drop-shadow(0 0 16px #ff8a3a); opacity: 0; }
}

/* =========================================================
   small screens & taste
   ========================================================= */

@media (max-width: 720px) {
  #fireplace { bottom: 25vh; height: 44vh; }
  #target-fire { bottom: 25vh; height: 30vh; }
  #hearth { height: 26vh; }
  #basket { bottom: 15vh; left: 1vw; }
  #box { bottom: 14vh; right: 1vw; }
  #rug { bottom: 3vh; }
  #item { zoom: .82; }
  #caption { bottom: 34vh; }
  #subcaption { bottom: 30.5vh; }
}

@media (prefers-reduced-motion: reduce) {
  #held.up #item .it, #held.tremble #item .it, .it-kittens .ears,
  #rug.live, .kittens-settled .cat, #glow::after, .candlestick i { animation: none; }
  #item, .box-lid { transition-duration: .01s; }
}
