/* =============================================================
   BikePass Systemstatus — status.css
   Token-Subset aus dev/pages designkit/tokens.css (DESIGNKIT v16):
   Fließtext Inter (Variable, 400–600), Display Bebas Neue,
   Teal-Palette, Radii/Shadows/Motion wie Hauptseite.
   Fonts self-hosted (DSGVO) — kein Google-Fonts-Remote.
   ============================================================= */

@font-face {
  font-family: 'Bebas Neue';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/bebas-neue-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600; /* Variable Font: eine Datei deckt 400/500/600 */
  font-display: swap;
  src: url('/assets/fonts/inter-latin-var.woff2') format('woff2');
}

:root {
  --brand-teal:       #36D0BC;
  --brand-teal-hover: #14b8a6;
  --brand-teal-deep:  #0d9488;
  --brand-teal-light: #e6f7f5;
  --brand-ink:        #0f172a;

  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;

  --bg-dark: #050a14;

  --status-fail:      #ef4444;
  --status-fail-deep: #b91c1c;
  --status-warn:      #f59e0b;

  --mesh-teal: rgba(54, 208, 188, 0.18);
  --mesh-mint: rgba(167, 243, 208, 0.22);

  --font-display: 'Bebas Neue', Impact, sans-serif;
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-card:    1.5rem;
  --radius-section: 2rem;
  --radius-pill:    9999px;

  --shadow-card:     0 1px 2px rgba(15,23,42,0.04), 0 18px 36px -20px rgba(15,23,42,0.10);
  --shadow-floating: 0 18px 36px -14px rgba(15,23,42,0.22);

  --ease-out-quart: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-base: 250ms;

  --bar-h: 42px;
  --bar-radius: 5px;
}

/* ---------- Basis ---------- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--brand-ink);
  background: #fff;
  overflow-x: clip;
  font-feature-settings: 'tnum' 0;
}

h1, h2, p { margin: 0; }
img { display: block; }
a { color: inherit; }

::selection { background: var(--brand-teal); color: var(--bg-dark); }

:focus-visible {
  outline: 2px solid var(--brand-teal-deep);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Dezente Marken-Aurora — fix, nie scrollend (GPU-schonend) */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 42% 34% at 18% -6%, var(--mesh-teal), transparent 68%),
    radial-gradient(ellipse 36% 30% at 86% 2%, var(--mesh-mint), transparent 70%);
}

.page {
  position: relative;
  z-index: 1;
  max-width: 62rem;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem) clamp(3rem, 7vw, 5.5rem);
}

/* ---------- Masthead ---------- */

.masthead { text-align: center; padding-top: clamp(0.5rem, 2vw, 1.5rem); }

.masthead-top {
  display: flex;
  justify-content: center;
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { height: 28px; width: auto; }

.h-display {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3.4rem, 9vw, 5.5rem);
  line-height: 0.96;
  letter-spacing: 0.005em;
  margin: 0 0 1.4rem;
}

/* ---------- Live-Badge (Doppelrand-Pill) ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.62rem 1.25rem;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 1px solid var(--slate-200);
  box-shadow: inset 0 0 0 4px var(--slate-50), var(--shadow-card);
  font-size: 0.95rem;
  font-weight: 600;
  transition: border-color 450ms var(--ease-out-quart);
}
.badge-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--slate-300);
  position: relative;
}
.badge-dot::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0;
}

.badge--ok       { border-color: rgba(54, 208, 188, 0.55); color: var(--brand-teal-deep); }
.badge--ok .badge-dot       { background: var(--brand-teal); color: var(--brand-teal); }
.badge--fail     { border-color: rgba(239, 68, 68, 0.45); color: var(--status-fail-deep); }
.badge--fail .badge-dot     { background: var(--status-fail); color: var(--status-fail); }
.badge--stale    { border-color: rgba(245, 158, 11, 0.5); color: #92400e; }
.badge--stale .badge-dot    { background: var(--status-warn); color: var(--status-warn); }
.badge--loading  { color: var(--slate-500); }

@keyframes dot-pulse {
  0%   { transform: scale(0.6); opacity: 0.8; }
  70%  { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}
.badge--ok .badge-dot::after,
.badge--fail .badge-dot::after { animation: dot-pulse 2.4s var(--ease-out-quart) infinite; }

.updated {
  margin-top: 0.9rem;
  font-size: 0.8rem;
  color: var(--slate-500);
  font-variant-numeric: tabular-nums;
}

/* ---------- Fehler-Banner ---------- */

/* [hidden] muss die display-Regel schlagen — Author-CSS gewinnt sonst
   gegen das UA-Stylesheet und das Banner bliebe trotz hidden sichtbar. */
.error-banner[hidden] { display: none; }

.error-banner {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 1.75rem 0 0;
  padding: 1rem 1.3rem;
  border-radius: var(--radius-card);
  background: #fef2f2;
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--status-fail-deep);
  font-size: 0.92rem;
}

/* ---------- Panels (Double-Bezel: Shell + Core) ---------- */

main { margin-top: clamp(2.5rem, 6vw, 4rem); }

/* v1.2.0: bewusst OHNE Karten-Einfassung (Chris) — die Bereiche stehen
   luftig auf der weißen Grundfläche, Gliederung über Whitespace + Bebas-H2. */
.panel { margin-bottom: clamp(2.75rem, 6vw, 4rem); }

.panel-head { margin-bottom: clamp(1.4rem, 3vw, 1.9rem); }
.panel-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.7rem, 3.4vw, 2.15rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
}
.panel-sub {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  color: var(--slate-500);
  max-width: 42ch;
}

