/* Öffentliche Website des Bielefelder Triathlons. Eigenständig, ohne Bibliotheken. */

:root {
    --blau: #005baa;
    --blau-dunkel: #003f7d;
    --blau-hell: #e8f1fa;
    --text: #1f2933;
    --text-leise: #5b6875;
    --linie: #d9e0e7;
    --flaeche: #f5f7f9;
    --weiss: #ffffff;
    --breite: 64rem;
    --radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--weiss);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { color: var(--blau); }
a:hover { color: var(--blau-dunkel); }

h1, h2, h3 { line-height: 1.25; color: var(--blau-dunkel); }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0 0 1rem; }
h2 { font-size: 1.35rem; margin: 2.25rem 0 .75rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }

img { max-width: 100%; height: auto; }

/* Kopf mit Menü */
.kopf { background: var(--blau); color: var(--weiss); position: sticky; top: 0; z-index: 10; }
.kopf-innen {
    max-width: var(--breite);
    margin: 0 auto;
    padding: .5rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1.5rem;
}
.marke {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--weiss);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.2rem;
}
.marke:hover { color: var(--weiss); }
.marke img { border-radius: 50%; width: 44px; height: 44px; }

.menue { display: flex; flex-wrap: wrap; gap: .25rem; margin-left: auto; }
.menue a {
    color: var(--weiss);
    text-decoration: none;
    padding: .4rem .7rem;
    border-radius: var(--radius);
    white-space: nowrap;
}
.menue a:hover { background: rgba(255, 255, 255, .15); color: var(--weiss); }
.menue a[aria-current="page"] { background: var(--weiss); color: var(--blau); }

.menue-schalter { position: absolute; opacity: 0; pointer-events: none; }
.menue-knopf { display: none; }

@media (max-width: 52rem) {
    .menue-knopf {
        display: block;
        margin-left: auto;
        padding: .4rem .8rem;
        border: 1px solid rgba(255, 255, 255, .6);
        border-radius: var(--radius);
        cursor: pointer;
    }
    .menue-knopf::before { content: "☰ "; }
    .menue { display: none; width: 100%; flex-direction: column; padding-bottom: .5rem; }
    .menue-schalter:checked ~ .menue { display: flex; }
    .menue-schalter:focus-visible + .menue-knopf { outline: 2px solid var(--weiss); }
}

/* Inhalt */
.inhalt {
    flex: 1;
    width: 100%;
    max-width: var(--breite);
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}

figure { margin: 1rem 0 1.5rem; }
figure img { display: block; border: 1px solid var(--linie); border-radius: var(--radius); }
figcaption { font-size: .85rem; color: var(--text-leise); margin-top: .35rem; }

/* Knöpfe */
.knoepfe { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.knopf {
    display: inline-block;
    background: var(--blau);
    color: var(--weiss);
    text-decoration: none;
    font-weight: 600;
    padding: .65rem 1.2rem;
    border-radius: var(--radius);
    border: 2px solid var(--blau);
}
.knopf:hover { background: var(--blau-dunkel); border-color: var(--blau-dunkel); color: var(--weiss); }
.knopf.neben { background: transparent; color: var(--blau); }
.knopf.neben:hover { background: var(--blau-hell); color: var(--blau-dunkel); }

/* Startseite */
.buehne {
    display: grid;
    grid-template-columns: 1fr minmax(0, 22rem);
    gap: 2rem;
    align-items: center;
    margin-bottom: 2.5rem;
}
.buehne h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
.buehne-datum { color: var(--blau); font-weight: 600; margin: 0 0 .5rem; }
.plakat { border-radius: var(--radius); box-shadow: 0 4px 20px rgba(0, 0, 0, .12); }
@media (max-width: 44rem) {
    .buehne { grid-template-columns: 1fr; }
    .plakat { max-width: 22rem; }
}

.kacheln {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
}
.kachel {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: 1.1rem 1.25rem;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
}
.kachel strong { color: var(--blau); font-size: 1.1rem; }
.kachel:hover { border-color: var(--blau); color: var(--text); }

/* News */
.neuigkeiten { margin-bottom: 2.5rem; }
.neuigkeiten article { padding: 1rem 0 1.25rem; border-bottom: 1px solid var(--linie); }
.neuigkeiten article:last-child { border-bottom: 0; }
.neuigkeiten h3 { margin: 0 0 .5rem; font-size: 1.2rem; }
.neuigkeiten .datum { margin: 0; font-size: .85rem; color: var(--text-leise); }
.neuigkeiten p { margin: .4rem 0; }

/* Aufzählungen als Tabelle: Begriff links, Erklärung rechts */
table.aufstellung { border-collapse: collapse; margin: .75rem 0 1.25rem; }
table.aufstellung th, table.aufstellung td {
    text-align: left;
    vertical-align: top;
    padding: .35rem 1.25rem .35rem 0;
    border-bottom: 1px solid var(--linie);
}
table.aufstellung th { font-weight: 600; white-space: nowrap; }
@media (max-width: 36rem) {
    table.aufstellung th { white-space: normal; }
}

/* Filter über Listen: Felder nebeneinander, Knöpfe unten bündig */
.filter {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .75rem 1rem;
    padding: 1rem;
    margin: 1rem 0 1.25rem;
    background: var(--flaeche);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
}
.filter label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; font-weight: 600; min-width: 10rem; flex: 1 1 10rem; }
.filter label.breit { flex: 3 1 16rem; }
.filter input, .filter select {
    font: inherit;
    font-weight: 400;
    padding: .5rem .6rem;
    border: 1px solid var(--linie);
    border-radius: 6px;
    background: var(--weiss);
    width: 100%;
}
.filter .knoepfe { margin: 0; }
button.knopf { font: inherit; font-weight: 600; cursor: pointer; }

