:root {
    --bg: #f6f6f4;
    --surface: #ffffff;
    --surface-alt: #f0f0ec;
    --text: #222222;
    --muted: #5a5a5a;
    --line: #dbdbd6;
    --accent: #1f3d3a;
    --max-width: 1120px;
    --radius: 12px;
    --category-tile-title-band: 3.6rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Calibri, "Calibri Light", Candara, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    padding-top: 4rem;
}

body.route-home,
body.route-list {
    padding-top: 0;
}

body.route-detail .hero,
body.route-detail .header-top-spacer,
body.route-not-found .hero,
body.route-not-found .header-top-spacer,
body.route-document .hero,
body.route-document .header-top-spacer {
    display: none;
}

.not-found-main {
    padding-bottom: 2rem;
}

.not-found-heading {
    margin: 0 0 1rem;
    font-size: clamp(1.35rem, 2.2vw, 1.85rem);
}

.not-found-copy {
    margin: 0;
    max-width: 42rem;
}

.spa-view[hidden] {
    display: none !important;
}

#hero-eyebrow {
    min-height: 1.35em;
}

#hero-title {
    min-height: clamp(2.28rem, 4.2vw, 3.6rem);
}

#hero-copy {
    min-height: calc(1.5em * 3);
}

#kontakt-intro {
    min-height: calc(1.5em * 3);
}

#kontakt-card {
    min-height: 10rem;
}

#detail {
    min-height: min(70vh, 36rem);
}

#category-list {
    min-height: min(55vh, 28rem);
}

.page-top-anchor {
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    pointer-events: none;
}

.header-top-spacer {
    height: 6rem;
}

.container {
    width: min(100% - 2rem, var(--max-width));
    margin: 0 auto;
}

.site-header {
    background: transparent;
    border-bottom: none;
}

.topbar-branding {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    min-width: 0;
}

.topbar {
    min-height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding-left: max(1rem, calc((100% - var(--max-width)) / 2));
    padding-right: max(1rem, calc((100% - var(--max-width)) / 2));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    z-index: 20;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand img {
    display: block;
    width: clamp(140px, 20vw, 220px);
    height: auto;
}

.nav-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-list a {
    text-decoration: none;
    color: var(--muted);
    font-size: 0.95rem;
}

.nav-list a:hover,
.nav-list a:focus-visible {
    color: var(--text);
}

.nav-list a[aria-current="page"] {
    color: var(--text);
    font-weight: 600;
}

.nav-toggle {
    display: none;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
    position: relative;
    color: var(--text);
}

.nav-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
    content: "";
    position: absolute;
    left: 50%;
    width: 1.5rem;
    height: 2px;
    background: currentColor;
    transform: translateX(-50%);
}

.nav-toggle-bar {
    top: 50%;
    transform: translate(-50%, -50%);
}

.nav-toggle-bar::before {
    top: -0.5rem;
}

.nav-toggle-bar::after {
    top: 0.5rem;
}

@media (max-width: 699px) {
    .nav-toggle {
        display: inline-block;
    }

    #primary-nav {
        display: none;
        position: fixed;
        top: 4rem;
        left: 0;
        right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--line);
        padding: 1rem;
        z-index: 19;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    }

    #primary-nav.is-open {
        display: block;
    }

    #primary-nav .nav-list {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    #primary-nav .nav-list a {
        display: block;
        padding: 0.5rem 0.25rem;
        font-size: 1rem;
    }
}

.hero {
    position: relative;
    padding: 3rem 0 4rem;
    border-bottom: 1px solid var(--line);
}

.hero-backdrop {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
}

.hero-backdrop::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(
        to bottom,
        rgba(246, 246, 244, 0.9),
        rgba(246, 246, 244, 0.74)
    );
}

.hero--has-media .hero-backdrop::after {
    background: linear-gradient(
        to bottom,
        rgba(246, 246, 244, 0.92),
        rgba(246, 246, 244, 0.68)
    );
}

