/* =====================================================================
   Вітрина моделей на сторінці компанії — «міні-магазин»

   Побудована на токенах платформи: світла тема працює без окремих правил.
   ===================================================================== */

.shop { margin-top: 6px; }

.shop__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.shop__lead {
    font-size: var(--t-md);
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 62ch;
    margin: 4px 0 18px;
}
.shop__source {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: var(--t-sm);
    color: var(--text-faint);
}
.shop__source svg { width: 13px; height: 13px; }

/* --- Фільтр за серіями --------------------------------------------- */
.shop__filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.shop__filter {
    height: 30px; padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-full);
    background: transparent;
    font-size: var(--t-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--fast) var(--ease);
}
.shop__filter:hover { border-color: var(--line-bright); color: var(--text); }
.shop__filter.is-on {
    border-color: var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent-text);
    font-weight: 550;
}

/* --- Сітка плиток --------------------------------------------------- */
.shop__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
    gap: 14px;
}

.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--bg-raised);
    overflow: hidden;
    isolation: isolate;
    transition: transform var(--normal) var(--ease-out),
                border-color var(--normal) var(--ease),
                box-shadow var(--normal) var(--ease);
}
.tile.is-hidden { display: none; }
.tile:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}
.tile:hover {
    transform: translateY(-4px);
    border-color: var(--line-bright);
    box-shadow: var(--shadow-lg);
}

/* Світло, що йде за курсором по плитці */
.tile::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%),
                var(--tile-accent-soft, var(--accent-soft)), transparent 60%);
    opacity: 0;
    transition: opacity var(--normal) var(--ease);
}
.tile:hover::before { opacity: 1; }

/* --- Зображення ------------------------------------------------------ */
.tile__shot {
    position: relative;
    z-index: 1;
    aspect-ratio: 4 / 3;
    /* Каталожні рендери зроблені на білому тлі, тож знімок завжди лежить
       на світлій «студійній» підкладці — і в темній темі теж. Так білі
       прямокутники PNG зливаються з плиткою замість того, щоб стирчати. */
    background:
        radial-gradient(120% 95% at 50% 4%, var(--tile-accent-soft, var(--accent-soft)), transparent 64%),
        linear-gradient(180deg, #fcfbfa 0%, #efece7 100%);
    border-bottom: 1px solid rgba(0, 0, 0, .10);
    overflow: hidden;
}
.tile__shot img {
    /* Абсолютне позиціювання — єдиний надійний спосіб вписати знімок:
       у контейнера висота задана через aspect-ratio, тож для звичайного
       потоку вона «невизначена» і height/max-height у відсотках Chrome
       ігнорує — високі рендери вилазили за край і обрізались. */
    position: absolute;
    inset: 18px;
    width: calc(100% - 36px);
    height: calc(100% - 36px);
    object-fit: contain;
    /* множення прибирає білу підкладку рендера й лишає саму модель.
       Тіні тут бути не може: рендер — непрозорий білий прямокутник,
       і drop-shadow малював би прямокутну пляму навколо знімка. */
    mix-blend-mode: multiply;
    transition: transform var(--slow) var(--ease-out);
}
.tile:hover .tile__shot img { transform: scale(1.07) translateY(-3px); }

/* Мітка серії та колір */
.tile__series {
    position: absolute;
    top: 12px; left: 12px;
    z-index: 2;                       /* знімок має filter — без цього перекриває мітку */
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, .82);
    border: 1px solid rgba(24, 20, 16, .12);
    font-size: var(--t-xs);
    font-weight: 600;
    letter-spacing: .04em;
    color: #3a332b;                   /* підкладка знімка світла в обох темах */
    backdrop-filter: var(--blur-light);
}
.tile__series i {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--tile-accent, var(--accent));
}
.tile__3d {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 2;
    height: 24px; padding: 0 9px;
    display: inline-flex; align-items: center; gap: 5px;
    border-radius: var(--r-full);
    background: var(--accent);
    color: var(--text-invert);
    font-size: 10px; font-weight: 700; letter-spacing: .08em;
}

