/* ============================================================
   Typenscheinschweiz.ch – gemeinsames Design-System
   Font: Inter (unverändert) · Akzent: Swiss-Rot
   ============================================================ */

:root {
    /* Marke */
    --red: #E30613;
    --red-600: #c8050f;
    --red-700: #a3040c;
    --red-tint: #fef2f2;

    /* Neutrale Palette (Slate) */
    --ink: #0b1220;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    --border-color: #e7eaef;
    --border-strong: #d6dbe2;
    --bg-body: #f5f6f8;
    --bg-card: #ffffff;
    --bg-soft: #f8fafc;

    /* Legacy-Aliasse (für Inline-Styles in den Templates) */
    --swiss-red: var(--red);
    --swiss-red-hover: var(--red-600);

    /* Form / Tiefe */
    --radius: 16px;
    --radius-md: 12px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .05);
    --shadow-md: 0 6px 18px -6px rgba(15, 23, 42, .12), 0 2px 6px -2px rgba(15, 23, 42, .06);
    --shadow-lg: 0 24px 50px -18px rgba(15, 23, 42, .25);
    --ring: 0 0 0 4px rgba(227, 6, 19, .14);
    --container: 980px;
    --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(1100px 480px at 50% -240px, rgba(227, 6, 19, .07), transparent 70%),
        var(--bg-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--red); }

::selection { background: rgba(227, 6, 19, .16); }

/* ---------- Layout ---------- */
.page {
    flex: 1 0 auto;
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 40px 20px 72px;
}
.page--narrow { max-width: 840px; }

/* ---------- Sticky Header / Nav ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .78);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border-color);
}
.nav {
    max-width: var(--container);
    margin: 0 auto;
    padding: 11px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    color: var(--ink);
    font-weight: 800;
    letter-spacing: -.02em;
    font-size: 1.06rem;
    white-space: nowrap;
}
.brand-logo {
    position: relative;
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 9px;
    background: linear-gradient(150deg, var(--red), var(--red-700));
    box-shadow: 0 8px 18px -8px rgba(227, 6, 19, .8);
}
.brand-logo::before,
.brand-logo::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 1.5px;
}
.brand-logo::before { width: 4px;  height: 17px; }
.brand-logo::after  { width: 17px; height: 4px; }
.brand small {
    color: var(--text-faint);
    font-weight: 600;
    font-size: .72rem;
    letter-spacing: .02em;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
    padding: 8px 13px;
    border-radius: 9px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: .9rem;
    white-space: nowrap;
    transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--ink); background: #eef1f5; }
.nav-links a.is-active { color: var(--red); background: var(--red-tint); }

/* ---------- Hero ---------- */
.hero {
    text-align: center;
    padding: 44px 0 30px;
}
.hero .kicker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: 22px;
}
.hero .kicker .dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .18);
}
.shield {
    width: 74px; height: 74px;
    margin: 0 auto 22px;
    border-radius: 20px;
    position: relative;
    background: linear-gradient(150deg, var(--red), var(--red-700));
    box-shadow: 0 18px 36px -14px rgba(227, 6, 19, .65);
}
.shield::before, .shield::after {
    content: "";
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #fff; border-radius: 3px;
}
.shield::before { width: 9px;  height: 38px; }
.shield::after  { width: 38px; height: 9px; }
.hero h1 {
    margin: 0 0 .5rem;
    font-weight: 800;
    font-size: clamp(2.1rem, 6vw, 3.3rem);
    letter-spacing: -.04em;
    line-height: 1.05;
    color: var(--ink);
}
.hero p {
    margin: 0 auto;
    max-width: 540px;
    color: var(--text-muted);
    font-size: 1.08rem;
}

/* ---------- Kategorie-Karten ---------- */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-top: 38px;
}
.cat-card {
    position: relative;
    display: block;
    padding: 28px 22px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--text-main);
    overflow: hidden;
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s;
}
.cat-card::after {
    content: "";
    position: absolute; inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--red), var(--red-700));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .3s var(--ease);
}
.cat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: #f1c4c6;
}
.cat-card:hover::after { transform: scaleX(1); }
.cat-card .ico {
    font-size: 2.6rem;
    line-height: 1;
    margin-bottom: 14px;
    display: block;
}
.cat-card h3 { margin: 0 0 5px; font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; }
.cat-card p  { margin: 0; font-size: .9rem; color: var(--text-muted); }
.cat-card .go {
    margin-top: 16px;
    font-size: .85rem;
    font-weight: 700;
    color: var(--red);
    display: inline-flex; align-items: center; gap: 6px;
    transition: gap .2s;
}
.cat-card:hover .go { gap: 11px; }

