/* style.css — a full-screen, layered scene.
   app.js sets these from schedule.js:
     --aspect   canvas width ÷ height        --safe     safe-area width ÷ canvas width
     --focus    safe-area centre (0–1)        --floor    floor line (0–1 from top)
     --wall / --floor-colour / --sky / --wash  colours                                  */

:root {
  --aspect: 1.5;
  --safe: 0.45;
  --focus: 0.5;
  --floor: 0.675;
  --wall: #e9e2d3;
  --floor-colour: #cfc3ad;
  --sky: #9fd0f2;
  --wash: #ffffff;

  /* Scene width: big enough to fill the screen ("cover"), but never so big that the
     safe area is cropped. On very tall phones that leaves a gap above and below,
     which is filled with the wall and floor colours. */
  --vh: 1vh;
  --w: max(100vw, min(calc(100 * var(--vh) * var(--aspect)), calc(100vw / var(--safe))));
  --h: calc(var(--w) / var(--aspect));
}
/* On phones, use the height that's actually visible between the browser's toolbars. */
@supports (height: 100dvh) {
  :root { --vh: 1dvh; }
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; overflow: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #2b2a28;
}

.viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(to bottom,
    var(--wall) calc(50% + var(--h) * (var(--floor) - 0.5)),
    var(--floor-colour) 0);
}

.world {
  position: absolute;
  top: 50%;
  left: calc(50% - var(--w) * var(--focus));
  width: var(--w);
  height: var(--h);
  transform: translateY(-50%);
  overflow: hidden;
}

/* Every layer is placed with percentages of the canvas, set by app.js. */
.part {
  position: absolute;
  display: block;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
}
img.part { width: 100%; height: 100%; }
.part[hidden] { display: none; }

.sky { background: var(--sky); transition: background-color 1.5s ease; }

.activity { opacity: 0; transition: opacity 0.8s ease; }
.activity.is-visible { opacity: 1; }

.light {
  position: absolute;
  inset: 0;
  background: var(--wash);
  mix-blend-mode: multiply;
  pointer-events: none;
  transition: background-color 1.5s ease;
}

.safe-guide {
  border-left: 2px dashed #e2443c;
  border-right: 2px dashed #e2443c;
  background: rgba(226, 68, 60, 0.06);
  pointer-events: none;
}

/* ---- Name and caption: ink outline on paper, like the illustrations ---- */
.label {
  position: fixed;
  top: 18px;
  left: 18px;
  right: 18px;
  pointer-events: none;
  font-family: "Bradley Hand", "Segoe Print", "Noteworthy", "Chalkboard SE", "Comic Neue", cursive;
}
.name {
  display: inline-block;
  margin: 0 0 10px;
  padding: 6px 16px 4px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #1f1d1b;
  background: #eeb4a3;
  border: 2.5px solid #1f1d1b;
  /* uneven corners look hand drawn */
  border-radius: 14px 18px 12px 20px / 18px 12px 20px 14px;
  transform: rotate(-1.5deg);
  box-shadow: 4px 4px 0 rgba(31, 29, 27, 0.12);
}
.now {
  display: table;
  margin: 0;
  padding: 6px 14px 5px;
  font-size: 1rem;
  color: #1f1d1b;
  background: #fbfaf6;
  border: 2.5px solid #1f1d1b;
  border-radius: 18px 12px 20px 14px / 12px 20px 14px 18px;
  transform: rotate(0.8deg);
}
.time { font-variant-numeric: tabular-nums; color: #d8532f; margin-right: 6px; font-weight: 700; }

/* ---- Testing panel ---- */
.debug {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(320px, calc(100vw - 32px));
  padding: 12px 14px;
  background: rgba(20, 20, 24, 0.92);
  color: #f2f2f2;
  border-radius: 10px;
  font-size: 0.85rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  z-index: 10;
}
.debug[hidden] { display: none; }
.debug-row { display: flex; gap: 6px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.debug input[type="range"] { width: 100%; margin: 10px 0; }
.debug button {
  flex: 1;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: #3b3b44;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.debug button:hover { background: #50505c; }
.debug-check { display: flex; gap: 6px; align-items: center; margin-top: 10px; cursor: pointer; }

/* ---- Wall clock ---- */
.clock-hands { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