/* --- Опис ------------------------------------------------------------ */
.tile__body { position: relative; z-index: 1; padding: 14px 15px 4px; flex: 1; }
.tile__kind {
    font-size: var(--t-xs);
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.tile__name {
    font-size: var(--t-md);
    font-weight: 600;
    letter-spacing: -.01em;
    margin-top: 4px;
    line-height: 1.3;
}
.tile__dims {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}
.tile__dim {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--r-sm);
    background: var(--tint-soft);
    border: 1px solid var(--line);
    font-size: var(--t-xs);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.tile__dim b { color: var(--text); font-weight: 600; }

/* --- Підвал плитки --------------------------------------------------- */
.tile__foot {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    margin-top: 12px;
    border-top: 1px solid var(--line);
    background: var(--tint-subtle);
}
.tile__marks { display: flex; gap: 5px; }
.tile__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px; min-width: 22px;
    padding: 0 6px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line-strong);
    background: var(--bg-base);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--text-muted);
    cursor: help;
}
.tile__mark svg { width: 12px; height: 12px; }
.tile__more {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border: 1px solid var(--accent-line);
    border-radius: var(--r-full);
    background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--bg-raised);
    font-size: var(--t-sm);
    font-weight: 550;
    color: var(--accent-text);
    cursor: pointer;
    transition: all var(--fast) var(--ease);
}
.tile__more:hover { background: var(--accent); border-color: var(--accent); color: var(--text-invert); }
.tile__more svg { width: 12px; height: 12px; transition: transform var(--normal) var(--ease-out); }
.tile:hover .tile__more svg { transform: translateX(2px); }

/* --- Картка моделі (модальне вікно) ---------------------------------- */
.shop-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--overlay);
    backdrop-filter: blur(3px);
}
.shop-modal.is-open { display: flex; animation: shop-fade var(--normal) var(--ease); }
@keyframes shop-fade { from { opacity: 0; } to { opacity: 1; } }

.shop-modal__box {
    width: min(920px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-xl);
    background: var(--bg-base);
    box-shadow: var(--shadow-lg);
    animation: shop-rise var(--slow) var(--ease-out);
}
@keyframes shop-rise { from { transform: translateY(18px) scale(.98); } to { transform: none; } }

.shop-modal__head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--line);
}
.shop-modal__close {
    margin-left: auto;
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--fast) var(--ease);
}
.shop-modal__close:hover { background: var(--tint-hover); color: var(--text); }

