/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: #2b1d12;
  color: #3a2a1c;
  font-family: Georgia, "Times New Roman", serif;
}

/* ============ Homepage scene ============ */
/* The picture's shape is 1671 x 941. The scene keeps that shape and is
   always big enough to cover the whole window, so the stickers and the
   chalkboard links stay lined up with the picture on every screen. */
:root { --ratio: calc(1671 / 941); }

body.home { overflow: hidden; height: 100vh; height: 100dvh; }

.scene {
  position: fixed;
  left: 50%;
  width: max(100vw, 100vh * var(--ratio));
  height: max(100vh, 100vw / var(--ratio));
  /* on very wide screens, trim a bit more from the top so the table stays in view */
  top: calc((100vh - max(100vh, 100vw / var(--ratio))) * 0.6);
  transform: translateX(-50%);
}
@supports (height: 100dvh) {
  .scene {
    width: max(100vw, 100dvh * var(--ratio));
    height: max(100dvh, 100vw / var(--ratio));
    top: calc((100dvh - max(100dvh, 100vw / var(--ratio))) * 0.6);
  }
}

.scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* ============ Through the window ============ */
/* This box covers the three windows (x 410-1490, y 0-580 of the 1671 x 941 photo).
   The mask only lets things show through the glass panes. */
.outside {
  position: absolute;
  left: 24.536%;
  top: 0;
  width: 64.632%;
  height: 61.636%;
  overflow: hidden;
  -webkit-mask-image: url(images/window-mask-v2.webp);   /* redrawn 22 Nov to fit the lamp, vase and plant exactly */
          mask-image: url(images/window-mask-v2.webp);
  -webkit-mask-size: 100% 100%;
          mask-size: 100% 100%;
  pointer-events: none;
}
html { --wx: saturate(1); }
.outside-sway {
  position: absolute;
  left: -37.963%;
  top: 0;
  width: 154.72%;
  height: 162.24%;
  max-width: none;
  filter: url(#sway) var(--wx);
  transition: filter 2s ease;
}
.outside-tint, .lightning {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 3s ease, background 3s ease;
}
.weather-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.lightning { background: #eef3ff; transition: opacity 0.08s ease; }

/* weather moods for the view outside */
.w-cloudy { --wx: saturate(0.85) brightness(0.95); }
.w-cloudy .outside-tint { opacity: 1; background: rgba(170, 180, 190, 0.25); }
.w-rain, .w-storm { --wx: saturate(0.6) brightness(0.8) contrast(0.95); }
.w-rain   .outside-tint { opacity: 1; background: rgba(110, 125, 140, 0.35); }
.w-storm  .outside-tint { opacity: 1; background: rgba(70, 80, 100, 0.5); }
.w-fog { --wx: saturate(0.6) contrast(0.75) brightness(1.05); }
.w-fog    .outside-tint { opacity: 1; background: linear-gradient(rgba(235,238,240,0.55), rgba(225,230,232,0.75)); }
.w-snow { --wx: saturate(0.35) brightness(1.08) contrast(0.85); }
.w-snow   .outside-tint { opacity: 1; background: linear-gradient(rgba(235,242,250,0.35), rgba(250,252,255,0.55) 70%); }

/* the room gets a little greyer when the weather's dull */
.room-dark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: rgba(60, 70, 90, 1);
  mix-blend-mode: multiply;
  transition: opacity 3s ease;
}
.w-cloudy .room-dark { opacity: 0.08; }
.w-rain .room-dark, .w-fog .room-dark, .w-snow .room-dark { opacity: 0.14; }
.w-storm .room-dark { opacity: 0.25; }

/* ============ Candle ============ */
/* The painted candle is covered by a "clean plate" of the wall behind it,
   and a separate strip of wax sits on the holder. JavaScript trims the wax
   from the top (--burn goes 0 to 1) and moves the flame down with it. */
.candlestick { position: absolute; inset: 0; pointer-events: none; }
.candle-plate {
  position: absolute;
  left: 72.172%; top: 52.497%; width: 1.915%; height: 6.908%;
}
.candle-wax {
  position: absolute;
  left: 72.531%; top: 54.942%; width: 1.197%; height: 4.251%;
  clip-path: inset(calc(var(--burn, 0) * 92%) 0 0 0);
}
.candle-wax img { display: block; width: 100%; height: 100%; }
.candle-wax::after {   /* the soft, melted rim at the top of the wax */
  content: "";
  position: absolute;
  left: 4%; right: 4%;
  top: calc(var(--burn, 0) * 92%);
  height: 7%;
  border-radius: 50%;
  background: rgba(255, 246, 225, 0.85);
}
/* once it's out, take the warm glow painted into the photo down a little */
.candle-shade {
  position: absolute;
  left: 66%; top: 44%; width: 14%; height: 22%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(150, 140, 150, 0.55), transparent);
  mix-blend-mode: multiply;
  opacity: 0;
  transition: opacity 4s ease;
}
.candle-out .candle-shade { opacity: 1; }

