/* =========================================================
   ABOUT & CONTACT: Verity's desk
   Built on the dining room's styles (style.css). Positions are
   percentages of the 1670 x 941 photo.
   ========================================================= */
body.room { overflow: hidden; height: 100vh; height: 100dvh; background: #2b1d12; }

/* ---------- the window ---------- */
body.room .outside {
  left: 47.904%; top: 0; width: 38.922%; height: 62.699%;
  -webkit-mask-image: url(images/room/window-mask.png);
          mask-image: url(images/room/window-mask.png);
}
body.room .outside-sway { left: -123.077%; top: 0; width: 256.923%; height: 159.492%; }

/* ---------- the candle (further back than the dining room's, so smaller) ---------- */
body.room .candle-plate { left: 73.174%; top: 62.274%; width: 1.796%; height: 6.908%; }
body.room .candle-wax   { left: 73.413%; top: 63.762%; width: 1.317%; height: 5.207%; }
body.room .candle { left: 74.072%; width: 0.8%; height: 1.42%; top: var(--flame-top, 62.8%); }
body.room .candle-shade { left: 69%; top: 56%; width: 10%; height: 18%; }

/* ---------- the desk lamp ---------- */
/* The photo already has the lamp on softly. As evening comes (--dusk 0 to 1)
   the room darkens and the lamp's light grows; at night it's the main light. */
body.room .room-dark {
  opacity: calc(var(--dusk, 0) * 0.55);
  background: radial-gradient(ellipse 55% 60% at 36% 62%, rgb(150, 115, 90), rgb(55, 45, 62) 78%);
  mix-blend-mode: multiply;
}
body.room.is-night .room-dark { opacity: 0.92; }
body.room .lamp-light { opacity: calc(0.12 + var(--dusk, 0) * 0.88); }
body.room.is-night .lamp-light { opacity: 1; }
body.room .lamp-bulb  { left: 30.5%; top: 34.5%; width: 13%; height: 11%; }
body.room .lamp-cone  { left: 22%; top: 40%; width: 36%; height: 50%; }
body.room .lamp-pool  { left: 18%; top: 66%; width: 52%; height: 30%; }
body.room .lamp-board {             /* spill onto the pinboard and the wall */
  left: 6%; top: 18%; width: 34%; height: 45%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 196, 120, 0.3), transparent);
  mix-blend-mode: screen;
}
/* outside darkens through the evening too */
body.room .outside-tint { opacity: calc(var(--dusk, 0) * 0.8); background: linear-gradient(rgba(30, 40, 75, 0.55), rgba(15, 20, 40, 0.65)); }
body.room.is-dusk .outside-sway { filter: url(#sway) brightness(calc(1 - var(--dusk, 0) * 0.6)) saturate(calc(1 - var(--dusk, 0) * 0.4)); }

/* ---------- steam from the tea ---------- */
.steam {
  position: absolute;
  left: 80.72%; top: 66.42%; width: 3.6%; height: 11.2%;
  pointer-events: none;
}
.steam i {
  position: absolute;
  bottom: 0;
  left: 40%;
  width: 22%;
  height: 70%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 70%, rgba(255, 248, 235, 0.32), rgba(255, 248, 235, 0) 70%);
  filter: blur(3px);
  opacity: 0;
  animation: steam 6.5s ease-in-out infinite;
}
.steam i:nth-child(2) { left: 22%; animation-delay: 2.2s; animation-duration: 7.2s; }
.steam i:nth-child(3) { left: 58%; animation-delay: 4.3s; animation-duration: 6.8s; }
@keyframes steam {
  0%   { transform: translate(0, 10%) scale(0.5, 0.6) skewX(0deg); opacity: 0; }
  20%  { opacity: 0.9; }
  55%  { transform: translate(-25%, -45%) scale(0.9, 1) skewX(-10deg); opacity: 0.6; }
  100% { transform: translate(20%, -110%) scale(1.3, 1.2) skewX(8deg); opacity: 0; }
}
body.room.is-night .steam i { background: radial-gradient(ellipse at 50% 70%, rgba(255, 225, 185, 0.28), transparent 70%); }

/* ---------- things to discover ---------- */
.thing {
  position: absolute;
  left: var(--l); top: var(--t); width: var(--w); height: var(--h);
  padding: 0; margin: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 3;
  -webkit-tap-highlight-color: transparent;
}
.thing img { display: block; width: 100%; height: 100%; pointer-events: none; }
.thing:focus-visible { outline: 2px dashed rgba(255, 240, 210, 0.8); outline-offset: 3px; }

/* books: a tiny bounce, up and down, while you're over them */
.book img { transform-origin: 50% 100%; }
.book:hover img, .book:focus-visible img { animation: book-bob 1.1s ease-in-out infinite; }
@keyframes book-bob {
  0%, 100% { transform: translateY(0); }
  45%      { transform: translateY(-2.2%); }
  60%      { transform: translateY(-1.6%); }
}

/* Dennis: the frame lifts a little */
.dennis img { transition: transform 0.3s cubic-bezier(.3, 1.5, .5, 1), filter 0.3s ease; transform-origin: 50% 100%; }
.dennis:hover img, .dennis:focus-visible img { transform: scale(1.035) rotate(-0.6deg); filter: drop-shadow(0 0.5vw 0.6vw rgba(40, 20, 5, 0.4)); }

/* the archway photo: lifts off the board */
.archway img { transition: transform 0.25s ease, filter 0.25s ease; }
.archway:hover img, .archway:focus-visible img { transform: translateY(-3%) rotate(-2deg) scale(1.05); filter: drop-shadow(0 0.4vw 0.5vw rgba(40, 20, 5, 0.45)); }

/* invisible hotspots: a soft glow so people know they can click */
.hotspot { border-radius: 8px; transition: background 0.3s ease, box-shadow 0.3s ease; }
.hotspot:hover, .hotspot:focus-visible { background: rgba(255, 240, 210, 0.08); box-shadow: 0 0 0.8vw rgba(255, 230, 190, 0.35); }
.magazine { clip-path: polygon(30% 0, 100% 6.2%, 89.7% 100%, 0 88.8%); border-radius: 0; }
.phone { border-radius: 30% 30% 12% 12%; }

/* ---------- the telephone ---------- */
.handset {
  position: absolute;
  left: 5.988%; top: 63.549%; width: 16.766%; height: 11.052%;
  pointer-events: none;
  z-index: 3;
  transform-origin: 50% 90%;
  opacity: 0;
}
.ring-lines {
  position: absolute;
  left: 21%; top: 61%; width: 4%; height: 7%;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
}
.ring-lines i {
  position: absolute;
  inset: 0;
  border: 0.22vw solid rgba(255, 236, 200, 0.9);
  border-color: transparent rgba(255, 236, 200, 0.9) transparent transparent;
  border-radius: 50%;
  animation: ring-wave 1.1s ease-out infinite;
}
.ring-lines i:nth-child(2) { animation-delay: 0.35s; }
@keyframes ring-wave {
  0%   { transform: scale(0.4); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}
/* ringing: only when someone arrives through Contact, until they answer */
.ringing .handset { opacity: 1; animation: rattle 1.6s infinite; }
.ringing .ring-lines { opacity: 1; animation: ring-pause 1.6s infinite; }
@keyframes rattle {
  0%, 52%, 100% { transform: translate(0, 0) rotate(0); }
  4%  { transform: translate(-0.4%, -6%) rotate(-1.4deg); }
  8%  { transform: translate(0.4%, -2%) rotate(1.2deg); }
  12% { transform: translate(-0.3%, -6%) rotate(-1.2deg); }
  16% { transform: translate(0.3%, -2%) rotate(1deg); }
  20% { transform: translate(-0.3%, -5%) rotate(-1deg); }
  24% { transform: translate(0.2%, -1%) rotate(0.8deg); }
  28% { transform: translate(0, -4%) rotate(-0.6deg); }
  34% { transform: translate(0, 0) rotate(0); }
}
@keyframes ring-pause { 0%, 40% { opacity: 1; } 55%, 100% { opacity: 0; } }
/* the spotlight: the rest of the room dims a little while it rings */
.spotlight {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse 22% 30% at 15% 76%, transparent 40%, rgba(25, 14, 6, 0.5) 100%);
  opacity: 0;
  transition: opacity 1.2s ease;
}
.ringing .spotlight { opacity: 1; }

/* ---------- hover tags and click notes ----------
   Same look as the "Coming soon" card on the homepage: cream paper,
   a strip of washi tape, a slight tilt, Caveat and Kalam handwriting. */
.tip, .note-card {
  position: fixed;
  z-index: 25;
  background: #fbf5e6;
  color: #3b2618;
  border-radius: 4px;
  box-shadow: 0 12px 30px rgba(10, 5, 0, 0.4);
}
.tip::before, .note-card::before {
  content: "";
  position: absolute;
  top: -9px; left: 50%;
  width: 54px; height: 16px;
  margin-left: -27px;
  background: rgba(210, 160, 110, 0.65);
  transform: rotate(-3deg);
}
.tip {
  left: 0; top: 0;
  padding: 0.5em 1em 0.45em;
  font: 700 clamp(18px, 1.6vw, 26px)/1.1 "Caveat", "Segoe Print", cursive;
  color: #5a2a14;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -100%) translateY(6px) rotate(-1.5deg);
  transition: opacity 0.2s ease, transform 0.3s cubic-bezier(.25, 1.4, .45, 1);
}
.tip.show { opacity: 1; transform: translate(-50%, -100%) translateY(-12px) rotate(-1.5deg); }
.note-card {
  max-width: min(320px, 82vw);
  padding: 22px 34px 18px 22px;
  font: 400 clamp(17px, 1.35vw, 20px)/1.45 "Kalam", "Segoe Print", cursive;
  transform: translate(-50%, -105%) rotate(-1.5deg);
  animation: note-in 0.45s cubic-bezier(.25, 1.4, .45, 1);
}
.note-card::before { width: 80px; height: 20px; margin-left: -40px; top: -11px; }
.note-card[hidden] { display: none; }
.note-card p { margin: 0; }
.note-link { display: inline-block; margin-top: 0.5em; color: #8a4b1c; }
.note-link:hover { text-decoration: underline wavy; text-underline-offset: 4px; }
.note-close {
  position: absolute;
  top: 6px; right: 8px;
  border: 0; background: none;
  font: 26px/1 Georgia, serif;
  color: #8a6a4a;
  cursor: pointer;
}
@keyframes note-in {
  from { opacity: 0; transform: translate(-50%, -90%) rotate(4deg) scale(0.85); }
  to   { opacity: 1; transform: translate(-50%, -105%) rotate(-1.5deg) scale(1); }
}

/* ---------- the address book ---------- */
.addressbook { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; }
.addressbook[hidden] { display: none; }
.ab-backdrop { position: absolute; inset: 0; background: rgba(30, 18, 8, 0.55); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.ab-book {
  position: relative;
  display: flex;
  width: min(860px, 94vw);
  min-height: min(520px, 86vh);
  padding: 14px;
  background: #6e2f22;            /* red leather, to go with the phone */
  background-image: radial-gradient(ellipse at 30% 20%, rgba(255, 210, 170, 0.15), transparent 60%);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(10, 5, 0, 0.55);
  animation: ab-in 0.55s cubic-bezier(.25, 1.25, .45, 1);
}
@keyframes ab-in {
  from { opacity: 0; transform: translateY(40px) scale(0.85) rotate(-3deg); }
  to   { opacity: 1; transform: none; }
}
.ab-page {
  flex: 1;
  position: relative;
  padding: 34px 34px 28px;
  background: #fbf5e6;
  color: #3b2618;
  font-family: "Kalam", "Segoe Print", cursive;
}
.ab-left { border-radius: 6px 0 0 6px; box-shadow: inset -14px 0 18px -14px rgba(80, 45, 20, 0.45); padding-left: 56px; }
.ab-right { border-radius: 0 6px 6px 0; box-shadow: inset 14px 0 18px -14px rgba(80, 45, 20, 0.45); }
.ab-tabs { position: absolute; left: 10px; top: 30px; display: flex; flex-direction: column; gap: 6px; }
.ab-tabs span {
  display: block;
  width: 26px; height: 30px;
  background: #e7d6b4;
  border-radius: 4px 0 0 4px;
  font: 700 15px/30px "Caveat", cursive;
  text-align: center;
  color: #6e2f22;
}
.ab-tabs span:nth-child(5) { background: #f3e6c9; }
.ab-title { font: 700 clamp(38px, 5vw, 56px)/1 "Caveat", cursive; color: #5a2a14; margin: 6px 0 4px; }
.ab-sub { margin: 0 0 26px; font-size: 17px; opacity: 0.75; }
.ab-links { list-style: none; margin: 0; padding: 0; }
.ab-links li { border-bottom: 1px solid rgba(120, 150, 190, 0.35); }
.ab-links a { display: flex; justify-content: space-between; gap: 10px; padding: 10px 2px; color: #3b2618; text-decoration: none; font-size: 18px; }
.ab-links a span { color: #8a4b1c; }
.ab-links a:hover span { text-decoration: underline wavy; text-underline-offset: 4px; }
.ab-form h3 { font: 700 34px/1 "Caveat", cursive; color: #8a4b1c; margin: 0 0 14px; }
.ab-form label { display: block; margin-bottom: 12px; font-size: 16px; }
.ab-form input, .ab-form textarea {
  display: block;
  width: 100%;
  margin-top: 3px;
  padding: 6px 2px;
  border: 0;
  border-bottom: 1.5px solid rgba(90, 60, 30, 0.35);
  background: transparent;
  font: 400 18px/1.4 "Kalam", "Segoe Print", cursive;
  color: #2c1a0e;
  resize: vertical;
}
.ab-form input:focus, .ab-form textarea:focus { outline: none; border-bottom-color: #8a4b1c; }
.ab-send {
  margin-top: 6px;
  padding: 8px 26px;
  border: 0;
  border-radius: 999px;
  background: #8a2e22;
  color: #fbeee0;
  font: 700 22px/1 "Caveat", cursive;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}
.ab-send:hover { background: #a3372a; }
.ab-status { min-height: 1.4em; margin: 10px 0 0; font-size: 16px; }
.ab-close {
  position: absolute;
  top: -16px; right: -16px;
  width: 42px; height: 42px;
  border: 0; border-radius: 50%;
  background: #fbf6ea;
  color: #4a3320;
  font: 26px/1 Georgia, serif;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
@media (max-width: 640px) {
  .ab-book { flex-direction: column; max-height: 90vh; overflow-y: auto; }
  .ab-left { border-radius: 6px 6px 0 0; padding: 24px 24px 16px 52px; }
  .ab-right { border-radius: 0 0 6px 6px; padding: 20px 24px; }
}

/* ---------- home button (same as the recipe book's) ---------- */
.home-btn {
  position: fixed; left: 16px; top: 16px; z-index: 30;
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(251, 246, 234, 0.94); color: #4a3320;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}
.home-btn svg { width: 22px; height: 22px; }
.home-btn:hover { transform: translateY(-2px); }

/* ---------- phones held upright: swipe across the room ---------- */
@media (max-aspect-ratio: 1/1) {
  body.room { overflow-x: auto; overflow-y: hidden; }
  body.room .scene {
    position: absolute; left: 0; top: 0; transform: none;
    height: 100vh; height: 100dvh;
    width: calc(100vh * var(--ratio)); width: calc(100dvh * var(--ratio));
  }
  body.room .swipe-hint {
    display: block; position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
    margin: 0; padding: 0.5em 1em; background: rgba(30, 20, 12, 0.7); color: #fbf6ea;
    font-size: 14px; border-radius: 999px; white-space: nowrap; z-index: 10;
  }
}

@media (prefers-reduced-motion: reduce) {
  .steam i, .book:hover img, .ringing .handset, .ring-lines i { animation: none !important; }
  .steam i { opacity: 0.4; }
}

/* The lifting pictures are copies of the photo: keep them hidden until hovered,
   and dim them with the room at dusk and night so they never glow */
.thing img { opacity: 0; transition: opacity 0.15s ease, transform 0.3s cubic-bezier(.3, 1.5, .5, 1), filter 0.3s ease; }
.thing:hover img, .thing:focus-visible img { opacity: 1; }
/* the Dracula spine in the photo is smudged, so its clean copy always shows */
.thing.book img[src*="book-dracula"] { opacity: 1; }
body.room.is-dusk .thing img, body.room.is-dusk .handset { filter: brightness(calc(1 - var(--dusk, 0) * 0.5)); }
body.room.is-night .thing img, body.room.is-night .handset { filter: brightness(0.42) sepia(0.2); }
body.room.is-night .dennis:hover img { filter: brightness(0.5) sepia(0.2) drop-shadow(0 0.5vw 0.6vw rgba(0, 0, 0, 0.5)); }
body.room.is-night .room-dark { opacity: 0.86; }

/* notes never block the things underneath: click another thing and its note replaces this one */
.note-card { pointer-events: none; }
.note-card .note-close, .note-card .note-link { pointer-events: auto; }

/* the link line only takes up room when there's a link (the magazine) */
.note-link[hidden] { display: none; }
.note-card { padding: 20px 36px 20px 22px; }

/* ---------- crisp cut-outs: each lifting picture is trimmed to its object's outline ---------- */
.book:nth-of-type(1) img, .thing.book[aria-label^="Dracula"] img { clip-path: polygon(3% 1.8%, 97% 1.8%, 97% 97.8%, 3% 97.8%); }
.thing.book[aria-label^="This Is Vegan"] img { clip-path: polygon(12.5% 1.6%, 98.4% 1.6%, 98.4% 99%, 12.5% 99%); }
.thing.book[aria-label^="The Invisible"] img { clip-path: polygon(3.1% 1.6%, 100% 1.6%, 100% 97.2%, 3.1% 97.2%); }
.dennis img { clip-path: polygon(1.7% 2.4%, 79.7% 1.2%, 98.5% 91.5%, 15.8% 97.6%); }
.archway img { clip-path: polygon(2.8% 2.8%, 95.7% 9.7%, 96.9% 94.2%, 2.8% 97.2%); }
/* shadows follow the cut shape */
.dennis:hover img, .dennis:focus-visible img { filter: none; }
.dennis:hover, .archway:hover { filter: drop-shadow(0 0.5vw 0.6vw rgba(40, 20, 5, 0.4)); }

/* the room's lighting sits above the pictures, so lifted pictures dim exactly like the rest of the room */
body.room .room-dark, body.room .lamp-light, body.room .spotlight { z-index: 4; pointer-events: none; }
body.room .candle, body.room .steam { z-index: 5; }
body.room.is-dusk .thing img, body.room.is-dusk .handset,
body.room.is-night .thing img, body.room.is-night .handset,
body.room.is-night .dennis:hover img { filter: none; }

/* ring lines on the open side, by the earpiece, and bright enough to see at night */
.ring-lines { left: 3.4%; top: 64.5%; z-index: 5; }
.ring-lines i { border-color: transparent transparent transparent rgba(255, 236, 200, 0.95); }

/* ---------- the magazine lifts off the desk like the other things ---------- */
.thing.magazine { clip-path: none; border-radius: 0; background: none; box-shadow: none; }
.thing.magazine:hover, .thing.magazine:focus-visible { background: none; box-shadow: none; filter: drop-shadow(0 0.5vw 0.6vw rgba(40, 20, 5, 0.4)); }
.magazine .cut {
  position: absolute; inset: 0; overflow: hidden; display: block;
  clip-path: polygon(29.47% 1%, 99.47% 6.53%, 90.53% 97.99%, 0.53% 88.94%);
  opacity: 0;
  transform-origin: 50% 60%;
  transition: opacity 0.15s ease, transform 0.3s cubic-bezier(.3, 1.5, .5, 1);
}
.magazine .cut img {
  position: absolute; opacity: 1; max-width: none;
  left: -190.53%; top: -372.86%; width: 439.47%; height: 472.86%;
}
.magazine:hover .cut, .magazine:focus-visible .cut { opacity: 1; transform: translateY(-3%) rotate(-1deg) scale(1.03); }

/* ---------- the lamp switched off: just the candle's glow ---------- */
.lamp { border-radius: 50% 50% 20% 20%; }
body.room.lamp-off .lamp-light { opacity: 0 !important; }
body.room.lamp-off .room-dark {
  opacity: 0.9 !important;
  background: radial-gradient(ellipse 30% 34% at 74% 63%, rgb(150, 110, 80), rgb(34, 28, 40) 70%) !important;
}
body.room.lamp-off .candle-halo { opacity: 1; width: 2600%; height: 2000%; }
body.room.lamp-off .candle-glow { width: 600%; height: 600%; }
/* covers the lit bulb in the photo */
.bulb-off {
  position: absolute;
  left: 31.4%; top: 36.6%; width: 11%; height: 6%;
  border-radius: 50%;
  background: radial-gradient(ellipse 50% 50% at 50% 55%, rgba(38, 27, 20, 0.92), rgba(38, 27, 20, 0.7) 55%, transparent);
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
body.room.lamp-off .bulb-off { opacity: 1; }
body.room .room-dark { transition: opacity 0.8s ease, background 0.8s ease; }

/* ---------- the new anglepoise lamp ---------- */
body.room .lamp-bulb { left: 31.7%; top: 36%; width: 13%; height: 9%; }
.bulb-off { left: 32.7%; top: 38.6%; width: 11%; height: 6%; }
.thing.lamp { left: 32.8%; top: 27%; width: 11.2%; height: 16.7%; }
.thing.lamp-switch { left: 33.5%; top: 71%; width: 2.2%; height: 4%; border-radius: 50%; }
/* in daylight the lamp just switches off; the room stays bright */
body.room.lamp-off:not(.lamp-dark) .room-dark { opacity: calc(var(--dusk, 0) * 0.55) !important; background: radial-gradient(ellipse 55% 60% at 36% 62%, rgb(150, 115, 90), rgb(55, 45, 62) 78%) !important; }
body.room.lamp-off:not(.lamp-dark) .candle-halo { opacity: 0; }

/* the whole phone rattles when it rings (cut out by room.js) */
.handset { left: 6.707%; top: 64.506%; width: 19.461%; height: 23.592%; transform-origin: 50% 100%; }
.ringing .handset { animation: phone-rattle 1.6s infinite; }
@keyframes phone-rattle {
  0%, 52%, 100% { transform: translate(0, 0) rotate(0); }
  4%  { transform: translate(-0.5%, -1.6%) rotate(-0.7deg); }
  8%  { transform: translate(0.5%, -0.4%) rotate(0.6deg); }
  12% { transform: translate(-0.4%, -1.5%) rotate(-0.6deg); }
  16% { transform: translate(0.4%, -0.4%) rotate(0.5deg); }
  20% { transform: translate(-0.3%, -1.2%) rotate(-0.5deg); }
  24% { transform: translate(0.3%, -0.2%) rotate(0.4deg); }
  28% { transform: translate(0, -0.8%) rotate(-0.3deg); }
  34% { transform: translate(0, 0) rotate(0); }
}

/* hovering the mug: the steam rises quicker and fuller, and the mug lifts a touch */
body.room:has(.mug:hover) .steam i, body.room:has(.mug:focus-visible) .steam i { animation-duration: 3.4s; }
body.room:has(.mug:hover) .steam, body.room:has(.mug:focus-visible) .steam { transform: scale(1.35); transform-origin: 50% 100%; transition: transform 0.6s ease; }
.steam { transition: transform 0.6s ease; }
