/* nirs4all-cockpit — dashboard skin. Warm-paper nirs4all.org identity with the
   animated spectral "wave" hero. Vanilla, no build. Status is shown with small
   LEDs + glyphs, never verbose capsules; numbers link to their source. */

:root {
  --paper: #faf7f0;
  --paper-2: #f1ebdd;
  --grid: #ece5d6;
  --surface: #ffffff;
  --surface-2: #fbfaf6;

  --text: #1b2230;
  --text-2: #46505f;
  --muted: #8a93a2;
  --line: #e7e0d2;
  --line-2: #efe9dd;

  --teal: #0d9488;
  --teal-d: #0f766e;
  --teal-l: #2dd4bf;
  --cyan: #06b6d4;
  --cyan-d: #0891b2;
  --indigo: #4f46e5;
  --amber: #d97706;
  --accent: var(--teal);

  --green: #10b981;
  --stale: #e0950c;
  --pending: #8b5cf6;
  --missing: #b9c0cb;
  --broken: #e11d48;
  --unknown: #06b6d4;
  --excluded: #cabf9e;

  --radius: 16px;
  --radius-sm: 11px;
  --radius-xs: 8px;
  --shadow: 0 4px 16px -6px rgba(40, 33, 16, 0.10), 0 1px 3px -1px rgba(40, 33, 16, 0.06);
  --shadow-lg: 0 24px 48px -20px rgba(40, 33, 16, 0.18), 0 6px 14px -8px rgba(40, 33, 16, 0.10);

  --display: "IBM Plex Sans", "Inter", system-ui, sans-serif;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--teal-d); }

/* ============================================================ wave hero === */

.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 36px 0 104px;
  background:
    radial-gradient(900px 360px at 84% -10%, rgba(13, 148, 136, 0.10), transparent 60%),
    radial-gradient(760px 320px at -4% 0%, rgba(79, 70, 229, 0.07), transparent 55%),
    var(--paper);
  border-bottom: 1px solid var(--line);
}
.hero-dots {
  position: absolute; inset: 0; z-index: 0; opacity: 0.55;
  background-image: radial-gradient(rgba(20, 50, 48, 0.10) 1px, transparent 1px);
  background-size: 50px 50px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 35%, black 30%, transparent 90%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 35%, black 30%, transparent 90%);
}
.hero-grain {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0.22; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.3  0 0 0 0 0.25  0 0 0 0 0.15  0 0 0 .35 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
}
.hero-spectra {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: calc(100% - 48px); max-width: 1180px; height: 80%; z-index: 0; pointer-events: none;
}
.spectrum-line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.wave-dot { fill: currentColor; filter: drop-shadow(0 0 6px currentColor); }
.wave-connector { fill: none; stroke-dasharray: 1.5 4; stroke-linecap: round; mix-blend-mode: multiply; }

.hero-inner {
  position: relative; z-index: 2;
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
  display: grid; grid-template-columns: 1fr auto; gap: 26px 40px; align-items: center;
}
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--display); font-weight: 700; letter-spacing: -0.025em;
  font-size: 2.1rem; color: var(--text);
}
.brand .dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--teal-l), var(--teal-d));
  box-shadow: 0 0 0 5px rgba(13, 148, 136, 0.13), 0 0 14px rgba(13, 148, 136, 0.5);
}
.brand b { color: var(--teal-d); }
.tagline { margin: 9px 0 0; color: var(--text-2); max-width: 50ch; font-size: 0.97rem; }
.meta {
  margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px 16px;
  font-size: 0.78rem; color: var(--muted); font-family: var(--mono);
}
.meta a { text-decoration: none; }
.meta a:hover { text-decoration: underline; }

/* X/Y score dials */
.scores { display: flex; gap: 16px; }
.score {
  display: grid; grid-template-columns: 62px 1fr; align-items: center; gap: 13px;
  background: rgba(255, 255, 255, 0.72); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 20px 14px 14px; box-shadow: var(--shadow); min-width: 176px;
}
.dial {
  position: relative; width: 62px; height: 62px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--c, var(--teal)) calc(var(--p, 0) * 1%), var(--paper-2) 0);
}
.dial::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.dial span { position: relative; font-family: var(--mono); font-weight: 700; font-size: 0.86rem; }
.score .num { font-family: var(--mono); font-weight: 700; font-size: 1.32rem; letter-spacing: -0.02em; }
.score .cap { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }

