/* Feuer & Flamme – rules that theme.json cannot express. */

/* Keep room for the scrollbar on short pages too, so logo and menu do not shift when switching pages. */
html {
    scrollbar-gutter: stable;
}

/* Header: logo left, navigation right; the active page is underlined like on the old site. */
.ff-header .ff-logo img {
    display: block;
    width: clamp(84px, 11vw, 130px);
    height: auto;
}

.ff-nav .wp-block-navigation-item__content {
    position: relative;
    padding: 0.75rem 1.1rem;
    text-decoration: none;
}

.ff-nav .wp-block-navigation-item__content::after {
    content: "";
    position: absolute;
    left: 1.1rem;
    right: 1.1rem;
    bottom: 0.35rem;
    height: 2px;
    background: currentColor;
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.ff-nav .current-menu-item > .wp-block-navigation-item__content::after,
.ff-nav .wp-block-navigation-item__content:hover::after,
.ff-nav .wp-block-navigation-item__content:focus-visible::after {
    transform: scaleX(1);
}

.ff-nav .wp-block-navigation-item__content:hover {
    color: inherit;
}

/*
 * Mobile menu: a panel in the top right corner instead of a black overlay over the whole page, so the current page
 * stays visible. A tap beside the panel closes it (assets/js/menu.js).
 */
.ff-nav .wp-block-navigation__responsive-container.is-menu-open {
    top: var(--wp-admin--admin-bar--height, 0px);
    right: 0;
    bottom: auto;
    left: auto;
    width: auto;
    height: auto;
    max-height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
    padding: 1rem 1.25rem 1.5rem 2.5rem;
    border-bottom-left-radius: 0.5rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

/* On phones the admin bar scrolls away (WordPress positions it absolute below 600px). */
@media (max-width: 600px) {
    .ff-nav .wp-block-navigation__responsive-container.is-menu-open {
        top: 0;
        max-height: 100dvh;
    }
}

.ff-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
    align-items: flex-end;
    padding-top: 3rem;
}

.ff-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
    font-size: 1.5rem;
}

/*
 * WordPress removes the link padding in the open menu: give the links some room above and below again and let the
 * underline span the whole word.
 */
.ff-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
    padding-block: 0.4rem;
}

.ff-nav .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content::after {
    left: 0;
    right: 0;
    bottom: 0.15rem;
}

.ff-nav .wp-block-navigation__responsive-container-open svg,
.ff-nav .wp-block-navigation__responsive-container-close svg {
    width: 32px;
    height: 32px;
}

/* Pages with a title: no gap above the first block below it. */
.ff-main .wp-block-post-content > :first-child {
    margin-block-start: 0;
}

.ff-main .wp-block-post-title {
    margin-block-end: var(--wp--preset--spacing--40);
}

/* Full-width sections follow each other without gaps. */
.ff-main .wp-block-post-content > .alignfull {
    margin-block-start: 0;
    margin-block-end: 0;
}

/*
 * Hero: photos at their own proportions (nothing cut off) that fade into each other, like the slider of the old site.
 * The text lies on the photos on wide screens and below them on narrow ones.
 */
.ff-hero {
    position: relative;
    background: var(--wp--preset--color--black);
}

.ff-hero-media {
    position: relative;
    aspect-ratio: 1920 / 697;
    overflow: hidden;
}

.ff-hero .ff-hero-media > .wp-block-image {
    position: absolute;
    inset: 0;
    margin: 0;
}

.ff-hero .ff-hero-media > .wp-block-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* The first photo stays as the base; the others fade in one after the other (6 s each). */
.ff-hero-media > .wp-block-image:nth-child(n + 2) {
    opacity: 0;
    animation: ff-hero-2 12s ease-in-out infinite;
}

.ff-hero-media:has(> :nth-child(3)) > .wp-block-image:nth-child(n + 2) {
    animation-name: ff-hero-3;
    animation-duration: 18s;
}

.ff-hero-media:has(> :nth-child(4)) > .wp-block-image:nth-child(n + 2) {
    animation-name: ff-hero-4;
    animation-duration: 24s;
}

.ff-hero-media > .wp-block-image:nth-child(3) {
    animation-delay: 6s;
}

.ff-hero-media > .wp-block-image:nth-child(4) {
    animation-delay: 12s;
}

