/* ==========================================================================
   MT - Box Configurator
   ========================================================================== */

.mtfe-bc {
    --bc-ink: #2B1A33;
    --bc-muted: #5E5266;
    --bc-accent: #1C6FAE;
    --bc-hover: #2B1A33;
    --bc-light: #3BA4E0;
    --bc-panel: #FFFFFF;
    --bc-stage: #EDE8F1;
    --bc-color: #C99962;
    --bc-sw: 1;
    --bc-sh: 1;
    --bc-sd: 1;
    --bc-ry: -32deg;

    display: grid;
    grid-template-columns: minmax(270px, 330px) minmax(0, 1fr) minmax(270px, 330px);
    gap: 28px;
    align-items: stretch;
    color: var(--bc-ink);
}

/* ---------- panels ---------- */
.mtfe-bc__panel {
    display: flex;
    flex-direction: column;
    padding: 28px 24px;
    border-radius: 24px;
    background: var(--bc-panel);
    border: 1px solid rgba(43, 26, 51, 0.07);
    box-shadow: 0 24px 50px -34px rgba(43, 26, 51, 0.5);
}
.mtfe-bc .mtfe-bc__heading {
    margin: 0 0 18px;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--bc-ink);
}

.mtfe-bc button { font-family: inherit; }

/* size cards */
.mtfe-bc__sizes { display: flex; flex-direction: column; gap: 12px; }
.mtfe-bc__size {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 2px solid rgba(43, 26, 51, 0.08);
    background: #FFFFFF;
    color: var(--bc-ink);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}
.mtfe-bc__size:hover { border-color: rgba(28, 111, 174, 0.45); transform: translateY(-2px); }
.mtfe-bc__size.is-active { border-color: var(--bc-accent); background: rgba(28, 111, 174, 0.06); }
.mtfe-bc__size:focus-visible, .mtfe-bc__swatch:focus-visible, .mtfe-bc__btn:focus-visible { outline: 3px solid var(--bc-light); outline-offset: 2px; }
.mtfe-bc__size-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: #F3EFF6;
}
.mtfe-bc__size-icon i {
    display: block;
    width: calc(34px * var(--s));
    height: calc(30px * var(--s));
    border-radius: 3px;
    background: linear-gradient(180deg, #D9B47F 0 30%, #C99962 30%);
    box-shadow: inset 0 0 0 1px rgba(43, 26, 51, 0.12);
    position: relative;
}
.mtfe-bc__size-icon i::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    width: 22%;
    height: 45%;
    margin-left: -11%;
    background: var(--bc-light);
    opacity: 0.85;
}
.mtfe-bc__size.is-active .mtfe-bc__size-icon { background: rgba(28, 111, 174, 0.12); }
.mtfe-bc__size-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.mtfe-bc__size-text strong { font-size: 16px; font-weight: 700; line-height: 1.2; }
.mtfe-bc__size-text span { font-size: 13.5px; color: var(--bc-muted); }
.mtfe-bc__size-text em { font-style: normal; font-size: 12.5px; color: var(--bc-muted); opacity: 0.85; }
.mtfe-bc__size-price { font-size: 15px; font-weight: 700; color: var(--bc-accent); }

/* colour swatches */
.mtfe-bc__swatches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mtfe-bc__swatch {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 2px solid rgba(43, 26, 51, 0.08);
    background: #FFFFFF;
    color: var(--bc-ink);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}
.mtfe-bc__swatch:hover { border-color: rgba(28, 111, 174, 0.45); }
.mtfe-bc__swatch.is-active { border-color: var(--bc-accent); background: rgba(28, 111, 174, 0.06); }
.mtfe-bc__swatch-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(43, 26, 51, 0.18);
}