.hero-fade-layer {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.1s ease;
    z-index: 0;
}

.hero-fade-layer.is-visible {
    opacity: 1;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 3;
}

.eyebrow {
    margin: 0;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.8rem;
}

h1,
h2,
h3 {
    margin: 0 0 0.75rem;
    line-height: 1.2;
}

h1 {
    font-size: clamp(1.9rem, 3.5vw, 3rem);
    max-width: 18ch;
}

h2 {
    font-size: clamp(1.4rem, 2.7vw, 2rem);
}

.hero-copy {
    color: var(--muted);
    max-width: 62ch;
}

.hero-logo-secondary {
    display: block;
    margin-top: 1rem;
    width: clamp(180px, 25vw, 280px);
    height: auto;
}

.section {
    padding: 5rem 0;
}

.section-alt {
    background: var(--surface-alt);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.section-head p {
    margin: 0;
    color: var(--muted);
    max-width: 70ch;
}

.card-grid {
    margin-top: 1.4rem;
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    overflow: hidden;
}

.card-link {
    text-decoration: none;
    color: inherit;
}

.card-link .card {
    height: 100%;
    transition: box-shadow 0.2s ease;
}

.card-link:hover .card,
.card-link:focus-visible .card {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.card-link:focus-visible .card {
    box-shadow: 0 0 0 2px var(--accent);
}

.card-media-wrap {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #e2e2dd;
}

.card-media-wrap--empty {
    min-height: 0;
}

.card-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.card-link:hover .card-media,
.card-link:focus-visible .card-media {
    transform: scale(1.05);
}

.card-body {
    padding: 1rem;
}

.card-title {
    margin: 0 0 0.45rem;
}

.card-copy {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.feature-list {
    margin: 1rem 0 0;
    padding-left: 1.2rem;
    display: grid;
    gap: 0.5rem;
}

.feature-link {
    color: #429fca;
    text-decoration: none;
    margin-left: 0.25rem;
}

.partner-logo {
    display: block;
    margin: 0;
    margin-left: 2rem;
    width: auto;
    height: clamp(36px, 6vw, 52px);
    max-width: clamp(100px, 22vw, 180px);
    object-fit: contain;
}

.news-list {
    margin-top: 1.4rem;
    display: grid;
    gap: 0.9rem;
}

.news-item {
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 1rem;
}

.news-item p {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.contact-layout {
    display: grid;
    gap: 1rem;
}

#kontakt {
    scroll-margin-top: 5rem;
}

#kontakt-intro {
    white-space: pre-line;
}

.contact-card {
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 1rem;
    font-style: normal;
}

.contact-card a {
    color: var(--accent);
    text-decoration: none;
}

.site-footer {
    padding: 1.5rem 0 2.5rem;
}

.site-footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.site-footer small {
    color: var(--muted);
}

.site-footer-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.875rem;
}

.site-footer-link:hover,
.site-footer-link:focus-visible {
    color: var(--accent);
    text-decoration: underline;
    outline: none;
}

.state-text {
    color: var(--muted);
    font-size: 0.95rem;
}

#kategorien .tile-grid {
    min-height: calc(
        3 * (var(--category-tile-title-band) + min(100vw - 2rem, var(--max-width)) * 0.625)
        + 2rem
    );
}

.tile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.category-tile {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 0;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.category-tile:hover,
.category-tile:focus-visible {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    outline: none;
}

.category-tile:focus-visible {
    box-shadow: 0 0 0 2px var(--accent);
}

.category-tile-visual {
    position: relative;
    aspect-ratio: 16 / 10;
    background: #e2e2dd;
    overflow: hidden;
}

.tile-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.category-tile:hover .tile-image,
.category-tile:focus-visible .tile-image {
    transform: scale(1.05);
}

.tile-image-placeholder {
    width: 100%;
    height: 100%;
    min-height: 0;
    background: #e2e2dd;
}

.tile-title {
    margin: 0;
    padding: 0.85rem 1rem;
    text-align: center;
    font-size: clamp(1.15rem, 2vw, 1.4rem);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.list-page-head {
    margin-bottom: 1.25rem;
}

.list-page-head .back-link {
    display: inline-block;
    margin-bottom: 0.75rem;
}

.list-main {
    padding-bottom: 2rem;
}

.detail-main {
    padding: 3rem 0 4rem;
}

#view-document p {
    margin: 0;
}

#view-document .detail-card > h1 {
    margin-top: 1.5em;
}

