/* Project descriptions read across the page; the work itself gets a wide,
   stable stage below. Only the center and its two neighbours are visible. */
.fullwidth-block.project-showcase:not(#block0) .split-layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: clamp(36px, 4vw, 58px);
}

.fullwidth-block.project-showcase:not(#block0) .left-text {
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
}

.fullwidth-block.project-showcase:not(#block0) .left-text > .icon-title {
    max-width: 100%;
    width: 100%;
}

.fullwidth-block.project-showcase:not(#block0) .left-text > .block-subtitle {
    max-width: 74ch;
}

.fullwidth-block.project-showcase:not(#block0) .dynamic-text-stack {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
}

.fullwidth-block.project-showcase:not(#block0) .dynamic-text-stack[data-card-count="2"],
.fullwidth-block.project-showcase:not(#block0) .dynamic-text-stack[data-card-count="4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fullwidth-block.project-showcase:not(#block0) .dynamic-text-stack[data-card-count="1"] {
    grid-template-columns: minmax(0, 1fr);
}

.fullwidth-block.project-showcase:not(#block0) .dynamic-text-panel {
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: clamp(24px, 2.1vw, 30px);
}

.fullwidth-block.project-showcase:not(#block0) .dynamic-text-panel h3 {
    margin-bottom: 16px;
}

.fullwidth-block.project-showcase:not(#block0) .dynamic-text-panel > p:last-of-type {
    margin-bottom: 0;
}

.fullwidth-block.project-showcase:not(#block0) .dynamic-text-panel .project-tags {
    padding-top: 22px;
    margin-top: auto;
}

.fullwidth-block.project-showcase:not(#block0) .right-images {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
    max-width: none;
    height: auto;
    min-height: 0;
    margin: 0;
    transform: none;
}

.fullwidth-block.project-showcase:not(#block0) .carousel-container {
    --showcase-stage-height: clamp(420px, 65svh, 720px);
    --showcase-image-width: min(78%, 1000px);
    --showcase-side-offset: clamp(200px, 28vw, 380px);
    --showcase-arrow-size: 52px;
    --showcase-arrow-gap: 12px;
    --showcase-control-lane: calc(var(--showcase-arrow-size) + var(--showcase-arrow-gap));
    display: block;
    position: relative;
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 0;
    margin: 0;
    isolation: isolate;
}

.fullwidth-block.project-showcase:not(#block0) .carousel-container[data-gallery-orientation="portrait"] {
    --showcase-image-width: min(48%, 430px);
    --showcase-side-offset: clamp(210px, 26vw, 350px);
}

.fullwidth-block.project-showcase:not(#block0) .carousel-container[data-gallery-layout="portrait"] {
    --showcase-stage-height: clamp(460px, 70svh, 720px);
}

.fullwidth-block.project-showcase:not(#block0) .carousel-container[data-gallery-count="0"] .carousel-track {
    display: none;
}

.fullwidth-block.project-showcase:not(#block0) .carousel-container[data-gallery-count="0"] > .carousel-arrow {
    display: none;
}

.fullwidth-block.project-showcase:not(#block0) .dynamic-text-stack > .dynamic-action-button {
    grid-column: 1 / -1;
    justify-self: start;
}

.fullwidth-block.project-showcase:not(#block0) .carousel-container::before {
    content: none;
    display: none;
}

.fullwidth-block.project-showcase:not(#block0) .carousel-track {
    display: block;
    position: relative;
    /* A clipped stage reserves a separate lane for each side button, so even
       the animated neighbouring photos cannot slide underneath a control. */
    width: calc(100% - var(--showcase-control-lane) * 2);
    height: var(--showcase-stage-height);
    min-width: 0;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 18px;
    isolation: isolate;
    touch-action: pan-y;
}

.fullwidth-block.project-showcase:not(#block0) .carousel-track > .carousel-item {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: auto;
    height: auto;
    max-width: var(--showcase-image-width);
    max-height: calc(100% - 20px);
    margin: 0;
    padding: 0;
    object-fit: contain;
    border: 0;
    border-radius: 18px;
    clip-path: inset(0 round 18px);
    background: transparent;
    box-shadow: none;
    filter: none !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 0;
    transform: translate(-50%, -50%) scale(.72) !important;
    transform-origin: center;
    animation: none !important;
    transition: transform .42s cubic-bezier(.2, .7, .2, 1), opacity .32s ease, visibility .32s;
}

.fullwidth-block.project-showcase:not(#block0) .carousel-track > .carousel-item.is-prev,
.fullwidth-block.project-showcase:not(#block0) .carousel-track > .carousel-item.is-next {
    opacity: .5;
    visibility: visible;
    pointer-events: auto;
    z-index: 1;
}

.fullwidth-block.project-showcase:not(#block0) .carousel-track > .carousel-item.is-prev {
    transform: translate(calc(-50% - var(--showcase-side-offset)), -50%) scale(.72) !important;
}

.fullwidth-block.project-showcase:not(#block0) .carousel-track > .carousel-item.is-next {
    transform: translate(calc(-50% + var(--showcase-side-offset)), -50%) scale(.72) !important;
}

.fullwidth-block.project-showcase:not(#block0) .carousel-track > .carousel-item.active,
.fullwidth-block.project-showcase:not(#block0) .carousel-track > .carousel-item.active:hover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 3;
    transform: translate(-50%, -50%) scale(1) !important;
}

.fullwidth-block.project-showcase:not(#block0) .carousel-item:focus-visible {
    outline-offset: -3px;
}

.fullwidth-block.project-showcase:not(#block0) .gallery-toolbar {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 18px;
    width: 100%;
    min-width: 0;
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--section-border);
}

.fullwidth-block.project-showcase:not(#block0) .gallery-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex: 0 1 auto;
    width: min(100%, 760px);
    min-width: 0;
    text-align: center;
}

.fullwidth-block.project-showcase:not(#block0) .gallery-toolbar .gallery-gif-decoration {
    display: block;
    position: static;
    inset: auto;
    width: 40px;
    height: 40px;
    min-width: 40px;
    max-width: 40px;
    margin: 0;
    padding: 0;
    flex: 0 0 40px;
    object-fit: contain;
    border-radius: 0;
    background: none;
    box-shadow: none;
    filter: none;
    transform: none !important;
    rotate: none;
    animation: none !important;
}

.fullwidth-block.project-showcase:not(#block0) .gallery-caption {
    min-width: 0;
    margin: 0;
    color: var(--section-muted);
    font-size: .875rem;
    line-height: 1.65;
    letter-spacing: -.005em;
    overflow-wrap: anywhere;
    text-wrap: pretty;
}

.fullwidth-block.project-showcase:not(#block0) .gallery-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    order: -1;
    gap: 12px;
    flex: 0 1 auto;
    min-width: 0;
}

.fullwidth-block.project-showcase:not(#block0) .carousel-container > .carousel-arrow,
.fullwidth-block.project-showcase:not(#block0) .carousel-container > .carousel-arrow:hover {
    position: absolute;
    top: calc(var(--showcase-stage-height) / 2);
    right: auto;
    bottom: auto;
    left: auto;
    width: var(--showcase-arrow-size);
    height: var(--showcase-arrow-size);
    min-width: var(--showcase-arrow-size);
    padding: 0;
    border: 1px solid var(--section-border-hover);
    border-radius: 50%;
    background: var(--section-surface);
    color: var(--section-ink);
    font-size: 1.5rem;
    font-family: Arial, sans-serif;
    font-weight: 400;
    line-height: 1;
    box-shadow: none;
    backdrop-filter: none;
    transform: translateY(-50%);
    touch-action: manipulation;
}

.fullwidth-block.project-showcase:not(#block0) .carousel-container > .carousel-arrow.left {
    left: 0;
    right: auto;
}

.fullwidth-block.project-showcase:not(#block0) .carousel-container > .carousel-arrow.right {
    right: 0;
    left: auto;
}

.fullwidth-block.project-showcase:not(#block0) .carousel-container > .carousel-arrow:hover {
    background: var(--section-surface-hover);
    border-color: var(--section-ink);
}

.fullwidth-block.project-showcase:not(#block0) .gallery-counter {
    min-width: 50px;
    color: var(--section-muted);
    font-size: .8125rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: .03em;
    text-align: center;
    white-space: nowrap;
}

.fullwidth-block.project-showcase:not(#block0) .gallery-expand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    margin-left: 6px;
    padding: 11px 17px;
    border: 1px solid var(--section-border);
    border-radius: 10px;
    background: transparent;
    color: var(--section-ink);
    font-family: Arial, sans-serif;
    font-size: .8125rem;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: -.01em;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color .18s ease, border-color .18s ease;
}

.fullwidth-block.project-showcase:not(#block0) .gallery-expand:hover {
    background: var(--section-surface-hover);
    border-color: var(--section-border-hover);
}

.fullwidth-block.project-showcase:not(#block0) .gallery-controls button:disabled,
.fullwidth-block.project-showcase:not(#block0) .gallery-controls [aria-disabled="true"],
.fullwidth-block.project-showcase:not(#block0) .carousel-container > .carousel-arrow:disabled,
.fullwidth-block.project-showcase:not(#block0) .carousel-container > .carousel-arrow[aria-disabled="true"] {
    opacity: .35;
    cursor: default;
    pointer-events: none;
}

@media (max-width: 1100px) {
    .fullwidth-block.project-showcase:not(#block0) .dynamic-text-stack {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fullwidth-block.project-showcase:not(#block0) .carousel-container {
        --showcase-side-offset: 30vw;
    }

    .fullwidth-block.project-showcase:not(#block0) .carousel-container[data-gallery-orientation="portrait"] {
        --showcase-side-offset: 27vw;
    }
}

@media (max-width: 768px) {
    .fullwidth-block.project-showcase:not(#block0) .split-layout {
        gap: 32px;
    }

    .fullwidth-block.project-showcase:not(#block0) .dynamic-text-stack,
    .fullwidth-block.project-showcase:not(#block0) .dynamic-text-stack[data-card-count] {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .fullwidth-block.project-showcase:not(#block0) .dynamic-text-panel {
        padding: 24px;
    }

    .fullwidth-block.project-showcase:not(#block0) .carousel-container {
        --showcase-stage-height: clamp(220px, 32svh, 310px);
        --showcase-image-width: 94%;
        --showcase-side-offset: 38vw;
        --showcase-arrow-size: 44px;
        --showcase-arrow-gap: 8px;
        /* Reuse part of the section gutters while retaining 8px to the
           viewport edge. The toolbar remains aligned with the text above. */
        width: calc(100% + 28px);
        margin-inline: -14px;
    }

    .fullwidth-block.project-showcase:not(#block0) .carousel-container[data-gallery-orientation="portrait"] {
        --showcase-image-width: 94%;
        --showcase-side-offset: 31vw;
    }

    .fullwidth-block.project-showcase:not(#block0) .carousel-container[data-gallery-layout="portrait"] {
        --showcase-stage-height: clamp(340px, 58svh, 520px);
    }

    .fullwidth-block.project-showcase:not(#block0) .carousel-track,
    .fullwidth-block.project-showcase:not(#block0) .carousel-track > .carousel-item {
        border-radius: 14px;
    }

    .fullwidth-block.project-showcase:not(#block0) .carousel-track > .carousel-item {
        clip-path: inset(0 round 14px);
    }

    .fullwidth-block.project-showcase:not(#block0) .gallery-toolbar {
        align-items: center;
        gap: 18px;
        width: calc(100% - 28px);
        margin-inline: 14px;
        margin-top: 18px;
        padding-top: 18px;
    }

    .fullwidth-block.project-showcase:not(#block0) .gallery-meta {
        flex-basis: auto;
        width: 100%;
    }

    .fullwidth-block.project-showcase:not(#block0) .gallery-caption {
        font-size: .8125rem;
    }

    .fullwidth-block.project-showcase:not(#block0) .gallery-controls {
        flex: 0 1 auto;
        justify-content: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    .fullwidth-block.project-showcase:not(#block0) .gallery-expand {
        margin-left: 0;
    }
}

@media (max-width: 380px) {
    .fullwidth-block.project-showcase:not(#block0) .gallery-controls {
        gap: 8px;
    }

    .fullwidth-block.project-showcase:not(#block0) .gallery-counter {
        min-width: 42px;
    }

    .fullwidth-block.project-showcase:not(#block0) .gallery-expand {
        flex: 0 1 auto;
        margin-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fullwidth-block.project-showcase:not(#block0) .carousel-track > .carousel-item {
        transition: none;
    }
}