/* Tabellen */
.tabelle { overflow-x: auto; }
table.liste { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.liste th, table.liste td { text-align: left; vertical-align: top; padding: .5rem .6rem; border-bottom: 1px solid var(--linie); }
table.liste thead th { position: sticky; top: 0; background: var(--blau-hell); white-space: nowrap; }
table.liste thead a { color: var(--blau-dunkel); text-decoration: none; }
table.liste thead a[aria-sort] { text-decoration: underline; }
table.liste td.zahl, table.liste th.zahl { text-align: right; width: 4.5rem; }
table.liste tbody tr:hover { background: var(--flaeche); }
.mitglieder { display: block; font-size: .85rem; color: var(--text-leise); }

/* Ergebnis des Vorjahres zur Startnummer */
/* Die Karte erscheint beim Darüberfahren; am Handy und mit der Tastatur genügt Antippen bzw.
   Tabulator (:focus-within). Ohne JavaScript, wie der Rest der Seite. Sie steht deshalb nicht an
   der Startnummer, sondern fest oben rechts im Bild – sonst liefe sie in den unteren Tabellen-
   zeilen aus dem Bildschirm heraus. Am Handy liegt sie unten über der ganzen Breite. */
.vorjahr { display: inline-block; }
.vorjahr-nr {
    cursor: help;
    color: var(--blau);
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}
.vorjahr-karte {
    position: fixed;
    right: 1.5rem;
    top: 5rem;
    z-index: 20;
    width: min(20rem, calc(50vw - 2rem));
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
    display: none;
    flex-direction: column;
    gap: .2rem;
    padding: .75rem .9rem;
    text-align: left;
    background: var(--weiss);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .15);
    font-size: .88rem;
}
.vorjahr-karte img { margin-top: .4rem; border-radius: 6px; max-width: 100%; height: auto; }
.vorjahr:hover > .vorjahr-karte,
.vorjahr:focus > .vorjahr-karte,
.vorjahr:focus-within > .vorjahr-karte { display: flex; }
@media (max-width: 44rem) {
    .vorjahr-karte {
        top: auto;
        right: .75rem;
        bottom: .75rem;
        left: .75rem;
        width: auto;
        max-height: 60vh;
    }
}