/* summary */
.mtfe-bc__summary {
    margin: 22px 0 18px;
    padding: 18px 0 0;
    border-top: 1px solid rgba(43, 26, 51, 0.08);
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.mtfe-bc__row { display: flex; justify-content: space-between; font-size: 14.5px; color: var(--bc-muted); }
.mtfe-bc__row strong { color: var(--bc-ink); font-weight: 600; }
.mtfe-bc__total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 6px;
    font-size: 14.5px;
    color: var(--bc-muted);
}
.mtfe-bc__total strong {
    font-family: "Archivo", "Source Sans 3", Arial, sans-serif;
    font-size: 34px;
    font-weight: 700;
    color: var(--bc-ink);
    letter-spacing: -0.02em;
}
.mtfe-bc__note { margin: 0; font-size: 13px; color: var(--bc-muted); }

.mtfe-bc__btn {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 20px;
    border-radius: 40px;
    background: var(--bc-accent);
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 14px 30px -16px rgba(28, 111, 174, 0.8);
    transition: background-color 0.25s ease, transform 0.25s ease;
}
.mtfe-bc__btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.25s ease; }
.mtfe-bc__btn:hover { background: var(--bc-hover); color: #FFFFFF; transform: translateY(-2px); }
.mtfe-bc__btn:hover svg { transform: translateX(4px); }

/* ---------- stage ---------- */
.mtfe-bc__stage {
    position: relative;
    min-height: 520px;
    border-radius: 28px;
    background:
        radial-gradient(circle at 50% 48%, rgba(59, 164, 224, 0.22), rgba(59, 164, 224, 0) 52%),
        linear-gradient(165deg, #FFFFFF 0%, var(--bc-stage) 75%);
    overflow: hidden;
    cursor: grab;
    touch-action: pan-y;
    user-select: none;
}
.mtfe-bc__stage.is-dragging { cursor: grabbing; }
.mtfe-bc__stage::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(43, 26, 51, 0.1) 1.2px, transparent 1.3px);
    background-size: 24px 24px;
    -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 25%, transparent 72%);
    mask-image: radial-gradient(circle at 50% 50%, #000 25%, transparent 72%);
}
.mtfe-bc__scene { position: absolute; inset: 0; perspective: 1500px; perspective-origin: 50% 30%; }
.mtfe-bc__world {
    position: absolute;
    left: 50%;
    top: 52%;
    width: 0;
    height: 0;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(var(--bc-ry));
}
.mtfe-bc__floor {
    position: absolute;
    width: 620px;
    height: 620px;
    left: -310px;
    top: -310px;
    transform: translateY(95px) rotateX(90deg);
    background: radial-gradient(closest-side, rgba(43, 26, 51, 0.32), rgba(43, 26, 51, 0.08) 45%, transparent 70%);
    transition: transform 0.6s cubic-bezier(.2, .8, .2, 1);
}

