body:has(.product-modal[open]),
body:has(.image-zoom-dialog[open]) {
    overflow: hidden;
}

.product-modal {
    width: min(1180px, calc(100% - 32px));
    max-width: none;
    height: min(760px, calc(100% - 32px));
    max-height: none;
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--ink);
    overflow: hidden;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

.product-modal::backdrop {
    background: rgba(9, 13, 12, 0.78);
    backdrop-filter: blur(3px);
}

.product-modal[open] {
    animation: modal-in 160ms ease-out;
}

.product-modal [hidden] {
    display: none !important;
}

.product-modal-shell {
    position: relative;
    height: 100%;
    min-height: 320px;
    background: var(--paper);
    overflow: hidden;
}

.product-modal-close {
    position: absolute;
    z-index: 6;
    top: 14px;
    right: 14px;
    display: grid;
    width: 42px;
    height: 42px;
    padding: 0 0 3px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(23, 33, 31, 0.88);
    color: #fff;
    font: 400 2rem/1 Arial, Helvetica, sans-serif;
    cursor: pointer;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.22);
}

.product-modal-close:hover {
    background: #000;
}

.product-modal-close:focus-visible,
.carousel-arrow:focus-visible,
.carousel-thumbnail:focus-visible,
.image-zoom-trigger:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.product-modal-loading,
.product-modal-error {
    display: flex;
    height: 100%;
    min-height: 320px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 70px 24px 24px;
    text-align: center;
}

.product-modal-error {
    flex-direction: column;
}

.product-modal-error p {
    max-width: 500px;
    margin-bottom: 4px;
    color: var(--muted);
}

.modal-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--line);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: modal-spin 700ms linear infinite;
}

.product-modal-content {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
    height: 100%;
    min-height: 0;
}

.modal-gallery {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    min-width: 0;
    min-height: 0;
    background: #0d1110;
}

.carousel-stage {
    position: relative;
    display: grid;
    min-height: 0;
    place-items: center;
    overflow: hidden;
    touch-action: pan-y;
    user-select: none;
}

.carousel-main-image {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
}

.carousel-main-video {
    width: 100%;
    height: 100%;
    max-height: 100%;
    background: #000;
    object-fit: contain;
}

.image-zoom-trigger {
    position: absolute;
    z-index: 3;
    left: 14px;
    bottom: 12px;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #111;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.product-media-stage .image-zoom-trigger {
    left: 12px;
    bottom: 12px;
}

.carousel-arrow {
    position: absolute;
    z-index: 2;
    top: 50%;
    display: grid;
    width: 44px;
    height: 44px;
    padding: 0 0 5px;
    place-items: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.88);
    color: #111;
    font: 400 2.2rem/1 Arial, Helvetica, sans-serif;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.carousel-arrow:hover {
    background: #fff;
}

.carousel-arrow-prev {
    left: 16px;
}

.carousel-arrow-next {
    right: 16px;
}

.carousel-counter {
    position: absolute;
    right: 14px;
    bottom: 12px;
    border-radius: 999px;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.68);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
}

.carousel-thumbnails {
    display: flex;
    gap: 8px;
    padding: 10px;
    overflow-x: auto;
    background: #151b19;
    scrollbar-width: thin;
}

.carousel-thumbnail {
    position: relative;
    flex: 0 0 66px;
    width: 66px;
    height: 66px;
    padding: 2px;
    border: 2px solid transparent;
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
    opacity: 0.68;
}

.media-play-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.image-zoom-dialog {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    border: 0;
    padding: 0;
    background: #080b0a;
    color: #fff;
}

.image-zoom-dialog::backdrop {
    background: rgba(0, 0, 0, 0.94);
}

.image-zoom-shell {
    display: grid;
    height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr);
}

.image-zoom-toolbar {
    position: relative;
    z-index: 2;
    display: flex;
    min-height: 62px;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: max(10px, env(safe-area-inset-top)) 14px 10px;
    background: #111715;
}

.image-zoom-actions {
    display: flex;
    gap: 8px;
}

.image-zoom-toolbar button {
    min-width: 42px;
    min-height: 42px;
    border: 1px solid #47534f;
    border-radius: 8px;
    background: #202a27;
    color: #fff;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
}

.image-zoom-toolbar button:disabled {
    opacity: 0.42;
    cursor: default;
}

.image-zoom-toolbar button:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.image-zoom-status {
    min-width: 58px;
    color: #d5ddd9;
    font-size: 0.82rem;
    font-weight: 800;
    text-align: center;
}

.image-zoom-close {
    position: absolute;
    right: max(14px, env(safe-area-inset-right));
    font-size: 1.6rem !important;
}

.image-zoom-viewport {
    position: relative;
    display: grid;
    min-height: 0;
    overflow: hidden;
    place-items: center;
    touch-action: none;
    cursor: zoom-in;
}

.image-zoom-viewport.is-zoomed {
    cursor: grab;
}

.image-zoom-viewport.is-zoomed:active {
    cursor: grabbing;
}

.image-zoom-viewport img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform-origin: center;
    user-select: none;
    will-change: transform;
}

.carousel-thumbnail[aria-current="true"] {
    border-color: #fff;
    opacity: 1;
}

.carousel-thumbnail img {
    width: 100%;
    height: 100%;
    border-radius: 5px;
    object-fit: cover;
}