.shop-modal__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 22px;
    padding: 22px;
}
.shop-modal__shot {
    position: relative;
    aspect-ratio: 4 / 3;
    min-height: 280px;
    border-radius: var(--r-lg);
    /* та сама світла підкладка, що й на плитці */
    background:
        radial-gradient(120% 95% at 50% 6%, var(--tile-accent-soft, var(--accent-soft)), transparent 64%),
        linear-gradient(180deg, #fcfbfa 0%, #efece7 100%);
    border: 1px solid rgba(24, 20, 16, .10);
}
.shop-modal__shot img {
    position: absolute;
    inset: 20px;
    width: calc(100% - 40px);
    height: calc(100% - 40px);
    object-fit: contain;
    mix-blend-mode: multiply;
}

.spec { width: 100%; border-collapse: collapse; margin-top: 4px; }
.spec td { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: var(--t-base); vertical-align: top; }
.spec td:first-child { color: var(--text-muted); width: 46%; }
.spec td:last-child { color: var(--text); font-variant-numeric: tabular-nums; }
.spec tr:last-child td { border-bottom: none; }

.shop-modal__opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* --- 3D-модель квітника ----------------------------------------------
   Зрізана піраміда: верх 43×43 см, низ вужчий. У пікселях — верхня
   півширина 54, нижня 36, висота 170; звідси нахил грані:
   atan(18 / 170) = 6.04°, а сама грань по схилу 171px заввишки.
   -------------------------------------------------------------------- */
.model3d {
    position: relative;
    aspect-ratio: 5 / 6;
    min-height: 420px;
    display: grid;
    place-items: center;
    border-radius: var(--r-lg);
    /* світла «студія»: мʼяке небо згори і тепла підлога знизу */
    background:
        radial-gradient(70% 46% at 50% 96%, rgba(196, 176, 148, .55), transparent 70%),
        linear-gradient(180deg, #FBF8F3 0%, #F2ECE2 52%, #E4DACA 100%);
    border: 1px solid rgba(24, 20, 16, .10);
    cursor: grab;
    overflow: hidden;
    touch-action: none;
    user-select: none;
}
.model3d:active { cursor: grabbing; }

.model3d__stage {
    position: relative;
    width: 300px; height: 400px;
    perspective: 1100px;
    perspective-origin: 50% 52%;
}
/* Нульовий якір у центрі верхнього отвору — від нього будується вся модель */
.model3d__obj {
    position: absolute;
    left: 50%; top: 176px;
    width: 0; height: 0;
    transform-style: preserve-3d;
    /* кути обертання задає showcase.js */
    transform: rotateX(var(--rx, -16deg)) rotateY(var(--ry, 28deg));
    transition: transform 90ms linear;
}

/* Плетена поверхня: дрібна діагональна сітка, а не велика «шахівниця» */
.model3d__face,
.model3d__bottom {
    position: absolute;
    /* Плетіння: горизонтальні ряди прутів + діагональна нитка всередині ряду */
    background-color: #5C564E;
    background-image:
        repeating-linear-gradient(0deg,
            rgba(0, 0, 0, .34) 0 1px,
            rgba(255, 255, 255, .05) 1px 2px,
            transparent 2px 7px),
        repeating-linear-gradient(58deg,
            rgba(255, 255, 255, .07) 0 2px,
            rgba(0, 0, 0, .13) 2px 5px);
    backface-visibility: hidden;
}
.model3d__face {
    left: -54px; top: 0;
    width: 108px; height: 171px;
    transform-origin: 50% 0;
    /* звуження донизу: 18px з кожного боку = 16.67% ширини */
    clip-path: polygon(0 0, 100% 0, 83.33% 100%, 16.67% 100%);
    transform:
        rotateY(calc(var(--i) * 90deg))
        translateZ(54px)
        rotateX(-6.04deg);
}
/* Мʼяке вертикальне світло по грані + притінення знизу */
.model3d__face::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .16), transparent 46%),
        linear-gradient(90deg, rgba(0, 0, 0, .22), transparent 32%, transparent 68%, rgba(0, 0, 0, .26)),
        linear-gradient(0deg, rgba(0, 0, 0, .26), transparent 48%);
}
.model3d__face--2 { filter: brightness(.74); }   /* протилежна грань */
.model3d__face--1 { filter: brightness(.88); }
.model3d__face--3 { filter: brightness(.95); }

.model3d__bottom {
    left: -36px; top: -36px;
    width: 72px; height: 72px;
    transform: translateY(170px) rotateX(90deg);
    filter: brightness(.45);
}