/* the flame box: 1% of the scene wide and the same height, so it scales with the picture */
.candle {
  position: absolute;
  left: 73.10%;
  top: var(--flame-top, 54.1%);
  width: 1%;
  height: 1.777%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.candle > span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.candle-flame {
  width: 40%; height: 100%;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(ellipse at 50% 72%, #fffef6 0 22%, #ffe9a8 40%, #ffb347 68%, rgba(255, 140, 40, 0) 100%);
  filter: blur(0.4px);
  transform-origin: 50% 90%;
  animation: flame 1.7s infinite ease-in-out;
  transition: opacity 0.6s ease;
}
.candle-wick {
  width: 8%; height: 30%;
  top: 92% !important;
  background: #2a1d14;
  border-radius: 1px;
}
.candle-glow, .candle-halo { border-radius: 50%; mix-blend-mode: screen; transition: opacity 1.5s ease; }
.candle-glow {
  width: 420%; height: 420%;
  background: radial-gradient(closest-side, rgba(255, 190, 100, 0.45), rgba(255, 150, 60, 0.12) 55%, transparent);
  animation: glow 3.3s infinite ease-in-out;
}
.candle-halo {
  width: 1500%; height: 1200%;
  background: radial-gradient(closest-side, rgba(255, 170, 80, 0.2), transparent);
  opacity: 0;
  animation: glow 4.1s infinite ease-in-out;
}
@keyframes flame {
  0%, 100% { transform: translate(-50%, -50%) scale(1, 1) skewX(0deg); opacity: 0.92; }
  20%      { transform: translate(-50%, -54%) scale(0.9, 1.1) skewX(-4deg); opacity: 1; }
  45%      { transform: translate(-50%, -48%) scale(1.05, 0.94) skewX(3deg); opacity: 0.82; }
  70%      { transform: translate(-50%, -52%) scale(0.95, 1.06) skewX(-2deg); opacity: 0.96; }
}
@keyframes glow {
  0%, 100% { opacity: 0.85; transform: translate(-50%, -50%) scale(1); }
  30%      { opacity: 1;    transform: translate(-50%, -50%) scale(1.05); }
  55%      { opacity: 0.7;  transform: translate(-50%, -50%) scale(0.97); }
  80%      { opacity: 0.95; transform: translate(-50%, -50%) scale(1.03); }
}
/* gone out: flame and glow off, one last curl of smoke */
.candle-out .candle-flame,
.candle-out .candle-glow,
.candle-out .candle-halo { opacity: 0 !important; animation: none; }
.candle-smoke { width: 100%; height: 100%; opacity: 0; }
.candle-smoke i {
  position: absolute;
  left: 30%; top: 70%;
  width: 40%; height: 40%;
  border-radius: 50%;
  background: rgba(200, 195, 190, 0.6);
  filter: blur(2px);
}
.candle-smoking .candle-smoke { opacity: 1; }
.candle-smoking .candle-smoke i { animation: smoke 5s ease-out forwards; }
.candle-smoking .candle-smoke i:nth-child(2) { animation-delay: 0.6s; }
.candle-smoking .candle-smoke i:nth-child(3) { animation-delay: 1.2s; }
@keyframes smoke {
  0%   { transform: translate(0, 0) scale(0.6); opacity: 0; }
  15%  { opacity: 0.8; }
  100% { transform: translate(60%, -900%) scale(3.5); opacity: 0; }
}

/* ============ Hanging lamp (night only) ============ */
.lamp-light { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 3s ease; }
.lamp-light span { position: absolute; mix-blend-mode: screen; }
.lamp-bulb {    /* the glow under the shade, bulb at about x 952, y 92 */
  left: 46%; top: 8.5%; width: 22%; height: 9%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,235,190,0.95), rgba(255,190,110,0.45) 45%, transparent);
}
.lamp-cone {    /* soft beam down to the table */
  left: 32%; top: 13%; width: 50%; height: 75%;
  background: radial-gradient(ellipse 45% 100% at 50% 0%, rgba(255,205,130,0.15), rgba(255,190,110,0.05) 60%, transparent 85%);
}
.lamp-pool {    /* the pool of light on the table */
  left: 22%; top: 66%; width: 70%; height: 36%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,190,105,0.42), rgba(255,170,90,0.12) 60%, transparent);
}