.wl-strip {
  position: relative; z-index: 2;
  max-width: 1180px; margin: 34px auto 0; padding: 0 28px;
  display: flex; align-items: flex-end; justify-content: space-between;
  font-family: var(--mono); font-size: 0.66rem; color: var(--teal-d);
  letter-spacing: 0.1em; font-weight: 500;
}
.wl-strip span { position: relative; padding-bottom: 7px; }
.wl-strip span::after {
  content: ""; position: absolute; bottom: 0; left: 50%; width: 1px; height: 6px;
  background: rgba(13, 118, 110, 0.45); transform: translateX(-50%);
}
.wl-strip span:first-child, .wl-strip span:last-child { color: var(--text); font-weight: 600; }

/* ================================================================ body === */

.wrap { max-width: 1180px; margin: 0 auto; padding: 30px 24px 72px; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 16px; top: 16px; background: var(--surface); padding: 8px 14px; border-radius: var(--radius-xs); z-index: 10; }

/* small chip rows (summary + totals) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 0.78rem; box-shadow: var(--shadow);
}
.chip .count { font-family: var(--mono); font-weight: 700; }
.chip .muted { color: var(--muted); }

section.block { margin: 0 0 34px; }
.section-h {
  font-family: var(--display); font-weight: 600; font-size: 1.04rem; letter-spacing: -0.01em;
  margin: 0 0 13px; display: flex; align-items: baseline; gap: 10px;
}
.section-h .muted { font-family: var(--font); font-weight: 400; font-size: 0.79rem; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ============================================================== LEDs ===== */

.led {
  position: relative; display: inline-block;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--st, var(--missing));
  vertical-align: middle;
}
.led--green   { --st: var(--green);   box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 16%, transparent), 0 0 8px color-mix(in srgb, var(--green) 75%, transparent); }
.led--stale   { --st: var(--stale);   box-shadow: 0 0 0 2px color-mix(in srgb, var(--stale) 16%, transparent), 0 0 7px color-mix(in srgb, var(--stale) 60%, transparent); }
.led--pending { --st: var(--pending); box-shadow: 0 0 0 2px color-mix(in srgb, var(--pending) 18%, transparent), 0 0 7px color-mix(in srgb, var(--pending) 55%, transparent); animation: led-pulse 2s ease-in-out infinite; }
.led--unknown { --st: var(--unknown); box-shadow: 0 0 0 2px color-mix(in srgb, var(--unknown) 16%, transparent); }
.led--broken  { --st: var(--broken);  box-shadow: 0 0 0 2px color-mix(in srgb, var(--broken) 18%, transparent), 0 0 8px color-mix(in srgb, var(--broken) 70%, transparent); animation: led-pulse 1.6s ease-in-out infinite; }
.led--missing { background: transparent; border: 1.5px solid var(--missing); box-shadow: none; }
.led--excluded { background: var(--excluded); opacity: 0.6; }
.led--none { background: none; }
.led--none::after { content: "·"; position: absolute; inset: 0; color: var(--line); text-align: center; line-height: 9px; }

@keyframes led-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ============================================================ matrix ===== */

.mx-wrap { overflow-x: auto; }
.mx { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.85rem; }
.mx thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2);
  padding: 9px 6px; border-bottom: 1px solid var(--line); color: var(--muted);
  font-weight: 600; text-align: center; white-space: nowrap;
}
.mx thead th.h-pkg, .mx thead th.h-ver { text-align: left; padding-left: 16px; font-family: var(--display); }
.mx thead th.reg-head { vertical-align: bottom; padding-bottom: 8px; }
.mx thead .reg-ico { width: 18px; height: 18px; display: block; margin: 0 auto; }
.mx thead .reg-ico svg { width: 100%; height: 100%; display: block; fill: currentColor; }
.mx thead .reg-name { display: block; margin-top: 4px; font-size: 0.6rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; color: var(--muted); font-family: var(--display); }

