/* =====================================================
   Piero Aero — Gallery
   Load after responsive.css
   ===================================================== */

:root {
    --gallery-dark: #080b0f;
    --gallery-dark-soft: #ffffff;
    --gallery-warm: #faf6ec;
    --gallery-gold: #9a711d;
    --gallery-champagne: #e1c98e;
    --gallery-border: rgba(154, 113, 29, 0.22);
}

body.gallery-open {
    overflow: hidden;
}

.gallery-page {
    background: #ffffff;
}

/* Intro */
.gallery-intro {
    position: relative;
    padding: clamp(9rem, 14vw, 13rem) var(--container-padding) clamp(4rem, 7vw, 7rem);
    overflow: hidden;
    color: #ffffff;

    background:
      /*  linear-gradient(
            rgba(3, 5, 6, 0.38),
            rgba(3, 5, 6, 0.55)
        ),*/
        url("/assets/img/back_gen.jpg");

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.gallery-intro::after {
    content: "";
    position: absolute;
    left: var(--container-padding);
    right: var(--container-padding);
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(225, 201, 142, 0.65), transparent);
}

.gallery-intro-inner {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 1.1rem;
}

.gallery-intro .eyebrow,
.gallery-lightbox .eyebrow {
    color: var(--gallery-champagne);
}

.gallery-intro h1 {
    max-width: 11ch;
    color: #ffffff;
}

.gallery-intro p {
    max-width: 760px;
    color: rgba(255, 255, 255, 0.68);
    font-size: clamp(1rem, 1.4vw, 1.2rem);
}

/* Aircraft section */
.gallery-aircraft {
    padding: clamp(4.5rem, 8vw, 8rem) var(--container-padding);
    background: #ffffff;
}

.gallery-aircraft-heading {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: clamp(1rem, 2vw, 1.6rem);
    align-items: end;
    padding-bottom: clamp(2rem, 4vw, 3.5rem);
    border-bottom: 1px solid var(--gallery-border);
}

.gallery-aircraft-number {
    display: grid;
    place-items: center;
    width: clamp(48px, 5vw, 64px);
    aspect-ratio: 1;
    border: 1px solid rgba(154, 113, 29, 0.48);
    color: #8a6417;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.gallery-aircraft-heading h2 {
    margin: 0;
}

.gallery-category {
    padding-top: clamp(3rem, 6vw, 5rem);
}

.gallery-category + .gallery-category {
    margin-top: clamp(4rem, 7vw, 7rem);
    padding-top: clamp(3rem, 5vw, 4.5rem);
    border-top: 1px solid var(--gallery-border);
}

.gallery-category-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: clamp(1.4rem, 2.5vw, 2.2rem);
}

.gallery-category-heading h3 {
    color: #1b1d20;
    font-size: clamp(1.55rem, 2.6vw, 2.35rem);
}

.gallery-category-count {
    flex: 0 0 auto;
    color: #8a6417;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* Explorer-like overview */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(0.9rem, 1.5vw, 1.35rem);
}

.gallery-thumb {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 0;
    overflow: hidden;
    background: var(--gallery-dark-soft);
    border: 1px solid rgba(154, 113, 29, 0.17);
    cursor: zoom-in;
    isolation: isolate;
}

.gallery-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    border: 1px solid transparent;
    background: linear-gradient(180deg, transparent 56%, rgba(0, 0, 0, 0.22));
    transition: border-color 260ms ease, background 260ms ease;
    pointer-events: none;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.001);
    transition: transform 650ms cubic-bezier(0.22, 1, 0.36, 1), filter 350ms ease;
}

.gallery-thumb:hover img,
.gallery-thumb:focus-visible img {
    transform: scale(1.035);
}

.gallery-thumb:hover::after,
.gallery-thumb:focus-visible::after {
    border-color: rgba(225, 201, 142, 0.75);
    background: linear-gradient(180deg, transparent 52%, rgba(0, 0, 0, 0.34));
}

.gallery-empty-state {
    min-height: 180px;
    display: grid;
    place-items: center;
    padding: 2rem;
    border: 1px dashed rgba(154, 113, 29, 0.32);
    background: var(--gallery-warm);
    color: #7a7469;
    text-align: center;
}

