/* ==========================================================================
   1. RADIKALER RESET & DESIGN TOKENS
   ========================================================================== */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #3366cc;
    --primary-hover: #2850a8;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-alt: #f1f5f9;
    --border: #e2e8f0;
    --radius-lg: 0;
    --radius-md: 0;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
    border-radius: 0 !important;
}

a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
.stempel-card:focus,
.stempel-card:active {
    outline: none !important;
}

html, body {
    width: 100%;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
}

main {
    margin-top: 0 !important;
    width: 100%;
}

/* ==========================================================================
   PHILATELISTISCHES INFO-LAYOUT (BLAUE AKZENTE REAKTIVIERT)
   ========================================================================== */

.info-layout {
    min-height: calc(100vh - 130px);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: var(--bg-body);
    padding-top: 1rem;
}

.info-inner {
    width: 100%;
    max-width: 850px;
    padding: 2rem;
}

.fact-list {
    list-style: none;
    padding: 0;
}

.fact-list > li {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 2.5rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
    align-items: baseline;
}

.fact-list > li:last-child {
    border-bottom: none;
}

/* ZAHLEN WIEDER IN BLAU */
.fact-num {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--primary); /* Das schöne Blau ist zurück */
}

/* TEXT IN EINHEITLICHER FARBE */
.fact-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-main);
}

