/* =========================================================================
   QR-Portal – Gestaltung
   Idee: Leitsystem-Schild in Markenblau (D4A-Logo) mit weißer Schrift
   für den Titel der Scan-Seite, sonst ruhig und hell. Schrift: Atkinson Hyperlegible
   (Braille Institute, für gute Lesbarkeit bei Sehbehinderung), lokal eingebunden.
   Alle Farbkombinationen erfüllen mindestens WCAG 2.2 AA.
   Farben anpassen: nur die Variablen unter :root ändern.
   ========================================================================= */

@font-face {
    font-family: "Atkinson Hyperlegible";
    src: url("fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
    font-weight: 400; font-style: normal; font-display: swap;
    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: "Atkinson Hyperlegible";
    src: url("fonts/atkinson-hyperlegible-latin-ext-400-normal.woff2") format("woff2");
    font-weight: 400; font-style: normal; font-display: swap;
    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;
}
@font-face {
    font-family: "Atkinson Hyperlegible";
    src: url("fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2");
    font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
    font-family: "Atkinson Hyperlegible";
    src: url("fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
    font-weight: 700; font-style: normal; font-display: swap;
    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: "Atkinson Hyperlegible";
    src: url("fonts/atkinson-hyperlegible-latin-ext-700-normal.woff2") format("woff2");
    font-weight: 700; font-style: normal; font-display: swap;
    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;
}

:root {
    --ink: #10121A;          /* Text – Schwarz aus dem Logo */
    --ink-soft: #4A4F5E;     /* Nebentext (Kontrast 8:1 auf Weiß) */
    --brand: #0012B1;        /* Blau aus dem D4A-Logo – Titelschild, Knöpfe, aktive Markierung */
    --brand-dark: #000C7A;
    --link: #0012B1;         /* Links (Kontrast 12:1 auf Weiß) */
    --paper: #FFFFFF;
    --mist: #EEF1F5;         /* ruhige Flächen */
    --line: #C9CFDA;         /* Linien */
    --line-strong: #6B7590;  /* Eingabefelder (3:1 Nicht-Text-Kontrast) */
    --error: #A8201A;
    --success: #1D6B3A;
    --radius: 10px;
    --wrap: 74rem;
    --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main { flex: 1; }
main:focus { outline: none; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 1.25rem; }
.narrow { max-width: 32rem; }
.reading { max-width: 44rem; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 3.2vw, 2.25rem); }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
p { margin: 0 0 1em; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }

code {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: .92em;
    background: var(--mist);
    padding: .1em .4em;
    border-radius: 5px;
    letter-spacing: .06em;
}

/* Fokus – gut sichtbar auf hellem, dunklem und gelbem Grund */
:focus-visible {
    outline: 2px solid #ffffff;
    box-shadow: 0 0 0 4px #000000;
    border-radius: 3px;
}

/* Sprunglink */
.screen-reader {
    position: absolute; left: 1rem; top: 0; z-index: 100;
    transform: translateY(-150%);
    background: #000; color: #fff;
    padding: .7rem 1.1rem; text-decoration: none; font-weight: 700;
}
.screen-reader:focus-visible { transform: translateY(0); }

.screen-reader-only {
    position: absolute !important; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* =========================================================================
   VERWALTUNG
   ========================================================================= */

.admin main { padding-block: 2.25rem 4rem; }

.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem 1.5rem; flex-wrap: wrap; padding-block: .9rem;
}
.brand { display: inline-flex; align-items: center; gap: .9rem; text-decoration: none; color: var(--ink); }
.logo { display: block; height: 44px; width: auto; }
.logo-text { font-weight: 700; font-size: 1.3rem; letter-spacing: -.01em; }
.brand-sub { color: var(--ink-soft); font-size: .95rem; padding-left: .9rem; border-left: 2px solid var(--brand); }

#nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
#nav a, #nav .linklike {
    display: inline-block; color: var(--ink); text-decoration: none;
    padding: .45rem .8rem; border-radius: 999px; font: inherit; font-size: 1rem;
}
#nav a:hover, #nav .linklike:hover { background: var(--mist); }
#nav a[aria-current="page"] { background: var(--brand); color: #fff; font-weight: 700; }

.linklike { background: none; border: 0; cursor: pointer; font: inherit; color: inherit; }
.inline { display: inline; margin: 0; }

.site-footer { border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .9rem; }
.site-footer p { margin: 1.1rem 0; }

/* Meldungen */
.notice {
    padding: .9rem 1.1rem; margin: 0 0 1.25rem; border-radius: var(--radius);
    border: 1px solid; border-left-width: 6px; font-weight: 700;
}
.notice-error { color: var(--error); border-color: var(--error); background: #FBEDEC; }
.notice-success { color: var(--success); border-color: var(--success); background: #E9F4EC; }

/* Seitenkopf */
.page-head {
    display: flex; justify-content: space-between; align-items: flex-end;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.75rem;
}
.page-head h1 { margin: 0; }
.count { color: var(--ink-soft); font-weight: 400; font-size: .7em; }
.head-actions { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }

.breadcrumb ol { list-style: none; padding: 0; margin: 0 0 .9rem; display: flex; flex-wrap: wrap; gap: .35rem; font-size: .95rem; }
.breadcrumb li + li::before { content: "/"; margin-right: .35rem; color: var(--line-strong); }
.breadcrumb a[aria-current="page"] { color: var(--ink); text-decoration: none; font-weight: 700; }

/* Formulare */
.form .field { margin-bottom: 1.15rem; }
label { display: block; font-weight: 700; margin-bottom: .35rem; }
.hint, .hint-inline, .req { font-weight: 400; color: var(--ink-soft); font-size: .93rem; }
.hint { margin: .35rem 0 0; }
.warn { color: var(--error); font-weight: 700; margin: .35rem 0 0; font-size: .95rem; }

input[type="text"], input[type="password"], input[type="search"], input[type="number"], textarea {
    width: 100%; font: inherit; color: var(--ink); background: #fff;
    border: 1.5px solid var(--line-strong); border-radius: 8px; padding: .65rem .8rem;
}
textarea { resize: vertical; min-height: 6rem; line-height: 1.55; }
input:hover, textarea:hover { border-color: var(--ink); }
input:focus-visible, textarea:focus-visible { border-color: var(--ink); }

input[type="file"] { font: inherit; font-size: .95rem; max-width: 100%; }
input[type="file"]::file-selector-button {
    font: inherit; font-weight: 700; color: var(--ink); background: var(--mist);
    border: 1.5px solid var(--line-strong); border-radius: 8px;
    padding: .5rem .9rem; margin-right: .8rem; cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: #E1E6EE; }

.field.checkbox { display: grid; grid-template-columns: auto 1fr; gap: .2rem .7rem; align-items: start; }
.field.checkbox input { width: 1.35rem; height: 1.35rem; margin: .15rem 0 0; accent-color: var(--brand); }
.field.checkbox label { margin: 0; }
.field.checkbox .hint { grid-column: 2; }
.field.small { max-width: 9rem; }
.row { display: flex; flex-wrap: wrap; gap: 0 1.75rem; align-items: end; }

.button {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    font: inherit; font-weight: 700; line-height: 1.25;
    background: var(--brand); color: #fff;
    border: 2px solid var(--brand); border-radius: 8px;
    padding: .7rem 1.2rem; text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.button.secondary { background: #fff; color: var(--brand); }
.button.secondary:hover { background: var(--mist); color: var(--brand-dark); }
.button.danger { background: var(--error); border-color: var(--error); }
.button.danger:hover { background: #861812; border-color: #861812; }

.form-actions { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; margin: .5rem 0 2rem; }

/* Suche */
.search { margin-bottom: 1.75rem; max-width: 38rem; }
.search-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.search-row input { flex: 1 1 14rem; }

/* Tabellen */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.entries { width: 100%; border-collapse: collapse; }
.entries th, .entries td { text-align: left; padding: .8rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.entries tbody tr:last-child > * { border-bottom: 0; }
.entries thead th { background: var(--mist); font-size: .93rem; color: var(--ink-soft); }
.entries tbody th { font-weight: 700; }
.entries tbody th a { color: var(--ink); }
.entries tbody tr:hover { background: #F7F9FB; }
.qr-thumb { display: block; width: 60px; height: 60px; background: #fff; border-radius: 4px; }
.actions a, .actions form.inline { display: inline-block; margin: .15rem 1rem .15rem 0; white-space: nowrap; }
.linklike.link { color: var(--link); text-decoration: underline; text-underline-offset: .2em; padding: 0; }
.linklike.link:hover { text-decoration-thickness: 2px; }
.linklike.danger-link { color: var(--error); }

.badge { display: inline-block; padding: .15rem .65rem; border-radius: 999px; font-size: .85rem; font-weight: 700; }
.badge.ok { color: var(--success); background: #E2F1E7; }
.badge.off { color: var(--ink-soft); background: var(--mist); }

.pagination ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.25rem; }
.pagination a {
    display: inline-block; min-width: 2.6rem; text-align: center; padding: .4rem .6rem;
    border: 1.5px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink);
}
.pagination a[aria-current="page"] { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Abschnitte in der Verwaltung */
.card {
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    padding: 1.5rem 1.5rem .75rem; margin-bottom: 1.5rem;
}
.card h2 { margin-bottom: .9rem; }
.card h3 { margin-top: 1.5rem; }
.card.danger { border-color: #E3B2AF; background: #FFFBFA; }
.card.danger h2 { color: var(--error); }

/* Einladungslink */
.invite-new { background: #EEF0FC; border: 2px solid var(--brand); border-radius: var(--radius); padding: 1.1rem 1.1rem .4rem; margin-bottom: 1.25rem; }
.copy-row { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: .4rem; }
.copy-row input { flex: 1 1 18rem; font-family: ui-monospace, Consolas, monospace; font-size: .92rem; }
.copy-status { min-height: 1.4em; color: var(--success); font-weight: 700; margin: 0 0 .6rem; }

/* Eintrag bearbeiten */
.edit-layout { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 1.75rem; align-items: start; }
.qr-panel { position: sticky; top: 1.25rem; background: var(--mist); border-color: transparent; }
.qr-large {
    display: block; width: 100%; max-width: 260px; height: auto; margin: 0 auto 1rem;
    background: #fff; padding: 10px; border-radius: 10px;
}
.qr-panel .plain { list-style: none; padding: 0; display: grid; gap: .55rem; margin: 1rem 0; }
.qr-panel .button { width: 100%; }
.break { overflow-wrap: anywhere; }
.meta { color: var(--ink-soft); font-size: .9rem; }

.media-list { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: 1rem; }
.media-item {
    display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 1.25rem;
    padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius);
}
.media-item.audio { grid-template-columns: minmax(0, 1fr); }
.media-thumb { width: 100%; height: auto; border-radius: 8px; background: var(--mist); }
.media-name { margin: 0 0 .6rem; font-weight: 700; overflow-wrap: anywhere; color: var(--ink-soft); font-size: .93rem; }
.media-item audio { width: 100%; margin-bottom: .9rem; }

@media (max-width: 54rem) {
    .edit-layout { grid-template-columns: 1fr; }
    .qr-panel { position: static; order: -1; }
    .media-item { grid-template-columns: 1fr; }
    .media-thumb { max-width: 14rem; }
}

/* =========================================================================
   SCAN-SEITE (öffentlich)
   ========================================================================= */

.public { background: var(--paper); font-size: 1.1875rem; line-height: 1.65; }

/* Das Schild: Titel weiß auf Markenblau */
.sign { background: var(--brand); color: #fff; padding: clamp(2rem, 7vw, 3.5rem) 0 clamp(1.5rem, 5vw, 2.5rem); }
.sign h1 {
    margin: 0; font-size: clamp(2rem, 8vw, 3.25rem); line-height: 1.08;
    letter-spacing: -.02em; overflow-wrap: break-word; hyphens: auto;
}
.sign-muted { background: var(--mist); color: var(--ink); }

.content { padding-block: 2rem 3rem; }
.description p { margin-bottom: 1.1em; }
.lead { font-size: 1.2rem; }

.block { margin-top: 2.5rem; padding-top: 1.75rem; border-top: 3px solid var(--brand); }
.block h2 { font-size: 1.5rem; margin-bottom: 1rem; }

.gallery { display: grid; gap: 1.25rem; }
.gallery figure { margin: 0; }
.gallery a { display: block; border-radius: 12px; overflow: hidden; }
.gallery img { display: block; width: 100%; height: auto; background: var(--mist); }
.gallery figcaption { color: var(--ink-soft); font-size: 1rem; margin-top: .5rem; }

.audio-item { background: var(--mist); border-radius: 14px; padding: 1.1rem 1.1rem 1rem; margin-bottom: 1rem; }
.audio-item h3 { margin: 0 0 .75rem; font-size: 1.2rem; }
.audio-item audio { display: block; width: 100%; }
.transcript { margin-top: .9rem; }
.transcript summary {
    cursor: pointer; font-weight: 700; color: var(--brand);
    padding: .4rem 0; text-decoration: underline; text-underline-offset: .2em;
}
.transcript[open] summary { margin-bottom: .5rem; }
.transcript > div { background: #fff; border-radius: 10px; padding: 1rem 1.1rem .2rem; }

.public-footer { border-top: 0; background: var(--mist); }
.public-footer .wrap { padding-block: 1.5rem; }
.footer-logo { display: block; height: 36px; width: auto; }
.footer-logo-text { font-weight: 700; color: var(--ink-soft); }

/* ========================================================================= */

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

@media (forced-colors: active) {
    .button { border: 2px solid ButtonText; }
    .sign { border-bottom: 3px solid CanvasText; }
    #nav a[aria-current="page"] { outline: 2px solid Highlight; }
    :focus-visible { outline: 3px solid Highlight; }
}

@media print {
    .site-header, .site-footer, .screen-reader { display: none; }
    .sign { background: none; border-bottom: 3px solid #000; }
}
