/* solar meditation — near-black room, one square of sun, a slim mixing desk. */

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

html, body {
  height: 100%;
  overflow: hidden;
  background: #050505;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

/* ── the sun ─────────────────────────────────────────────────── */

#stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

#stage canvas {
  touch-action: none;               /* we own the drag: the sun is the timeline */
  cursor: ew-resize;
}

#stage canvas,
#stage img {
  grid-area: 1 / 1;                 /* canvas and poster stack in the same cell */
  width: min(100vw, 100vh);
  height: min(100vw, 100vh);
  display: block;
}

#poster {
  object-fit: contain;
  opacity: 1;
  transition: opacity 1.2s ease;
  pointer-events: none;
}
#poster.gone { opacity: 0; }

/* ── the invitation back in (shown only while stopped) ───────── */

#spacehint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 21px;
  font-weight: 300;
  letter-spacing: 0.4em;
  white-space: nowrap;
  text-transform: lowercase;
  color: rgba(255, 235, 220, 0.85);
  /* just a faint drop shadow to lift the letters off bright corona */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55), 0 0 10px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 1.4s ease;
  pointer-events: none;
}
#spacehint.shown { opacity: 1; }

/* ── UI chrome (fades away when the pointer rests) ───────────── */

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;             /* children opt back in */
  opacity: 1;
  transition: opacity 0.4s ease;
}
body.idle #ui { opacity: 0.03; transition: opacity 1.8s ease; }

#title {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.4em;
  text-transform: lowercase;
  color: rgba(255, 235, 220, 0.55);
}

/* ── volume: speaker · glowing line · whisper label, upper right ── */

#volume {
  --v: 0.9;
  position: absolute;
  top: 30px;
  right: 36px;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 7px;
  pointer-events: auto;
  transform: scale(0.9);              /* the whole cluster, one notch quieter */
  transform-origin: top right;
  opacity: 0.9;                       /* and one notch dimmer */
}
#volume:hover .vmute { color: #ffc233; }

/* the speaker is also the mute switch */
#volume .vmute {
  grid-row: 1;
  grid-column: 1;
  border: none;
  background: none;
  padding: 4px;
  cursor: pointer;
  color: rgba(255, 178, 44, 0.85);   /* warm gold, kin to the 171 tint */
  transition: color 0.2s ease;
  line-height: 0;
}
#volume .vsp { fill: currentColor; }
#volume .vw1, #volume .vw2 {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}
#volume .vx {
  display: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}
#volume.muted .vw1, #volume.muted .vw2 { display: none; }
#volume.muted .vx { display: block; }
#volume.muted .vfill { opacity: 0.25; }

#volume .vbody {
  grid-row: 1;
  grid-column: 2;
  padding: 10px 0;                  /* generous hit area around a thin track */
  cursor: pointer;
  touch-action: none;
}

#volume .vtrack {
  position: relative;
  width: 170px;
  height: 10px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
}

/* the whole solar spectrum lives in the bar, revealed as it fills — the
   gradient stays pinned to the track so each loudness has its color */
#volume .vfill {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, #ff9a8a, #ff4d2e, #ffc233, #c98a4b, #b48cff);
  clip-path: inset(0 calc((1 - var(--v)) * 100%) 0 0 round 2px);
  filter: drop-shadow(0 0 9px rgba(255, 120, 60, 0.55));
  transition: clip-path 0.06s linear;
}

/* ── bottom bar: reverb · clock · desk, one row ──────────────── */

#bottombar {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

/* ── the desk: play · five faders · speed ────────────────────── */

#desk {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  pointer-events: auto;
  padding: 8px 10px;
}

#mixer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

#faders {
  display: flex;
  gap: 12px;
}

/* ── spectrum scrubber: one position sweeping the whole atmosphere ── */

#spectrum {
  --x: 0.25;                          /* 0304 sits at 1/4 of the desk */
  height: 14px;
  display: grid;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

#spectrum .strack {
  position: relative;
  height: 4px;
  border-radius: 2px;
  /* the five channel tints, coolest to hottest, matching the fader order */
  background: linear-gradient(90deg, #ff9a8a, #ff4d2e, #ffc233, #c98a4b, #b48cff);
  opacity: 0.55;
}

#spectrum .sknob {
  position: absolute;
  top: 50%;
  left: calc(var(--x) * 100%);
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffebdc;
  box-shadow: 0 0 8px rgba(255, 235, 220, 0.7);
}

.fader {
  width: 24px;
  height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  touch-action: none;               /* we own the drag on touch */
}

.fader .track {
  position: relative;
  width: 4px;
  flex: 1;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.10);
}

.fader .fill {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: calc(var(--v) * 100%);
  border-radius: 2px;
  background: var(--tint);
  box-shadow: 0 0 10px color-mix(in srgb, var(--tint) 60%, transparent);
}

.fader .knob {
  position: absolute;
  left: 50%;
  bottom: calc(var(--v) * 100%);
  transform: translate(-50%, 50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--tint);
  box-shadow: 0 0 8px color-mix(in srgb, var(--tint) 70%, transparent);
}

.fader .flabel {
  margin-top: 6px;
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--tint);
  opacity: 0.85;
}

/* ── sun clock: the moment of sun on screen ──────────────────── */

/* True viewport center when the window is wide enough (the bar's 16px
   insets are symmetric, so its center IS the viewport's); on narrow
   windows the desk would collide, so it falls back to centering in the
   free gap between the two control clusters. */
#sunclock {
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  font-size: 14px;
  letter-spacing: 0.25em;
  color: rgba(255, 235, 220, 0.55);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 760px) {
  #sunclock {
    position: static;
    transform: none;
    flex: 1;
    text-align: center;
    padding-bottom: 2px;
  }
}

/* ── reverb corner: the room, lower left ─────────────────────── */

#verb {
  display: flex;
  gap: 12px;
  pointer-events: auto;
  padding: 8px 10px;
}

/* ── transport ───────────────────────────────────────────────── */

#playpause {
  width: 26px;
  height: 26px;
  margin-bottom: 14px;
  border: 1px solid rgba(255, 235, 220, 0.25);
  border-radius: 50%;
  background: none;
  color: rgba(255, 235, 220, 0.7);
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
#playpause:hover { border-color: rgba(255, 235, 220, 0.6); color: #ffebdc; }

#speeds {
  display: flex;
  flex-direction: column-reverse;   /* 0.5x at the bottom, 4x on top */
  gap: 6px;
  margin-bottom: 14px;
}

#speeds button {
  width: 26px;
  height: 17px;
  border: none;
  border-radius: 4px;
  background: none;
  color: rgba(255, 235, 220, 0.35);
  font-size: 9px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}
#speeds button:hover { color: rgba(255, 235, 220, 0.8); }
#speeds button.on {
  color: #ffebdc;
  background: rgba(255, 235, 220, 0.10);
}