/* ---------- Toolbar (Seitenkopf innerhalb der Seiten) ---------- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-color);
}
.toolbar h1 {
    margin: 0;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--ink);
}
.toolbar h1 .accent { color: var(--red); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .95rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform .12s var(--ease), background .18s, box-shadow .18s, border-color .18s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--red);
    color: #fff;
    box-shadow: 0 10px 20px -10px rgba(227, 6, 19, .7);
}
.btn-primary:hover { background: var(--red-600); }
.btn-dark {
    background: var(--ink);
    color: #fff;
}
.btn-dark:hover { background: #1d2939; }
.btn-ghost {
    background: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { background: var(--bg-soft); border-color: var(--text-faint); }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 15px; font-size: .88rem; }

/* ---------- Suchformular ---------- */
.searchbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}
.field, select, input[type="text"], input[type="search"], textarea {
    padding: 13px 15px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-main);
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color .18s, box-shadow .18s;
}
.searchbar input { flex: 1 1 260px; min-width: 0; }
.searchbar select { flex: 0 0 auto; max-width: 100%; }
select:focus, input:focus, textarea:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: var(--ring);
}
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    padding-right: 38px;
}

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline; }

/* ---------- Hinweis / Alert ---------- */
.notice {
    display: flex;
    gap: 11px;
    background: #fffbeb;
    color: #854d0e;
    border: 1px solid #fde68a;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: .94rem;
    margin-bottom: 24px;
}
.notice b { color: #713f12; }

/* ---------- Inhaltskarte ---------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: clamp(24px, 4vw, 42px);
    box-shadow: var(--shadow-sm);
}
.card h2 { margin-top: 0; color: var(--ink); letter-spacing: -.02em; }
.lead { color: var(--text-muted); margin: 0 0 6px; }

/* FAQ */
.faq-item { padding: 20px 0; border-top: 1px solid var(--border-color); }
.faq-item:first-of-type { padding-top: 6px; border-top: none; }
.faq-q { font-weight: 700; font-size: 1.08rem; color: var(--ink); margin-bottom: 6px; }
.faq-a { color: var(--text-muted); }

/* ---------- Timeline (Status) ---------- */
.timeline {
    margin-top: 28px;
    padding-left: 26px;
    border-left: 2px solid var(--border-color);
}
.timeline-item { position: relative; margin-bottom: 26px; }
.timeline-item::before {
    content: "";
    position: absolute;
    left: -33px; top: 6px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--red);
    border: 3px solid var(--bg-body);
    box-shadow: 0 0 0 1px var(--border-color);
}
.timeline-date {
    font-size: .8rem; font-weight: 700; letter-spacing: .03em;
    text-transform: uppercase; color: var(--red); margin-bottom: 7px;
}
.timeline-text {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px 18px;
    box-shadow: var(--shadow-sm);
}

/* ---------- Katalog-Grid ---------- */
.back {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-muted); text-decoration: none;
    font-weight: 600; font-size: .9rem;
    margin-bottom: 16px;
    transition: color .15s, gap .15s;
}
.back:hover { color: var(--red); gap: 9px; }
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 22px;
}
.chip {
    display: block;
    padding: 15px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    transition: transform .15s var(--ease), border-color .15s, box-shadow .15s;
}
.chip:hover { transform: translateY(-3px); border-color: #f1c4c6; box-shadow: var(--shadow-md); }
.chip .sub { display: block; margin-top: 5px; font-size: .85rem; font-weight: 400; color: var(--text-muted); }
.chip .tg  { font-variant-numeric: tabular-nums; letter-spacing: .01em; }

/* ---------- Ergebnis-Tabelle (Suche) ---------- */
.result-meta { margin: 22px 0 12px; font-weight: 600; color: var(--text-main); }
.result-meta .count { color: var(--red); }
.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: 14px 16px; text-align: left; }
.table thead th {
    background: var(--bg-soft);
    color: var(--text-muted);
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border-color);
}
.table tbody tr { border-top: 1px solid var(--border-color); transition: background .15s; }
.table tbody tr:first-child { border-top: none; }
.table tbody tr:hover { background: var(--bg-soft); }
.cell-title { font-weight: 700; color: var(--ink); }
.cell-sub { display: block; margin-top: 3px; font-size: .85rem; font-weight: 400; color: var(--text-muted); }
.tg-mono { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: .02em; color: var(--text-main); }
.empty-state { padding: 28px 4px; color: var(--text-muted); font-weight: 500; }

