/* Kontaktkarte + Pflichtseiten. Bewusst klein und ohne Framework:
   der Server hat keinen Build-Schritt, alles hier ist handgeschrieben.
   Designsprache identisch zu root/index.html (dort inline dupliziert). */

:root {
    --bg:        #f4f5f7;
    --card:      #ffffff;
    --fg:        #14161a;
    --fg-muted:  #5b6270;
    --line:      #e2e5ea;
    --accent:    #1f6feb;
    --accent-fg: #ffffff;
    --chip:      #eef1f6;
    --radius:    16px;
    --shadow:    0 1px 2px rgb(0 0 0 / .05), 0 8px 24px rgb(20 22 26 / .06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:       #0f1115;
        --card:     #171a20;
        --fg:       #e9ecf1;
        --fg-muted: #9aa3b2;
        --line:     #272c36;
        --accent:   #4d8ef7;
        --chip:     #212630;
        --shadow:   0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .35);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: clamp(1rem, 4vw, 3rem) 1rem;
    background: var(--bg);
    color: var(--fg);
    font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

.card {
    max-width: 34rem;
    margin: 0 auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(1.25rem, 5vw, 2rem);
}

/* ── Kopf ─────────────────────────────────────────────────────────────────── */

.head { text-align: center; }

.avatar {
    width: 128px; height: 128px;
    border-radius: 50%;
    background: var(--chip);          /* runder Badge — der Avatar ist bewusst
                                         kein Foto, das zeigt die Form auch */
    display: block;
    margin: 0 auto .75rem;
    object-fit: cover;
}

h1 { font-size: clamp(1.35rem, 5.5vw, 1.6rem); line-height: 1.25; margin: 0 0 .25rem; letter-spacing: -.01em; }
.headline { margin: 0; font-weight: 500; color: var(--fg); }
.location { margin: .15rem 0 0; color: var(--fg-muted); font-size: .95rem; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: .5rem;
    margin: 1.25rem 0 0;
}

.btn {
    display: flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .7rem 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    color: var(--fg);
    font: inherit; font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
/* Symbole erben Farbe und Größe von der Schaltfläche — dadurch stimmen sie in
   Dark Mode und bei geänderter Schriftgröße automatisch. */
.ico {
    width: 1.15em; height: 1.15em; flex: 0 0 auto;
    fill: none; stroke: currentColor; stroke-width: 1.75;
    stroke-linecap: round; stroke-linejoin: round;
}

.btn:hover  { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn-primary {
    grid-column: 1 / -1;
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
}
.btn-primary:hover { color: var(--accent-fg); filter: brightness(1.08); }

/* Beschriftungen in zwei Längen (siehe bi_len() in lib/render.php). Standard
   ist die lange Fassung; unterhalb von 26rem (416 px) würde sie neben dem
   Symbol umbrechen, deshalb übernimmt dort die kurze. Der Wert ist gemessen,
   nicht geraten: bei 375 px bricht „Zu meinen Kontakten hinzufügen“ um, bei
   420 px passt es. Reine CSS-Lösung — reagiert sofort beim Drehen des Geräts
   und funktioniert ohne JavaScript. */
.lbl-short { display: none; }
@media (max-width: 26rem) {
    .lbl-long  { display: none; }
    .lbl-short { display: inline; }
}

/* ── Abschnitte ───────────────────────────────────────────────────────────── */

section { margin-top: 1.75rem; }
h2 {
    font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--fg-muted); margin: 0 0 .6rem; font-weight: 600;
}
p { margin: 0 0 .8rem; }
p:last-child { margin-bottom: 0; }

.roles { list-style: none; margin: 0; padding: 0; }
.roles li { padding: .55rem 0; border-top: 1px solid var(--line); }
.roles li:first-child { border-top: 0; padding-top: 0; }
.roles b { font-weight: 600; }
.roles span { display: block; color: var(--fg-muted); font-size: .92rem; }
/* Der Organisationsname ist ein Link, soll aber die Zeile nicht dominieren:
   Farbe wie der Rest, nur dezent unterstrichen. */
.roles a {
    color: inherit; text-decoration: underline;
    text-underline-offset: 2px; text-decoration-color: var(--line);
}
.roles a:hover { color: var(--accent); text-decoration-color: currentColor; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.chips li {
    background: var(--chip); border-radius: 999px;
    padding: .28rem .7rem; font-size: .88rem;
}

.facts { margin: 0; padding-left: 1.15rem; color: var(--fg-muted); }
.facts li { margin: .25rem 0; }

/* Hervorgehobene Zeile für die entsperrte Telefonnummer. */
.private {
    display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap;
    background: var(--chip); border-radius: 12px; padding: .6rem .85rem;
}
.private .lbl { color: var(--fg-muted); font-size: .85rem; }
.private a { color: var(--fg); font-weight: 600; text-decoration: none; }

/* Sichtbarer Hinweis auf noch fehlende Inhalte (z. B. Anschrift). */
.todo {
    border: 1px dashed var(--accent); border-radius: 12px;
    padding: .6rem .85rem; color: var(--fg-muted); font-size: .9rem;
}

/* ── Fuß ──────────────────────────────────────────────────────────────────── */

footer {
    margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line);
    display: flex; flex-wrap: wrap; gap: .5rem 1rem;
    align-items: center; justify-content: space-between;
    font-size: .88rem; color: var(--fg-muted);
}
footer a { color: var(--fg-muted); }
footer nav { display: flex; gap: 1rem; }

.langtoggle { display: flex; gap: .25rem; }
.langtoggle button {
    border: 1px solid var(--line); background: var(--card); color: var(--fg-muted);
    border-radius: 8px; padding: .2rem .55rem; font: inherit; cursor: pointer;
}
.langtoggle button[aria-pressed="true"] {
    border-color: var(--accent); color: var(--accent); font-weight: 600;
}

/* ── Fließtextseiten (Impressum, Datenschutz, stats) ──────────────────────── */

.prose { max-width: 42rem; }
.prose h1 { font-size: 1.5rem; margin-bottom: 1rem; }
.prose h2 { font-size: 1rem; text-transform: none; letter-spacing: 0; color: var(--fg); margin-top: 1.5rem; }
.prose table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.prose th, .prose td { text-align: left; padding: .35rem .6rem; border-bottom: 1px solid var(--line); }
.prose th { color: var(--fg-muted); font-weight: 600; }

/* ── QR-Anzeige ───────────────────────────────────────────────────────────── */

/* Kopf der Vorzeige-Seite: Name links, Avatar rechts — der Aufbau, den auch
   gedruckte und digitale Visitenkarten nutzen. Bewusst linksbündig und größer
   gesetzt als auf der Kontaktkarte: dieser Bildschirm wird jemandem aus
   Armlänge hingehalten. */
.idhead {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem;
}
.idhead > div { min-width: 0; }
/* Skaliert mit, damit „Thomas Hampp-Bahnmüller“ auch neben dem Avatar auf
   einem 375-px-Display in EINER Zeile bleibt — ein umgebrochener Nachname
   sieht auf einer vorgezeigten Karte nach Panne aus. */
.idname { font-size: clamp(1.15rem, 5vw, 1.45rem); font-weight: 600; line-height: 1.25; margin: 0; }
.idname .nb { white-space: nowrap; }
.idavatar {
    width: 68px; height: 68px; border-radius: 50%;
    background: var(--chip); flex: 0 0 auto;
}
.idfield { margin-top: 1.1rem; }
.idfield p { font-size: 1.05rem; margin: 0; }

/* Der Code selbst braucht keinen großen Abstand — Kontaktdaten und Code
   gehören sichtbar zusammen. */
.qrwrap { margin-top: 1rem; }

/* Fußzeile unter dem Code: welcher Zugangslink, welcher Host. Nur für den
   Besitzer interessant, deshalb klein und ohne Überschrift. */
.qrmeta {
    margin: .8rem 0 0; text-align: center;
    font-size: .82rem; color: var(--fg-muted);
}

.qr {
    background: #fff;              /* fest weiß, auch im Dark Mode: Scanner
                                      brauchen den Kontrast */
    border-radius: var(--radius);
    padding: .75rem;               /* der QR-Code bringt seine eigene Ruhezone
                                      mit (border=4 Module), mehr braucht es
                                      nicht — sonst klafft eine leere Fläche */
    display: block;
    margin: 0 auto;
}
.qr svg, .qr img {
    display: block; margin: 0 auto;
    width: min(72vw, 20rem); height: auto;
    shape-rendering: crispEdges;   /* keine Kantenglättung — Scanner mögen es hart */
}

/* ── Bewegung sparsam ─────────────────────────────────────────────────────── */

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