/* Interactive shelf */
.shelf {
  border: 0;
  padding: 0;
  cursor: pointer;
  overflow: visible;
}


.shelf .book {
  transition:
    transform 420ms cubic-bezier(.2,.8,.2,1),
    height 420ms ease,
    left 420ms ease,
    background 420ms ease;
}

.shelf.shelf-shift-1 .b1 {
  left: 20px;
  height: 54px;
  transform: rotate(-7deg);
  background: #7f948c;
}
.shelf.shelf-shift-1 .b2 {
  left: 47px;
  height: 66px;
  transform: rotate(4deg);
  background: #d1a36d;
}
.shelf.shelf-shift-1 .b3 {
  left: 78px;
  height: 44px;
  transform: rotate(-3deg);
  background: #a87268;
}

.shelf.shelf-shift-2 .b1 {
  left: 38px;
  height: 48px;
  transform: rotate(5deg);
  background: #b68a72;
}
.shelf.shelf-shift-2 .b2 {
  left: 64px;
  height: 58px;
  transform: rotate(-7deg);
  background: #7e8f9e;
}
.shelf.shelf-shift-2 .b3 {
  left: 90px;
  height: 63px;
  transform: rotate(3deg);
  background: #96a37b;
}

.shelf-secret {
  position: absolute;
  right: 73px;
  bottom: 24px;
  font-size: 22px;
  color: #d7a45f;
  opacity: 0;
  transform: translateY(8px) scale(.7) rotate(-12deg);
  transition: 350ms ease;
  pointer-events: none;
}

.shelf.secret-visible .shelf-secret {
  opacity: 1;
  transform: translateY(0) scale(1) rotate(0deg);
}


/* Wall cross */
.cross-wall {
  position: absolute;
  left: 56%;
  top: 15%;
  width: 62px;
  height: 86px;
  z-index: 3;
  filter: drop-shadow(0 8px 8px rgba(55, 38, 25, .16));
}

.cross-vertical,
.cross-horizontal {
  position: absolute;
  display: block;
  background: linear-gradient(90deg, #6d4b35, #b08a62, #6d4b35);
  border-radius: 5px;
}

.cross-vertical {
  width: 18px;
  height: 82px;
  left: 22px;
  top: 4px;
}

.cross-horizontal {
  width: 58px;
  height: 18px;
  left: 2px;
  top: 28px;
}

.room.night .cross-wall {
  filter: drop-shadow(0 0 14px rgba(255, 224, 165, .35));
}

.cross-wall::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 154px;
  height: 154px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(.74);
  background: radial-gradient(circle, rgba(255, 246, 215, .72) 0%, rgba(255, 235, 184, .48) 22%, rgba(255, 226, 164, .24) 42%, rgba(255, 226, 164, .10) 58%, rgba(255, 226, 164, 0) 76%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 420ms ease, transform 420ms ease;
}

.room.night .cross-wall.scripture-glow::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.06);
}

.room.night .cross-wall.scripture-glow {
  filter: drop-shadow(0 0 14px rgba(255, 238, 198, .78)) drop-shadow(0 0 26px rgba(255, 229, 172, .46)) drop-shadow(0 0 42px rgba(255, 225, 156, .24));
}


/* Cat interaction */
/*
 * The cat is a real button for mouse/touch/keyboard interaction.
 * Older room-object CSS treated it as a decorative div, so explicitly
 * neutralize native button chrome and restore pointer events when visible.
 */
.cat {
  display: block;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: none;
  z-index: 6;
}

.cat.visible:not(.runaway) {
  pointer-events: auto;
}

.cat:focus {
  background: transparent;
}

.cat:focus:not(:focus-visible) {
  outline: none;
}

.cat.runaway {
  pointer-events: none;
  animation: cat-run-away 720ms cubic-bezier(.55,.08,.8,.35) forwards;
}

.cat.runaway .cat-tail {
  animation: cat-tail-flick 120ms ease-in-out infinite alternate;
}

@keyframes cat-run-away {
  0% {
    opacity: 1;
    transform: scale(var(--cat-scale)) translate(0, 0) rotate(0deg);
  }
  18% {
    transform: scale(var(--cat-scale)) translate(-12px, -9px) rotate(-2deg);
  }
  45% {
    opacity: 1;
    transform: scale(var(--cat-scale)) translate(-85px, 3px) rotate(-3deg);
  }
  100% {
    opacity: 0;
    transform: scale(var(--cat-scale)) translate(-330px, 12px) rotate(-5deg);
  }
}