/* Ergebnisse */
.auswahlleiste {
    position: sticky;
    top: 3.75rem;
    z-index: 4;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1rem;
    padding: .6rem 1rem;
    margin-bottom: 1rem;
    background: var(--weiss);
    border: 1px solid var(--linie);
    border-radius: var(--radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
    font-size: .9rem;
}
.auswahlleiste .knopf { padding: .4rem .9rem; }
/* Feste Spaltenbreiten, damit die Tabellen der einzelnen Gruppen untereinander bündig sind. */
table.ergebnisse { table-layout: fixed; min-width: 52rem; }
table.ergebnisse th:nth-child(1) { width: 4rem; }
table.ergebnisse th:nth-child(2) { width: 4rem; }
table.ergebnisse th:nth-child(3) { width: 22%; }
table.ergebnisse th:nth-child(4) { width: 20%; }
table.ergebnisse th:nth-child(6) { width: 5.5rem; }
table.ergebnisse th:nth-child(7) { width: 5.5rem; }
table.ergebnisse th:nth-child(8) { width: 4.5rem; }
table.ergebnisse th:nth-child(9) { width: 2.5rem; }
table.ergebnisse td.zeit, table.bestenliste td.zeit { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.bestenliste { table-layout: fixed; min-width: 46rem; }
table.bestenliste th:nth-child(1) { width: 4rem; }
table.bestenliste th:nth-child(2) { width: 28%; }
table.bestenliste th:nth-child(3) { width: 22%; }
table.bestenliste th:nth-child(5) { width: 5.5rem; }
table.bestenliste th:nth-child(6) { width: 4rem; }
table.bestenliste th:nth-child(7) { width: 4.5rem; }
table.ergebnisse input[type="checkbox"] { width: 1.15rem; height: 1.15rem; }
.balken {
    display: flex;
    width: 100%;
    height: 1rem;
    margin-top: .2rem;
    background: var(--blau-hell);
    border-radius: 4px;
    overflow: hidden;
}
.balken > span { display: block; height: 100%; }
.balken-schwimm { background: #5b8fd9; }
.balken-rad { background: #2f64b5; }
.balken-lauf { background: #173f7a; }
.bestzeit { margin-left: .25rem; }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hilfe { color: var(--text-leise); font-size: .9rem; }

.skala {
    display: block;
    padding-bottom: .35rem;
    background-image: repeating-linear-gradient(to right, var(--linie) 0 1px, transparent 1px var(--raster));
    background-size: 100% .35rem;
    background-repeat: no-repeat;
    background-position: bottom;
}
.vergleich { margin: 1.5rem 0 2rem; }
.vergleich-zeile {
    display: grid;
    grid-template-columns: minmax(8rem, 14rem) 1fr 5rem;
    gap: 1rem;
    align-items: center;
    padding: .35rem 0;
    border-bottom: 1px solid var(--linie);
    font-size: .95rem;
}
.vergleich-zeile .zeit { text-align: right; font-variant-numeric: tabular-nums; }
.person { padding: 1.25rem 0 1.5rem; border-bottom: 1px solid var(--linie); }
.person-kopf { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.person-kopf h2 { margin: 0 0 .25rem; }
.person-kopf p { margin: .2rem 0; }
.zielbild img { max-height: 12rem; border-radius: var(--radius); }
.person table.liste th[scope], .person table.liste tbody th { width: 9rem; }
.person .aktuell { font-weight: 700; }
@media (max-width: 36rem) {
    .vergleich-zeile { grid-template-columns: 1fr 4.5rem; }
    .vergleich-zeile .skala { grid-column: 1 / -1; grid-row: 2; }
}

/* Blättern und Seiten */
.blaettern, .seiten { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin: 1rem 0; }
.seiten a, .seiten strong { padding: .2rem .5rem; }
.seiten strong { background: var(--blau); color: var(--weiss); border-radius: 4px; }

details.erklaerung { margin: 2rem 0 1rem; }
details.erklaerung summary { cursor: pointer; color: var(--blau); font-weight: 600; }
code { background: var(--flaeche); padding: 0 .3rem; border-radius: 4px; font-size: .9em; }

/* Fuß */
.fuss { background: var(--flaeche); border-top: 1px solid var(--linie); font-size: .9rem; color: var(--text-leise); }
.fuss-innen {
    max-width: var(--breite);
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 2rem;
}
.fuss p { margin: 0; }
.fuss nav { display: flex; gap: 1.25rem; margin-left: auto; }
.fuss-logo img { display: block; border-radius: 50%; }

/* Testbetrieb: Vorschau-Link des Meldeformulars aktiv (Web\Kern\Vorschau). */
.testbetrieb { padding: 0.8rem 1rem; border: 2px dashed #b35c00; border-radius: 6px; margin: 0 0 1.2rem; background: #fff4e5; color: #6b3700; }
.testbetrieb a { color: inherit; font-weight: 600; }