/* =====================================================
   Lightbox / slideshow
   ===================================================== */
.gallery-lightbox[hidden] {
    display: none;
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 0.5rem;
}

.gallery-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 4, 6, 0.93);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.gallery-lightbox-dialog {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: calc(100vw - 1rem);
    height: calc(100vh - 1rem);
	max-width: none;
    max-height: none;
    min-height: 0;
    overflow: hidden;
    background: #080b0f;
    border: 1px solid rgba(225, 201, 142, 0.34);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.gallery-lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 72px;
    padding: 0.85rem 1rem 0.85rem clamp(1rem, 2vw, 1.5rem);
    border-bottom: 1px solid rgba(225, 201, 142, 0.2);
}

.gallery-lightbox-heading {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    min-width: 0;
}

.gallery-lightbox-heading h2 {
    overflow: hidden;
    margin: 0;
    color: #ffffff;
    font-size: clamp(1.1rem, 2vw, 1.55rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gallery-lightbox-close {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    font-size: 2rem;
    line-height: 1;
    transition: background 200ms ease, border-color 200ms ease;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-close:focus-visible {
    background: rgba(154, 113, 29, 0.72);
    border-color: rgba(255, 255, 255, 0.6);
}

.gallery-stage {
    position: relative;
    min-height: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 45%, #20242b 0%, #111419 52%, #06080b 100%);
    cursor: pointer;
}

.gallery-stage-images {
    position: absolute;
    inset: 0;
}

.gallery-stage-image {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    object-fit: contain;
    object-position: center;
    opacity: 0;
    transform: scale(1.006);
    transition: opacity 1.4s ease-in-out, transform 5.8s ease-out;
    pointer-events: none;
}

.gallery-stage-image.is-active {
    z-index: 1;
    opacity: 1;
    transform: scale(1.025);
}

.gallery-arrow {
    position: absolute;
    top: 50%;
    z-index: 5;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    color: #ffffff;
    background: rgba(8, 10, 13, 0.56);
    font-size: 2.2rem;
    line-height: 1;
    transform: translateY(-50%);
    transition: background 200ms ease, border-color 200ms ease, opacity 200ms ease;
}

.gallery-arrow:hover,
.gallery-arrow:focus-visible {
    background: rgba(122, 90, 29, 0.88);
    border-color: rgba(255, 255, 255, 0.72);
}

.gallery-prev {
    left: clamp(0.65rem, 2vw, 1.5rem);
}

.gallery-next {
    right: clamp(0.65rem, 2vw, 1.5rem);
}

.gallery-play-toggle {
    position: absolute;
    right: clamp(0.75rem, 2vw, 1.4rem);
    bottom: clamp(0.75rem, 2vw, 1.4rem);
    z-index: 6;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 42px;
    padding: 0.65rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 999px;
    color: #ffffff;
    background: rgba(8, 10, 13, 0.64);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.gallery-play-toggle:hover,
.gallery-play-toggle:focus-visible {
    background: rgba(8, 10, 13, 0.88);
}

.gallery-play-icon {
    display: inline-flex;
    min-width: 1rem;
    justify-content: center;
    color: var(--gallery-champagne);
    font-weight: 700;
}

.gallery-image-meta {
    position: absolute;
    left: clamp(0.75rem, 2vw, 1.4rem);
    bottom: clamp(0.75rem, 2vw, 1.4rem);
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    max-width: min(65%, 700px);
    padding: 0.6rem 0.8rem;
    color: rgba(255, 255, 255, 0.86);
    background: rgba(8, 10, 13, 0.52);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 0.82rem;
}

.gallery-image-meta [data-gallery-position] {
    flex: 0 0 auto;
    color: var(--gallery-champagne);
    font-weight: 700;
}

.gallery-filmstrip-wrap {
    position: relative;
    min-width: 0;
    padding: 0.8rem;
    background: #07090c;
    border-top: 1px solid rgba(225, 201, 142, 0.2);
}

.gallery-filmstrip {
    display: flex;
    gap: 0.55rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: #6e6553 #15181d;
}

.gallery-filmstrip-button {
    position: relative;
    flex: 0 0 clamp(94px, 10vw, 150px);
    aspect-ratio: 16 / 10;
    padding: 0;
    overflow: hidden;
    scroll-snap-align: center;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: #15181d;
    opacity: 0.58;
    transition: opacity 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.gallery-filmstrip-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-filmstrip-button:hover,
.gallery-filmstrip-button:focus-visible,
.gallery-filmstrip-button.is-active {
    opacity: 1;
    border-color: var(--gallery-champagne);
}

.gallery-filmstrip-button.is-active {
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 980px) {
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-lightbox {
        padding: 0;
    }

    .gallery-lightbox-dialog {
        width: 100%;
        height: 100dvh;
        max-height: none;
        border: 0;
    }
}

@media (max-width: 640px) {
    .gallery-intro {
        padding-top: clamp(7.5rem, 28vw, 9rem);
    }

    .gallery-aircraft-heading {
        align-items: center;
    }

    .gallery-category-heading {
        align-items: flex-end;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .gallery-thumb {
        aspect-ratio: 16 / 11;
    }

    .gallery-lightbox-header {
        min-height: 64px;
    }

    .gallery-lightbox-heading .eyebrow {
        display: none;
    }

    .gallery-arrow {
        width: 44px;
        height: 44px;
        font-size: 1.8rem;
    }

    .gallery-image-meta {
        right: auto;
        bottom: 0.75rem;
        max-width: calc(100% - 8.5rem);
    }

    .gallery-image-meta [data-gallery-caption] {
        display: none;
    }

    .gallery-play-toggle {
        right: 0.75rem;
        bottom: 0.75rem;
    }

    .gallery-play-text {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-thumb img,
    .gallery-stage-image,
    .gallery-filmstrip-button {
        transition-duration: 0.001ms !important;
        transform: none !important;
    }
}

.gallery-grid > .gallery-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
}

.gallery-grid > .gallery-thumb > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.gallery-thumb {
    background: #ffffff;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform: none;
}

.gallery-thumb:hover img,
.gallery-thumb:focus-visible img {
    transform: none;
}

.gallery-thumb::after,
.gallery-thumb:hover::after,
.gallery-thumb:focus-visible::after {
    background: transparent;
}

/* Let the page underneath remain visible around the lightbox */
.gallery-lightbox-backdrop {
    background: rgba(2, 4, 6, 0.55);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Main slideshow images: no zoom / pan, only a soft crossfade */
.gallery-stage-image {
    transform: none !important;
    transition: opacity 1.4s ease-in-out !important;
    object-fit: contain;
    object-position: center;
}

.gallery-stage-image.is-active {
    transform: none !important;
}

/* =====================================================
   Gallery Lightbox – Mobile Optimierung
   ===================================================== */

@media (max-width: 980px) {

    /* Lightbox nutzt den kompletten Bildschirm */
    .gallery-lightbox {
        padding: 0;
    }

    .gallery-lightbox-dialog {
        width: 100vw;
        height: 100dvh;
        max-width: none;
        max-height: none;

        /* nur Header + großes Bild */
        grid-template-rows: auto minmax(0, 1fr);

        border: 0;
    }

    /* Filmstreifen mobil komplett ausblenden */
    .gallery-filmstrip-wrap {
        display: none;
    }

    /* Bild bekommt maximal verfügbaren Platz */
    .gallery-stage {
        min-height: 0;
        height: 100%;
    }

    .gallery-stage-images {
        inset: 0;
    }

    .gallery-stage-image {
        padding: 0;
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center;
    }
	
    .gallery-lightbox-header {
        min-height: 54px;
        padding: 0.45rem 0.7rem;
    }

    .gallery-lightbox-heading h2 {
        font-size: 1rem;
    }

    .gallery-lightbox-close {
        width: 40px;
        height: 40px;
        font-size: 1.7rem;
    }
	
	.gallery-image-meta {
        left: 0.65rem;
        bottom: 0.65rem;

        max-width: none;
        padding: 0.45rem 0.6rem;

        background: rgba(8, 10, 13, 0.45);
    }

    .gallery-image-meta [data-gallery-caption] {
        display: none;
    }
}
