/* ============================================================
   The Hum — Comic/Playful Mosaic Theme
   ============================================================ */

:root {
  --cream:    #fdf6e3;
  --ink:      #1a1a1a;
  --ink-mid:  #444;
  --ink-faint:#888;

  /* Symptom bucket colors — bold comic palette */
  --col-none: #a8d8a8;   /* soft green  — none */
  --col-low:  #ffe066;   /* mustard     — 1-2  */
  --col-mid:  #ff9f43;   /* orange      — 3-4  */
  --col-high: #ee5a24;   /* red-orange  — 5+   */

  /* When loudest row accent */
  --night:    #2c3e7a;
  --equal:    #7a5c2c;
  --day:      #2c7a4a;

  --font-display: 'Bangers', cursive;
  --font-body:    'Comic Neue', cursive;
  --border:       3px solid var(--ink);
  --radius:       6px;
}

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

html {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
}

body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem 2rem;
  background: var(--cream);
}

/* ── Comic header ── */
.comic-header {
  border: var(--border);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--cream);
  padding: 1.2rem 1.8rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.comic-header::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: 3px;
  pointer-events: none;
}

.header-inner { position: relative; z-index: 1; }

.issue-tag {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #ffd700;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.main-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 6rem);
  letter-spacing: 0.04em;
  color: #fff;
  line-height: 1;
  text-shadow: 4px 4px 0 #ff6b35, 8px 8px 0 rgba(0,0,0,0.3);
}

.main-subtitle {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: #ccc;
  font-style: italic;
  margin: 0.4rem 0 0.8rem;
  max-width: 620px;
}

.header-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stat-pill {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.25);
  color: #fff;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.stat-pill.blood {
  background: #c0392b;
  border-color: #e74c3c;
}

/* ── Chart area ── */
.chart-area {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.y-label {
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 1.8vw, 1.1rem);
  letter-spacing: 0.12em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: var(--ink-mid);
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
  flex-shrink: 0;
}

.mosaic-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#mosaic-container {
  width: 100%;
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  position: relative;
}

#mosaic-container svg {
  display: block;
  width: 100%;
}

.x-label {
  font-family: var(--font-display);
  font-size: clamp(0.85rem, 1.6vw, 1rem);
  letter-spacing: 0.1em;
  color: var(--ink-mid);
  text-align: center;
}

/* ── Mosaic cells ── */
.mosaic-cell {
  cursor: pointer;
  transition: filter 0.15s ease;
}

.mosaic-cell:hover { filter: brightness(1.12); }

.cell-border {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  pointer-events: none;
}

.cell-count {
  font-family: var(--font-display);
  dominant-baseline: central;
  text-anchor: middle;
  fill: var(--ink);
  pointer-events: none;
}

.cell-pct {
  font-family: var(--font-body);
  dominant-baseline: central;
  text-anchor: middle;
  font-weight: 700;
  fill: var(--ink);
  pointer-events: none;
}

/* ── Row labels ── */
.row-label {
  font-family: var(--font-display);
  dominant-baseline: central;
  letter-spacing: 0.06em;
  pointer-events: none;
}

/* ── Age group labels ── */
.age-label {
  font-family: var(--font-display);
  text-anchor: middle;
  letter-spacing: 0.06em;
  fill: var(--ink);
}

.age-count {
  font-family: var(--font-body);
  text-anchor: middle;
  font-size: 10px;
  fill: var(--ink-faint);
}

/* ── Speech bubble annotations ── */
.annotation-bubble {
  pointer-events: none;
}

.bubble-rect {
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 2;
  rx: 8;
}

.bubble-text {
  font-family: var(--font-body);
  font-weight: 700;
  fill: var(--ink);
  dominant-baseline: central;
  text-anchor: middle;
}

.bubble-tail {
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 2;
}

/* ── Tooltip ── */
.hum-tooltip {
  position: fixed;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 999;
  max-width: 220px;
  line-height: 1.4;
  border: 2px solid #fff;
}
.hum-tooltip.visible { opacity: 1; }

/* ── Legend ── */
.legend-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.6rem 1rem;
  border: var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.legend-title {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: var(--ink-mid);
  flex-shrink: 0;
}

.legend-items {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
}

.legend-swatch {
  width: 22px;
  height: 22px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── Footer ── */
.comic-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.5rem;
}

.footer-bubble {
  font-family: var(--font-body);
  font-size: clamp(0.85rem, 1.8vw, 1rem);
  font-weight: 700;
  background: #fff;
  border: var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 1.2rem;
  color: var(--ink);
  text-align: center;
  max-width: 680px;
}

.footer-bubble strong { color: #c0392b; }

.footer-source {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  text-align: center;
}
