/* The room around the monitor: wall, window, desk, wall light, CV switch, coffee. */

.scene {
  /* horizontal centre of the free wall space left of the monitor */
  --gutter-centre: calc((100vw - var(--monitor-width)) / 4);

  height: max(100dvh, 600px); /* never collapse: the page scrolls instead */
  padding: clamp(12px, 3vh, 30px) 20px 54px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: repeating-linear-gradient(90deg, #6b3239 0 92px, #592830 92px 96px);
}

/* warm glow from the window + darker floor */
.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(45% 60% at 92% 45%, rgba(255, 170, 110, 0.22), transparent 70%),
    linear-gradient(transparent 55%, rgba(27, 15, 34, 0.35));
}

/* ---------- window (tucked behind the right edge of the monitor) ---------- */

.window {
  position: absolute;
  z-index: -4;
  left: calc(50% + 480px);
  top: 19%;
  width: min(430px, calc(50vw - 504px));
  height: 46%;
  overflow: hidden;
  border: 12px solid var(--wood);
  outline: var(--pixel) solid var(--shadow);
  box-shadow:
    inset 0 0 0 4px var(--wood-dark),
    0 18px 0 -4px var(--wood),
    0 18px 0 0 var(--shadow);
  background: linear-gradient(#35598c 0%, #5b93ad 34%, #f0bb93 68%, #ff9068 100%);
}

.sun {
  position: absolute;
  left: 16%;
  bottom: 112px;
  width: 32px;
  height: 32px;
  background: #fff0b8;
  box-shadow:
    0 0 0 4px #ffd58a,
    0 0 0 8px rgba(255, 190, 120, 0.55),
    0 0 50px 22px rgba(255, 200, 140, 0.5);
}

/* skyline layers; the buildings are drawn in js/room.js */
.sky {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background-repeat: repeat-x;
  background-position: left bottom;
}

.sky.far {
  height: 150px;
  background-size: 300px 150px;
  opacity: 0.75;
}

.sky.near {
  height: 100px;
  background-size: 200px 100px;
}

/* stars are added in js/room.js */
.star {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #ffe9f3;
  animation: twinkle 3s steps(2) infinite;
}

@keyframes twinkle {
  50% {
    opacity: 0.25;
  }
}

.cloud {
  position: absolute;
  width: 120px;
  height: 20px;
  scale: 0.5;
  background: #f8b9b4;
  opacity: 0.85;
  box-shadow:
    24px -16px #f8b9b4,
    60px -8px #f8b9b4,
    -20px 8px #f8b9b4;
  animation: drift 60s linear infinite;
}

.cloud.one {
  top: 22%;
  left: -4%;
}

.cloud.two {
  top: 38%;
  right: -6%;
  transform: scale(0.7);
  animation-duration: 45s;
  animation-direction: reverse;
}

.cloud.three {
  top: 12%;
  right: 30%;
  transform: scale(0.5);
  animation-duration: 80s;
}

@keyframes drift {
  0% {
    translate: -8vw 0;
  }
  50% {
    translate: 8vw 0;
  }
  100% {
    translate: -8vw 0;
  }
}

/* ---------- desk ---------- */

.desk {
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  bottom: 0;
  height: 74px;
  border-top: var(--pixel) solid var(--shadow);
  background: linear-gradient(#c97a4b 0 4px, #b5653f 4px 30px, #3a1c26 30px 34px, #8a4632 34px 100%);
}

.coffee {
  position: absolute;
  z-index: -1;
  bottom: 52px;
  right: calc(50% - var(--monitor-width) / 2 - 240px);
  width: 120px;
  shape-rendering: crispEdges;
}

.steam rect {
  animation: steam 2.6s steps(7) infinite;
}

.steam rect:nth-child(2) {
  animation-delay: -0.9s;
}

.steam rect:nth-child(3) {
  animation-delay: -1.7s;
}

@keyframes steam {
  0% {
    transform: translateY(3px);
    opacity: 0;
  }
  30% {
    opacity: 0.85;
  }
  100% {
    transform: translateY(-5px);
    opacity: 0;
  }
}

/* ---------- left wall: light, beam and the CV switch ---------- */

.wall-item {
  position: absolute;
  left: var(--gutter-centre);
  translate: -50% 0;
}

.wall-light {
  z-index: -1;
  top: 18%;
  width: 52px;
  height: 22px;
  background: var(--orange);
  border: 4px solid var(--shadow);
  box-shadow:
    0 4px 0 0 #fff0b8,
    0 -10px 0 -4px #3f8f86,
    0 -14px 0 -4px var(--shadow);
}

.beam {
  z-index: -2;
  top: calc(18% + 24px);
  width: 300px;
  height: 400px;
  pointer-events: none;
  background: linear-gradient(rgba(255, 226, 160, 0.6), rgba(255, 226, 160, 0.18) 55%, rgba(255, 226, 160, 0) 92%);
  clip-path: polygon(43% 0, 57% 0, 100% 100%, 0 100%);
}

/* The switch is a link to cv.html. */
.cv-switch {
  z-index: 0;
  text-decoration: none;
  top: calc(18% + 150px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 0;
  border: 0;
  box-shadow: none;
  transition: none;
}

.cv-switch,
.cv-switch:hover {
  background: none;
  color: var(--ink);
}

.cv-switch:active {
  transform: none;
}

.cv-switch__plate {
  display: block;
  position: relative;
  width: 64px;
  height: 92px;
  background: var(--cream);
  border: 4px solid var(--shadow);
  box-shadow: 5px 5px 0 var(--shadow);
}

.cv-switch__plate::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 10px;
  width: 28px;
  height: 64px;
  margin-left: -14px;
  border: 4px solid #d9c7a8;
  box-sizing: border-box;
}

.cv-switch__toggle {
  position: absolute;
  left: 50%;
  top: 14px;
  width: 20px;
  height: 30px;
  margin-left: -10px;
  background: var(--red);
  border: 4px solid var(--shadow);
  transition: top 0.12s steps(2);
}

.cv-switch:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 6px;
}

.cv-switch:hover .cv-switch__toggle,
.cv-switch:focus-visible .cv-switch__toggle {
  top: 40px;
}

.cv-switch__label {
  display: block;
  font: 10px/1.7 var(--font-pixel);
  background: var(--cream);
  border: 4px solid var(--shadow);
  box-shadow: 5px 5px 0 var(--shadow);
  padding: 8px 10px 6px;
  text-align: center;
}

.cv-switch:hover .cv-switch__label {
  background: var(--red);
  color: #fff;
}
