/* product-3d.css — блок 3D-визуализации на странице товара.
   Совместим с .pp-panorama по отступам и заголовку. */

.pp-3d {
    margin: 40px 0;
}

.pp-3d .pp-section-title {
    margin-bottom: 14px;
}

.pp-3d__viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 2000 / 1300;
    max-width: calc((100dvh - 200px) * 2000 / 1300);
    margin: 0 auto;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .06);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

@supports not (height: 100dvh) {
    .pp-3d__viewport {
        max-width: calc((100vh - 200px) * 2000 / 1300);
    }
}

.pp-3d__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.pp-3d__canvas canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    outline: none;
}

/* --------------------- Загрузка --------------------- */
.pp-3d__loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #5a6270;
    font-size: 14px;
    background: rgba(255, 255, 255, .85);
    pointer-events: none;
    z-index: 5;
    transition: opacity .2s ease;
}

.pp-3d__spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(0, 0, 0, .1);
    border-top-color: #fed500;
    border-radius: 50%;
    animation: pp-3d-spin .9s linear infinite;
}

@keyframes pp-3d-spin {
    to { transform: rotate(360deg); }
}

.pp-3d__loader-txt {
    font-weight: 500;
    letter-spacing: .01em;
}

/* ---------------------- Ошибка ---------------------- */
.pp-3d__error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    text-align: center;
    color: #5a6270;
    background: rgba(255, 255, 255, .95);
    z-index: 6;
}

.pp-3d__error strong {
    color: #1d2430;
    font-size: 16px;
}

.pp-3d__error span {
    font-size: 13px;
    max-width: 420px;
    line-height: 1.5;
}

/* --------------------- Кнопки ----------------------- */
.pp-3d__toolbar {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
    z-index: 4;
    pointer-events: auto;
}

.pp-3d__btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 10px;
    background: rgba(255, 255, 255, .92);
    color: #2a3140;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background-color .15s ease, color .15s ease, transform .15s ease, border-color .15s ease;
}

.pp-3d__btn:hover {
    background: #ffffff;
    border-color: rgba(0, 0, 0, .16);
}

.pp-3d__btn:active {
    transform: scale(.96);
}

.pp-3d__btn svg {
    width: 20px;
    height: 20px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pp-3d__btn.is-active {
    background: #fed500;
    color: #10131a;
    border-color: #fed500;
}

/* Заглушка для «Вращение» — иконка поворота */
.pp-3d__btn[data-pp-3d-rotate]::before {
    content: "";
    display: none;
}

/* ------------------- Полноэкранный -------------------- */
.pp-3d__viewport:fullscreen {
    max-width: none;
    border-radius: 0;
    aspect-ratio: auto;
    width: 100vw;
    height: 100vh;
}

.pp-3d__viewport:-webkit-full-screen {
    max-width: none;
    border-radius: 0;
    aspect-ratio: auto;
    width: 100vw;
    height: 100vh;
}

.pp-3d__viewport:fullscreen .pp-3d__toolbar {
    top: 16px;
    right: 16px;
}

/* ------------------- Адаптив ------------------------- */
@media (max-width: 768px) {
    .pp-3d__viewport {
        aspect-ratio: 4 / 3;
        max-width: none;
    }

    .pp-3d__toolbar {
        top: 8px;
        right: 8px;
        gap: 4px;
    }

    .pp-3d__btn {
        width: 36px;
        height: 36px;
    }

    .pp-3d__btn svg {
        width: 18px;
        height: 18px;
    }
}
/* ------------------- Водяной знак --------------------- */
.pp-3d__watermark {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 4;
    pointer-events: auto;
}

.pp-3d__watermark-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(0, 0, 0, .06);
    color: #2a3140;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .01em;
    opacity: .85;
    transition: opacity .15s ease, background-color .15s ease;
}

.pp-3d__watermark-link:hover {
    opacity: 1;
    background: rgba(255, 255, 255, .92);
    color: #10131a;
}

.pp-3d__watermark-logo {
    width: 22px;
    height: 22px;
    display: block;
    object-fit: contain;
    opacity: .9;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .08));
}

.pp-3d__watermark-link:hover .pp-3d__watermark-logo {
    opacity: 1;
}

.pp-3d__watermark-text {
    line-height: 1;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .pp-3d__watermark { left: 8px; bottom: 8px; }
    .pp-3d__watermark-link { padding: 5px 9px 5px 6px; font-size: 12px; gap: 6px; }
    .pp-3d__watermark-logo { width: 18px; height: 18px; }
}

/* ============================================================
   Защитные плашки поверх 3D-сцены (уникальные классы)
   ============================================================ */

/* Логотип — верхний левый угол, прозрачный фон, кликабельная ссылка */
.pp-3d__brand-logo {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    background: rgba(255, 255, 255, .55);
    border-radius: 8px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    text-decoration: none;
    transition: background-color .15s ease;
    pointer-events: auto;
}

.pp-3d__brand-logo:hover {
    background: rgba(255, 255, 255, .85);
}

.pp-3d__brand-logo img {
    display: block;
    height: 26px;
    width: auto;
    background: transparent;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .08));
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

/* Водяной знак — правый нижний угол, не кликабельный */
.pp-3d__brand-wm {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 5;
    font-family: 'Capture', Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .04em;
    color: rgba(20, 25, 35, .6);
    background: rgba(255, 255, 255, .5);
    padding: 4px 10px;
    border-radius: 8px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    user-select: none;
    pointer-events: none;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .7);
}

/* В полноэкранном режиме — крупнее */
.pp-3d__viewport:fullscreen .pp-3d__brand-logo {
    top: 20px;
    left: 20px;
    padding: 8px 14px;
}
.pp-3d__viewport:fullscreen .pp-3d__brand-logo img {
    height: 36px;
}
.pp-3d__viewport:fullscreen .pp-3d__brand-wm {
    right: 20px;
    bottom: 20px;
    font-size: 16px;
    padding: 6px 14px;
}

/* Адаптив */
@media (max-width: 768px) {
    .pp-3d__brand-logo {
        top: 8px;
        left: 8px;
        padding: 4px 8px;
    }
    .pp-3d__brand-logo img {
        height: 20px;
    }
    .pp-3d__brand-wm {
        right: 8px;
        bottom: 8px;
        font-size: 12px;
        padding: 3px 8px;
    }
}

/* 3d-white-bg: белый фон 3D-вьюпорта */
.pp-3d__viewport {
    background: #ffffff !important;
}


/* 3d-white-bg: белый фон 3D-вьюпорта */
.pp-3d__viewport {
    background: #ffffff !important;
}
