/**
 * City memories carousel (content-slider + memory-slider).
 */

/* No section background/title here — layout in the editor (Cover block, etc.). */
.cityfi-memories {
    position: relative;
    margin: 1.5rem 0;
    padding: 0;
    color: inherit;
}

.cityfi-memories__title {
    margin: 0 0 1.25rem;
    text-align: center;
    font-size: clamp(1.35rem, 3vw, 1.85rem);
    font-weight: 700;
    line-height: 1.2;
    color: inherit;
    letter-spacing: 0.02em;
}

.cityfi-memories__inner {
    position: relative;
    z-index: 1;
}

/* Slider layout: reuse theme flex + scroll-snap; override colors */
.cityfi-memories .content-slider.memory-slider {
    margin: 0;
    gap: 0.65rem;
}

/* Three full cards at once: width from visible viewport (no fourth strip peeking). */
.cityfi-memories .memory-slider__viewport {
    --memory-slider-gap: 1.25rem;
    container-type: inline-size;
    container-name: cityfi-memories-vp;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.cityfi-memories .memory-slider__viewport::-webkit-scrollbar {
    height: 0;
}

.cityfi-memories .memory-slider__track {
    display: flex;
    gap: var(--memory-slider-gap);
    padding: 0.25rem 0.25rem 0.5rem;
    align-items: stretch;
}

.cityfi-memories .memory-slider__item {
    scroll-snap-align: start;
    box-sizing: border-box;
    flex: 0 0 calc((100cqw - 2 * var(--memory-slider-gap)) / 3);
    width: calc((100cqw - 2 * var(--memory-slider-gap)) / 3);
    max-width: calc((100cqw - 2 * var(--memory-slider-gap)) / 3);
    display: flex;
    min-height: 220px;
}

/* Without container query units we cannot compute exactly 3 per view; fixed card width fallback. */
@supports not (width: 1cqw) {
    .cityfi-memories .memory-slider__item {
        flex: 0 0 min(100%, 280px);
        width: min(100%, 280px);
        max-width: min(100%, 280px);
    }
}

@media (max-width: 1100px) {
    .cityfi-memories .memory-slider__item {
        flex: 0 0 calc((100cqw - var(--memory-slider-gap)) / 2);
        width: calc((100cqw - var(--memory-slider-gap)) / 2);
        max-width: calc((100cqw - var(--memory-slider-gap)) / 2);
    }

    @supports not (width: 1cqw) {
        .cityfi-memories .memory-slider__item {
            flex: 0 0 calc((100vw - 5rem) / 2);
            width: calc((100vw - 5rem) / 2);
            max-width: calc((100vw - 5rem) / 2);
        }
    }
}

.cityfi-memories .memory-slider__card {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100%;
    padding: 1.1rem 1.15rem 1rem;
    box-sizing: border-box;
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 2px;
}

/* Vertically center memory text; footer (read more + name) stays at bottom. */
.cityfi-memories .memory-slider__main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
}

.cityfi-memories .memory-slider__body {
    flex: 0 1 auto;
    width: 100%;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.45;
    font-weight: 200;
    color: rgba(255, 255, 255, 0.95);
    text-align: left;
}

.cityfi-memories .memory-slider__body p {
    margin: 0 0 0.65em;
    text-align: left;
}

.cityfi-memories .memory-slider__body p:last-child {
    margin-bottom: 0;
}

.cityfi-memories .memory-slider__excerpt {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.45;
    font-weight: 200;
    color: rgba(255, 255, 255, 0.95);
    text-align: left;
}

.cityfi-memories .memory-slider__excerpt p {
    margin: 0 0 0.65em;
    text-align: left;
}

.cityfi-memories .memory-slider__excerpt p:last-child {
    margin-bottom: 0;
}

.cityfi-memories .memory-slider__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.35rem 0.75rem;
    flex: 0 0 auto;
    margin-top: 1rem;
    width: 100%;
}

.cityfi-memories .memory-slider__readmore {
    display: inline-block;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 0.15em;
    cursor: pointer;
    text-align: left;
    flex: 0 1 auto;
}