@keyframes ff-hero-2 {
    0%, 42% { opacity: 0; }
    50%, 92% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes ff-hero-3 {
    0%, 28% { opacity: 0; }
    33%, 61% { opacity: 1; }
    67%, 100% { opacity: 0; }
}

@keyframes ff-hero-4 {
    0%, 21% { opacity: 0; }
    25%, 46% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .ff-hero-media > .wp-block-image:nth-child(n + 2) {
        animation: none;
    }
}

.ff-hero-text {
    padding-top: var(--wp--preset--spacing--40);
    padding-bottom: var(--wp--preset--spacing--40);
}

/* Same size as the page titles elsewhere (theme.json h1). */
.ff-hero-text h1,
.ff-hero-text h2 {
    line-height: 1.1;
}

@media (min-width: 1100px) {
    .ff-hero-media::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.15) 60%, rgba(0, 0, 0, 0));
        pointer-events: none;
    }

    .ff-hero-text {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1;
    }
}

/* Offer sections: large photo, black text column (7/12 to 5/12 like on the old site). */
.ff-offer.wp-block-media-text {
    background: var(--wp--preset--color--black);
}

.ff-offer.wp-block-media-text > .wp-block-media-text__content {
    padding: clamp(2rem, 6vw, 6.25rem) clamp(1.25rem, 3.5vw, 2.5rem);
}

.ff-offer.wp-block-media-text .wp-block-media-text__media {
    min-height: clamp(260px, 45vw, 640px);
}

@media (max-width: 600px) {
    .ff-offer.wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__media {
        min-height: 62vw;
    }
}

/* Quote between the sections. */
.ff-quote {
    text-align: center;
}

.ff-quote p {
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    font-style: italic;
}

/* Gallery: square tiles, slight zoom on hover. */
.ff-gallery.wp-block-gallery .wp-block-image {
    overflow: hidden;
}

.ff-gallery.wp-block-gallery .wp-block-image img {
    aspect-ratio: 1;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ff-gallery.wp-block-gallery .wp-block-image:hover img {
    transform: scale(1.04);
}

/* Footer links without underline until hover. */
.ff-footer a {
    text-decoration: none;
}

.ff-footer a:hover,
.ff-footer a:focus-visible {
    text-decoration: underline;
}

.ff-footer p {
    margin: 0;
}

/* Contact form (plugin "Feuer & Flamme – Seiteneinstellungen"): white fields on black like on the old site. */
.ff-contact {
    display: grid;
    gap: 1rem;
    max-width: 640px;
}

.ff-contact p {
    margin: 0;
}

.ff-contact-field label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 700;
}

.ff-contact input[type="text"],
.ff-contact input[type="email"],
.ff-contact input[type="tel"],
.ff-contact textarea {
    box-sizing: border-box;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d9d6d6;
    border-radius: 0;
    background: #fff;
    color: #000;
    font: inherit;
}

.ff-contact input:focus-visible,
.ff-contact textarea:focus-visible {
    outline: 2px solid var(--wp--preset--color--flame);
    outline-offset: 2px;
}

.ff-contact-website {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.ff-contact-privacy {
    color: var(--wp--preset--color--grey);
    font-size: var(--wp--preset--font-size--small);
}

.ff-contact-result {
    padding: 1rem 1.25rem;
    border-left: 4px solid currentColor;
    background: #161616;
}

.ff-contact-result.is-error {
    border-color: var(--wp--preset--color--flame);
}

.ff-contact-result ul {
    margin: 0;
    padding-left: 1.2rem;
}

/* Own lightbox for the gallery (assets/js/gallery.js): photo whole on black, counter between the arrows. */
.ff-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    grid-template-rows: 1fr auto;
    background: rgba(0, 0, 0, 0.96);
    color: #fff;
}

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

.ff-lightbox-stage {
    min-height: 0;
    padding-top: 3.5rem;
    overflow: hidden;
    /* Horizontal moves belong to the swipe, pinch zoom stays possible. */
    touch-action: pan-y pinch-zoom;
    cursor: grab;
}

.ff-lightbox-stage:active {
    cursor: grabbing;
}

.ff-lightbox-track {
    display: flex;
    height: 100%;
    transform: translateX(-100%);
    will-change: transform;
}

