html, body {
    height: 100%;
    margin: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    display: flex;
    flex-direction: column;
    font-family: "Century Gothic", sans-serif;
    scrollbar-width: none;
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

main {
    flex: 1 0 auto;
}

header {
    padding-top: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}


h3 {
    margin: 0;
}


.centered {
    text-align: center;
    align-items: center;
    align-content: center;
}

.nav-dropdown-container {
    position: relative;
    display: inline-block;
}

.sub-dropdown-link {
    position: relative;
    left: 20px;
}

.sub-dropdown-menu {
    padding-bottom: 10px;
    display: none;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    min-width: 20%;
    z-index: 1;
    left: -20px;
}

.nav-dropdown-container {
    display: block;
}

.dropdown-link {
    color: black;
    text-decoration: none;
    display: none;
    background-color: white;
    padding: 0;
}

.nav-dropdown-menu .dropdown-link:hover {
    background-color: #f1f1f1;
}

.nav-links {
    display: flex;
    justify-content: space-evenly;
    flex-grow: 1;
    align-items: center;
    gap: clamp(12px, 3vw, 48px);
}

.nav-link, .nav-logo {
    font-size: clamp(1rem, 1.7vw, 1.25rem);
    color: #8e0100;
    text-decoration: none;
}

.nav-logo img {
    height: 4rem;
    /* width:auto keeps the intrinsic ratio; without it the width attribute wins */
    width: auto;
    padding-right: 20px;
    z-index: 5;
}

.header-nav-mobile {
    display: none;
    position: relative;
    z-index: 2; /* Ensure it sits above other content */
}

.mobile-link {
    padding-top: 5px;
    font-size: 2vh;
    text-decoration: none;
    display: block; /* Ensure the link is block to properly cover the area */
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 133%; /* Position below the mobile link */
    left: 0;
    width: 100vw;
    max-height: calc(100vh - 5rem); /* Ensure the menu fits within the viewport height */
    overflow-y: auto; /* Allow scrolling if the content is too long */
    background-color: white;
    z-index: 1; /* Ensure it sits below other elements like the logo */
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.dropdown-link {
    display: block;
    padding: 10px 20px;
    font-size: 2vh;
    color: #8e0100;
    text-decoration: none;
}

.dropdown-link:hover {
    background-color: #ddd;
}

.dropdown-project-menu {
    display: none;
    top: 100%;
    left: 0;
    flex-direction: column;
    z-index: 2;
}

.dropdown-project-link {
    font-size: 2vh;
    color: #8e0100;
    text-decoration: none;
}

/* Menu toggles are <button> for keyboard access; strip the native chrome so
   they match the <a> siblings they sit next to. */
button.nav-link,
button.mobile-link,
button.dropdown-link {
    appearance: none;
    background: none;
    border: none;
    font-family: inherit;
    line-height: inherit;
    cursor: pointer;
}

button.nav-link {
    padding: 0;
}

button.mobile-link {
    padding: 5px 0 0;
    text-align: left;
}

button.dropdown-link {
    width: 100%;
    text-align: left;
    background-color: #fff;
}

:focus-visible {
    outline: 3px solid #900000;
    outline-offset: 2px;
}

.modal :focus-visible,
.map-link:focus-visible {
    outline-color: #fff;
}

.skip-link {
    position: absolute;
    top: 0;
    left: -9999px;
    z-index: 100;
    padding: 10px 16px;
    background-color: #900000;
    color: #fff;
    text-decoration: none;
}

.skip-link:focus {
    left: 0;
}


.work-box {
    padding-bottom: 30px;
}


.contact-text {
    padding: 10px 5%;
    font-size: 1.3rem;
    text-align: center;
}

.contact-text h4 {
    margin: 0;
}

@media (max-width: 767px) {
    .contact-text {
        text-align: center;
        font-size: 1rem;
        padding: 0 10px;
    }

    .work-box {
        padding-bottom: 0;
    }
}


.contact-methods {
    padding-top: 5px;
}

.title {
    margin: 0 3% 0 3%;
    font-size: 2rem;
    color: #333;
}

@media (max-width: 767px) {
    .title {
        text-align: center;
        margin-bottom: 5px;
        font-size: 1.6rem;
        color: #333;
    }

}

.carousel {
    position: relative;
    width: 100%;
    height: clamp(240px, 35vw, 560px);
    margin: auto;
    overflow: hidden;
    background-color: #f5f5f5;
    contain: layout paint;
}

/* Large screens: a fixed 560px height across a 2500px-wide viewport turns the
   hero into a letterbox sliver, because object-fit has to crop the sides off a
   ~2.5:1 photo. Capping the width and matching that ratio shows the whole
   image instead, and the vh ceiling keeps the buttons below it on screen. */
@media (min-width: 1200px) {
    .carousel {
        width: min(100%, 1400px);
        height: auto;
        aspect-ratio: 5 / 2;
        max-height: 58vh;
        margin-inline: auto;
    }
}

.carousel-inner {
    display: flex;
    transition: 0.5s ease-in-out;
    height: 100%;
    will-change: transform;
}

.carousel-item {
    min-width: 100%;
    box-sizing: border-box;
    height: 100%;
}

.carousel-item > a {
    display: block;
    height: 100%;
}

.carousel picture {
    display: block;
    height: 100%;
}

.carousel img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

@media (max-width: 767px) {
    .carousel {
        height: clamp(240px, 66vw, 420px);
    }

    .only-show-item-on-desktop {
        display: none;
    }
}

.modal-button {
    position: absolute;
    top: 50%;
    width: clamp(44px, 6vw, 70px);
    height: clamp(56px, 10vw, 100px);
    background: rgba(0, 0, 0, 0);
    color: #900000;
    border: none;
    cursor: pointer;
    font-size: 2rem;
    transform: translateY(-50%);
    touch-action: manipulation;
}

.prev {
    left: 0;
}

.next {
    right: 0;
}

@media (max-width: 767px) {
    .prev {
        left: 0.1vw;
    }

    .next {
        right: 0.1vw;
    }

    button:active {
        background: rgba(0, 0, 0, 0);
    }
}

.quote {
    text-align: center;
    font-size: 1.4rem;
    color: #900000;
    margin: 10px;
}

.quote p {
    margin: 10px 10px;
}

@media (max-width: 767px) {
    .quote {
        font-size: 1.2rem;
        padding: 0 10px;
    }
}


.legal {
    display: flex;
}

.red-block {
    width: 10vw;
    margin-left: 5vw;
    background-color: #900000;
}

.text-content {
    width: 100%;
    padding: 0 40px;
}

.text-content h1,
.text-content h2 {
    color: #900000;
    margin: 20px 0 0 0;
}

.text-content h3 {
    margin: 20px 0 0 0;
}

.text-content p {
    line-height: 1.5;
    margin: 1px;
}

.text-div {
    font-size: 1.2rem;
}

@media (max-width: 767px) {
    .text-div {
        font-size: 1rem;
    }


    .text-content {
        width: 80%;
        padding: 0 20px;
    }

    .text-content h1,
    .text-content h2 {
        color: #900000;
        margin: 10px 0 0 0;
        font-size: 1.3rem;
    }

    .text-content h3 {
        margin: 10px 0 0 0;
        font-size: 1.2rem;
    }

    .text-content p {
        line-height: 1.3;
        margin: 1px;
    }
}


.text-image-box {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

.text-box {
    width: 40vw;
    padding: 0 20px;
}

.image-box {
    object-fit: cover;
    width: 40vw;
    padding: 0 20px;

}

.text-box h1 {
    font-size: 2rem;
    text-align: center;
}

.text-box p {
    font-size: 1.2rem;
    margin: 0;
}

.text-box.hidden {
    display: none;
}

.text-box.visible {
    display: block;
}


.image-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.about-us-text h3 {
    font-size: 1.4rem;
    color: #900000;
}

.about-us-text p {
    margin-top: 5px;
    font-size: 1.2rem;
}

.about-us-text {
    align-items: start;
}

.about-us-box {
    padding: 2vw 0 2vw 0;
}

/* Responsive adjustments for mobile */
@media (max-width: 767px) {

    .text-image-box {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .text-box {
        width: 90vw;
        text-align: center;
        padding: 0;
    }

    .image-box {
        object-fit: cover;
        padding: 10px 0;
        width: 90vw;
    }

    .text-box h1 {
        font-size: 1.8rem;
        text-align: center;
    }

    .text-box p {
        font-size: 1rem;
    }

    .text-box.hidden {
        display: none;
    }

    .text-box.visible {
        display: block;
    }


    .image-box img {
        max-width: 100%;
        max-height: 100%;
        object-fit: cover;
    }

    .about-us-text h3 {
        font-size: 1.4rem;
        color: #900000;
    }

    .about-us-text p {
        margin-top: 5px;
        font-size: 1.2rem;
    }

    .about-us-text {
        align-items: start;
    }
}

.project {
    text-decoration: none;
    color: black;
}

.project-text-image-box {
    margin: 20px clamp(12px, 4vw, 40px);
    display: flex;
    flex-direction: row; /* Default to row for desktop */
    justify-content: center;
    align-items: center;
    gap: clamp(16px, 3vw, 36px);
}

.project-text-box {
    display: flex;
    flex-direction: column; /* Arrange child elements in a column */
    max-width: 50%; /* Ensure text box does not grow too large */
}

.project-text-box h2 {
    margin: 0 0 5px;
    font-size: 1.8rem;
}

.project-text-box h3 {
    margin: 0 0 5px;
    font-size: 1.2rem;
    color: #900000;
    font-weight: lighter;
}

.project-text-box p {
    font-size: 1.3rem; /* Use rem for a more controlled font size */
    color: #444;
    margin: 0;
}

.project-image-box {
    position: relative; /* Required for absolute positioning of images */
    width: min(40rem, 46vw); /* Explicit width */
    aspect-ratio: 4 / 3;
    height: auto;
    overflow: hidden;
}

.project-image-container {
    position: relative;
    width: 100%;
    height: 100%; /* Ensure the container covers the full height */
}

.project-image-container img {
    position: absolute;
    width: 100%;
    height: 100%; /* Ensure images cover the full container */
    object-fit: cover; /* Ensure images cover the container */
    transition: opacity 0.3s ease-in-out;
    will-change: opacity;
}

.project-first-image {
    opacity: 1;
}

.project-second-image {
    opacity: 0;
}

.project-hidden-image {
    opacity: 0;
}

.project-image-box:hover .project-first-image {
    opacity: 0;
}

.project-image-box:hover .project-second-image {
    opacity: 1;
}

/* Responsive adjustments for mobile */
@media (max-width: 767px) {
    .project-text-image-box {
        flex-direction: column; /* Stack elements vertically on mobile */
        padding: 10px; /* Reduce padding to use screen space more effectively */
        margin: 10px 0;
        gap: 12px;
    }

    .project-text-box {
        max-width: 100%;
        margin-bottom: 10px;
    }

    .project-text-box p {
        font-size: 1.1rem;
    }

    .project-image-box {
        width: min(100%, 25rem);
        max-width: calc(100vw - 40px);
        aspect-ratio: 5 / 3;
        height: auto;
    }

    .project-image-container {
        width: 100%; /* Adjust as needed */
        height: 100%; /* Adjust as needed */
        overflow: hidden;
        position: relative;
    }

    .project-image-container img {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: auto;
        height: 100%;
    }

    .project-first-image {
        opacity: 1;
    }

    .project-second-image {
        opacity: 0;
    }

    .project-image-box:hover .project-first-image {
        opacity: 1;
    }

    .project-image-box:hover .project-second-image {
        opacity: 0;
    }
}

.card-title {
    margin: 0;
    font-size: 1.5rem;
    position: relative;
}

.card-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1rem;
    gap: clamp(1rem, 4vw, 3rem);
}

.card-link {
    text-decoration: none;
    color: inherit;
    width: min(40%, 36rem);
    margin: 10px 10px;
}

.modal-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
}


.card {
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    transition: opacity 250ms ease-in-out;
    position: relative;
}

.card-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 70%;
    overflow: hidden;
}

.card-image,
.card-image-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 250ms ease-in-out;
}