/* ---------- Reihen + Balken ---------- */

.row { margin-bottom: 1.5rem; }
.row:last-of-type { margin-bottom: 0.65rem; }

.row-head {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin-bottom: 0.6rem;
}
.row-dot {
  align-self: center;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--slate-300);
  flex: none;
}
.row-dot.is-ok   { background: var(--brand-teal); }
.row-dot.is-fail { background: var(--status-fail); }
.row-label { font-weight: 600; font-size: 0.95rem; }
.row-uptime {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-600);
  font-variant-numeric: tabular-nums;
}
.row-uptime small { font-weight: 400; color: var(--slate-400); font-size: 0.72rem; }

.track {
  display: flex;
  gap: clamp(2px, 0.45vw, 4px);
  min-height: var(--bar-h);
}

.bar {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  flex: 1 1 0;
  min-width: 0;
  height: var(--bar-h);
  border-radius: var(--bar-radius);
  background: var(--slate-200);
  cursor: default;
  position: relative;
  transform-origin: bottom center;
  transition: transform var(--dur-base) var(--ease-out-quart), filter var(--dur-base) var(--ease-out-quart);
}
.bar--ok {
  background: linear-gradient(180deg, var(--brand-teal) 0%, #22b9a5 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.bar--fail {
  background: linear-gradient(180deg, var(--status-fail) 0%, #dc2626 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.bar--nodata { background: var(--slate-200); }

.bar:hover, .bar:focus-visible { transform: scaleY(1.1); filter: brightness(1.05); z-index: 2; }

/* Skeleton beim Laden */
@keyframes shimmer { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.track.is-loading .bar { animation: shimmer 1.6s ease-in-out infinite; }
.track.is-loading .bar:nth-child(odd) { animation-delay: 0.35s; }

/* Balken-Einzug beim ersten Render (gestaffelt via --i) */
@keyframes bar-in {
  from { transform: scaleY(0.25); opacity: 0; }
  to   { transform: scaleY(1); opacity: 1; }
}
.track.is-fresh .bar {
  animation: bar-in 620ms var(--ease-out-quart) both;
  animation-delay: calc(var(--i, 0) * 14ms);
}

/* ---------- Tooltip (CSS, Hover + Fokus) ---------- */

.bar::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, 4px);
  background: var(--bg-dark);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.45;
  white-space: pre;
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  box-shadow: var(--shadow-floating);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 5;
  transition: opacity var(--dur-base) var(--ease-out-quart), transform var(--dur-base) var(--ease-out-quart);
}
.bar:hover::after, .bar:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
/* Randbalken: Tooltip nicht aus dem Panel schieben */
.bar.tip-start::after { left: 0; transform: translate(0, 4px); }
.bar.tip-start:hover::after, .bar.tip-start:focus-visible::after { transform: translate(0, 0); }
.bar.tip-end::after { left: auto; right: 0; transform: translate(0, 4px); }
.bar.tip-end:hover::after, .bar.tip-end:focus-visible::after { transform: translate(0, 0); }

/* ---------- Achse + Legende + Footer ---------- */

.axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.7rem;
  font-size: 0.72rem;
  color: var(--slate-400);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem 1.6rem;
  margin-top: clamp(1.5rem, 4vw, 2.25rem);
  font-size: 0.82rem;
  color: var(--slate-500);
}
.legend-item { display: inline-flex; align-items: center; gap: 0.45rem; }
.chip {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  flex: none;
}
.chip--ok     { background: linear-gradient(180deg, var(--brand-teal), #22b9a5); }
.chip--fail   { background: linear-gradient(180deg, var(--status-fail), #dc2626); }
.chip--nodata { background: var(--slate-200); }

.foot {
  margin-top: clamp(3rem, 7vw, 4.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--slate-200);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--slate-500);
}
.foot a {
  color: var(--slate-600);
  text-decoration: none;
  border-bottom: 1px solid var(--slate-300);
  transition: color var(--dur-base) var(--ease-out-quart), border-color var(--dur-base) var(--ease-out-quart);
}
.foot a:hover { color: var(--brand-teal-deep); border-color: var(--brand-teal); }
.foot nav { display: inline-flex; gap: 0.55rem; }

/* ---------- Entrance-Reveals ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); filter: blur(5px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}
.reveal { animation: rise 820ms var(--ease-out-quart) both; animation-delay: var(--d, 0ms); }
/* Staffelung in CSS statt style-Attributen — CSP läuft ohne 'unsafe-inline' */
.masthead.reveal          { --d: 0ms; }
main .panel:nth-of-type(1) { --d: 90ms; }
main .panel:nth-of-type(2) { --d: 180ms; }
main .panel:nth-of-type(3) { --d: 270ms; }
.legend.reveal            { --d: 360ms; }
.foot.reveal              { --d: 430ms; }

/* ---------- Reduced Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .reveal, .track.is-fresh .bar, .track.is-loading .bar,
  .badge--ok .badge-dot::after, .badge--fail .badge-dot::after { animation: none; }
  .bar { transition: none; }
  .bar:hover, .bar:focus-visible { transform: none; }
}

/* ---------- Mobil ---------- */

@media (max-width: 640px) {
  :root { --bar-h: 34px; --bar-radius: 3px; }
  .track { gap: 2px; }
  .foot { flex-direction: column; gap: 0.5rem; }
  .masthead-top { margin-bottom: 2.2rem; }
}