.ff-lightbox-slide {
    display: flex;
    flex: 0 0 100%;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 0;
    height: 100%;
    padding: 0 1rem;
}

.ff-lightbox-slide img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: auto;
}

.ff-lightbox.is-single .ff-lightbox-prev,
.ff-lightbox.is-single .ff-lightbox-next {
    visibility: hidden;
}

.ff-lightbox-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(2.5rem, 12vw, 5rem);
    padding: 0.75rem 1rem 1.25rem;
}

.ff-lightbox-counter {
    min-width: 5.5em;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.ff-lightbox button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
    touch-action: manipulation;
}

.ff-lightbox button:hover,
.ff-lightbox button:focus-visible {
    background: rgba(255, 255, 255, 0.15);
}

.ff-lightbox button:focus-visible {
    outline: 2px solid var(--wp--preset--color--flame);
    outline-offset: 2px;
}

.ff-lightbox button svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ff-lightbox-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

.ff-gallery figure a {
    cursor: zoom-in;
}

/* Headings after shortcode output (e.g. the lists on the events page) get more room above them. */
.ff-main .wp-block-post-content > div + h2,
.ff-main .wp-block-post-content > section + h2 {
    margin-block-start: var(--wp--preset--spacing--60);
}

/*
 * Page sections (group block with the class "ff-section", e.g. on the events page): the heading stays at the top
 * while the visitor scrolls through its section. A sticky element may only move within its section's content box,
 * margins included, so the heading carries no bottom margin and the space before the next section belongs to the
 * section itself: the heading stays until the next heading reaches it and is then pushed up by it.
 */
.ff-main .wp-block-post-content > .ff-section {
    --ff-section-gap: calc(var(--wp--preset--spacing--60) * 1.5);
    margin-block-start: var(--ff-section-gap);
}

.ff-main .wp-block-post-content > .ff-section + .ff-section {
    margin-block-start: 0;
}

.ff-main .wp-block-post-content > .ff-section:has(+ .ff-section)::after {
    content: "";
    display: block;
    height: var(--ff-section-gap);
}

/* An introduction followed by a list of entries (e.g. "Save the Dates!" above the notices): a little more room. */
.ff-main .wp-block-post-content > p + .venue-events-list {
    /* Same as the space above the section headings (see .ff-section). */
    margin-block-start: calc(var(--wp--preset--spacing--60) * 1.5);
}

/*
 * The sticky part is either the heading alone or a group with the class "ff-section-head" holding the heading and a
 * subtitle, so the subtitle stays visible as well.
 */
.ff-section > h2:first-child + *,
.ff-section > .ff-section-head:first-child + * {
    margin-block-start: var(--wp--preset--spacing--40);
}

.ff-section > h2:first-child,
.ff-section > .ff-section-head:first-child {
    position: sticky;
    top: var(--wp-admin--admin-bar--height, 0px);
    z-index: 5;
    margin-block: 0;
    padding-block: 0.6rem;
    background: var(--wp--preset--color--black);
    box-shadow: 0 10px 12px -10px rgba(0, 0, 0, 0.9);
}

.ff-section-head > * {
    margin-block: 0;
}

.ff-section-head > * + * {
    margin-block-start: 0.15rem;
}

/*
 * Entries that are jumped to (e.g. from the overview) stop below the sticky heading instead of under it;
 * assets/js/sections.js replaces these rough heights with the measured ones.
 */
.ff-section {
    --ff-section-head-height: 4rem;
}

.ff-section:has(> .ff-section-head:first-child) {
    --ff-section-head-height: 6rem;
}

.ff-main .ff-section [id] {
    scroll-margin-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--ff-section-head-height) + 1rem);
}

/* On phones the admin bar scrolls away (WordPress positions it absolute below 600px). */
@media (max-width: 600px) {
    .ff-section > h2:first-child,
    .ff-section > .ff-section-head:first-child {
        top: 0;
    }

    .ff-main .ff-section [id] {
        scroll-margin-top: calc(var(--ff-section-head-height) + 1rem);
    }
}

/* Stacked columns on small screens: room between the send button and the contact details below it. */
@media (max-width: 781px) {
    /* Doubled class: WordPress resets the bottom margin of the last block in a column with equal weight. */
    .ff-contact.ff-contact {
        margin-block-end: 3rem;
    }
}