.card-image-hover {
    opacity: 0;
}


footer {
    padding-top: 5px;
    background-color: rgb(245, 245, 245);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly;
    text-align: center;
    padding-left: 50px;
    padding-right: 50px;
    box-sizing: border-box;
}

footer p, footer a {
    font-size: 0.8rem;
    margin: 5px 10px 10px;
}

footer span {
    margin: 5px;
}

.clickable {
    color: #900000;
    cursor: pointer;
    text-underline: #900000;
}

@media (max-width: 767px) {
    .nav-links {
        display: none;
    }

    .nav {
        height: 2.2rem;
    }

    .nav .nav-logo img {
        height: 2.8rem;
    }

    .header-nav-mobile {
        display: flex;
        padding-left: 20px;
    }

    .dropdown-link {
        background-color: #ffffff;
        font-size: 1.2rem;
    }

    .mobile-link {
        font-size: 1.2rem;
    }

    footer p, footer a {
        font-size: 0.8rem;
        margin: 5px 10px 10px;
    }

    footer span {
        display: none;
    }
}

@media (min-width: 769px) {
    .card-image-wrapper:hover .card-image {
        opacity: 0;
    }

    .card-image-wrapper:hover .card-image-hover {
        opacity: 1;
    }
}

@media (max-width: 767px) {
    .card-link {
        width: min(100%, 34rem);
    }

    .card-image-hover {
        opacity: 0;
    }
}