/* ============ Birds ============ */
.birds { position: absolute; inset: 0; }
.bird {
  position: absolute;
  width: 1.6%;
  aspect-ratio: 2 / 1;
  animation: fly linear forwards;
}
.bird svg { display: block; width: 100%; height: 100%; overflow: visible; animation: flap 0.45s ease-in-out infinite alternate; transform-origin: 50% 60%; }
.bird.rtl { animation-name: fly-rtl; }
.bird.rtl svg { transform: scaleX(-1); }
@keyframes flap { from { transform: scaleY(1); } to { transform: scaleY(-0.35); } }
.bird.rtl svg { animation-name: flap-rtl; }
@keyframes flap-rtl { from { transform: scaleX(-1) scaleY(1); } to { transform: scaleX(-1) scaleY(-0.35); } }
@keyframes fly     { from { transform: translate(0, 0); }   to { transform: translate(7000%, var(--drift, -60%)); } }
@keyframes fly-rtl { from { transform: translate(0, 0); }   to { transform: translate(-7000%, var(--drift, -60%)); } }

/* ============ Night ============ */
.is-night .room-dark { opacity: 1; background: radial-gradient(ellipse 65% 60% at 57% 72%, rgb(150, 120, 100), rgb(58, 50, 70) 80%); }
.is-night { --wx: brightness(0.22) saturate(0.4) hue-rotate(-15deg); }
.is-night .outside-tint { opacity: 1; background: linear-gradient(rgba(20, 30, 60, 0.55), rgba(10, 15, 30, 0.7)); }
.is-night .lamp-light { opacity: 1; }
.is-night .candle-halo { opacity: 1; }
.is-night .candle-out .candle-halo, .is-night.candle-out .candle-halo { opacity: 0; }
.is-night .candle-glow { width: 560%; height: 560%; }
/* stickers at night: the one under the lamp is brightest, until you hover
   another one, which then takes the light */
.sticker img { transition: filter 0.45s ease; }
.is-night .slot .sticker img { filter: brightness(0.68) sepia(0.18) saturate(0.9); }
.is-night .slot-centre .sticker img { filter: brightness(1) sepia(0.06); }
.is-night .scene:has(.slot:hover) .slot-centre .sticker img,
.is-night .scene:has(.slot:focus-within) .slot-centre .sticker img { filter: brightness(0.68) sepia(0.18) saturate(0.9); }
.is-night .scene .slot:hover .sticker img,
.is-night .scene .slot:focus-within .sticker img { filter: brightness(1.08) sepia(0.04); }
.is-night .chalk-link:hover, .is-night .chalk-link:focus-visible {
  background: radial-gradient(closest-side, rgba(255, 240, 210, 0.28), transparent);
}
/* at night the chalk itself glows a little, so the menu stays readable */
.chalkboard::before {
  content: "";
  position: absolute;
  left: 4.309%; top: 12.540%; width: 13.525%; height: 43.996%;
  background: url(images/chalk-all.png) center / 100% 100% no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 3s ease;
}
.is-night .chalkboard::before { opacity: 0.55; filter: drop-shadow(0 0 2px rgba(255, 225, 180, 0.5)); }