.mx tbody td, .mx tbody th { padding: 7px 6px; border-bottom: 1px solid var(--line-2); text-align: center; }
.mx tbody tr:last-child td, .mx tbody tr:last-child th { border-bottom: none; }
.mx tbody tr:hover td, .mx tbody tr:hover th { background: color-mix(in srgb, var(--teal) 4%, var(--surface)); }
.mx .c-pkg { text-align: left; padding-left: 12px; }
.mx .c-pkg a { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.mx .c-pkg a:hover .pkg-name { color: var(--teal-d); }
.pkg-name { font-family: var(--display); font-weight: 600; }
.pkg-flag { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 32%, transparent); border-radius: 5px; padding: 0 5px; }
.mx .c-ver { text-align: left; font-family: var(--mono); font-size: 0.78rem; color: var(--text-2); }
.mx .c-led a, .mx .c-led span.led { cursor: default; }
.mx .c-led a { display: inline-block; line-height: 0; }
.mx .c-led a:hover .led { transform: scale(1.25); transition: transform 0.12s ease; }
.led-multi { position: relative; }
.led-multi .badge-n {
  position: absolute; bottom: -7px; right: -12px;
  font-family: var(--mono); font-size: 0.58rem; font-weight: 700; line-height: 1;
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 3px;
}

/* legend = the status totals: LED + count + label */
.legend { display: flex; flex-wrap: wrap; gap: 9px; margin: 2px 0 14px; }
.leg {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px 4px 9px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow);
}
.leg-n { font-family: var(--mono); font-weight: 700; font-size: 0.84rem; }
.leg-l { color: var(--muted); font-size: 0.74rem; }

/* ========================================================== downloads ==== */

.dlchart { padding: 18px 20px; }

/* period selector (segmented control) */
.dlwin { display: inline-flex; gap: 4px; padding: 3px; background: var(--paper-2); border-radius: 999px; margin-bottom: 16px; }
.dlwin-btn { border: none; background: none; font: inherit; font-size: 0.76rem; color: var(--text-2); padding: 4px 13px; border-radius: 999px; cursor: pointer; transition: background 0.15s, color 0.15s; }
.dlwin-btn:hover { color: var(--text); }
.dlwin-btn.on { background: var(--surface); color: var(--teal-d); font-weight: 600; box-shadow: var(--shadow); }

