/* ---------- Schrift (liegt auf dem eigenen Server, kein Google) ---------- */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('vendor/fonts/bricolage-grotesque-latin-standard-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('vendor/fonts/bricolage-grotesque-latin-ext-standard-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Farben & Maße ---------- */
:root {
  color-scheme: dark;
  --night: #16142c;        /* Grund */
  --panel: #211e40;        /* Flächen */
  --panel-2: #2b2752;      /* Linien, leere Zellen */
  --ink: #f1eefc;          /* Text */
  --ink-2: #a8a2c9;        /* gedämpfter Text */
  --gold: #f2c14e;         /* Akzent: Nachrichten / Rang */
  --gold-dim: #8a6e2c;

  --display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --text: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.4rem;
  --step-4: clamp(2.6rem, 9vw, 5.2rem);

  --gutter: clamp(16px, 4vw, 40px);
  --measure: 72rem;
}

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

html { background: var(--night); }

body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: var(--text);
  font-size: var(--step-0);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:hover { color: var(--gold); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

code {
  font-family: inherit;
  font-weight: 700;
  color: var(--gold);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: var(--gutter);
  top: 8px;
  background: var(--gold);
  color: var(--night);
  padding: 6px 12px;
  z-index: 10;
}

/* ---------- Kopfzeile ---------- */
.top {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 18px var(--gutter);
}

.brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: var(--step-1);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.search {
  position: relative;
  margin-left: auto;
  width: min(100%, 20rem);
}

.search input {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--panel-2);
  border-radius: 999px;
  padding: 9px 16px;
}
.search input::placeholder { color: var(--ink-2); }
.search input:focus-visible { outline-offset: 1px; }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--panel-2);
  border-radius: 14px;
  z-index: 5;
  max-height: 60vh;
  overflow: auto;
}
.search-results li { padding: 8px 10px; border-radius: 8px; }
.search-results li[aria-selected="true"] { background: var(--panel-2); }
.search-results .who { display: block; font-weight: 700; }
.search-results .where { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.search-results .where a {
  font-size: var(--step--1);
  color: var(--ink-2);
  text-decoration: none;
  border: 1px solid var(--panel-2);
  border-radius: 999px;
  padding: 1px 9px;
}
.search-results .where a:hover { color: var(--gold); border-color: var(--gold-dim); }
.search-results .empty { color: var(--ink-2); }

/* ---------- Seitenrahmen ---------- */
main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 8px var(--gutter) 64px;
}
main:focus { outline: none; }

.hero { padding: clamp(24px, 6vw, 64px) 0 clamp(20px, 4vw, 40px); }

.hero h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: var(--step-4);
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin: 0 0 16px;
  overflow-wrap: anywhere;
}

.hero p {
  margin: 0;
  max-width: 38rem;
  font-size: var(--step-1);
  color: var(--ink-2);
}
.hero p strong { color: var(--ink); font-weight: 700; }

.crumb {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--ink-2);
  text-decoration: none;
}

section { margin-top: clamp(40px, 7vw, 72px); }

h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--step-2);
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.note {
  color: var(--ink-2);
  margin: 0 0 18px;
  max-width: 40rem;
}

.two-col {
  display: grid;
  gap: clamp(40px, 6vw, 64px);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 900px) {
  .two-col { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .two-col > section { margin-top: 0; }
}

/* ---------- Startseite: Anzeigetafel ---------- */
.board { list-style: none; margin: 0; padding: 0; }

.board li + li { border-top: 1px solid var(--panel-2); }

.board a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 24px;
  padding: clamp(16px, 3vw, 28px) 0;
  text-decoration: none;
}

.board .name {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2rem, 7vw, 3.6rem);
  letter-spacing: -0.03em;
  line-height: 1;
  overflow-wrap: anywhere;
}

.board .count {
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--step-2);
  color: var(--gold);
  text-align: right;
}

.board .meta {
  grid-column: 1 / -1;
  color: var(--ink-2);
}

.board a:hover .name { color: var(--gold); }