/* ============ Chalkboard links ============ */
.chalk-link {
  position: absolute;
  left: 5.8%;
  width: 11%;
  top: var(--top);
  height: var(--h);
  /* hide the text: the words are already painted on the board */
  color: transparent;
  font-size: 0;
  border-radius: 40%;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
/* each word's own chalk, brightened: a touch on hover by day, glowing at night */
.chalk-link::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--img) center / 100% 100% no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, filter 0.35s ease;
}
.chalk-link:hover::before, .chalk-link:focus-visible::before { opacity: 0.45; }
.is-night .chalk-link::before { opacity: 0.85; filter: drop-shadow(0 0 3px rgba(255, 220, 170, 0.65)); }
.is-night .chalk-link:hover::before,
.is-night .chalk-link:focus-visible::before { opacity: 1; filter: drop-shadow(0 0 7px rgba(255, 225, 180, 0.95)) brightness(1.15); }
.chalk-link::after {
  /* a chalky underline that draws in on hover */
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 4%;
  height: 2px;
  background: rgba(240, 235, 220, 0.85);
  border-radius: 2px;
  filter: blur(0.4px);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}
.chalk-link:hover,
.chalk-link:focus-visible {
  background: radial-gradient(closest-side, rgba(255, 250, 230, 0.16), transparent);
  outline: none;
}
.chalk-link:hover::after,
.chalk-link:focus-visible::after { transform: scaleX(1); }

/* ============ Stickers ============ */
/* each slot is anchored by the bottom-centre of its sticker, so stickers of
   different shapes all sit on the table */
.slot {
  position: absolute;
  left: var(--cx);
  top: var(--by);
  width: var(--w, 16%);
  transform: translate(-50%, -100%);
  z-index: 2;
}
.slot:hover, .slot:focus-within { z-index: 3; }
.sticker {
  position: relative;
  display: block;
  width: 100%;
  transform: rotate(var(--tilt, 0deg));
  transform-origin: 50% 60%;
  transition: transform 0.25s cubic-bezier(.3, 1.6, .5, 1), filter 0.25s ease;
  filter: drop-shadow(0 0.25vw 0.3vw rgba(40, 20, 5, 0.45));
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  z-index: 2;
}
.sticker img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

/* hover: the sticker lifts off the table a little */
.sticker:hover,
.sticker:focus-visible {
  transform: rotate(calc(var(--tilt, 0deg) * 0.4)) translateY(-4%) scale(1.06);
  filter: drop-shadow(0 1.2vw 1.2vw rgba(40, 20, 5, 0.45));
  outline: none;
  z-index: 3;
}

/* click: it pops forward before the recipe page opens */
.sticker.popping {
  transform: rotate(0deg) translateY(-8%) scale(1.25);
  filter: drop-shadow(0 2.2vw 2vw rgba(40, 20, 5, 0.5));
  transition: transform 0.35s cubic-bezier(.2, 1.4, .4, 1), filter 0.35s ease;
  z-index: 4;
}

/* the recipe name on a little cocktail-stick flag that plants itself on hover */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.flag {
  position: absolute;
  left: 52%;
  bottom: 62%;              /* the tip of the stick pokes into the top of the sticker */
  height: 7em;
  width: 0;
  font-size: clamp(12px, 1.05vw, 20px);
  transform-origin: 0 100%;
  transform: translateY(-60%) rotate(-14deg);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(.25, 1.7, .5, 1), opacity 0.15s ease;
}
/* the stick */
.flag::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0.2em;
  height: 100%;
  border-radius: 0.1em 0.1em 0.05em 0.05em;
  background: linear-gradient(90deg, #c9a46b, #f0d9a8 45%, #b88c50);
  box-shadow: 0.15em 0.1em 0.25em rgba(40, 20, 5, 0.35);
}
/* the little hole where it goes in */
.flag::after {
  content: "";
  position: absolute;
  left: -0.12em;
  bottom: -0.1em;
  width: 0.45em;
  height: 0.2em;
  border-radius: 50%;
  background: rgba(50, 25, 10, 0.45);
}
/* the cloth */
.flag-cloth {
  position: absolute;
  left: 0.18em;
  top: 0.15em;
  padding: 0.2em 1.5em 0.25em 0.6em;
  white-space: nowrap;
  font-family: "Caveat", "Segoe Print", cursive;
  font-weight: 600;
  font-size: 1.35em;
  line-height: 1.1;
  color: #fff8ec;
  background: #b5452b;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.06) 0 2px, transparent 2px 4px);
  clip-path: polygon(0 0, 100% 0, 88% 50%, 100% 100%, 0 100%);   /* swallowtail end */
  filter: drop-shadow(0.1em 0.15em 0.15em rgba(40, 20, 5, 0.3));
  transform-origin: 0 50%;
}