@keyframes cat-tail-flick {
  from { transform: rotate(4deg); }
  to { transform: rotate(24deg); }
}

@media (prefers-reduced-motion: reduce) {
  .cat.runaway {
    animation-duration: 180ms;
  }

  .cat.runaway .cat-tail {
    animation: none;
  }
}


/* Clickable growing plant on the shelf */
.tiny-pot {
  overflow: visible;
  clip-path: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  outline: none;
  z-index: 4;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.tiny-pot::before {
  content: "";
  position: absolute;
  inset: 0;
  top: auto;
  left: 0;
  width: 35px;
  height: 30px;
  background: #b87357;
  clip-path: polygon(8% 0, 92% 0, 80% 100%, 20% 100%);
  z-index: 2;
}

.tiny-pot:focus-visible {
  outline: 3px solid rgba(90, 126, 173, .45);
  outline-offset: 5px;
  border-radius: 5px;
}

.tiny-plant-crown {
  position: absolute;
  left: 3px;
  bottom: 24px;
  width: 30px;
  height: 42px;
  transform-origin: 50% 100%;
  pointer-events: none;
}

.tiny-stem {
  position: absolute;
  left: 14px;
  bottom: 0;
  width: 3px;
  height: 32px;
  border-radius: 3px;
  background: #65805b;
  transform-origin: bottom;
  transition: transform 320ms cubic-bezier(.2,.8,.2,1);
}

.tiny-leaf {
  position: absolute;
  width: 13px;
  height: 7px;
  border-radius: 100% 0 100% 0;
  background: #739465;
  opacity: 0;
  transition: opacity 280ms ease, transform 320ms cubic-bezier(.2,.8,.2,1);
}

.tiny-leaf-1 {
  left: 3px;
  bottom: 14px;
  transform: rotate(28deg) scale(.2);
}

.tiny-leaf-2 {
  right: 2px;
  bottom: 21px;
  transform: rotate(150deg) scale(.2);
}

.tiny-leaf-3 {
  left: 4px;
  bottom: 27px;
  transform: rotate(12deg) scale(.2);
}

.tiny-flower {
  position: absolute;
  left: 5px;
  top: -4px;
  color: #d88b95;
  font-size: 19px;
  line-height: 1;
  opacity: 0;
  transform: scale(.15) rotate(-8deg);
  transition: opacity 280ms ease, transform 340ms cubic-bezier(.2,.8,.2,1);
}

.tiny-plant-crown.level-0 .tiny-stem {
  transform: scaleY(.38);
}

.tiny-plant-crown.level-1 .tiny-stem {
  transform: scaleY(.62);
}

.tiny-plant-crown.level-1 .tiny-leaf-1 {
  opacity: 1;
  transform: rotate(28deg) scale(.82);
}

.tiny-plant-crown.level-2 .tiny-stem {
  transform: scaleY(.84);
}

.tiny-plant-crown.level-2 .tiny-leaf-1,
.tiny-plant-crown.level-2 .tiny-leaf-2 {
  opacity: 1;
}

.tiny-plant-crown.level-2 .tiny-leaf-1 {
  transform: rotate(28deg) scale(1);
}

.tiny-plant-crown.level-2 .tiny-leaf-2 {
  transform: rotate(150deg) scale(.92);
}

.tiny-plant-crown.level-3 .tiny-stem {
  transform: scaleY(1);
}

.tiny-plant-crown.level-3 .tiny-leaf {
  opacity: 1;
}

.tiny-plant-crown.level-3 .tiny-leaf-1 {
  transform: rotate(28deg) scale(1);
}

.tiny-plant-crown.level-3 .tiny-leaf-2 {
  transform: rotate(150deg) scale(1);
}

.tiny-plant-crown.level-3 .tiny-leaf-3 {
  transform: rotate(12deg) scale(.9);
}

.tiny-plant-crown.level-3 .tiny-flower {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

@media (prefers-reduced-motion: reduce) {
  .tiny-stem,
  .tiny-leaf,
  .tiny-flower {
    transition: none;
  }
}

/* Cross interaction + individually dismissible sheep */
.cross-wall {
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 180ms ease, filter 300ms ease;
}

.cross-wall:hover {
  transform: translateY(-2px) scale(1.03);
}

.cross-wall:focus-visible {
  outline: 3px solid rgba(90, 126, 173, .45);
  outline-offset: 7px;
  border-radius: 8px;
}

.sheep-flock {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.sheep {
  --sheep-scale: 1;
  position: absolute;
  display: block;
  width: 82px;
  height: 58px;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(var(--sheep-scale));
  transform-origin: bottom center;
  transition:
    opacity 360ms ease,
    transform 460ms cubic-bezier(.2,.85,.25,1.15);
}

/* Keep the flock gathered on the floor between the desk legs. */
.sheep-1 { left: 40%; bottom: 5%; }
.sheep-2 { left: 49%; bottom: 3%; --sheep-scale: .88; }
.sheep-3 { left: 58%; bottom: 6%; --sheep-scale: .95; }

.sheep-flock.visible .sheep:not(.gone) {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(var(--sheep-scale));
}

.sheep-flock.visible .sheep-1:not(.gone) { transition-delay: 0ms; }
.sheep-flock.visible .sheep-2:not(.gone) { transition-delay: 110ms; }
.sheep-flock.visible .sheep-3:not(.gone) { transition-delay: 220ms; }

.sheep.gone {
  opacity: 0;
  pointer-events: none;
  transform: translate(18px, -5px) scale(calc(var(--sheep-scale) * .72));
  transition-delay: 0ms !important;
  animation: none !important;
}

.sheep:focus {
  outline: none;
}

.sheep:focus-visible {
  outline: 3px solid rgba(90, 126, 173, .42);
  outline-offset: 5px;
  border-radius: 48%;
}

.sheep-body {
  position: absolute;
  left: 12px;
  top: 8px;
  width: 55px;
  height: 39px;
  border-radius: 48% 52% 46% 50%;
  background:
    radial-gradient(circle at 18% 30%, #fffdf7 0 11px, transparent 12px),
    radial-gradient(circle at 42% 18%, #fffdf7 0 12px, transparent 13px),
    radial-gradient(circle at 67% 27%, #fffdf7 0 12px, transparent 13px),
    radial-gradient(circle at 80% 55%, #f8f3e8 0 12px, transparent 13px),
    radial-gradient(circle at 48% 62%, #fffaf0 0 20px, transparent 21px),
    #f8f3e8;
  box-shadow: 0 7px 9px rgba(52, 41, 32, .12);
}

.sheep-head {
  position: absolute;
  right: 2px;
  top: 21px;
  width: 28px;
  height: 26px;
  border-radius: 48% 52% 52% 48%;
  background: #8c8176;
  transform: rotate(7deg);
}

.sheep-eye {
  position: absolute;
  right: 6px;
  top: 7px;
  width: 3px;
  height: 4px;
  border-radius: 50%;
  background: #2b2927;
}

.sheep-ear {
  position: absolute;
  left: -7px;
  top: 4px;
  width: 11px;
  height: 7px;
  border-radius: 70% 20% 70% 20%;
  background: #776d64;
  transform: rotate(18deg);
}

.sheep-leg {
  position: absolute;
  top: 42px;
  width: 5px;
  height: 15px;
  border-radius: 0 0 3px 3px;
  background: #756b62;
}

.sheep-leg-a { left: 28px; }
.sheep-leg-b { left: 54px; }

.sheep-flock.visible .sheep-1:not(.gone) { animation: sheep-bob 3.4s ease-in-out 700ms infinite; }
.sheep-flock.visible .sheep-2:not(.gone) { animation: sheep-bob-small 3.8s ease-in-out 900ms infinite; }
.sheep-flock.visible .sheep-3:not(.gone) { animation: sheep-bob 4.1s ease-in-out 1050ms infinite reverse; }

@keyframes sheep-bob {
  0%, 100% { margin-bottom: 0; }
  50% { margin-bottom: 3px; }
}

@keyframes sheep-bob-small {
  0%, 100% { margin-bottom: 0; }
  50% { margin-bottom: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .cross-wall,
  .sheep {
    transition-duration: 0.01ms;
  }

  .sheep-flock.visible .sheep {
    animation: none !important;
  }
}


/* v0.9.31: mobile wall layout guard.
 * This file loads after 04-responsive.css, so keep the mobile cross
 * positioning here as the final authority: window -> passed heart -> cross,
 * with the clock centered directly below the cross. */
@media (max-width: 800px) {
  .cross-wall {
    left: auto;
    right: 6%;
    top: 18%;
  }
}

@media (max-width: 650px) {
  .cross-wall { right: 5%; }
}

@media (max-width: 340px) {
  .cross-wall { right: 3%; }
}