/* ---------- Detailseite ---------- */
.detail-head { margin-bottom: 18px; }
.detail-head .eyebrow {
    font-size: .8rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    color: var(--red);
}
.detail-head h1 {
    margin: 6px 0 2px;
    font-size: clamp(1.6rem, 4.5vw, 2.3rem);
    font-weight: 800; letter-spacing: -.02em; color: var(--ink);
}
.detail-head .sub { color: var(--text-muted); font-size: 1.05rem; }

.accordion {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 14px;
    overflow: hidden;
}
.accordion > summary {
    list-style: none;
    cursor: pointer;
    padding: 16px 18px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.accordion > summary::-webkit-details-marker { display: none; }
.accordion > summary::after {
    content: "";
    width: 9px; height: 9px;
    border-right: 2.5px solid var(--red);
    border-bottom: 2.5px solid var(--red);
    transform: rotate(45deg);
    transition: transform .2s var(--ease);
    flex: none;
}
.accordion[open] > summary::after { transform: rotate(225deg); }
.accordion[open] > summary { border-bottom: 1px solid var(--border-color); }
.accordion .summary-ico { margin-right: auto; display: inline-flex; gap: 9px; align-items: center; }

.kv { width: 100%; border-collapse: collapse; }
.kv tr { border-top: 1px solid var(--border-color); }
.kv tr:first-child { border-top: none; }
.kv th, .kv td { padding: 12px 18px; text-align: left; vertical-align: top; }
.kv th { width: 42%; color: var(--text-muted); font-weight: 600; font-size: .92rem; }
.kv td { color: var(--text-main); font-weight: 500; }

/* ---------- Support / Spende ---------- */
.support {
    margin-top: 44px;
    padding: 30px 24px;
    text-align: center;
    background: linear-gradient(180deg, var(--bg-soft), var(--bg-card));
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}
.support h3 { margin: 0 0 .5rem; color: var(--ink); }
.support p { margin: 0 auto 1.3rem; max-width: 540px; color: var(--text-muted); font-size: .95rem; }

/* ---------- Footer ---------- */
.site-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    margin-top: 40px;
}
.site-footer .inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 34px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: .88rem;
}
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 4px; margin-bottom: 8px; }
.footer-links a {
    color: var(--text-muted); text-decoration: none; font-weight: 600;
    padding: 5px 11px; border-radius: 7px; transition: color .15s, background .15s;
}
.footer-links a:hover { color: var(--red); background: var(--red-tint); }
.footer-meta { margin-top: 14px; font-size: .8rem; color: var(--text-faint); }

/* ---------- Hilfsklassen ---------- */
.text-center { text-align: center; }
.muted { color: var(--text-muted); }

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 720px) {
    .page { padding: 26px 16px 56px; }
    .nav { padding: 10px 14px; }
    .brand small { display: none; }
    .toolbar { gap: 10px; }

    /* Such-Formular gestapelt + volle Breite */
    .searchbar { flex-direction: column; }
    .searchbar input, .searchbar select, .searchbar .btn { width: 100%; }

    /* Ergebnis-Tabelle -> Karten */
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tbody tr {
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        margin: 12px;
        padding: 6px 4px;
        box-shadow: var(--shadow-sm);
    }
    .table td { padding: 8px 16px; text-align: left !important; }
    .table td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: .72rem; font-weight: 700; text-transform: uppercase;
        letter-spacing: .04em; color: var(--text-faint); margin-bottom: 2px;
    }
    .table td .btn { width: 100%; }

    /* Detail key/value gestapelt */
    .kv th, .kv td { display: block; width: 100%; }
    .kv th { padding-bottom: 0; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-faint); }
    .kv td { padding-top: 2px; }
}

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