.primary-color {
    color: #900000;
}

.underlined {
    text-decoration: underline #900000;
}

.hr-top {
    width: 95%;
    border: none;
    border-bottom: 2px solid #900000;
    margin: 0 auto;
    cursor: default;
    padding-top: 20px;
}

.hr-bottom {
    width: 95%;
    border: none;
    border-top: 2px solid #900000;
    margin: 0 auto;
    cursor: default;
    padding-bottom: 20px;
}

.hr-middle {
    width: 95%;
    border: none;
    border-bottom: 2px solid #900000;
    margin: 0 auto;
    cursor: default;
    padding-top: 10px;
    margin-bottom: 10px;
}

.text {
    align-content: center;
    justify-self: center;
    justify-content: center;
    font-size: 1.2rem;
    margin: 0 40px;
}

@media (max-width: 767px) {
    .text {
        font-size: 1rem;
        margin: 0;
        padding: 0 20px;
    }

    .page-hero,
    .content-section,
    .cta-band,
    .home-cta,
    .legal-details {
        width: min(100% - 24px, 1120px);
    }

    .service-grid,
    .contact-grid,
    .team-grid,
    .facts-grid,
    .process-list {
        grid-template-columns: 1fr;
    }

    .page-hero {
        margin-top: 18px;
    }

    .cta-row {
        width: 100%;
    }


    .button-link {
        flex: 1 1 44px;
    }

    .cta-band {
        padding: 20px;
    }
}