.mtfe-bc__box {
    --w: 240px;
    --h: 190px;
    --d: 210px;
    --side: color-mix(in srgb, var(--bc-color) 80%, #2B1A33);
    --top: color-mix(in srgb, var(--bc-color) 86%, #FFFFFF);
    position: absolute;
    left: calc(var(--w) / -2);
    top: calc(var(--h) / -2);
    width: var(--w);
    height: var(--h);
    transform-style: preserve-3d;
    transform-origin: 50% 100%;
    transform: scale3d(var(--bc-sw), var(--bc-sh), var(--bc-sd));
    transition: transform 0.6s cubic-bezier(.2, .8, .2, 1);
}
.mtfe-bc__box .bc-face {
    position: absolute;
    left: 0;
    top: 0;
    backface-visibility: visible;
    box-shadow: inset 0 0 0 1px rgba(43, 26, 51, 0.1);
    transition: background-color 0.45s ease;
}
.mtfe-bc__box .bc-face::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(90deg, rgba(43, 26, 51, 0.025) 0 2px, transparent 2px 7px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(43, 26, 51, 0.08));
}
.mtfe-bc__box .bc-front,
.mtfe-bc__box .bc-back { width: var(--w); height: var(--h); background-color: var(--bc-color); }
.mtfe-bc__box .bc-front { transform: translateZ(calc(var(--d) / 2)); }
.mtfe-bc__box .bc-back { transform: rotateY(180deg) translateZ(calc(var(--d) / 2)); background-color: var(--side); }
.mtfe-bc__box .bc-right,
.mtfe-bc__box .bc-left { width: var(--d); height: var(--h); left: calc((var(--w) - var(--d)) / 2); background-color: var(--side); }
.mtfe-bc__box .bc-right { transform: rotateY(90deg) translateZ(calc(var(--w) / 2)); }
.mtfe-bc__box .bc-left { transform: rotateY(-90deg) translateZ(calc(var(--w) / 2)); }
.mtfe-bc__box .bc-top,
.mtfe-bc__box .bc-bottom { width: var(--w); height: var(--d); top: calc((var(--h) - var(--d)) / 2); }
.mtfe-bc__box .bc-top { transform: rotateX(90deg) translateZ(calc(var(--h) / 2)); background-color: var(--top); }
.mtfe-bc__box .bc-bottom { transform: rotateX(-90deg) translateZ(calc(var(--h) / 2)); background-color: var(--side); }

.mtfe-bc__box .bc-seam {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    margin-top: -1px;
    background: rgba(43, 26, 51, 0.25);
}
.mtfe-bc__box .bc-tape-h,
.mtfe-bc__box .bc-tape-v {
    position: absolute;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0) 45%, rgba(255, 255, 255, 0.2)), var(--bc-tape, var(--bc-light));
    opacity: 0.9;
}
.mtfe-bc__box .bc-tape-h { left: 0; right: 0; top: 50%; height: 22%; transform: translateY(-50%); }
.mtfe-bc__box .bc-tape-v { left: 39%; width: 22%; top: 0; height: 26%; }
.mtfe-bc__box .bc-handle {
    position: absolute;
    left: 50%;
    top: 22%;
    width: 34%;
    height: 9%;
    transform: translateX(-50%);
    border-radius: 20px;
    background: rgba(43, 26, 51, 0.5);
    box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.35);
}
.mtfe-bc__box .bc-label {
    position: absolute;
    left: 10%;
    bottom: 12%;
    width: 46%;
    padding: 10px 12px;
    border-radius: 3px;
    background: #FBFAF7;
    box-shadow: 0 1px 0 rgba(43, 26, 51, 0.12), 0 6px 10px -6px rgba(43, 26, 51, 0.35);
    transform: rotate(-2deg);
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: #2B1A33;
    font-family: "Archivo", "Source Sans 3", Arial, sans-serif;
}
.mtfe-bc__box .bc-label b { font-size: 17px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; line-height: 1; }
.mtfe-bc__box .bc-label i { font-style: normal; font-size: 11px; color: #5E5266; }

.mtfe-bc__dims {
    position: absolute;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%);
    padding: 9px 18px;
    border-radius: 30px;
    background: var(--bc-ink);
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 12px 24px -12px rgba(43, 26, 51, 0.7);
}
.mtfe-bc__hint {
    position: absolute;
    left: 50%;
    top: 22px;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.85);
    color: var(--bc-muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
}
.mtfe-bc__hint svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
    .mtfe-bc { grid-template-columns: 1fr 1fr; }
    .mtfe-bc__stage { grid-column: 1 / -1; order: -1; min-height: 460px; }
}
@media (max-width: 680px) {
    .mtfe-bc { grid-template-columns: 1fr; gap: 18px; }
    .mtfe-bc__stage { min-height: 380px; }
    .mtfe-bc__world { transform: rotateX(-20deg) rotateY(var(--bc-ry)) scale(0.78); }
}
@media (prefers-reduced-motion: reduce) {
    .mtfe-bc__box, .mtfe-bc__floor, .mtfe-bc__box .bc-face { transition: none; }
}
