/* The wider workshop is isolated from the published menu and other sections. */
.workshop .workshop-layout {
    display: block;
}

.workshop-copy {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: end;
    gap: clamp(32px, 6vw, 80px);
    margin-bottom: clamp(32px, 4vw, 56px);
}

.workshop-copy .chapter {
    margin-bottom: 1.2rem;
}

.workshop-copy h2 {
    margin-bottom: 0;
}

.workshop-intro > p + p {
    margin-top: 1rem;
    max-width: 29rem;
}

.workshop .media-gallery {
    --gallery-height: clamp(400px, 50svh, 560px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 28px;
    row-gap: 16px;
    width: 100%;
    padding-top: 0;
    border-top: 0;
}

.media-gallery .gallery-track {
    grid-column: 1 / -1;
    gap: 16px;
    width: 100%;
    scrollbar-width: none;
    cursor: grab;
}

.media-gallery .gallery-track[data-dragging] {
    cursor: grabbing;
    scroll-snap-type: none;
}

.media-gallery .gallery-slide {
    flex: 0 0 auto;
    width: calc(var(--gallery-height) * var(--media-ratio));
    max-width: calc(100% - 40px);
}

.media-gallery .gallery-track::-webkit-scrollbar,
.media-gallery .gallery-thumbs::-webkit-scrollbar {
    display: none;
}

.media-gallery .gallery-open {
    position: relative;
    display: block;
    width: 100%;
    height: var(--gallery-height);
    padding: 0;
    border: 0;
    border-radius: 4px;
    color: var(--navy);
    background: rgba(29, 53, 87, 0.035);
    cursor: zoom-in;
    overflow: hidden;
}

.workshop .media-gallery .gallery-open img,
.workshop .media-gallery .gallery-open video {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
}

.media-gallery .gallery-expand {
    position: absolute;
    right: 14px;
    bottom: 14px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #F1FAEE;
    color: var(--navy-deep);
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 140ms ease, transform 140ms ease;
}

.media-gallery .gallery-open:hover .gallery-expand,
.media-gallery .gallery-open:focus-visible .gallery-expand {
    opacity: 1;
    transform: none;
}

.media-gallery svg,
.media-viewer svg {
    display: block;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.media-gallery .gallery-slide figcaption {
    min-height: 3rem;
    padding-block: 0.8rem 0.5rem;
    line-height: 1.5;
}

.media-gallery .gallery-toolbar {
    grid-column: 2;
    grid-row: 2;
    gap: 24px;
    padding-top: 0;
    min-height: 48px;
    font-variant-numeric: tabular-nums;
}

.media-gallery [data-gallery-counter] {
    min-width: 52px;
}

.media-gallery .gallery-arrow {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    border-color: rgba(29, 53, 87, 0.25);
    transition: background 140ms ease, color 140ms ease;
}

.media-gallery .gallery-arrow:hover:not(:disabled) {
    background: var(--navy);
    color: #F1FAEE;
}

.media-gallery .gallery-thumbs {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding: 6px 2px;
    margin-top: 0;
}

.media-gallery .gallery-thumb {
    position: relative;
    flex: 0 0 48px;
    height: 56px;
    padding: 3px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
}

.media-gallery .gallery-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
    opacity: 0.65;
}

.media-gallery .gallery-thumb[aria-current="true"] {
    border-color: var(--navy);
}

.media-gallery .gallery-thumb[aria-current="true"] img,
.media-gallery .gallery-thumb:hover img {
    opacity: 1;
}

.media-gallery .gallery-thumb-video {
    position: absolute;
    inset: auto 4px 4px;
    padding-block: 2px;
    color: #fff;
    background: var(--navy-deep);
    font: 10px / 1.4 var(--sans);
    text-align: center;
}

.media-gallery .gallery-open:focus-visible,
.media-gallery .gallery-thumb:focus-visible {
    outline: 2px solid var(--navy);
    outline-offset: -2px;
}

html[data-media-viewer-open] {
    overflow: hidden;
    scrollbar-gutter: stable;
    background: var(--navy-deep);
}

.media-viewer {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    border: 0;
    background: var(--navy-deep);
    color: #F1FAEE;
    overflow: hidden;
    overscroll-behavior: contain;
}

.media-viewer[open] {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 12px;
}

.media-viewer::backdrop {
    background: var(--navy-deep);
}

.media-viewer .viewer-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 44px;
}

.media-viewer .viewer-topbar h2 {
    flex: 1;
    margin: 0;
    font: 400 16px / 1.4 var(--sans);
    text-transform: none;
    letter-spacing: 0;
}

.media-viewer button {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
    border: 1px solid rgba(241, 250, 238, 0.28);
    border-radius: 24px;
    color: inherit;
    background: transparent;
    cursor: pointer;
    font: 14px / 1.2 var(--sans);
}

.media-viewer button:disabled {
    opacity: 0.3;
    cursor: default;
}

.media-viewer button:hover:not(:disabled),
.media-viewer button[aria-pressed="true"] {
    background: rgba(241, 250, 238, 0.12);
}

.media-viewer button:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
}

.media-viewer .viewer-stage {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.media-viewer .viewer-image,
.media-viewer .viewer-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
    transform-origin: center;
}

.media-viewer .viewer-image {
    cursor: zoom-in;
}

.media-viewer .viewer-stage[data-zoomed] {
    touch-action: none;
}

.media-viewer .viewer-stage[data-zoomed] .viewer-image {
    cursor: grab;
}

.media-viewer .viewer-stage[data-dragging] .viewer-image {
    cursor: grabbing;
}

.media-viewer .viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    min-height: 44px;
}

.media-viewer .viewer-toolbar p {
    min-width: 70px;
    margin: 0;
    font: 14px / 1.5 var(--sans);
    text-align: center;
}

.media-viewer .viewer-status {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 12px;
    margin: 0;
    font: 14px / 1.5 var(--sans);
    text-align: center;
    pointer-events: none;
}

.media-gallery [hidden],
.media-viewer [hidden] {
    display: none !important;
}

@media (max-width: 760px) {
    .workshop-copy {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
        margin-bottom: 32px;
    }

    .workshop .media-gallery {
        /* Keep the portrait video at full height, with room to preview the next item. */
        --gallery-height: clamp(360px, calc((100vw - 82px) * 1.5), 540px);
        grid-template-columns: minmax(0, 1fr);
        row-gap: 8px;
    }

    .media-gallery .gallery-slide {
        max-width: calc(100% - 28px);
    }

    .media-gallery .gallery-toolbar {
        grid-column: 1;
        grid-row: 2;
    }

    .media-gallery .gallery-thumbs {
        grid-column: 1;
        grid-row: 3;
    }

    .media-gallery .gallery-thumb {
        flex-basis: 48px;
        height: 56px;
    }

    .media-viewer .viewer-topbar {
        gap: 8px;
    }

    .media-viewer .viewer-topbar h2 {
        font-size: 14px;
    }

    .media-viewer .viewer-zoom span {
        display: none;
    }
}

@media (hover: none) {
    .media-gallery .gallery-expand {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .media-gallery *,
    .media-viewer * {
        scroll-behavior: auto;
        transition: none;
    }
}