.page-hero {
    width: min(1120px, calc(100% - 40px));
    margin: 28px auto;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
    gap: clamp(24px, 5vw, 60px);
    align-items: center;
}

.page-hero--simple {
    grid-template-columns: 1fr;
    text-align: center;
    max-width: 900px;
}

.page-eyebrow {
    margin: 0 0 8px;
    color: #900000;
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
}

.page-hero h1 {
    margin: 0;
    color: #222;
    font-size: clamp(2rem, 5vw, 4.25rem);
    line-height: 1;
}

.page-lead {
    margin: 18px 0 0;
    color: #333;
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    line-height: 1.55;
}

.page-hero-media {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.page-hero-media img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.cta-row {
    /* was missing, so the gap below never applied and the buttons were
       spaced by whatever whitespace sat between the tags */
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 24px;
}

/* A row of calls to action that should read as one set: equal columns that
   wrap to full width rather than leaving a stretched odd one out. */
.cta-row--equal {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
    align-items: stretch;
    gap: 12px;
}

.cta-row--equal .button-link {
    padding: 8px 14px;
    font-size: 1rem;
    text-align: center;
}

/* The three opening calls to action read as one set, so they get one width
   rather than three lengths of German. */
.home-cta .cta-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    /* the base rule centres items, which stops the grid equalising heights */
    align-items: stretch;
    gap: 12px;
    width: min(46rem, 100%);
    margin-inline: auto;
}

/* Without this they inherit the oversized quote type and two of the three
   labels wrap to a second line. */
.home-cta .cta-row .button-link {
    padding: 8px 14px;
    font-size: 1rem;
    text-align: center;
}

@media (max-width: 640px) {
    .home-cta .cta-row {
        grid-template-columns: 1fr;
    }
}