/* GEZIELTE FARBAKZENTE IN DEN UNTERPUNKTEN */
.txt-red { color: #cc0000; font-weight: 800; }
.txt-blue { color: #0044cc; font-weight: 800; }

.sub-facts {
    display: block;
    margin-top: 0.8rem;
    color: var(--text-main);
}

.sub-facts span {
    display: block;
    margin-bottom: 0.4rem;
}

@media (max-width: 768px) {
    body { overflow-y: auto !important; }

    .info-layout {
        align-items: flex-start;
        padding-top: 0; 
        padding-bottom: 60px;
    }

    .info-inner {
        padding: 1rem 1.5rem; 
    }

    .fact-list > li {
        grid-template-columns: 1fr;
        gap: 0.2rem;
        padding: 1.2rem 0;
    }

    .fact-num {
        font-size: 1.1rem;
        margin-bottom: 0.1rem;
    }
}

/* ==========================================================================
   STRUKTUR 2026: SIDEBAR, PAGE START / PAGE END
   ========================================================================== */

:root {
    --sidebar-w: 260px;
    --sidebar-mobile-h: 76px;
}

body.has-sidebar {
    min-height: 100vh;
    padding-left: var(--sidebar-w);
    background: var(--bg-body);
}

.site-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    z-index: 2500;
    display: flex;
    flex-direction: column;
    gap: 2.15rem;
    padding: 1.45rem 1.2rem;
    background: #fff;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.mobile-brand {
    display: none;
}

.logo {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
    color: #111;
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1;
    letter-spacing: 0;
}

.logo-main,
.logo-accent {
    display: block;
    font-weight: 900;
}

.logo-accent {
    color: var(--primary);
}

.admin-section .logo-accent,
.admin-mode .site-nav a.active,
.admin-mode .site-nav a:hover,
.admin-mode .logout-link {
    color: #ef4444;
}

.admin-login-pending .logo {
    opacity: 0.72;
}

.admin-login-pending .logo-accent {
    color: #94a3b8;
}

.site-nav {
    display: flex;
    flex-direction: column;
    gap: 0.48rem;
}

.site-nav a {
    display: flex;
    align-items: center;
    gap: 0.78rem;
    min-height: 46px;
    padding: 0.78rem 0.72rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    line-height: 1.15;
    border-left: 3px solid transparent;
}

.site-nav a i {
    width: 1.1rem;
    text-align: center;
    font-size: 0.95rem;
}

.site-nav a:hover,
.site-nav a.active {
    color: var(--primary);
    background: #f8fafc;
    border-left-color: currentColor;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.75rem 0.72rem;
}

.sidebar-copyright {
    color: #71717a;
    font-size: 0.64rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    line-height: 1.55;
}

.sidebar-meta {
    display: flex;
    flex-direction: column;
    gap: 0.68rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-meta a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.64rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.035em;
}

.sidebar-meta a:hover {
    color: var(--primary);
}

.logo {
    position: static;
    width: 100%;
    height: auto;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo::before {
    content: none;
}

.logo-mark {
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    display: block;
}

.logo-copy {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 0;
}

.logo-main {
    color: #111;
    font-size: 0.74rem;
    font-weight: 900;
    line-height: 1;
}

.logo-accent {
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 900;
    line-height: 1;
    transform-origin: top left;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
}

/* Sammlung: kritische Styles zusätzlich in der Hauptdatei, damit die Galerie nie blank fällt. */
.collection-page {
    padding: 0.45rem 0 0;
}

.collection-toolbar {
    position: sticky;
    top: 0;
    z-index: 500;
    display: grid;
    grid-template-columns: minmax(260px, 1.2fr) minmax(260px, 1fr);
    gap: 1rem;
    align-items: end;
    width: min(1400px, 100%);
    margin: 0 auto 1.25rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #e5e7eb;
    backdrop-filter: blur(10px);
}

.toolbar-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toolbar-label,
.result-count {
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.search-grid {
    display: grid;
    grid-template-columns: 0.8fr 1fr 1fr;
    gap: 0.65rem;
}

.search-grid input {
    width: 100%;
    min-height: 42px;
    padding: 0.72rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    outline: none;
}

.search-grid input:focus {
    border-color: #111;
    background: #fff;
}

.sort-controls {
    display: grid;
    grid-template-columns: 1fr 0.7fr;
    gap: 0.65rem;
}

.tab-nav {
    display: flex;
    min-height: 42px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.tab-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 0.65rem;
    border: none;
    border-left: 1px solid #e2e8f0;
    background: transparent;
    color: #64748b;
    font: inherit;
    font-size: 0.68rem;
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
}

.tab-item:first-child {
    border-left: none;
}

.tab-item.is-active {
    background: #fff;
    color: #111;
}

.result-count {
    align-self: center;
    justify-self: end;
}

.gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
    gap: 20px;
    width: min(1400px, 100%);
    max-width: none;
    margin: 0 auto;
    padding: 0 0 0.75rem !important;
}

.stempel-card {
    height: 216px;
    padding: 0;
    background: #fff;
    border: 1px solid #eee;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stempel-card:focus,
.stempel-card:active {
    outline: none;
    border-color: #eee;
}

@media (hover: hover) {
    .stempel-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    }
}

.img-container {
    width: 100%;
    height: 144px;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 0;
    overflow: hidden;
}

.img-container img {
    max-width: 94%;
    max-height: 94%;
    object-fit: contain;
}

.card-info {
    min-height: 72px;
    padding: 8px 10px;
    text-align: center;
    border-top: 1px solid #f8f8f8;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.primary-label {
    display: block;
    font-weight: 800;
    font-size: 0.8rem;
    color: #111;
    margin-bottom: 2px;
}

.secondary-label {
    display: block;
    width: 100%;
    color: #777;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Aktuelles Sidebar- und Sammlungs-Layout */
.logo {
    position: static;
    width: 100%;
    min-height: 168px;
    position: relative;
    display: block;
    color: #111;
    text-decoration: none;
    line-height: 1;
}

.logo::before {
    content: none !important;
}

.logo-mark {
    position: absolute;
    top: 1.15rem;
    left: 50%;
    width: 104px;
    height: 104px;
    transform: translateX(-50%);
}

.logo-admin {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    color: #ef4444;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    line-height: 1;
}

.logo-copy {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.18rem;
    width: 1.05rem;
}

.logo-main {
    color: #111;
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    writing-mode: vertical-rl;
    text-orientation: upright;
}

.logo-accent {
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 0;
}

.sidebar-collection-tools {
    display: flex;
    flex-direction: column;
    gap: 0.78rem;
    padding: 0.82rem 0.45rem 0.92rem;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.sidebar-collection-tools .toolbar-group {
    gap: 0.3rem;
}

.sidebar-collection-tools .toolbar-label {
    color: #a1a1aa;
    font-size: 0.52rem;
    letter-spacing: 0.1em;
}

.sidebar-collection-tools .search-grid,
.sidebar-collection-tools .sort-controls {
    display: flex;
    flex-direction: column;
    gap: 0.26rem;
}

.sidebar-collection-tools .search-grid input {
    min-height: 30px;
    padding: 0.28rem 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid #e4e7ec;
    color: #111;
    font-size: 0.7rem;
    font-weight: 700;
}

.sidebar-collection-tools .search-grid input:focus {
    border-bottom-color: #111;
}

.sidebar-collection-tools .tab-nav {
    min-height: 30px;
    background: transparent;
    border: 1px solid #e5e7eb;
}

.sidebar-collection-tools .tab-item {
    padding: 0.32rem 0.25rem;
    background: transparent;
    color: #71717a;
    font-size: 0.52rem;
    letter-spacing: 0.03em;
    border-left: 1px solid #e5e7eb;
}

.sidebar-collection-tools .tab-item:first-child {
    border-left: none;
}

.sidebar-collection-tools .tab-item.is-active {
    background: #f8fafc;
    color: #111;
}

.sidebar-collection-tools .result-count {
    justify-self: auto;
    align-self: flex-start;
    padding-top: 0;
    color: #a1a1aa;
    font-size: 0.6rem;
    letter-spacing: 0.05em;
}

.collection-toolbar {
    display: none;
}

.collection-page {
    padding-top: 0.45rem;
}

.legal-layout {
    min-height: 100vh !important;
    margin-top: 0 !important;
}

@media (min-width: 769px) {
    body.has-sidebar {
        overflow-x: hidden;
        overflow-y: auto !important;
    }
}

@media (max-width: 768px) {
    body.has-sidebar {
        padding-left: 0;
        padding-top: 96px !important;
        padding-bottom: 24px !important;
    }

    .mobile-brand {
        position: fixed;
        inset: 0 0 auto 0;
        z-index: 2600;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.12rem;
        background: #fff;
        border-bottom: 1px solid var(--border);
        color: #111;
        font-size: 0.9rem;
        font-weight: 900;
        line-height: 1;
    }

    .mobile-brand-logo {
        width: 36px;
        height: 36px;
        display: block;
    }

    .site-sidebar {
        position: fixed;
        inset: 44px 0 auto 0;
        width: 100%;
        z-index: 2500;
        height: 52px;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0;
        padding: 0;
        background: #fff;
        border-top: none;
        border-bottom: 1px solid var(--border);
        border-right: none;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    }

    .logo {
        display: none;
    }

    .sidebar-collection-tools {
        display: none;
    }

    .site-nav {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-around;
        gap: 0;
        overflow-x: auto;
        padding: 0 0.35rem;
    }

    .site-nav a {
        flex: 1 0 auto;
        min-width: 64px;
        min-height: 51px;
        justify-content: center;
        flex-direction: column;
        gap: 0.22rem;
        padding: 0.45rem 0.35rem;
        border-left: none;
        border-bottom: 2px solid transparent;
        font-size: 0.56rem;
        text-align: center;
    }

    .site-nav a span {
        display: block;
    }

    .site-nav a i {
        width: auto;
        font-size: 1rem;
    }

    .site-nav a:hover,
    .site-nav a.active {
        border-bottom-color: currentColor;
    }

    .sidebar-footer {
        display: none;
    }

    .sidebar-copyright {
        display: none;
    }

    .sidebar-meta {
        flex-direction: row;
        justify-content: center;
        gap: 0.75rem;
        width: 100%;
        overflow-x: auto;
    }

    .sidebar-meta a {
        flex: 0 0 auto;
        font-size: 0.56rem;
    }

    .legal-layout {
        height: auto !important;
        min-height: calc(100vh - 96px);
    }

    .collection-page {
        padding: 0.45rem 0.75rem 0;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        width: 100%;
        padding-bottom: 0.75rem !important;
    }
}

/* ==========================================================================
   ÖFFENTLICHE SEITEN
   ========================================================================== */

.index-content {
    padding: 40px 1.5rem 100px;
    display: flex;
    justify-content: center;
}

.content-container,
.info-inner,
.legal-inner {
    width: 100%;
    max-width: 850px;
}

.intro-section {
    line-height: 1.8;
    font-size: 1.1rem;
    color: var(--text-main);
}

.intro-section p {
    margin-bottom: 1.5rem;
}

.intro-section strong {
    color: var(--primary);
}

.legal-layout {
    width: 100%;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    background: var(--bg-body);
}

.legal-inner {
    padding: 2rem 1.5rem 100px;
}

.legal-body {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-main);
}

.legal-body h2,
.legal-body h3 {
    font-size: 1.35rem;
    margin: 2rem 0 1rem;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.legal-body p {
    margin-bottom: 1.2rem;
}

.legal-body a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

.legal-body a:hover {
    text-decoration: underline;
}

.page-datenschutz .legal-body .content > h2:first-of-type {
    margin: 0 0 0.6rem;
    padding: 0;
    border-bottom: 0;
    color: var(--text-main);
    font-size: clamp(2rem, 3vw, 2.45rem);
    line-height: 1.08;
}

.page-datenschutz .legal-body .content > h2:first-of-type + p {
    margin-bottom: 2rem;
    color: var(--text-main);
    font-style: italic;
}

.page-datenschutz .legal-body .content > h2:nth-of-type(2) {
    margin: 0 0 0.65rem;
    padding: 0;
    border-bottom: 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.page-datenschutz .legal-body .index {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.2rem 1.25rem;
    padding: 0;
    margin: 0 0 2.25rem;
    list-style: none;
}

.page-datenschutz .legal-body .index li {
    margin: 0;
}

.page-datenschutz .legal-body .index-link {
    display: block;
    padding: 0.42rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 850;
    line-height: 1.25;
    text-decoration: none;
}

.page-datenschutz .legal-body .index-link:hover {
    color: var(--primary);
    text-decoration: none;
}

.legal-spacer {
    height: 50px;
}

.info-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 100px;
}

.info-card {
    background: #ffffff;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.info-image-section {
    flex: 1.2;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.info-image-section img {
    max-width: 100%;
    height: auto;
    max-height: 500px;
    box-shadow: 0 10px 15px rgba(0,0,0,0.15);
}

.info-content-section {
    flex: 1;
    padding: 50px;
    display: flex;
    flex-direction: column;
}

.info-content-section h1 {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 800;
    color: #1e293b;
}

.info-tag {
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    margin-bottom: 10px;
    display: block;
}

.info-meta {
    color: #64748b;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.data-item {
    border-left: 4px solid var(--primary);
    padding-left: 15px;
}

.data-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
}

.data-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
}

.back-btn {
    margin-top: auto;
    background: var(--primary);
    color: white;
    text-decoration: none;
    text-align: center;
    padding: 15px;
    font-weight: 700;
    transition: background 0.2s;
}

.back-btn:hover {
    background: var(--primary-hover);
}

@media (max-width: 850px) {
    .info-card {
        flex-direction: column;
    }

    .info-image-section {
        padding: 20px;
    }

    .info-content-section {
        padding: 30px;
    }

    .info-content-section h1 {
        font-size: 1.8rem;
    }

    .data-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .index-content,
    .legal-inner,
    .info-wrapper {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .intro-section {
        font-size: 1rem;
    }
}

/* Finale Korrektur: nur das Vierring-Logo im Markenblock. */
@media (min-width: 769px) {
    .site-sidebar {
        gap: 1.6rem;
    }

    .logo {
        width: 100%;
        min-height: 222px;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 1.35rem 0 1.6rem;
        border-bottom: 1px solid var(--border);
        cursor: default;
    }

    .logo::before {
        content: none !important;
    }

    .logo-mark {
        position: static;
        width: 184px;
        height: 184px;
        transform: none;
        margin: 0;
        display: block;
        opacity: 1;
    }
}

.admin-login-pending .logo {
    opacity: 1;
}

.admin-login-pending .logo-mark {
    opacity: 1;
    filter: grayscale(1);
}

.admin-login-pending .site-nav a:hover,
.admin-login-pending .site-nav a.active,
.admin-login-pending .sidebar-meta a:hover {
    color: #111;
}

.admin-login-pending .site-nav a:hover,
.admin-login-pending .site-nav a.active {
    background: #f4f4f5;
    border-left-color: #111;
}

.admin-login-pending .sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.admin-login-pending .sidebar-meta {
    border-bottom-color: #d4d4d8;
}

.mobile-brand-admin {
    color: #ef4444;
    letter-spacing: 0.18em;
}

.admin-login-pending .mobile-brand-admin {
    color: #111;
}

/* Öffentliches Header-Layout: keine Sidebar, Suche nur auf der Sammlung. */
body.has-public-header {
    min-height: 100vh;
    padding-left: 0 !important;
    background: var(--bg-body);
}

.public-header {
    position: sticky;
    top: 0;
    z-index: 2400;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--border);
}

.public-header-main {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    width: 100%;
    padding: 0.72rem clamp(1rem, 4vw, 3rem);
}

.public-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.public-brand-logo {
    width: 54px;
    height: 54px;
    flex: 0 0 auto;
    display: block;
}

.public-wordmark {
    display: flex;
    align-items: baseline;
    flex-wrap: nowrap;
    color: #111;
    font-size: clamp(0.86rem, 1.2vw, 1rem);
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1;
    white-space: nowrap;
}

.public-wordmark strong {
    color: var(--primary);
    font: inherit;
}

.public-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.public-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.035em;
}

.public-nav a:hover,
.public-nav a.active {
    color: var(--primary);
    border-bottom-color: currentColor;
}

.public-menu-toggle,
.public-mobile-menu {
    display: none;
}

.header-collection-tools {
    display: grid;
    grid-template-columns: minmax(360px, 1.1fr) minmax(320px, 0.9fr) auto;
    gap: 0.9rem;
    align-items: end;
    padding: 0.65rem clamp(1rem, 4vw, 3rem) 0.85rem;
    border-top: 1px solid #eef2f7;
}

.header-collection-tools .toolbar-group {
    gap: 0.32rem;
}

.header-collection-tools .toolbar-label,
.header-collection-tools .result-count {
    color: #94a3b8;
    font-size: 0.58rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.header-collection-tools .search-grid {
    display: grid;
    grid-template-columns: 0.9fr 1fr 1fr;
    gap: 0.45rem;
}

.header-collection-tools .search-grid input {
    min-height: 36px;
    padding: 0.5rem 0.62rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #111;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 750;
}

.header-collection-tools .search-grid input:focus {
    border-color: #111;
}

.header-collection-tools .sort-controls {
    display: grid;
    grid-template-columns: 1fr 0.62fr;
    gap: 0.45rem;
}

.header-collection-tools .tab-nav {
    min-height: 36px;
    display: flex;
    background: #fff;
    border: 1px solid #e2e8f0;
}

.header-collection-tools .tab-item {
    flex: 1;
    border: 0;
    border-left: 1px solid #e2e8f0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font: inherit;
    font-size: 0.58rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.header-collection-tools .tab-item:first-child {
    border-left: 0;
}

.header-collection-tools .tab-item.is-active {
    background: #f8fafc;
    color: #111;
}

.header-collection-tools .result-count {
    align-self: center;
    white-space: nowrap;
    text-transform: none;
    letter-spacing: 0.04em;
}

.public-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding: 1.2rem clamp(1rem, 4vw, 3rem);
    border-top: 1px solid var(--border);
    background: #fff;
}

.public-footer-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.public-footer a,
.public-footer-copy {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.public-footer a:hover {
    color: var(--primary);
}

body.has-public-header .collection-toolbar,
body.has-public-header .sidebar-collection-tools {
    display: none !important;
}

@media (min-width: 769px) {
    body.has-sidebar .logo {
        min-height: 118px;
        padding: 0.45rem 0 0.9rem;
    }

    body.has-sidebar .logo-mark {
        width: 96px;
        height: 96px;
    }
}

@media (max-width: 900px) {
    body.has-public-header {
        padding-top: 58px;
    }

    .public-header {
        position: fixed;
        inset: 0 0 auto 0;
        z-index: 2400;
    }

    .public-header-main {
        min-height: 58px;
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
        padding: 0.55rem 1rem;
    }

    .public-brand {
        justify-content: flex-start;
        flex: 1;
    }

    .public-nav {
        display: none;
    }

    .header-collection-tools {
        display: none;
    }

    .public-wordmark {
        font-size: 0.98rem;
    }

    .public-menu-toggle {
        width: 38px;
        height: 38px;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        border: 1px solid var(--border);
        background: #fff;
        color: #111;
        cursor: pointer;
    }

    .public-menu-toggle span {
        width: 16px;
        height: 2px;
        display: block;
        background: currentColor;
    }

    .public-mobile-menu {
        position: fixed;
        inset: 58px 0 auto 0;
        z-index: 2390;
        display: none;
        padding: 0.8rem 1rem 1rem;
        background: #fff;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 16px 28px rgba(15, 23, 42, 0.08);
    }

    body.public-menu-open .public-mobile-menu {
        display: block;
    }

    .public-mobile-nav {
        display: grid;
        gap: 0.35rem;
    }

    .public-mobile-nav a {
        min-height: 42px;
        display: flex;
        align-items: center;
        border-bottom: 1px solid #edf1f5;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 0.78rem;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    .public-mobile-nav a.active {
        color: var(--primary);
    }

    .mobile-sort {
        display: grid;
        gap: 0.35rem;
        margin-top: 0.85rem;
    }

    body.has-public-header .legal-layout {
        min-height: 0;
        overflow-y: visible;
        align-items: flex-start;
    }

    body.has-public-header .legal-inner {
        padding: 0.9rem 1.05rem 2.25rem;
    }

    body.has-public-header .legal-body {
        font-size: 0.92rem;
        line-height: 1.62;
    }

    body.has-public-header .legal-body > :first-child {
        margin-top: 0;
    }

    body.has-public-header .legal-body h1 {
        margin: 0 0 0.8rem;
        font-size: 1.72rem;
        line-height: 1.08;
        letter-spacing: 0;
    }

    body.has-public-header .legal-body h2,
    body.has-public-header .legal-body h3 {
        margin: 1.35rem 0 0.65rem;
        padding-bottom: 0.35rem;
        font-size: 1.12rem;
        line-height: 1.2;
    }

    body.has-public-header .legal-body h4 {
        margin: 1.05rem 0 0.45rem;
        font-size: 0.98rem;
        line-height: 1.25;
        color: var(--text-main);
    }

    body.has-public-header .legal-body p {
        margin-bottom: 0.9rem;
    }

    body.has-public-header .legal-body ul {
        padding-left: 1.1rem;
        margin: 0 0 1rem;
    }

    body.has-public-header .legal-body li {
        margin-bottom: 0.45rem;
    }

    body.has-public-header .legal-body a {
        overflow-wrap: anywhere;
    }

    body.page-index .index-content,
    body.page-beschreibung .info-layout {
        min-height: 0;
    }

    body.page-index .index-content {
        padding-bottom: 1.2rem;
    }

    body.page-beschreibung .info-layout {
        padding-bottom: 1.2rem;
    }

    body.has-public-header .collection-page {
        padding-bottom: 0.75rem !important;
    }

    body.has-public-header .legal-spacer {
        height: 0;
    }

    body.has-public-header.page-impressum .legal-layout {
        min-height: auto !important;
    }

    body.has-public-header.page-impressum {
        min-height: 100svh;
        display: flex;
        flex-direction: column;
    }

    body.has-public-header.page-impressum .legal-inner {
        padding-bottom: 0.75rem;
    }

    body.has-public-header.page-impressum .legal-body p:last-child {
        margin-bottom: 0;
    }

    body.has-public-header.page-impressum .public-footer {
        margin-top: auto;
    }

    .page-datenschutz .legal-body .content > h2:first-of-type {
        font-size: 1.72rem;
    }

    .page-datenschutz .legal-body .content > h2:first-of-type + p {
        margin-bottom: 1.35rem;
    }

    .page-datenschutz .legal-body .index {
        grid-template-columns: 1fr;
        gap: 0;
        margin-bottom: 1.6rem;
    }

    .page-datenschutz .legal-body .index-link {
        padding: 0.36rem 0;
        font-size: 0.78rem;
    }
}

@media (max-width: 560px) {
    .public-brand-logo {
        width: 42px;
        height: 42px;
    }

    .public-wordmark {
        font-size: 0.9rem;
    }

    .public-nav a {
        min-height: 34px;
        padding: 0.45rem 0.48rem;
        font-size: 0.62rem;
    }

    .public-footer {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
        margin-top: 0.9rem;
        padding: 1.1rem 0.9rem calc(1.85rem + env(safe-area-inset-bottom));
        text-align: center;
    }

    .public-footer-links {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }

    .public-footer-links a {
        flex: 1 1 auto;
        min-width: 96px;
        padding: 0.55rem 0.35rem;
        border: 1px solid var(--border);
        background: #fff;
        font-size: 0.62rem;
    }

    .public-footer-copy {
        font-size: 0.6rem;
        line-height: 1.35;
    }

    body.has-public-header .gallery-grid {
        padding-bottom: 0.75rem !important;
    }
}

/* Desktop: fester Public-Header/Footer und einzeilige Sammlungstools. */
@media (min-width: 901px) {
    body.has-public-header {
        padding-top: 72px;
        padding-bottom: 58px;
    }

    body.page-index,
    body.page-impressum {
        overflow-y: hidden;
    }

    body.has-public-header .legal-layout {
        min-height: calc(100vh - 130px) !important;
        overflow-y: visible;
    }

    body.has-public-header .legal-inner {
        padding-top: 0.35rem;
        padding-bottom: 4.5rem;
    }

    body.page-impressum .legal-inner {
        padding-bottom: 1rem;
    }

    body.page-index .index-content {
        height: calc(100vh - 130px);
        min-height: 0;
        padding-top: 2.1rem;
        padding-bottom: 0;
        align-items: flex-start;
    }

    body.page-beschreibung .info-layout {
        padding-top: 0;
    }

    body.page-beschreibung .info-inner {
        padding-top: 0.7rem;
    }

    body.has-public-header.page-galerie {
        padding-top: 72px;
    }

    .public-header {
        position: fixed;
        inset: 0 0 auto 0;
        z-index: 2400;
    }

    .public-header-main {
        min-height: 72px;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .page-galerie .public-header-main {
        display: grid;
        grid-template-columns: auto minmax(520px, 1fr) auto;
        align-items: center;
        gap: 1rem;
    }

    .page-galerie .public-brand-logo {
        width: 46px;
        height: 46px;
    }

    .page-galerie .public-nav {
        justify-self: end;
        gap: 0.25rem;
    }

    .page-galerie .public-nav a {
        min-height: 40px;
        padding: 0.6rem 0.75rem;
        font-size: 0.72rem;
    }

    .page-galerie .header-collection-tools {
        display: grid;
        grid-template-columns: minmax(240px, 1fr) minmax(230px, 0.9fr) auto;
        align-items: end;
        gap: 0.5rem;
        padding: 0;
        border-top: none;
    }

    .page-galerie .header-collection-tools .toolbar-group {
        gap: 0.22rem;
    }

    .page-galerie .header-collection-tools .toolbar-label,
    .page-galerie .header-collection-tools .result-count {
        font-size: 0.5rem;
        letter-spacing: 0.06em;
    }

    .page-galerie .header-collection-tools .search-grid {
        grid-template-columns: 0.72fr 1fr 1fr;
        gap: 0.28rem;
    }

    .page-galerie .header-collection-tools .search-grid input {
        min-height: 32px;
        padding: 0.42rem 0.48rem;
        font-size: 0.68rem;
    }

    .page-galerie .header-collection-tools .sort-controls {
        grid-template-columns: 1fr 0.58fr;
        gap: 0.28rem;
    }

    .page-galerie .header-collection-tools .tab-nav {
        min-height: 32px;
    }

    .page-galerie .header-collection-tools .tab-item {
        font-size: 0.5rem;
    }

    .page-galerie .header-collection-tools .result-count {
        align-self: end;
        padding-bottom: 0.3rem;
    }

    .public-footer {
        position: fixed;
        inset: auto 0 0 0;
        z-index: 2300;
        margin-top: 0;
        min-height: 58px;
        padding-top: 0.9rem;
        padding-bottom: 0.9rem;
    }
}

/* Galerie: dynamische feste Spalten, 8 Kacheln ab typischer 14-Zoll-Breite. */
body.has-public-header .gallery-grid {
    width: 100% !important;
    max-width: none !important;
    padding: 0 clamp(0.8rem, 1.8vw, 1.6rem) 0.75rem !important;
    gap: clamp(0.55rem, 0.9vw, 0.9rem) !important;
}

body.has-public-header .stempel-card {
    min-width: 0;
}

@media (min-width: 1200px) {
    body.has-public-header .gallery-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 901px) and (max-width: 1199px) {
    body.has-public-header .gallery-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 561px) and (max-width: 900px) {
    body.has-public-header .gallery-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 560px) {
    body.has-public-header .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Öffentlicher Header: Logo raus, Startseite bekommt es als ruhiges Hintergrundmotiv. */
body.has-public-header .public-brand-logo {
    display: none !important;
}

body.has-public-header .public-brand {
    gap: 0;
}

body.page-index .index-content {
    position: relative;
    isolation: isolate;
    min-height: calc(100vh - 130px);
    overflow: hidden;
}

body.page-index .index-content::before {
    content: "";
    position: absolute;
    top: 66%;
    left: min(86%, calc(100% - 280px));
    width: min(46vw, 560px);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    background: url("assets/img/logo/vierringnummernstempel-logo-blau.svg") center / contain no-repeat;
    opacity: 0.09;
    pointer-events: none;
    z-index: 0;
}

body.page-index .index-content > * {
    position: relative;
    z-index: 1;
}

/* Sammlung: eine Suche und ein Dropdown statt schwerer Button-Leisten. */
.header-collection-tools .header-search-input {
    width: 100%;
    min-height: 26px;
    padding: 0.2rem 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid #dbe2ea;
    color: #111;
    font: inherit;
    font-size: 0.62rem;
    font-weight: 800;
    outline: none;
}

.sort-menu {
    position: relative;
}

.sort-menu-trigger {
    width: 100%;
    min-height: 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    padding: 0.2rem 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid #dbe2ea;
    color: #475569;
    cursor: pointer;
    font: inherit;
    font-size: 0.62rem;
    font-weight: 850;
    text-align: left;
}

.sort-menu-trigger i {
    color: #94a3b8;
    font-size: 0.55rem;
}

.sort-menu-panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    min-width: 100%;
    z-index: 2600;
    display: none;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.1);
}

.sort-menu.is-open .sort-menu-panel {
    display: grid;
}

.sort-option {
    min-height: 32px;
    padding: 0.52rem 0.65rem;
    background: #fff;
    border: 0;
    border-bottom: 1px solid #f1f5f9;
    color: #64748b;
    cursor: pointer;
    font: inherit;
    font-size: 0.65rem;
    font-weight: 850;
    text-align: left;
}

.sort-option:last-child {
    border-bottom: 0;
}

.sort-option:hover,
.sort-option.is-active {
    color: #111;
    background: #f8fafc;
}

.header-collection-tools .header-search-input:focus,
.sort-menu-trigger:focus {
    border-bottom-color: #111;
}

body.has-public-header .header-collection-tools .search-grid,
body.has-public-header .header-collection-tools .sort-controls,
body.has-public-header .header-collection-tools .tab-nav {
    display: none;
}

@media (min-width: 901px) {
    .page-galerie .public-header-main {
        grid-template-columns: auto minmax(340px, 0.64fr) auto;
        gap: 1rem;
    }

    .page-galerie .header-collection-tools {
        grid-template-columns: minmax(210px, 1fr) minmax(150px, 0.62fr) auto;
        gap: 0.62rem;
    }

    .page-galerie .header-collection-tools .header-search-input,
    .page-galerie .sort-menu-trigger {
        min-height: 25px;
        font-size: 0.6rem;
    }

    .page-galerie .header-collection-tools .toolbar-label,
    .page-galerie .header-collection-tools .result-count {
        color: #a1a9b6;
        font-size: 0.46rem;
        letter-spacing: 0.05em;
    }
}

@media (max-width: 900px) {
    .mobile-sort .sort-menu-trigger {
        min-height: 40px;
        padding: 0 0.2rem;
        font-size: 0.78rem;
    }

    .mobile-sort .sort-menu-panel {
        position: static;
        margin-top: 0.4rem;
        box-shadow: none;
    }
}

@media (max-width: 560px) {
    body.page-index .index-content::before {
        left: 50%;
        width: 115vw;
        opacity: 0.075;
    }
}