/* Обід верхнього отвору */
.model3d__rim {
    position: absolute;
    left: -57px; top: -57px;
    width: 114px; height: 114px;
    box-sizing: border-box;
    border: 7px solid #6B655D;
    border-radius: 5px;
    background: transparent;
    transform: rotateX(90deg);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, .45),
        inset 0 0 0 1px rgba(255, 255, 255, .10);
}
/* Ґрунт трохи нижче обода */
.model3d__soil {
    position: absolute;
    left: -47px; top: -47px;
    width: 94px; height: 94px;
    border-radius: 3px;
    background:
        radial-gradient(circle at 38% 32%, rgba(255, 255, 255, .07), transparent 60%),
        radial-gradient(circle at 60% 70%, #3A2D21, #221A13 70%);
    transform: rotateX(90deg) translateZ(-14px);
    box-shadow: 0 0 26px 6px rgba(0, 0, 0, .8) inset;
}

/* Контактна тінь під дном — точно на рівні низу моделі */
.model3d__shadow {
    position: absolute;
    left: 50%; top: 342px;
    width: 128px; height: 22px;
    margin-left: -64px;
    border-radius: 50%;
    background: radial-gradient(ellipse at 50% 50%, rgba(52, 38, 24, .42), rgba(52, 38, 24, .20) 45%, transparent 72%);
    filter: blur(5px);
}
.model3d__hint {
    position: absolute;
    left: 0; right: 0; bottom: 12px;
    text-align: center;
    font-size: var(--t-xs);
    color: rgba(58, 51, 43, .62);
    pointer-events: none;
    transition: opacity var(--normal) var(--ease);
}
.model3d.is-touched .model3d__hint { opacity: 0; }
.model3d__reset {
    position: absolute;
    right: 12px; top: 12px;
    height: 28px; padding: 0 11px;
    border: 1px solid rgba(24, 20, 16, .16);
    border-radius: var(--r-full);
    background: rgba(255, 255, 255, .78);
    font-size: var(--t-xs);
    color: #3a332b;
    cursor: pointer;
    transition: all var(--fast) var(--ease);
}
.model3d__reset:hover { background: #fff; border-color: rgba(24, 20, 16, .3); }

/* --- Рослина в кашпо -------------------------------------------------
   Листя й квіти розставлені по колу навколо осі кашпо: під будь-яким
   кутом огляду видно достатньо елементів, щоб крона мала обʼєм.
   -------------------------------------------------------------------- */
.plant { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
.plant__item {
    position: absolute;
    left: 0; top: 0;
    transform-style: preserve-3d;
}
.leaf {
    position: absolute;
    left: 0; top: 0;
    width: var(--w); height: var(--h);
    margin: calc(var(--h) / -2) 0 0 calc(var(--w) / -2);
    border-radius: 50% 8% 50% 8% / 50% 50% 50% 50%;
    background:
        linear-gradient(0deg, transparent 44%, rgba(255, 255, 255, .20) 48% 52%, transparent 56%),
        linear-gradient(120deg, rgba(255, 255, 255, .34), transparent 46%),
        linear-gradient(200deg, hsl(var(--hue) 36% 54%), hsl(var(--hue) 40% 28%));
    box-shadow: inset 0 0 0 1px rgba(20, 40, 18, .18);
    transform-origin: 50% 50%;
    animation: leaf-sway 4.6s var(--ease, ease-in-out) infinite alternate;
    animation-delay: var(--d, 0s);
}
@keyframes leaf-sway {
    from { transform: rotate(-3.5deg) translateY(0); }
    to   { transform: rotate(3.5deg) translateY(-2px); }
}
.stem {
    position: absolute;
    left: 0; top: 0;
    width: 3px; height: var(--h);
    margin: calc(var(--h) * -1) 0 0 -1.5px;
    border-radius: 2px;
    background: linear-gradient(180deg, hsl(96 30% 44%), hsl(96 32% 26%));
}
.bloom {
    position: absolute;
    left: 0; top: 0;
    width: var(--w); height: var(--w);
    margin: calc(var(--w) / -2) 0 0 calc(var(--w) / -2);
    background:
        radial-gradient(circle at 50% 16%, var(--pf) 0 21%, transparent 22%),
        radial-gradient(circle at 84% 40%, var(--pf) 0 21%, transparent 22%),
        radial-gradient(circle at 69% 86%, var(--pf) 0 21%, transparent 22%),
        radial-gradient(circle at 31% 86%, var(--pf) 0 21%, transparent 22%),
        radial-gradient(circle at 16% 40%, var(--pf) 0 21%, transparent 22%),
        radial-gradient(circle at 50% 52%, #E8B44A 0 15%, transparent 16%);
    filter: drop-shadow(0 2px 3px rgba(60, 45, 30, .28));
    animation: leaf-sway 5.4s ease-in-out infinite alternate;
    animation-delay: var(--d, 0s);
}

@media (max-width: 720px) {
    .shop-modal__grid { grid-template-columns: minmax(0, 1fr); }
    .shop-modal { padding: 12px; }
}
@media (max-width: 520px) {
    /* сцена 300px завширшки не влазить у вузьку картку — стискаємо цілком */
    .model3d { aspect-ratio: 1 / 1; min-height: 320px; }
    .model3d__stage { transform: scale(.78); }
}
@media (prefers-reduced-motion: reduce) {
    .tile, .tile__shot img, .shop-modal__box { transition: none !important; animation: none !important; }
}