.page-hero--simple .cta-row {
    justify-content: center;
}

.button-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 2px solid #900000;
    padding: 0 18px;
    margin-bottom: 2px;
    color: #900000;
    background-color: #fff;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.button-link:hover,
.button-link:focus {
    background-color: #900000;
    color: #fff;
}

.button-link--primary {
    background-color: #900000;
    color: #fff;
}

.button-link--primary:hover,
.button-link--primary:focus {
    background-color: #5f0000;
    border-color: #5f0000;
}

.home-cta {
    width: min(980px, calc(100% - 40px));
    margin: 20px auto 30px;
    text-align: center;
}

.home-cta p {
    margin: 8px auto 0;
    max-width: 720px;
    color: #333;
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.5;
}

.content-section {
    width: min(1120px, calc(100% - 40px));
    margin: 34px auto;
}

.section-heading {
    margin: 0 0 18px;
    color: #222;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    line-height: 1.1;
}

.service-grid,
.contact-grid,
.team-grid,
.facts-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.facts-grid .info-panel {
    position: relative;
    padding-bottom: 42px;
}

.facts-grid .external-link-icon {
    position: absolute;
    right: 16px;
    bottom: 16px;
    width: 18px;
    height: 18px;
    color: #900000;
}

.info-panel {
    border-top: 3px solid #900000;
    background-color: #f7f7f7;
    padding: 20px;
}

.info-panel h2,
.info-panel h3 {
    margin: 0 0 10px;
    color: #900000;
    font-size: 1.25rem;
}

.info-panel p,
.info-panel li {
    color: #333;
    font-size: 1rem;
    line-height: 1.5;
}

.info-panel p {
    margin: 0;
}

.info-panel p + p {
    margin-top: 12px;
}

.info-panel ul {
    margin: 0;
    padding-left: 18px;
}