.langcell { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.lang-ico { width: 14px; height: 14px; display: inline-block; }
.lang-ico svg { width: 100%; height: 100%; display: block; fill: currentColor; }

.dlrow { display: grid; grid-template-columns: 168px 1fr 86px; align-items: center; gap: 14px; padding: 6px 0; }
.dlrow .dl-name { font-family: var(--mono); font-size: 0.78rem; text-decoration: none; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlrow .dl-name:hover { color: var(--teal-d); }
.dlbar { height: 15px; border-radius: 8px; background: var(--paper-2); display: flex; overflow: hidden; transform-origin: left; animation: growx 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes growx { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.dlseg { height: 100%; transition: opacity 0.15s ease; }
.dlseg:hover { opacity: 0.78; }
.dlrow .dl-tot { font-family: var(--mono); font-size: 0.8rem; font-weight: 700; text-align: right; color: var(--text); }
.dl-axis { display: flex; gap: 16px; margin-top: 8px; font-size: 0.72rem; color: var(--muted); flex-wrap: wrap; }
.dl-axis span { display: inline-flex; align-items: center; gap: 6px; }
.dl-swatch { width: 10px; height: 10px; border-radius: 3px; }

/* ============================================================= tables ==== */

.panels { display: grid; grid-template-columns: 1fr; gap: 18px; }
.panel { padding: 16px 20px; }
.stats { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.stats th, .stats td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); text-align: right; white-space: nowrap; }
.stats tbody tr:last-child th, .stats tbody tr:last-child td { border-bottom: none; }
.stats tbody tr:hover td, .stats tbody tr:hover th { background: color-mix(in srgb, var(--teal) 4%, var(--surface)); }
.stats thead th { color: var(--muted); font-family: var(--display); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stats .s-repo { text-align: left; font-family: var(--mono); }
.stats .s-repo a { text-decoration: none; color: var(--text); }
.stats .s-repo a:hover { color: var(--teal-d); }
.stats .num { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--text-2); }
.stats a.num { color: var(--text-2); text-decoration: none; border-bottom: 1px dotted var(--line); }
.stats a.num:hover { color: var(--teal-d); border-bottom-color: var(--teal); }
.bar { position: relative; height: 7px; border-radius: 999px; background: var(--paper-2); overflow: hidden; min-width: 56px; display: inline-block; vertical-align: middle; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: linear-gradient(90deg, var(--teal), var(--cyan)); }
.conclusion { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.conclusion[data-ok="success"] { color: var(--teal-d); background: color-mix(in srgb, var(--green) 13%, var(--surface)); }
.conclusion[data-ok="failure"] { color: var(--broken); background: color-mix(in srgb, var(--broken) 11%, var(--surface)); }
.conclusion[data-ok="other"] { color: var(--muted); background: var(--paper-2); }

.admin .card + .card { margin-top: 16px; }
.admin-note { font-size: 0.78rem; color: var(--muted); }

/* pages visits (public · GoatCounter) */
.vchips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.vchip { display: flex; flex-direction: column; gap: 2px; padding: 13px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.vchip__n { font-family: var(--mono); font-weight: 700; font-size: 1.5rem; line-height: 1.1; color: var(--text); letter-spacing: -0.02em; }
.vchip__l { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
/* Sentry "Errors" panel */
.sentry-head { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.sentry-stat { display: flex; flex-direction: column; gap: 2px; padding: 13px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.sentry-stat__n { font-family: var(--mono); font-weight: 700; font-size: 1.5rem; line-height: 1.1; color: var(--text); letter-spacing: -0.02em; }
.sentry-stat__l { font-size: 0.71rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.sentry-stat--alert { border-color: color-mix(in srgb, var(--broken) 42%, var(--line)); background: color-mix(in srgb, var(--broken) 7%, var(--surface-2)); }
.sentry-stat--alert .sentry-stat__n { color: var(--broken); }
@media (max-width: 620px) { .sentry-head { grid-template-columns: repeat(2, 1fr); } }
.vcap { font-size: 0.78rem; color: var(--muted); margin: 18px 0 11px; }
@media (max-width: 620px) {
  .vchips { grid-template-columns: repeat(2, 1fr); }
}
.kv { padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.kv:last-child { border-bottom: none; }
.kv__head { display: flex; justify-content: space-between; gap: 10px; }
.kv__name { font-family: var(--mono); font-size: 0.78rem; }

/* tooltip */
.tooltip {
  position: fixed; z-index: 60; pointer-events: none;
  background: #20262f; color: #f3f0e7; font-size: 0.74rem; line-height: 1.45;
  padding: 8px 11px; border-radius: var(--radius-xs); box-shadow: var(--shadow-lg);
  max-width: 280px; transform: translate(-50%, -112%);
}
.tooltip b { color: #fff; }
.tooltip .tt-row { display: flex; gap: 8px; align-items: center; }
.tooltip .led { width: 9px; height: 9px; box-shadow: none; }

.error { margin: 16px 0; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, var(--broken) 30%, var(--line)); background: color-mix(in srgb, var(--broken) 8%, var(--surface)); color: var(--broken); }
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.78rem; font-family: var(--mono); }
.foot a { text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
section.block, .chips { animation: rise 0.5s ease both; }

@media (prefers-reduced-motion: reduce) { *, .led--broken { animation: none !important; scroll-behavior: auto; } }
@media (max-width: 820px) {
  .hero-inner { grid-template-columns: 1fr; }
  .scores { flex-wrap: wrap; }
  .brand { font-size: 1.7rem; }
}
