/* ————————————————————————————————————————
   sonARe — playground
   the house instrument, given the whole room.
———————————————————————————————————————— */

:root {
  --black: #000;
  --porcelain: #eaedef;
  --porcelain-dim: rgba(234, 237, 239, 0.6);
  --porcelain-faint: rgba(234, 237, 239, 0.5);
  --hairline: rgba(255, 255, 255, 0.08);
  --signal: #9fd8d4;
  --signal-dim: rgba(159, 216, 212, 0.4);
  --sans: "Switzer", "Helvetica Neue", -apple-system, sans-serif;
  --mono: "Fragment Mono", "SF Mono", ui-monospace, monospace;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --tick: 150ms linear;
}

/* after 21:00 the ink warms — night.js flips the class */
body.night {
  --porcelain: #ece4d3;
  --porcelain-dim: rgba(236, 228, 211, 0.6);
  --porcelain-faint: rgba(236, 228, 211, 0.5);
  --signal: #dcb98c;
  --signal-dim: rgba(220, 185, 140, 0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--black);
  color: var(--porcelain);
  font-family: var(--sans);
}

::selection { background: var(--signal-dim); color: var(--black); }

#stage {
  position: fixed;
  inset: 0;
  cursor: crosshair;
  touch-action: none;
  outline: none;
  overscroll-behavior: none;
}

#pg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ── the shared room chrome — same bones as every other room ── */
.brand-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 52px;
  border-bottom: 1px solid var(--hairline);
  z-index: 4; pointer-events: none;
}
.home-link {
  position: fixed; top: 18px; left: 24px; z-index: 6;
  font-family: var(--mono); font-weight: 400;
  font-size: 12px; letter-spacing: 0.22em;
  opacity: 0.85; color: var(--porcelain);
  text-decoration: none;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.75);
  transition: opacity 0.15s;
}
.home-link:hover { opacity: 1; color: var(--porcelain); }

/* ── the tunings — centered in the bar ── */
.pg-tunings {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 52px;
  display: flex;
  align-items: center;
  gap: 18px;
  z-index: 6;
}
.pg-tunings button {
  appearance: none;
  background: none;
  border: 0;
  padding: 2px 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--porcelain-faint);
  opacity: 0.55;
  cursor: pointer;
  pointer-events: auto;
  border-bottom: 1px solid transparent;
  transition: color var(--tick), opacity var(--tick), border-color var(--tick);
}
.pg-tunings button:hover, .pg-tunings button:focus-visible { color: var(--porcelain); opacity: 1; }
.pg-tunings button.on { color: var(--signal); opacity: 1; border-bottom-color: var(--signal-dim); }

/* ── corners — the range of the room ── */
.pg-corner {
  position: absolute;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--porcelain-faint);
  opacity: 0.3;
  pointer-events: none;
  line-height: 1.9;
  z-index: 3;
}
.pg-bl { bottom: 20px; left: 32px; }
.pg-br { bottom: 20px; right: 24px; text-align: right; }

/* ── the hint — spoken once, then it gets out of the way ── */
.pg-hint {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--porcelain-faint);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.6s ease;
  z-index: 3;
}
.pg-hint.visible { opacity: 0.45; }
.pg-hint.gone { opacity: 0; transition: opacity 2.5s ease; }

/* ── the veil — a browser needs one true gesture before sound ── */
.pg-veil {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 5;
  background: transparent;
  transition: opacity 1.4s ease;
}
.pg-veil.lifting { opacity: 0; pointer-events: none; }
.pg-veil-line {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(17px, 2.2vw, 22px);
  color: var(--porcelain);
}
.pg-veil-line.dim { color: var(--porcelain-dim); font-size: clamp(14px, 1.8vw, 17px); }

/* ── the readout that follows the hand ── */
.pg-freq {
  position: fixed;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--signal);
  z-index: 6;
  opacity: 0;
  transition: opacity 0.25s;
  white-space: nowrap;
}
.pg-freq.visible { opacity: 0.7; }

@media (max-width: 640px) {
  #stage { cursor: default; }
  .home-link { top: 16px; left: 16px; font-size: 11px; }
  /* the bar belongs to sonARe + about + sound on; the tunings step just below it */
  .pg-tunings { top: 52px; height: auto; padding-top: 12px; gap: 16px; }
  .pg-tunings button { font-size: 9px; letter-spacing: 0.1em; padding: 6px 0; }
  .pg-corner { font-size: 9px; opacity: 0.22; line-height: 1.7; }
  .pg-bl { left: 20px; bottom: 16px; }
  .pg-br { right: 16px; bottom: 16px; }
  .pg-hint {
    white-space: normal;
    text-align: center;
    max-width: 74vw;
    letter-spacing: 0.1em;
    font-size: 9px;
    bottom: 56px; /* clear of the corner labels */
    line-height: 2;
  }
  .pg-hint.visible { opacity: 0.35; }
  .pg-freq { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .pg-veil, .pg-hint { transition: opacity 0.3s linear; }
}