.process-list {
    counter-reset: process;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.process-step {
    position: relative;
    padding: 18px;
    background-color: #fff;
    border: 1px solid #ddd;
}

.process-step::before {
    counter-increment: process;
    content: counter(process, decimal-leading-zero);
    display: block;
    margin-bottom: 12px;
    color: #900000;
    font-size: 1.5rem;
    font-weight: 700;
}

.process-step h3 {
    margin: 0 0 8px;
    color: #222;
    font-size: 1.15rem;
}

.process-step p {
    margin: 0;
    color: #444;
    line-height: 1.5;
}

.cta-band {
    width: min(1120px, calc(100% - 40px));
    margin: 38px auto;
    padding: 28px;
    background-color: #f2f2f2;
    box-sizing: border-box;
    display: flex;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
}

.cta-band h2 {
    margin: 0 0 8px;
    color: #222;
}

.cta-band p {
    margin: 0;
    color: #333;
    line-height: 1.5;
}

.team-profile {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.team-profile .info-panel {
    background-color: #fff;
    border: 1px solid #ddd;
    border-top: 3px solid #900000;
}

.contact-card {
    background-color: #fff;
    border: 1px solid #ddd;
    padding: 22px;
}

.contact-card h2,
.contact-card h3 {
    margin: 0 0 10px;
    color: #900000;
}

.contact-card p {
    margin: 0 0 8px;
    line-height: 1.5;
}

.map-link {
    display: block;
    min-height: 220px;
    padding: 24px;
    color: #fff;
    background: linear-gradient(rgba(40, 40, 40, 0.55), rgba(40, 40, 40, 0.55)), url("../images/Arbeitsweise/IMG_0909.jpeg") center / cover;
    text-decoration: none;
}

.map-link h2 {
    margin: 0 0 10px;
    color: #fff;
    font-size: clamp(1.8rem, 4vw, 3rem);
}

.map-link p {
    margin: 0;
    max-width: 520px;
    font-size: 1.1rem;
}

.legal-details {
    width: min(960px, calc(100% - 40px));
    margin: 34px auto;
}

.legal-details summary {
    cursor: pointer;
    color: #900000;
    font-weight: 700;
    font-size: 1.1rem;
}

.legal-details .text-content {
    width: auto;
    padding: 18px 0 0;
}

@media (max-width: 900px) {
    .page-hero,
    .team-profile {
        grid-template-columns: 1fr;
    }

    .service-grid,
    .contact-grid,
    .team-grid,
    .facts-grid,
    .process-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cta-band {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 767px) {
    .service-grid,
    .contact-grid,
    .team-grid,
    .facts-grid,
    .process-list {
        grid-template-columns: 1fr;
    }
}

.facts-grid > a {
    color: inherit;
    text-decoration: none;
    display: block;
}

.facts-grid > a:hover,
.facts-grid > a:focus,
.facts-grid > a:active {
    color: inherit;
    text-decoration: none;
}

.facts-grid > a .info-panel {
    height: 100%;
    box-sizing: border-box;
}

/* Initial hidden state for the modal */
.modal {
    display: none; /* Hide the modal by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.8); /* Optional background color for the modal */
    z-index: 20; /* Ensure modal is above other content */
}

/* Style for modal content */
.modal-content {
    position: relative;
    width: 100vw;
    height: 100dvh;
    margin-top: 0;
    padding: 56px 0 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Ensure image is centered and fits within modal content */
.modal-carousel {
    position: relative;
    width: 100%;
    /* display:flex was missing, so this box collapsed to the image's own height
       instead of filling the dialog - the photo sat in a band with a large gap
       above the thumbnail strip, and the arrows centred on the band. */
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    align-items: center;
    justify-content: center;
}

/* Gallery strip: every frame of the project, click to jump. */
.modal-thumbs {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    width: 100%;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: safe center;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.modal-thumbs:empty,
.modal-thumbs[hidden] {
    display: none;
}

.modal-thumb {
    flex: 0 0 auto;
    width: clamp(54px, 8vw, 92px);
    aspect-ratio: 4 / 3;
    padding: 0;
    appearance: none;
    background: none;
    border: 2px solid transparent;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 160ms ease, border-color 160ms ease;
}

.modal-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.modal-thumb:hover,
.modal-thumb:focus-visible {
    opacity: 1;
}

.modal-thumb[aria-selected="true"] {
    opacity: 1;
    border-color: #fff;
}

@media (max-width: 767px) {
    .modal-thumbs {
        gap: 6px;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    }
}

.modal-carousel .carousel-inner {
    display: flex;
    width: 100%;
    height: 100%;
}

.modal-carousel .carousel-item {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-carousel img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Ensures the entire image fits within the container without distortion */
}

.modal-open {
    overflow: hidden;
}

/* Class to show the modal */
.modal.show {
    display: flex; /* Show the modal */
}

/* Close button. It is a <button> so it can be reached by keyboard, which means
   the native background, border and font have to be stripped or it renders as
   a grey OS button instead of a bare cross. */
.close {
    position: absolute;
    top: 8px;
    right: 16px;
    appearance: none;
    background: none;
    border: none;
    padding: 0 10px;
    line-height: 1;
    font-family: inherit;
    color: #f1f1f1;
    font-size: 44px;
    font-weight: bold;
    cursor: pointer;
    z-index: 25;
    transition: color 160ms ease;
}

.close:hover,
.close:focus-visible {
    color: #fff;
    text-decoration: none;
}

/* Navigation buttons for the carousel */
.modal-carousel .prev, .modal-carousel .next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #D00000;
    border: none;
    padding: 10px;
    cursor: pointer;
    z-index: 2;
    font-size: 50px;
}

.modal-carousel .prev {
    left: 10px;
}

.modal-carousel .next {
    right: 20px;
}

@media (max-width: 769px) {
    .modal-carousel .prev {
        left: -3vw;
    }

    .modal-carousel .next {
        right: -2vw;
    }
}

.nav-link-container {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%; /* Position it below the parent link */
    left: 0;
    background-color: white;
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.dropdown-content a {
    color: #8e0100;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.dropdown-content a:hover {
    background-color: #ddd;
}

/* Style for active state, if needed */
.nav-link-container.active .dropdown-content {
    display: block;
}


.collage {
    text-decoration: none;
    color: black;
}

.collage h3 {
    text-align: right;
    font-size: 1.6vw;
    margin-bottom: 5px;
}

.collage-box {
    width: 20vw;
    height: 20vw;
}

.collage-text-image-box {
    display: flex;
    flex-direction: row; /* Default to row for desktop */
    justify-content: center;
    align-items: center;
    gap: 20px; /* Gap between the two boxes */
}

.collage-text-box {
    display: flex;
    flex-direction: column; /* Arrange child elements in a column */
    justify-content: center; /* Center content vertically */
    align-items: center; /* Center content horizontally */
    text-align: center; /* Center text horizontally */
    max-width: 45%; /* Ensure text box does not grow too large */
}

.collage-text-box h2 {
    margin: 0 0 5px;
    font-size: 1.8rem;
}

.collage-text-box h3 {
    font-size: 1.2rem;
    color: #900000;
    font-weight: lighter;
}

.collage-text-box p {
    font-size: 1.3rem; /* Use rem for a more controlled font size */
    color: #444;
    margin: 0;
}

.collage-image-box {
    position: relative; /* Required for absolute positioning of images */
    width: 20%; /* Explicit width */
    height: 30rem;
    overflow: hidden;
}

.collage-image-container {
    position: relative;
    width: 100%;
    height: 100%; /* Ensure the container covers the full height */
}

.collage-image-container img {
    position: absolute;
    width: 100%;
    height: 100%; /* Ensure images cover the full container */
    object-fit: cover; /* Ensure images cover the container */
    transition: opacity 0.3s ease-in-out;
}

.collage-first-image {
    opacity: 1;
}

.collage-second-image {
    opacity: 0;
}

.collage-hidden-image {
    opacity: 0;
}

.collage-image-box:hover .collage-first-image {
    opacity: 0;
}

.collage-image-box:hover .collage-second-image {
    opacity: 1;
}

@media (max-width: 1000px) {
    .collage-box {
        width: 28vw;
        height: 28vw;

    }

    .collage h3 {
        text-align: right;
        font-size: 2.2vw;
        margin-bottom: 5px;
    }
}

/* Responsive adjustments for mobile */
@media (max-width: 767px) {
    .collage-text-image-box {
        flex-direction: column; /* Stack elements vertically on mobile */
    }

    .collage-box {
        width: min(40vw, 13rem);
        height: min(40vw, 13rem);

    }

    .collage h3 {
        text-align: right;
        font-size: 2.5vw;
        margin-bottom: 5px;
    }

    .collage-text-box {
        max-width: 100%;
        margin-bottom: 10px;
    }

    .collage-text-box p {
        font-size: 1.1rem;
    }

    .collage-image-box {
        width: min(100%, 25rem); /* Explicit width */
        max-width: calc(100vw - 40px);
        aspect-ratio: 5 / 3;
        height: auto;
    }

    .collage-image-container {
        width: 100%; /* Adjust as needed */
        height: 100%; /* Adjust as needed */
        overflow: hidden;
        position: relative;
    }

    .collage-image-container img {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: auto;
        height: 100%;
    }

    .collage-first-image {
        opacity: 1;
    }

    .collage-second-image {
        opacity: 0;
    }

    .collage-image-box:hover .collage-first-image {
        opacity: 1;
    }

    .collage-image-box:hover .collage-second-image {
        opacity: 0;
    }
}

@media (max-width: 500px) {
    .collage h3 {
        text-align: right;
        font-size: 5vw;
        margin-bottom: 5px;
    }
}


/* Style for the button */
#scrollToTopBtn {
    position: fixed;
    bottom: 1%;
    right: 1%;
    padding: 0 4px;
    margin: 0;
    color: #900000;
    background-color: rgba(255, 255, 255, 0.42);
    border: none;
    cursor: pointer;
    font-size: 2rem;
    opacity: 1;
    transition: opacity 0.3s;
}

#scrollToTopBtn:hover {
    opacity: 1;
    color: #300000;
}


@media (max-width: 767px) {
    /* Style for the button */
    #scrollToTopBtn {
        position: fixed;
        bottom: 2vw;
        right: 3vw;
        padding: 0 4px;
        margin: 0;
        color: #900000;
        background-color: rgba(255, 255, 255, 0);
        border: none;
        cursor: pointer;
        font-size: 2rem;
        opacity: 1;
        transition: opacity 0.3s;
    }

    #scrollToTopBtn:hover {
        opacity: 1;
        color: #900000;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Verbesserung für beide Startseiten-Text-Bild-Boxen */
.text-image-box.work-box,
.text-image-box.work-box + .text-image-box {
    width: min(1120px, calc(100% - 40px));
    margin: 30px auto 24px;
    padding: clamp(18px, 3vw, 34px) 0;
    align-items: center;
    justify-content: space-between;
    gap: clamp(20px, 4vw, 58px);
}

.text-image-box.work-box + .text-image-box {
    margin-top: 0;
    margin-bottom: 28px;
}

.text-image-box.work-box .text-box,
.text-image-box.work-box + .text-image-box .text-box {
    width: auto;
    max-width: 520px;
    flex: 1 1 0;
    padding: 0;
}

.text-image-box.work-box .text-box h1,
.text-image-box.work-box + .text-image-box .text-box h1 {
    margin: 0 0 14px;
    color: #222;
    font-size: clamp(2rem, 4vw, 3.25rem);
    line-height: 1.05;
    letter-spacing: -0.04em;
    text-align: left;
}

.text-image-box.work-box .text-box p,
.text-image-box.work-box + .text-image-box .text-box p {
    max-width: 52ch;
    color: #333;
    font-size: clamp(1.05rem, 1.6vw, 1.3rem);
    line-height: 1.6;
}

.text-image-box.work-box .image-box,
.text-image-box.work-box + .text-image-box .image-box {
    width: auto;
    max-width: 560px;
    flex: 1 1 0;
    padding: 0;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.text-image-box.work-box .image-box img,
.text-image-box.work-box + .text-image-box .image-box img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

@media (max-width: 767px) {
    .text-image-box.work-box,
    .text-image-box.work-box + .text-image-box {
        width: min(100% - 24px, 640px);
        margin: 18px auto 12px;
        padding: 18px 0 10px;
        gap: 16px;
    }

    .text-image-box.work-box + .text-image-box {
        margin-top: 0;
        padding-top: 0;
    }

    .text-image-box.work-box .text-box,
    .text-image-box.work-box + .text-image-box .text-box {
        width: 100%;
        max-width: none;
        padding: 0;
        text-align: center;
    }

    .text-image-box.work-box .text-box h1,
    .text-image-box.work-box + .text-image-box .text-box h1 {
        margin-bottom: 10px;
        font-size: clamp(1.8rem, 9vw, 2.5rem);
        text-align: center;
    }

    .text-image-box.work-box .text-box p,
    .text-image-box.work-box + .text-image-box .text-box p {
        max-width: none;
        font-size: 1rem;
        line-height: 1.5;
        text-align: center;
    }

    .text-image-box.work-box .image-box,
    .text-image-box.work-box + .text-image-box .image-box {
        width: 100%;
        max-width: none;
        padding: 0;
        aspect-ratio: 4 / 3;
    }
}

/* ---------------------------------------------------------------- collages
   Startseite: vier Collagen pro Reihe am Desktop, drei am Handy. Die
   Aussenkanten folgen exakt den Projektzeilen darueber, deshalb sind die
   Randregeln von .project-text-image-box hier gespiegelt: clamp-Rand im
   mittleren Bereich, volle Breite mit 10px Polster am Handy, und ab 1600px
   das --shell-Raster, an dem onepage.css die Projektzeilen ausrichtet.
   Auf #projekte gescoped, damit privat-bauten.html und
   oeffentlich-bauten.html ihr zentriertes Flex-Layout behalten. */
#projekte .collage-section {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: start;
    gap: clamp(12px, 2vw, 28px);
    margin-inline: clamp(12px, 4vw, 40px);
}

#projekte .collage-section > hr {
    grid-column: 1 / -1;
    width: 100%;
}

#projekte .collage-section .collage,
#projekte .collage-section .collage-text-image-box {
    display: block;
    width: 100%;
}

/* die feste 20vw-Kachel weicht der Rasterzelle */
#projekte .collage-section .collage-box {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
}

@media (max-width: 767px) {
    #projekte .collage-section {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        /* exakt die Randwerte von .project-text-image-box am Handy:
           kein Aussenabstand, 10px Innenabstand */
        margin-inline: 0;
        padding-inline: 10px;
    }
}

@media (min-width: 1600px) {
    #projekte .collage-section {
        width: var(--shell);
        margin-inline: auto;
    }
}
