/* 3D model sayfası. Renkler yalnız :root değişkenlerinden. */

/* ---------- varyantlar yan yana: 2, 3, 4 sütun; fazlası alt satıra iner */
.m3d-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

/* harita satırı ile öteki varyantların satırı arası */
.m3d-grid + .m3d-grid {
    margin-top: 24px;
}

/* 2, 3, 4 sütun: eksik kalan son satır ortalanır (6 varyantta alttaki 2 kutu ortada) */
.m3d-grid-2,
.m3d-grid-3,
.m3d-grid-4 {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.m3d-grid-2 { --m3d-cols: 2; }
.m3d-grid-3 { --m3d-cols: 3; }
.m3d-grid-4 { --m3d-cols: 4; }

.m3d-grid-2 > .m3d-cell,
.m3d-grid-3 > .m3d-cell,
.m3d-grid-4 > .m3d-cell {
    flex: 0 0 calc((100% - (var(--m3d-cols) - 1) * 16px) / var(--m3d-cols));
}

.m3d-cell {
    margin: 0;
    min-width: 0;
}

/* varyant adı: kutunun üstünde, sayfa başlıkları gibi (altında kısa turuncu çizgi) */
.m3d-cell-name {
    display: flex;
    justify-content: center;
    margin: 0 0 14px;
}

.m3d-cell-name span {
    position: relative;
    padding-bottom: 10px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.125rem, 1.6vw, 1.375rem);
    line-height: 1.15;
    letter-spacing: 0.01em;
    color: var(--heading-color);
    text-align: center;
}

.m3d-cell-name span::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 36px;
    height: 2px;
    border-radius: 2px;
    background: var(--main-color);
    transform: translateX(-50%);
}

/* ---------- önizleme kutusu */
.m3d-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 75vh;
    border: 1px solid var(--line-color);
    border-radius: 14px;
    background: var(--bg);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* tek model: geniş kutu */
.m3d-grid-1 .m3d-stage {
    aspect-ratio: 16 / 10;
    max-height: 78vh;
    min-height: 320px;
}

/* Dokunmatik: yatay sürükleme modeli döndürür, dikey sürükleme sayfayı
   kaydırır, iki parmak yakınlaştırır (görüntüleyici kendi satır içi
   touch-action değerini yazdığı için !important gerekli) */
.m3d-stage .m3d-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: pan-y !important;
}

.m3d-stage .m3d-canvas:active {
    cursor: grabbing;
}

.m3d-stage-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    text-align: center;
    color: var(--light-text);
    font-size: 15px;
    pointer-events: none;
}

.m3d-stage.is-ready .m3d-stage-status {
    display: none;
}

.m3d-stage.is-error .m3d-stage-status {
    color: var(--danger);
}

.m3d-stage-help {
    margin-top: 16px;
    text-align: center;
    color: var(--light-text);
    font-size: 14px;
}

/* ---------- fiyat: kartta altta, sosyal medya butonlarıyla aynı kutu
   (solda "Fiyat", sağda dolar ve TL karşılığı) */
.m3d-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    min-height: 42px;
    margin: auto 6px 0;
    padding: 8px 12px;
    border: 1px solid var(--line-color);
    border-radius: 10px;
    background-color: var(--bg);
}

.m3d-price-label {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    color: var(--light-text);
}

.m3d-price-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 2px 8px;
    min-width: 0;
}

.m3d-price-old {
    font-size: 0.8rem;
    line-height: 1.2;
    color: var(--soft-text);
    text-decoration: line-through;
}

.m3d-price-now {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--main-color);
}

.m3d-price-try {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--light-text);
}

.m3d-price-try:empty {
    display: none;
}

.m3d-price-badge {
    padding: 0.15rem 0.45rem;
    border-radius: 20px;
    background: var(--main-color);
    color: var(--on-main);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.9;
}

.m3d-price-gain {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--base-text);
}

/* model sayfası: başlık kutusunun sağında, büyük hali
   (Fiyat Listesi sayfasındaki paket fiyatıyla aynı düzen) */
.m3d-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px 24px;
}

.m3d-price-lg {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.m3d-price-lg .m3d-price-old {
    font-size: 0.95rem;
}

.m3d-price-lg .m3d-price-row {
    justify-content: flex-start;
}

.m3d-price-lg .m3d-price-now {
    font-size: 1.75rem;
}

.m3d-price-lg .m3d-price-save {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
}

/* seçenek sayfası: başlığın altındaki açıklama */
.m3d-lead {
    max-width: 760px;
    margin: 0 auto 24px;
    text-align: center;
    font-size: 15px;
    line-height: 1.6;
    color: var(--light-text);
}

/* ---------- tablet: en fazla 2 sütun */
@media (max-width: 991px) {
    .m3d-grid-3,
    .m3d-grid-4 {
        --m3d-cols: 2;
    }
}

/* ---------- telefon: alt alta */
@media (max-width: 575px) {
    .m3d-grid-2,
    .m3d-grid-3,
    .m3d-grid-4 {
        --m3d-cols: 1;
    }
    .m3d-stage,
    .m3d-grid-1 .m3d-stage {
        aspect-ratio: 1 / 1;
        min-height: 0;
    }
}

/* Proje sayfasındaki gibi: çok geniş ekranda başlık ve içerik 1430px'te kalır */
@media (min-width: 1800px) {
    .pj-head .well-box,
    .pj-content-row > [class*="col-"] > .well-box {
        max-width: 1430px;
        margin-right: auto;
        margin-left: auto;
    }
}

/* ölçüm kutusu (yalnız ?m3ddebug) */
.m3d-debug {
    position: fixed;
    right: 12px;
    bottom: 12px;
    z-index: 9999;
    max-width: 420px;
    padding: 10px 12px;
    border: 1px solid var(--line-color);
    border-radius: 10px;
    background-color: var(--bg);
    color: var(--base-text);
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    pointer-events: none;
}