.modal-detail-copy {
    min-width: 0;
    overflow-y: auto;
    padding: 68px 28px 28px;
    background: var(--paper);
}

body:not(.admin-body) .product-modal-shell,
body:not(.admin-body) .product-modal-loading,
body:not(.admin-body) .product-modal-error,
body:not(.admin-body) .modal-detail-copy {
    background: var(--catalog-surface);
    color: var(--catalog-text);
}

body:not(.admin-body) .product-modal-error p,
body:not(.admin-body) .modal-detail-copy .status-list dt {
    color: var(--catalog-muted);
}

body:not(.admin-body) .modal-detail-copy h2,
body:not(.admin-body) .modal-detail-copy .description,
body:not(.admin-body) .modal-detail-copy .status-list dd {
    color: var(--catalog-text);
}

body:not(.admin-body) .modal-detail-copy .status-list div {
    border-color: var(--catalog-border);
}

body:not(.admin-body) .product-modal-error .button-secondary {
    background: var(--catalog-surface-alt);
    color: var(--catalog-text);
    border-color: var(--catalog-surface-alt);
}

.modal-detail-copy h2 {
    margin-bottom: 10px;
    font-size: clamp(1.45rem, 2.5vw, 2rem);
}

.modal-detail-copy .description {
    white-space: pre-line;
}

.modal-detail-copy .button-large {
    margin-top: 8px;
}

.sms-copy-buffer {
    position: fixed;
    left: -10000px;
    top: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.contact-copy-dialog {
    width: min(520px, calc(100% - 24px));
    max-height: calc(100dvh - 24px);
    margin: auto;
    border: 0;
    border-radius: 14px;
    padding: 0;
    background: transparent;
    color: var(--catalog-text, var(--ink));
}

.contact-copy-dialog[open] {
    animation: modal-in 180ms ease-out;
}

.contact-copy-dialog::backdrop {
    background: rgba(0, 0, 0, 0.68);
    backdrop-filter: blur(2px);
}

.contact-copy-card {
    position: relative;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    border: 1px solid var(--catalog-border, var(--line));
    border-radius: 14px;
    padding: 24px;
    background: var(--catalog-surface, var(--paper));
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.contact-copy-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--catalog-surface-alt, var(--soft));
    color: var(--catalog-text, var(--ink));
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.contact-copy-kicker {
    margin: 0 48px 5px 0;
    color: var(--teal);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.contact-copy-card h2 {
    margin: 0 48px 10px 0;
    font-size: clamp(1.35rem, 4vw, 1.8rem);
}

.contact-copy-card > p:not(.contact-copy-kicker):not(.contact-copy-result) {
    margin: 0 0 18px;
    color: var(--catalog-muted, var(--muted));
    line-height: 1.55;
}

.contact-copy-preview {
    display: grid;
    gap: 7px;
    font-weight: 750;
}

.contact-copy-preview textarea {
    width: 100%;
    min-height: 138px;
    resize: vertical;
    border: 1px solid var(--catalog-border, var(--line));
    border-radius: 9px;
    padding: 11px;
    background: var(--catalog-surface-alt, var(--soft));
    color: var(--catalog-text, var(--ink));
    font: inherit;
    font-size: 0.86rem;
    line-height: 1.45;
}

.contact-copy-result {
    min-height: 1.4em;
    margin: 10px 0 16px;
    color: var(--catalog-accent-text, var(--teal));
    font-size: 0.86rem;
    font-weight: 700;
}

.contact-copy-result[data-copy-state="failed"] {
    color: #b45309;
}

.contact-copy-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.contact-copy-actions .button {
    flex: 1 1 160px;
}

.contact-copy-actions [aria-disabled="true"],
.contact-copy-actions button:disabled {
    opacity: 0.58;
    pointer-events: none;
}

.contact-copy-cancel {
    flex: 1 1 100%;
    border: 0;
    padding: 7px;
    background: transparent;
    color: var(--catalog-muted, var(--muted));
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: scale(0.975) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modal-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 900px) {
    .product-modal-content {
        grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    }
}

@media (max-width: 720px) {
    .product-card .contact-options,
    .modal-contact .contact-options,
    .contact-chooser-large .contact-options {
        right: 0;
        left: 0;
        width: 100%;
        min-width: 0;
    }

    .contact-copy-card {
        padding: 22px 16px max(18px, env(safe-area-inset-bottom));
    }

    .contact-copy-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .contact-copy-actions .button,
    .contact-copy-cancel {
        width: 100%;
    }

    .product-modal {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .product-modal-content {
        display: block;
        overflow-y: auto;
    }

    .modal-gallery {
        display: grid;
        min-height: min(62vh, 520px);
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .modal-detail-copy {
        overflow: visible;
        padding: 24px 18px 32px;
    }

    .product-modal-close {
        position: fixed;
        top: max(10px, env(safe-area-inset-top));
        right: 10px;
    }

    .carousel-arrow {
        width: 40px;
        height: 40px;
    }

    .carousel-arrow-prev {
        left: 10px;
    }

    .carousel-arrow-next {
        right: 10px;
    }

    .image-zoom-toolbar {
        justify-content: flex-start;
        gap: 8px;
        padding-right: 64px;
    }

    .image-zoom-status {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .product-modal[open],
    .modal-spinner {
        animation: none;
    }
}
