html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #0a0a12;
  color: #ffffff;
  font-family: system-ui, -apple-system, "Helvetica Neue", "Hiragino Sans", "Noto Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#stage {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

/* ──────────────────────────────────────────────────────────────────────
   Poster (information layer)

   Sizing strategy
   ───────────────
   • Lengths use `min(Xvmin, Yvw, Zvh)` (or `clamp` with multiple axes)
     so type scales by the smaller dimension AND is capped at the larger
     one. This keeps the central content readable across 9:16, 16:9, 4:3,
     and ultra-wide.
   • Decorative vertical text (city / month) is gated behind container
     width — it appears only when the viewport is wide enough to hold
     it without crowding the central temp.
   • Landscape uses a flex cluster (icon + text) centred horizontally
     in the viewport, instead of two columns that stretch.
   ────────────────────────────────────────────────────────────────────── */

.poster {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  color: var(--ink, #ffffff);
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 1fr;
  padding: clamp(16px, 3.5vmin, 56px);
  box-sizing: border-box;
}

/* Cluster — icon + label + temp, stacked vertically and centred in the
   middle row of the grid. This is the same in portrait and landscape;
   only the cluster's gap and the relationship to the decorative side
   text changes. */
.poster__cluster {
  grid-row: 2;
  grid-column: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2.4vmin, 36px);
  width: 100%;
  max-width: min(720px, 92%);
  margin: 0 auto;
}

/* Head — small all-caps tracking, fixed to the top */
.poster__head {
  grid-row: 1;
  justify-self: center;
  font-size: clamp(10px, 1.4vmin, 16px);
  font-weight: 500;
  letter-spacing: 0.35em;
  opacity: 0.85;
  text-transform: uppercase;
  padding-top: clamp(2px, 1vmin, 8px);
}

/* Icon */
.poster__icon {
  width:  min(28vmin, 220px);
  height: min(28vmin, 220px);
  max-width: 70vw;
  max-height: 38vh;
}
.poster__icon canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Weather name */
.poster__label {
  text-align: center;
  line-height: 1.1;
}
.poster__label .en {
  font-size: clamp(22px, 5.2vmin, 60px);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.poster__label .ja {
  font-size: clamp(10px, 1.4vmin, 18px);
  font-weight: 400;
  letter-spacing: 0.4em;
  opacity: 0.72;
  margin-top: 0.4em;
}

/* Giant temperature */
.poster__temp {
  font-size: min(28vmin, 22vw, 22vh, 280px);
  font-weight: 200;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum" 1;
  line-height: 0.95;
  display: flex;
  align-items: flex-start;
}
.poster__temp .deg {
  font-size: 0.45em;
  font-weight: 300;
  margin-left: 0.05em;
  margin-top: 0.1em;
  opacity: 0.85;
}

/* Vertical city name — sits behind the cluster on the left side.
   Hidden by default; revealed only when the viewport has room for it
   (portrait at >= 480px, or unusually wide landscape). */
.poster__city {
  position: absolute;
  display: none;
  left: clamp(16px, 3.5vmin, 56px);
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: min(15vmin, 200px);
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0.55;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
  z-index: 1;
  max-height: 70vh;
}

/* Vertical month repetition — sits behind the cluster on the right. */
.poster__month {
  position: absolute;
  display: none;
  right: clamp(16px, 3.5vmin, 56px);
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: min(5.6vmin, 72px);
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.32;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-align: left;
  user-select: none;
  z-index: 1;
  max-height: 60vh;
}

/* Footer */
.poster__foot {
  grid-row: 3;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font: 500 clamp(9px, 1.2vmin, 13px)/1.4 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.16em;
  opacity: 0.55;
  text-transform: uppercase;
}

/* ──────────────────────────────────────────────────────────────────────
   Decorative side text — only when there's room.
   • Portrait wider than 480px: show city (left) and month (right) flanking
     the cluster.
   • Landscape: stays hidden — the cluster occupies the visual centre and
     the side text would compete with it.
   ────────────────────────────────────────────────────────────────────── */

@media (orientation: portrait) and (min-width: 480px) {
  .poster__city  { display: block; }
  .poster__month { display: block; }
}

/* ──────────────────────────────────────────────────────────────────────
   Landscape — the cluster is identical, just sized with a different
   icon ratio and the cluster gap loosens. Side text stays hidden.
   ────────────────────────────────────────────────────────────────────── */

@media (orientation: landscape) {
  .poster__cluster {
    flex-direction: row;
    gap: clamp(20px, 4vmin, 80px);
    max-width: min(1200px, 88%);
  }
  .poster__icon {
    flex: 0 0 auto;
    width:  min(26vmin, 30vh, 260px);
    height: min(26vmin, 30vh, 260px);
    max-width: none;
    max-height: none;
  }
  .poster__text-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: clamp(6px, 1.6vmin, 24px);
  }
  .poster__label { text-align: left; }
  .poster__label .en { font-size: clamp(28px, 6vmin, 80px); }
  .poster__temp {
    font-size: min(22vmin, 36vh, 320px);
  }
}

/* Portrait: text-stack just contains label + temp stacked centred. */
@media (orientation: portrait) {
  .poster__text-stack {
    display: contents; /* let label and temp participate in cluster gap directly */
  }
}

/* ── Debug HUD ────────────────────────────────────────────────────── */

#hud {
  position: fixed;
  left: 14px;
  bottom: 10px;
  font: 11px/1.45 ui-monospace, "SF Mono", "Courier New", Menlo, monospace;
  color: rgba(255, 255, 255, 0.55);
  white-space: pre;
  pointer-events: none;
  user-select: none;
  letter-spacing: 0.02em;
  z-index: 10;
  margin: 0;
}
