/* Leitwerk — hand-written dashboard CSS. No frameworks.
   Palette + chrome from the validated data-viz reference (categorical slots
   1–3, both modes selected). Colours are exposed as custom properties so the
   SVG strokes (via inline style) and legend swatches read one system, and
   light/dark swap in one place. */

:root {
  /* chart chrome & ink (light) */
  --page:           #f9f9f7;
  --surface:        #fcfcfb;
  --ink:            #0b0b0b;
  --ink-2:          #52514e;
  --muted:          #898781;
  --grid:           #e1e0d9;
  --axis:           #c3c2b7;
  --border:         rgba(11, 11, 11, 0.10);

  /* categorical series (light) */
  --series-1:       #2a78d6; /* blue   */
  --series-2:       #1baf7a; /* aqua   */
  --series-3:       #eda100; /* yellow */

  --radius:         10px;
  --maxw:           960px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page:         #0d0d0d;
    --surface:      #1a1a19;
    --ink:          #ffffff;
    --ink-2:        #c3c2b7;
    --muted:        #898781;
    --grid:         #2c2c2a;
    --axis:         #383835;
    --border:       rgba(255, 255, 255, 0.10);

    --series-1:     #3987e5;
    --series-2:     #199e70;
    --series-3:     #c98500;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Header / footer ---------------------------------------------------- */

.site-head {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 24px 8px;
}

.brand h1 {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 0.95rem;
}

.site-foot {
  max-width: var(--maxw);
  margin: 8px auto 0;
  padding: 0 24px;
  color: var(--muted);
  font-size: 0.82rem;
}

.creator {
  max-width: var(--maxw);
  margin: 16px auto 48px;
  padding: 14px 24px 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.85rem;
  color: var(--ink-2);
}

.creator-name {
  font-weight: 500;
}

.contact {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--series-1);
  text-decoration: none;
}

.contact:hover {
  text-decoration: underline;
}

.mail-icon {
  font-size: 0.95rem;
}

/* ---- Intro / portfolio lead -------------------------------------------- */

.intro {
  max-width: var(--maxw);
  margin: 10px auto 0;
  padding: 0 24px;
}

.intro-lead {
  margin: 0 0 10px;
  max-width: 64ch;
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.intro-body {
  margin: 0 0 14px;
  max-width: 72ch;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-2);
}

.tech {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tech li {
  font-size: 0.75rem;
  color: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--surface);
}

/* ---- Why I built this -------------------------------------------------- */

.why-built {
  max-width: var(--maxw);
  margin: 22px auto 0;
  padding: 0 24px;
}

.why-built h2 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.why-built p {
  margin: 0;
  max-width: 72ch;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-2);
}

/* ---- State-of-transmission summary ------------------------------------- */

.state {
  max-width: var(--maxw);
  margin: 16px auto 0;
  padding: 0 24px;
}

.state-title {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.stat-label {
  font-size: 0.74rem;
  color: var(--ink-2);
}

.stat-value {
  margin-top: 3px;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-tag {
  margin-top: 3px;
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
}

.stat-tag.neutral { color: var(--ink-2); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.stat-tag.good    { color: #0f7a35; background: color-mix(in srgb, #0ca30c 15%, transparent); }
.stat-tag.warn    { color: #b4611a; background: color-mix(in srgb, #eda100 20%, transparent); }

@media (prefers-color-scheme: dark) {
  .stat-tag.good { color: #4bd07a; }
  .stat-tag.warn { color: #e0a437; }
}

/* ---- Time-range presets ------------------------------------------------ */

.range-bar {
  max-width: var(--maxw);
  margin: 14px auto 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.range-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-right: 2px;
}

.range-chip {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--ink-2);
  text-decoration: none;
  background: var(--surface);
}

.range-chip:hover {
  border-color: var(--axis);
}

.range-chip.active {
  background: var(--series-1);
  border-color: var(--series-1);
  color: #fff;
  font-weight: 600;
}

/* ---- Reading guide + per-panel insight --------------------------------- */

.reading-guide {
  max-width: var(--maxw);
  margin: 18px auto 4px;
  padding: 0 24px;
  color: var(--ink-2);
  font-size: 0.9rem;
  line-height: 1.55;
}

.insight {
  margin: 10px 2px 2px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

/* ---- Sample-data / error notice ---------------------------------------- */

.notice {
  max-width: var(--maxw);
  margin: 12px auto 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--series-3);
  border-radius: 8px;
  background: color-mix(in srgb, var(--series-3) 8%, var(--surface));
  color: var(--ink-2);
  font-size: 0.85rem;
}

.notice.error {
  border-left-color: #d03b3b;
  background: color-mix(in srgb, #d03b3b 8%, var(--surface));
}

/* ---- Dashboard grid ----------------------------------------------------- */

.dashboard {
  max-width: var(--maxw);
  margin: 16px auto 0;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 12px;
}

.panel-head { margin-bottom: 6px; }

.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 0.85rem;
}

/* ---- Legend (identity is never colour-alone) --------------------------- */

.legend {
  list-style: none;
  margin: 10px 0 4px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  /* reset button chrome — it behaves as a toggle */
  margin: 0;
  padding: 2px 2px;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 4px;
}

.legend-item:hover {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}

/* Toggled-off series: dimmed, struck through. */
.legend-item.off {
  opacity: 0.45;
}

.legend-item.off .legend-label {
  text-decoration: line-through;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.legend-label {
  color: var(--ink-2);        /* text wears ink, never the series colour */
  font-size: 0.82rem;
}

/* ---- Chart SVG ---------------------------------------------------------- */

.chart {
  display: block;
  width: 100%;
  height: auto;                /* viewBox preserves aspect ratio */
  margin-top: 4px;
}

.chart .grid {
  stroke: var(--grid);
  stroke-width: 1;
}

.chart .zero-line {
  stroke: var(--axis);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.chart .axis-label {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart .axis-label.y { text-anchor: end; }
.chart .axis-label.x { text-anchor: middle; }

.chart .axis-unit {
  fill: var(--muted);
  font-size: 11px;
  text-anchor: end;
}

.chart polyline {
  vector-effect: non-scaling-stroke;
}

/* Faint vertical marker at each ECB rate move. */
.chart .decision-marker {
  stroke: var(--axis);
  stroke-width: 1;
  opacity: 0.28;
}

/* Tint below zero: negative real rates / inverted yield curve. */
.chart .neg-shade {
  fill: #d03b3b;
  opacity: 0.07;
}

/* ---- Hover layer (crosshair, dots, tooltip) ---------------------------- */

.chart .hit {
  fill: transparent;
  pointer-events: all;
}

.chart .hover-layer {
  pointer-events: none;
}

.chart .crosshair {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.chart .hover-dot {
  stroke: var(--surface);
  stroke-width: 1.5;
}

.tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  min-width: 190px;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}

.tooltip .tt-date {
  font-weight: 650;
  margin-bottom: 2px;
}

.tooltip .tt-move {
  color: var(--ink-2);
  font-size: 11px;
  margin-bottom: 4px;
}

.tooltip .tt-group {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 6px 0 2px;
}

.tooltip .tt-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.tooltip .tt-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex: 0 0 auto;
}

.tooltip .tt-label {
  color: var(--ink-2);
  flex: 1 1 auto;
}

.tooltip .tt-val {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

@media (max-width: 560px) {
  .site-head { padding-top: 24px; }
  .brand h1 { font-size: 1.6rem; }
}