.cityfi-memories .memory-slider__readmore:hover,
.cityfi-memories .memory-slider__readmore:focus-visible {
    color: #e31e24;
    text-decoration: underline;
}

.cityfi-memories .memory-slider__readmore:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.cityfi-memories .memory-slider__author {
    margin: 0;
    text-align: right;
    font-size: 0.88rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.3;
    flex: 0 1 auto;
    margin-left: auto;
}

.cityfi-memories .memory-slider__author::before,
.cityfi-memories .cityfi-memories__dialog-author::before {
    content: "- ";
}

/* Arrows: white glyph only, no circular background. */
.cityfi-memories .memory-slider__arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 2.75rem;
    height: 2.75rem;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.96);
    font-size: 2.3rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    transition:
        color 0.15s ease,
        text-shadow 0.15s ease,
        opacity 0.15s ease;
}

.cityfi-memories .memory-slider__arrow:hover:not([disabled]) {
    background: transparent;
    color: #fff;
    text-shadow: 0 2px 7px rgba(0, 0, 0, 0.6);
}

.cityfi-memories .memory-slider__arrow[disabled] {
    opacity: 0.35;
    cursor: default;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    text-shadow: none;
}

.cityfi-memories__cta-wrap {
    margin: 1.75rem 0 0;
    text-align: center;
}

.cityfi-memories__cta {
    display: inline-block;
    padding: 0.75rem 1.75rem;
    border-radius: 999px;
    background-color: #e31e24;
    color: #fff !important;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.25;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.cityfi-memories__cta:hover,
.cityfi-memories__cta:focus-visible {
    background-color: #c41a1f;
    color: #fff !important;
    text-decoration: none;
}

.cityfi-memories__cta:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

/* Closed <dialog>: do not use display:flex without [open] — it overrides native hiding. */
.cityfi-memories__dialog:not([open]) {
    display: none;
}

/* Modal open: fixed center of the viewport. */
.cityfi-memories__dialog[open] {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    width: min(36rem, calc(100vw - 2rem));
    max-width: min(36rem, calc(100vw - 2rem));
    max-height: min(85vh, 34rem);
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.35rem;
    background: #1e1e1e;
    color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.45);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cityfi-memories__dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.cityfi-memories__dialog-inner {
    padding: 1.1rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-sizing: border-box;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.cityfi-memories__dialog-header {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}

.cityfi-memories__dialog-title {
    margin: 0;
    flex: 1 1 auto;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
    color: #fff;
}

.cityfi-memories__dialog-title:empty {
    display: none;
}

.cityfi-memories__dialog-close-form {
    margin: 0;
    flex: 0 0 auto;
    margin-left: auto;
}

.cityfi-memories__dialog-close {
    margin: 0;
    padding: 0.4rem 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.cityfi-memories__dialog-close:hover,
.cityfi-memories__dialog-close:focus-visible {
    background: rgba(255, 255, 255, 0.2);
}

.cityfi-memories__dialog-body {
    margin: 0;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.cityfi-memories__dialog-body p {
    margin: 0 0 0.75em;
}

.cityfi-memories__dialog-body p:last-child {
    margin-bottom: 0;
}

.cityfi-memories__dialog-author {
    margin: 0.25rem 0 0;
    text-align: left;
    align-self: flex-start;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.92);
}

@media (max-width: 640px) {
    .cityfi-memories .content-slider.memory-slider {
        gap: 0.35rem;
    }

    .cityfi-memories .memory-slider__viewport {
        --memory-slider-gap: 0.75rem;
    }

    /* One full card at a time — no next-card strip visible. */
    .cityfi-memories .memory-slider__item {
        flex: 0 0 100cqw;
        width: 100cqw;
        max-width: 100cqw;
    }

    @supports not (width: 1cqw) {
        .cityfi-memories .memory-slider__item {
            flex: 0 0 calc(100vw - 3.75rem);
            width: calc(100vw - 3.75rem);
            max-width: calc(100vw - 3.75rem);
        }
    }
}