.detail-card {
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 1.25rem;
}

.detail-card > p:first-of-type {
    margin: 0 0 1.5rem;
}

.detail-card h1 {
    margin: 0 0 1.5rem;
    font-size: clamp(1.35rem, 2.2vw, 1.85rem);
    max-width: none;
}

.detail-copy {
    color: var(--muted);
    margin: 0 0 2rem;
}

#view-document .detail-card > p:has(.back-link) ~ .detail-copy {
    margin-top: 30px;
}

.detail-downloads {
    margin: 0 0 2rem;
}

.detail-downloads-heading {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.detail-download-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-download-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--line);
    background: var(--surface-alt);
    text-decoration: none;
    color: var(--text);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.detail-download-link:hover,
.detail-download-link:focus-visible {
    background: var(--surface);
    border-color: var(--accent);
    outline: none;
}

.detail-download-link:hover .detail-download-name,
.detail-download-link:focus-visible .detail-download-name {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.detail-download-icon {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    color: var(--muted);
}

.detail-download-link:hover .detail-download-icon,
.detail-download-link:focus-visible .detail-download-icon {
    color: var(--accent);
}

.detail-download-name {
    font-weight: 500;
    min-width: 0;
    word-break: break-word;
}

.detail-gallery {
    margin: 0 0 40px;
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
}

.detail-gallery-tile {
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    display: block;
    width: 100%;
}

.detail-gallery-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #e2e2dd;
}

.detail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.detail-gallery-tile:hover .detail-image,
.detail-gallery-tile:focus-visible .detail-image {
    transform: scale(1.05);
}

.back-link {
    color: var(--accent);
    text-decoration: none;
}

.photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 4vw, 2.5rem);
}

.photo-lightbox.is-open {
    display: flex;
}

.photo-lightbox:focus {
    outline: none;
}

.photo-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.82);
    cursor: pointer;
}

.photo-lightbox-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: min(92vw, 1280px);
    max-height: min(88vh, 920px);
    pointer-events: none;
}

.photo-lightbox-inner > * {
    pointer-events: auto;
}

.photo-lightbox-frame {
    position: relative;
    display: inline-block;
    max-width: min(86vw, 1100px);
    max-height: min(85vh, 900px);
}

.photo-lightbox-img {
    max-width: min(86vw, 1100px);
    max-height: min(85vh, 900px);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    cursor: pointer;
}

.photo-lightbox-arrow {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-lightbox-arrow:hover,
.photo-lightbox-arrow:focus-visible {
    background: #ffffff;
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.photo-lightbox-arrow--overlay {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.photo-lightbox-arrow--overlay.photo-lightbox-prev {
    left: 0.5rem;
}

.photo-lightbox-arrow--overlay.photo-lightbox-next {
    right: 0.5rem;
}

.photo-lightbox-arrow[hidden] {
    display: none;
}

@media (max-width: 519px) {
    .photo-lightbox-arrow--overlay {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 1.1rem;
    }
}

@media (min-width: 700px) {
    #kategorien .tile-grid {
        min-height: calc(
            var(--category-tile-title-band)
            + ((min(100vw - 2rem, var(--max-width)) - 2.5rem) / 3) * 0.625
        );
    }

    .tile-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.25rem;
    }

    .card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .contact-layout {
        grid-template-columns: 2fr 1fr;
        align-items: start;
    }
}

@media (min-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .detail-gallery {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
