/* Rain mosaic · full-window stage and the "How to read this" box (after QuietSignal's quietsignal.css). */

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --ground: #f2f4f5;
  --ink: #1d2833;
  /* The rain ramp, least to most; matches THEMES in rain-mosaic.js. */
  --b1: #86afd8;
  --b2: #5389c2;
  --b3: #29609e;
  --b4: #12345e;
  --empty: #b9c3cc;
  --now: #5389c2;
  --panel-bg: rgba(250, 251, 252, 0.93);
  --panel-line: rgba(0, 0, 0, 0.09);
  --panel-text: #2b3136;
  --panel-muted: #6f777e;
  --tip-bg: rgba(252, 253, 253, 0.95);
  --tip-muted: #6b7682;
  --tip-shadow: 0 6px 24px rgba(29, 40, 51, 0.08);
  color-scheme: light;
}

/* Dark: deep blue ground, white text, the ramp flipped so heavy rain glows. */
:root[data-theme='dark'] {
  --ground: #0c1a2c;
  --ink: #eef4fb;
  --b1: #336499;
  --b2: #5a91cb;
  --b3: #97c1ea;
  --b4: #e0eefb;
  --empty: #4a5f78;
  --now: #97c1ea;
  --panel-bg: rgba(16, 32, 52, 0.9);
  --panel-line: rgba(255, 255, 255, 0.1);
  --panel-text: #e3ebf4;
  --panel-muted: #92a3b8;
  --tip-bg: rgba(18, 36, 58, 0.95);
  --tip-muted: #92a3b8;
  --tip-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html,
body {
  height: 100%;
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

.qs-stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  container-type: size;
  background: var(--ground);
}

.qs-viz__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- hover tip ---- */

.qs-rain-mosaic__tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  min-width: 10em;
  padding: 0.6em 0.75em 0.65em;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: var(--tip-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--tip-shadow);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.qs-rain-mosaic__tip.is-on { opacity: 1; }
.qs-rain-mosaic__tip strong { display: block; font-weight: 600; }
.qs-rain-mosaic__tip span { display: block; margin-bottom: 0.35em; color: var(--tip-muted); }
.qs-rain-mosaic__tip .is-now { margin-top: 0.3em; color: var(--now); font-weight: 500; }

/* ---- how to read this ---- */

.qs-howto {
  --ht-bg: var(--panel-bg);
  --ht-line: var(--panel-line);
  --ht-text: var(--panel-text);
  --ht-muted: var(--panel-muted);
  position: absolute;
  z-index: 5;
  right: max(10px, 2.2cqmin);
  bottom: max(10px, 2.2cqmin);
  font-family: var(--font);
  font-size: clamp(11px, 1.35cqmin, 15px);
  line-height: 1.4;
  color: var(--ht-text);
}
/* Folded: a small "Learn more" pill whose arrow nudges now and then. */
.qs-howto__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  height: 2.2em;
  padding: 0 0.85em 0 0.95em;
  border: 1px solid var(--ht-line);
  border-radius: 999px;
  background: var(--ht-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--ht-muted);
  font: 500 0.88em/1 var(--font);
  letter-spacing: 0.01em;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.3s, color 0.3s, border-color 0.3s;
}
.qs-howto__toggle svg { flex: none; animation: qs-howto-nudge 9s ease-in-out 2.5s infinite; }
.qs-howto__toggle:hover,
.qs-howto__toggle:focus-visible { opacity: 1; color: var(--ht-text); border-color: var(--ht-muted); }
.qs-howto__toggle:hover svg { animation: none; transform: translateX(2px); transition: transform 0.25s ease; }
@keyframes qs-howto-nudge {
  0%, 82%, 100% { transform: none; }
  88% { transform: translateX(3px); }
  94% { transform: none; }
}
.qs-howto.is-open .qs-howto__toggle { display: none; }
.qs-howto__panel {
  display: none;
  position: relative;
  width: min(22em, 62cqw);
  max-height: min(78cqh, 40em);
  overflow-y: auto;
  padding: 1em 1.1em 1.1em;
  border: 1px solid var(--ht-line);
  border-radius: 12px;
  background: var(--ht-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  scrollbar-width: thin;
}
.qs-howto.is-open .qs-howto__panel { display: block; animation: qs-howto-in 0.4s ease; }
@keyframes qs-howto-in { from { opacity: 0; transform: translateY(4px); } }
.qs-howto section + section { margin-top: 0.95em; padding-top: 0.85em; border-top: 1px solid var(--ht-line); }
.qs-howto h4 {
  margin: 0;
  padding-right: 1.6em;
  font-size: 0.74em;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ht-muted);
}
.qs-howto__close {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  position: absolute;
  top: 0.7em;
  right: 0.7em;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ht-muted);
  cursor: pointer;
}
.qs-howto__close:hover { color: var(--ht-text); }
.qs-howto p { margin: 0.45em 0 0; color: var(--ht-text); text-wrap: pretty; }
.qs-howto ul { margin: 0.55em 0 0; padding: 0; list-style: none; display: grid; gap: 0.38em; }
.qs-howto li { display: flex; align-items: center; gap: 0.6em; }
.qs-howto li svg { flex: none; }
.qs-howto__source {
  display: flex;
  align-items: flex-start;
  gap: 0.7em;
  margin-top: 0.95em;
  padding-top: 0.85em;
  border-top: 1px solid var(--ht-line);
  font-size: 0.82em;
}
.qs-howto__source img { flex: none; width: auto; height: 2.6em; margin-top: 0.1em; }
.qs-howto .qs-howto__source p { margin: 0; color: var(--ht-muted); }
.qs-howto__source a { color: inherit; }
.qs-swatch--1 { color: var(--b1); }
.qs-swatch--2 { color: var(--b2); }
.qs-swatch--3 { color: var(--b3); }
.qs-swatch--4 { color: var(--b4); }
.qs-swatch--empty { color: var(--empty); }
.qs-swatch--now { color: var(--now); }
@container (max-width: 420px) {
  .qs-howto__panel { width: min(17em, 80cqw); font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .qs-howto.is-open .qs-howto__panel { animation: none; }
  .qs-rain-mosaic__tip { transition: none; }
  .qs-howto__toggle svg { animation: none; }
}