.sticker:hover .flag,
.sticker:focus-visible .flag,
.sticker.popping .flag {
  opacity: 1;
  transform: translateY(0) rotate(6deg);
}
.sticker:hover .flag-cloth,
.sticker:focus-visible .flag-cloth {
  animation: flutter 2.4s ease-in-out 0.45s infinite;
}
@keyframes flutter {
  0%, 100% { transform: skewY(0deg) scaleX(1); }
  50%      { transform: skewY(-2deg) scaleX(0.97); }
}

/* ============ Phones held upright ============ */
/* The whole kitchen won't fit a tall, narrow screen, so it fills the
   height and you swipe sideways to look around, starting at the chalkboard. */
.swipe-hint { display: none; }

@media (max-aspect-ratio: 1/1) {
  body.home { overflow-x: auto; overflow-y: hidden; }
  .scene {
    position: absolute;
    left: 0;
    top: 0;
    transform: none;
    height: 100vh;
    height: 100dvh;
    width: calc(100vh * var(--ratio));
    width: calc(100dvh * var(--ratio));
  }
  /* no hover on phones, so the flags are always planted */
  .flag { opacity: 1; transform: rotate(6deg); font-size: 11px; }
  .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;
    transition: opacity 0.4s ease;
    pointer-events: none;            /* just a prompt: taps go straight through */
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  }
  .swipe-hint.hidden { opacity: 0; pointer-events: none; }
}

@media (prefers-reduced-motion: reduce) {
  .candle span, .bird, .bird svg { animation: none !important; }
  .sticker, .sticker.popping, .chalk-link::after, .flag { transition: none; }
  .flag-cloth { animation: none !important; }
}

