/*
 * Morf product demo — self-contained styles.
 *
 * Hand-authored (NOT compiled by gulp). Lives outside assets/src so the
 * SCSS pipeline never clobbers it and the shortcode can be dropped into any
 * page without a build step.
 */

.morf-demo {
    --morf-ink: #1e1736;
    --morf-panel: #f4f2ed;
    --morf-stage: #f2f2f2;
    --morf-radius: 0px;

    /* Thumbnail rail. Desktop sizing; the mobile block at the foot of this
       file overrides these four to the smaller Figma spec. */
    --morf-thumb: 73px;
    --morf-thumb-gap: 10px;
    --morf-nav: 48px;
    --morf-rail-gap: 10px;

    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    color: var(--morf-ink);
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
}

.morf-demo *,
.morf-demo *::before,
.morf-demo *::after {
    box-sizing: border-box;
}

.morf-demo__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--morf-panel);
    border-radius: var(--morf-radius);
}

/* ---------------------------------------------------------------- stage */

.morf-demo__stage {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--morf-stage);
}

.morf-demo__topbar {
    position: absolute;
    top: 28px;
    left: 28px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
}

.morf-demo__ar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 12px 12px;
    font: inherit;
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
    color: var(--morf-ink);
    background: #fff;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.morf-demo__ar:hover,
.morf-demo__ar:focus-visible {
    border-color: var(--morf-ink);
    outline: none;
}

.morf-demo__ar svg {
    display: block;
    width: 23px;
    height: 23px;
    flex: 0 0 auto;
}

.morf-demo__visual {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
}

.morf-demo__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: bottom;
    -webkit-user-select: none;
    user-select: none;
}

.morf-demo__img[hidden] {
    display: none;
}

.morf-demo__viewer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.morf-demo__viewer[hidden] {
    display: none;
}

.morf-demo__viewer morf-model {
    display: block;
    width: 100%;
    height: 100%;
}

/* Soft contact shadow under the product, matching the Next build. */
.morf-demo__shadow {
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 65%;
    height: 12px;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    filter: blur(12px);
    pointer-events: none;
}

.morf-demo__shadow[hidden] {
    display: none;
}

/* -------------------------------------------------------------- loader */

.morf-demo__loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.morf-demo__loader[hidden] {
    display: none;
}

.morf-demo__loader span {
    width: 34px;
    height: 34px;
    border: 2px solid rgba(30, 23, 54, 0.15);
    border-top-color: var(--morf-ink);
    border-radius: 50%;
    animation: morf-demo-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .morf-demo__loader span {
        animation-duration: 2.4s;
    }
}

/* ---------------------------------------------------------- thumb rail */

.morf-demo__rail {
    position: absolute;
    bottom: 32px;
    left: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--morf-rail-gap);
    width: 100%;
    padding: 0 20px;
}

.morf-demo__rail[hidden] {
    display: none;
}

.morf-demo__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--morf-nav);
    height: var(--morf-nav);
    flex: 0 0 auto;
    padding: 0;
    color: var(--morf-ink);
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.morf-demo__nav:hover,
.morf-demo__nav:focus-visible {
    border-color: var(--morf-ink);
    outline: none;
}

.morf-demo__nav svg {
    display: block;
    width: 25px;
    height: 25px;
}

.morf-demo__nav--prev svg {
    margin-right: 3px;
}

.morf-demo__nav--next svg {
    margin-left: 3px;
}

.morf-demo__thumbs {
    display: flex;
    align-items: center;
    gap: var(--morf-thumb-gap);
}

.morf-demo__thumb {
    position: relative;
    width: var(--morf-thumb);
    height: var(--morf-thumb);
    flex: 0 0 auto;
    padding: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.morf-demo__thumb:hover,
.morf-demo__thumb:focus-visible {
    border-color: var(--morf-ink);
    outline: none;
}

.morf-demo__thumb.is-active {
    border-color: var(--morf-ink);
}

.morf-demo__thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 8px;
    object-fit: contain;
}

/* 360°/3D tile — icon over a label instead of a frame thumbnail. */
.morf-demo__thumb--3d {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding-top: 8px;
    color: var(--morf-ink);
    font: inherit;
    line-height: 1;
}

.morf-demo__thumb--3d svg {
    width: 22px;
    height: 22px;
}

.morf-demo__thumb--3d span {
    font-size: 16px;
    font-weight: 500;
}

/* ------------------------------------------------------------ QR modal */

.morf-demo-qr {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(30, 23, 54, 0.6);
}

.morf-demo-qr[hidden] {
    display: none;
}

.morf-demo-qr__box {
    position: relative;
    max-width: 340px;
    padding: 32px;
    text-align: center;
    color: #1e1736;
    background: #fff;
    border-radius: 24px;
}

.morf-demo-qr__box h3 {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 500;
}

.morf-demo-qr__box p {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.6;
    opacity: 0.7;
}

.morf-demo-qr__box img {
    display: block;
    width: 220px;
    height: 220px;
    margin: 0 auto;
}

.morf-demo-qr__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    font-size: 20px;
    line-height: 1;
    color: #1e1736;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.morf-demo-qr__close:hover {
    background: rgba(30, 23, 54, 0.08);
}

/* -------------------------------------------------------------- mobile */

@media (max-width: 767px) {
    .morf-demo {
        --morf-radius: 0px;

        /* Rail shrinks to the Figma spec (29.2px tiles) on mobile only. */
        --morf-thumb: 29px;
        --morf-thumb-gap: 7px;
        --morf-nav: 19px;
        --morf-rail-gap: 16px;
    }

    .morf-demo__topbar {
        top: 12px;
        left: 12px;
        gap: 6px;
    }

    .morf-demo__ar {
        padding: 6px 12px 6px 8px;
        font-size: 11px;
        gap: 4px;
    }

    .morf-demo__ar svg {
        width: 14px;
        height: 14px;
    }

    .morf-demo__rail {
        bottom: 12px;
        padding: 0 12px;
    }

    /* Sizes the four variables above can't reach. */
    .morf-demo__nav svg {
        width: 10px;
        height: 10px;
    }

    .morf-demo__nav--prev svg {
        margin-right: 1px;
    }

    .morf-demo__nav--next svg {
        margin-left: 1px;
    }

    .morf-demo__thumb {
        border-radius: 4px;
    }

    .morf-demo__thumb img {
        padding: 3px;
    }

    .morf-demo__thumb--3d {
        gap: 0;
        padding-top: 3px;
    }

    .morf-demo__thumb--3d svg {
        width: 12px;
        height: 12px;
    }

    .morf-demo__thumb--3d span {
        font-size: 10px;
    }
}