/* ---------- Rangliste (das Herzstück) ---------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
}

.tabs button, .range button, .more {
  font: inherit;
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--panel-2);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.tabs button[aria-pressed="true"], .range button[aria-pressed="true"] {
  color: var(--night);
  background: var(--gold);
  border-color: var(--gold);
}
.tabs button:hover:not([aria-pressed="true"]),
.range button:hover:not([aria-pressed="true"]),
.more:hover { color: var(--ink); border-color: var(--ink-2); }

.ranking { list-style: none; margin: 0; padding: 0; }

.ranking li {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 14px;
  padding: 7px 0;
}

.ranking .pos {
  font-family: var(--display);
  font-weight: 800;
  font-size: var(--step-2);
  line-height: 1;
  color: var(--ink-2);
  text-align: right;
}
.ranking li:nth-child(-n+3) .pos { color: var(--gold); font-size: var(--step-3); }

.ranking .who { min-width: 0; }
.ranking .who a {
  display: block;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ranking li:nth-child(-n+3) .who a { font-size: var(--step-1); }

.ranking .bar {
  height: 4px;
  margin-top: 6px;
  border-radius: 0 4px 4px 0;
  background: var(--gold);
  min-width: 2px;
}
.ranking .bar.muted { background: var(--ink-2); opacity: 0.55; }

.ranking .val {
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.ranking.compact li { grid-template-columns: minmax(0, 1fr) auto; }
.ranking.compact .who span { font-weight: 700; }

.more { margin-top: 14px; }

/* ---------- Diagramme ---------- */
.range {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.chart-box {
  position: relative;
  height: clamp(220px, 34vw, 320px);
}

.empty-state {
  color: var(--ink-2);
  border: 1px dashed var(--panel-2);
  border-radius: 12px;
  padding: 24px;
}

/* Heatmap: Wochentag × Uhrzeit */
.heat {
  display: grid;
  grid-template-columns: 2rem repeat(24, minmax(0, 1fr));
  gap: 3px;
}
.heat .day, .heat .hour {
  font-size: 0.75rem;
  color: var(--ink-2);
  line-height: 1;
}
.heat .day { align-self: center; }
.heat .hour { text-align: center; padding-top: 6px; }
.heat .cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--panel-2);
  border: 0;
  padding: 0;
  cursor: default;
}
.heat .cell:focus-visible { outline-offset: 1px; }

.heat-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: var(--step--1);
  color: var(--ink-2);
}
.heat-legend .ramp {
  width: 140px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #184f95, #3987e5, #86b6ef, #cde2fb);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  font-size: var(--step--1);
}
.legend li { display: flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

/* ---------- Profil ---------- */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 24px;
  margin: 0;
}
.facts div { border-left: 2px solid var(--panel-2); padding-left: 14px; }
.facts dt { color: var(--ink-2); font-size: var(--step--1); }
.facts dd {
  margin: 2px 0 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--step-2);
}

.first-msg {
  margin: 0;
  padding: 18px 22px;
  background: var(--panel);
  border-radius: 4px 18px 18px 18px;
  max-width: 38rem;
}
.first-msg p { margin: 0 0 8px; font-size: var(--step-1); overflow-wrap: anywhere; }
.first-msg footer { color: var(--ink-2); font-size: var(--step--1); }

.chips { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 0; }
.chips a {
  display: inline-block;
  border: 1px solid var(--panel-2);
  border-radius: 999px;
  padding: 6px 14px;
  text-decoration: none;
}
.chips a:hover { border-color: var(--gold-dim); }
.chips span { color: var(--ink-2); margin-left: 6px; }

/* ---------- Tooltip, Fuß, Zustände ---------- */
.tooltip {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  background: var(--ink);
  color: var(--night);
  font-size: var(--step--1);
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
}

.foot {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 32px var(--gutter) 48px;
  border-top: 1px solid var(--panel-2);
  color: var(--ink-2);
  font-size: var(--step--1);
}
.foot p { margin: 0 0 8px; max-width: 46rem; }

.status { padding: 64px 0; color: var(--ink-2); font-size: var(--step-1); }
.status a { color: var(--gold); }

@media (max-width: 560px) {
  .top { flex-wrap: wrap; }
  .search { width: 100%; margin-left: 0; }
  .ranking li { grid-template-columns: 2.4rem minmax(0, 1fr) auto; column-gap: 10px; }
  .heat { grid-template-columns: 1.6rem repeat(24, minmax(0, 1fr)); gap: 2px; }
  .heat .hour:not(.major) { visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