/* ============ Inner pages (placeholders for now) ============ */
body.page {
  min-height: 100vh;
  background: #f6efe2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.page-card {
  max-width: 640px;
  text-align: center;
}
.page-card h1 { font-weight: normal; font-size: 2.4rem; margin: 0 0 0.5rem; }
.page-card img { width: 220px; max-width: 60%; filter: drop-shadow(0 6px 8px rgba(40,20,5,.35)); }
.page-card a { color: #8a4b1c; }

/* ============ My Shop: coming soon card ============ */
.soon { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; }
.soon[hidden] { display: none; }
.soon-backdrop { position: absolute; inset: 0; background: rgba(30, 18, 8, 0.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.soon-card {
  position: relative;
  width: min(380px, 88vw);
  padding: 30px 30px 26px;
  background: #fbf5e6;
  color: #3b2618;
  text-align: center;
  font: 400 18px/1.45 "Kalam", "Segoe Print", cursive;
  border-radius: 4px;
  box-shadow: 0 18px 44px rgba(10, 5, 0, 0.5);
  transform: rotate(-1.5deg);
  animation: soon-in 0.45s cubic-bezier(.25, 1.4, .45, 1);
}
.soon-card::before {            /* washi tape */
  content: ""; position: absolute; top: -11px; left: 50%;
  width: 90px; height: 22px; margin-left: -45px;
  background: rgba(210, 160, 110, 0.65); transform: rotate(-3deg);
}
@keyframes soon-in { from { opacity: 0; transform: translateY(30px) rotate(4deg) scale(0.85); } to { opacity: 1; transform: rotate(-1.5deg); } }
.soon-kicker { margin: 0; font: 700 20px/1 "Caveat", cursive; color: #8a4b1c; letter-spacing: 1px; }
.soon-card h2 { margin: 2px 0 10px; font: 700 48px/1 "Caveat", cursive; color: #5a2a14; }
.soon-card p { margin: 0 0 14px; }
.soon-links { list-style: none; margin: 0; padding: 0; text-align: left; }
.soon-links li { border-bottom: 1px solid rgba(120, 150, 190, 0.35); }
.soon-links a { display: flex; justify-content: space-between; padding: 8px 2px; color: #3b2618; text-decoration: none; }
.soon-links a span { color: #8a4b1c; }
.soon-links a:hover span { text-decoration: underline wavy; text-underline-offset: 4px; }
.soon-close {
  position: absolute; top: 6px; right: 8px;
  border: 0; background: none; font: 26px/1 Georgia, serif; color: #8a6a4a; cursor: pointer;
}

/* ============ Loading: nothing shows until the whole page is ready ============ */
html:not(.page-ready) body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #2b1d12;
}
body::before { transition: opacity 0.6s ease; }
html.page-ready body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #2b1d12;
  opacity: 0;
  pointer-events: none;
  animation: loader-gone 0s linear 0.6s forwards;
}
@keyframes loader-gone { to { visibility: hidden; } }

/* ============ The idle nudge ============ */
@keyframes nudge {
  0%, 100% { transform: rotate(0) translateY(0); }
  15% { transform: rotate(-3deg) translateY(-3%); }
  30% { transform: rotate(2.5deg) translateY(-3%); }
  45% { transform: rotate(-2deg) translateY(-1.5%); }
  60% { transform: rotate(1.2deg) translateY(-0.5%); }
  75% { transform: rotate(-0.5deg); }
}
/* the whole sticker wiggles, so its flag moves with it (rotate/translate
   stack on top of the sticker's own tilt rather than replacing it) */
@keyframes nudge-whole {
  0%, 100% { rotate: 0deg; translate: 0 0; }
  15% { rotate: -3deg; translate: 0 -3%; }
  30% { rotate: 2.5deg; translate: 0 -3%; }
  45% { rotate: -2deg; translate: 0 -1.5%; }
  60% { rotate: 1.2deg; translate: 0 -0.5%; }
  75% { rotate: -0.5deg; translate: 0 0; }
}
.sticker.nudge { animation: nudge-whole 1.4s ease-in-out; }
.open-hint.nudge { animation: hint-nudge 1.4s ease-in-out; }
@keyframes hint-nudge {
  0%, 100% { transform: translate(-50%, 0) rotate(-1.5deg); }
  20% { transform: translate(-50%, -10px) rotate(-4deg); }
  40% { transform: translate(-50%, -10px) rotate(2deg); }
  60% { transform: translate(-50%, -4px) rotate(-3deg); }
  80% { transform: translate(-50%, 0) rotate(-1deg); }
}
/* things in the study: show the lifting copy while it wiggles */
.thing.nudge img { opacity: 1 !important; animation: nudge 1.4s ease-in-out; transform-origin: 50% 90%; }
.thing.magazine.nudge .cut { opacity: 1; animation: nudge 1.4s ease-in-out; }
.thing.phone.nudge ~ .handset { opacity: 1; animation: rattle 1.4s; }


/* ============ Christmas (1 to 25 December, or index.html?season=christmas) ============ */
html.xmas .outside {
  -webkit-mask-image: url(images/window-mask-christmas.png);
          mask-image: url(images/window-mask-christmas.png);
}
html.xmas .chalk-link:nth-child(1) { --img: url(images/chalk-home-christmas.png) !important; }
html.xmas .chalk-link:nth-child(2) { --img: url(images/chalk-recipes-christmas.png) !important; }
html.xmas .chalk-link:nth-child(3) { --img: url(images/chalk-about-christmas.png) !important; }
html.xmas .chalk-link:nth-child(4) { --img: url(images/chalk-shop-christmas.png) !important; }
html.xmas .chalk-link:nth-child(5) { --img: url(images/chalk-contact-christmas.png) !important; }
html.xmas .chalkboard::before { background-image: url(images/chalk-all-christmas.png); }
/* the Christmas candle is a little taller */
html.xmas .candle-plate { left: 72.292%; top: 50.159%; width: 1.676%; height: 8.820%; }
html.xmas .candle-wax   { left: 72.591%; top: 53.560%; width: 1.077%; height: 5.526%; }
html.xmas .candle       { left: 73.130%; }

/* fairy lights along the sill */
.fairy-layer { position: absolute; pointer-events: none; }
.fairy-glow { mix-blend-mode: screen; }

/* the little controller box on the right-hand end of the sill (desktop only) */
.fairy-dial {
  position: absolute;
  left: 92.4%; top: 63.4%;
  width: 2.1%; aspect-ratio: 1.45;
  padding: 0; border: 0;
  border-radius: 0.22vw 0.22vw 0.12vw 0.12vw;
  background: linear-gradient(170deg, #3d4036, #24261f 70%, #191a15);
  box-shadow: 0 0.18vw 0.3vw rgba(30, 15, 5, 0.55), inset 0 0.06vw 0 rgba(255, 255, 255, 0.12);
  cursor: pointer;
  z-index: 3;
  -webkit-tap-highlight-color: transparent;
}
.fairy-knob {
  position: absolute; left: 50%; top: 50%;
  width: 52%; aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #e9cf96, #a77d3e 70%);
  box-shadow: 0 0.05vw 0.12vw rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%) rotate(var(--turn, -120deg));
  transition: transform 0.35s cubic-bezier(.3, 1.6, .5, 1);
}
.fairy-knob::after {   /* the pointer line on the dial */
  content: ""; position: absolute; left: 44%; top: 8%; width: 12%; height: 36%;
  border-radius: 1px; background: #3a2a14;
}
.fairy-led {
  position: absolute; right: 9%; top: 14%;
  width: 11%; aspect-ratio: 1; border-radius: 50%;
  background: #ffcf7a; box-shadow: 0 0 0.4vw #ffb347;
}
.fairy-tag {
  position: absolute; left: 50%; bottom: 135%;
  transform: translateX(-50%) rotate(-2deg);
  white-space: nowrap;
  padding: 0.25em 0.7em 0.3em;
  font-family: "Caveat", "Segoe Print", cursive;
  font-weight: 600;
  font-size: clamp(14px, 1.1vw, 20px);
  color: #3b2a1a;
  background: #fbf5e6;
  border-radius: 3px;
  box-shadow: 0 0.2em 0.5em rgba(40, 20, 5, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.fairy-dial:hover .fairy-tag, .fairy-dial:focus-visible .fairy-tag, .fairy-dial.show-tag .fairy-tag { opacity: 1; }
.fairy-dial:focus-visible { outline: 2px dashed rgba(255, 240, 210, 0.9); outline-offset: 3px; }

/* shine on the baubles once it's getting dark */
.bauble-glint {
  position: absolute;
  width: calc(1.1% * var(--s, 1)); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 245, 220, 0.95), rgba(255, 210, 140, 0.35) 45%, transparent);
  mix-blend-mode: screen;
  pointer-events: none;
  opacity: calc(var(--dusk, 0) * 0.8);
  animation: glint 4.2s ease-in-out infinite;
}
.is-night .bauble-glint { opacity: 0.9; }
@keyframes glint {
  0%, 100% { scale: 1; filter: brightness(1); }
  50%      { scale: 0.8; filter: brightness(0.75); }
}
@media (prefers-reduced-motion: reduce) { .bauble-glint { animation: none; } }

/* Only the treetops sway. A still copy of the view sits underneath, and the
   swaying copy fades out above the fence and stops just short of the window
   frames, so the field, fence and frames stay perfectly still. */
.outside-sway.still { filter: var(--wx); }
body.home .outside-sway:not(.still) {
  -webkit-mask-image: url(images/window-mask-inset.png), linear-gradient(#000 34%, transparent 44%);
          mask-image: url(images/window-mask-inset.png), linear-gradient(#000 34%, transparent 44%);
  -webkit-mask-size: 64.632% 61.636%, 100% 100%; mask-size: 64.632% 61.636%, 100% 100%;
  -webkit-mask-position: 69.37% 0, 0 0; mask-position: 69.37% 0, 0 0;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
html.xmas body.home .outside-sway:not(.still) {
  -webkit-mask-image: url(images/window-mask-christmas-inset.png), linear-gradient(#000 34%, transparent 44%);
          mask-image: url(images/window-mask-christmas-inset.png), linear-gradient(#000 34%, transparent 44%);
}

/* A burned-down candle can be swapped for a fresh one (click), then lit (click again) */
.candle-unlit .candle-flame,
.candle-unlit .candle-glow,
.candle-unlit .candle-halo { opacity: 0 !important; animation: none; }
.candle-hit {
  position: absolute; z-index: 6;
  padding: 0; border: 0; background: none;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.candle-hit[hidden] { display: none; }
.candle-hit:focus-visible { outline: 2px dashed rgba(255, 240, 210, 0.8); outline-offset: 2px; border-radius: 6px; }
/* with the candle out or unlit, the warm glow painted on the window post goes too */
.candle-unlit-wall {
  position: absolute;
  left: 71.215%; top: 31.881%; width: 3.770%; height: 33.156%;
  opacity: 0;
  transition: opacity 3s ease;
}
.candle-out .candle-unlit-wall, .candle-unlit .candle-unlit-wall { opacity: 1; }
.candlestick:has(.candle-unlit-wall) .candle-shade { display: none; }

/* ============ The menu in Verity's handwriting ============ */
/* board-clean covers the printed words with clean board; chalk-words is her writing (both cover the same box) */
.board-clean, .chalk-words {
  position: absolute;
  left: 6.104%; top: 19.554%; width: 10.054%; height: 31.243%;
  pointer-events: none;
}
html:not(.xmas) .chalk-link::before { display: none; }
html:not(.xmas) .chalkboard::before {
  left: 6.104%; top: 19.554%; width: 10.054%; height: 31.243%;
  background-image: url(images/chalk-words.svg);
}
html:not(.xmas) .is-night .chalkboard::before { opacity: 0.8; }

/* ============ My Shop: a polaroid ============ */
.soon-card.polaroid {
  width: min(330px, 82vw);
  padding: 14px 14px 0;
  background: #fbf8f1;
  border-radius: 2px;
  box-shadow: 0 18px 44px rgba(10, 5, 0, 0.55), inset 0 0 0 1px rgba(120, 90, 60, 0.08);
}
.polaroid-photo { display: block; width: 100%; height: auto; aspect-ratio: 720 / 860; background: #6b3a2c; }
.polaroid-caption { padding: 10px 4px 16px; }
.polaroid-caption h2 { margin: 0 0 6px; font: 700 36px/1 "Caveat", cursive; color: #5a2a14; }
.polaroid-handles { margin: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 2px 16px; font: 700 20px/1.2 "Caveat", cursive; }
.polaroid-handles a { color: #8a4b1c; text-decoration: none; }
.polaroid-handles a:hover, .polaroid-handles a:focus-visible { text-decoration: underline wavy; text-underline-offset: 4px; }
.polaroid .soon-close { top: 18px; right: 20px; width: 30px; height: 30px; border-radius: 50%; background: rgba(251, 248, 241, 0.85); line-height: 30px; }

/* the handwriting on the Christmas board too */
.board-clean-xmas { top: 19.129%; height: 31.881%; }
html.xmas .chalk-link::before { display: none; }
html.xmas .chalkboard::before {
  left: 6.104%; top: 19.554%; width: 10.054%; height: 31.243%;
  background-image: url(images/chalk-words.svg);
}
html.xmas .is-night .chalkboard::before { opacity: 0.8; }

/* a hand-drawn chalk underline that draws in on hover */
.chalk-link::after {
  left: 12%; right: 12%; bottom: 13%;
  height: 16%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14' preserveAspectRatio='none'%3E%3Cfilter id='c'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='1' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.4 1.25'/%3E%3CfeComposite in='SourceGraphic' operator='in'/%3E%3C/filter%3E%3Cg fill='none' stroke='%23f4efe3' stroke-linecap='round' filter='url%28%23c%29'%3E%3Cpath d='M4 8.5C30 6.2 52 9.6 80 7.6S140 5.4 168 7.9C181 9 190 7.4 196 6.4' stroke-width='3.2'/%3E%3Cpath d='M14 9.8C48 8.6 90 9.2 132 8.1S178 7.6 190 8.6' stroke-width='1.4' opacity='.6'/%3E%3C/g%3E%3C/svg%3E") center / 100% 100% no-repeat;
  border-radius: 0;
  filter: none;
  transform: none;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.45s cubic-bezier(.3, .7, .4, 1);
}
.chalk-link:nth-child(even)::after { rotate: 0.9deg; left: 16%; right: 9%; }
.chalk-link:nth-child(odd)::after { rotate: -1.1deg; }
.chalk-link:hover::after, .chalk-link:focus-visible::after { transform: none; clip-path: inset(0 0 0 0); }

/* ============ Dusk in the kitchen (from 4pm, deepening to night at 9pm) ============ */
/* --dusk goes from 0 to 1, set by script.js; the window's view darkens through --wx */
body.home.is-dusk .room-dark {
  opacity: calc(var(--dusk, 0) * 0.92);
  background: radial-gradient(ellipse 65% 60% at 57% 72%, rgb(150, 120, 100), rgb(58, 50, 70) 80%);
}
body.home.is-dusk .outside-tint {
  opacity: var(--dusk, 0);
  background: linear-gradient(rgba(20, 30, 60, 0.55), rgba(10, 15, 30, 0.7));
}
body.home.is-dusk .lamp-light { opacity: var(--dusk, 0); }
body.home.is-dusk .candle-halo { opacity: var(--dusk, 0); }
