/* ==========================================================================
   TGF Slab — 3D viewer
   ==========================================================================
   Theme hooks (override these on .tgf-slab or globally for re-skinning):
     --tgf-slab-bg, --tgf-slab-text, --tgf-slab-accent, --tgf-slab-radius
   ========================================================================== */

.tgf-slab {
    /* GradeIt brand palette (matches the wizard) */
    --tgf-slab-bg:     transparent;
    --tgf-slab-text:   #fff;
    --tgf-slab-accent: #F15F51;   /* coral — primary brand */
    /* Real slab cases have very subtle rounded corners — closer to 4-6px than 18px.
       The 18px default made the corners look pillowy, not slab-like. */
    --tgf-slab-radius: 6px;
    --tgf-slab-shadow: 0 30px 60px -20px rgba(0,0,0,0.55), 0 12px 24px -12px rgba(0,0,0,0.35);

    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--tgf-slab-text);
    perspective: 1500px;
    perspective-origin: 50% 50%;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
}

.tgf-slab__viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    transform-style: preserve-3d;
}

.tgf-slab__card {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform;
}

.tgf-slab.is-flipped .tgf-slab__card {
    transform: rotateY(180deg);
}

.tgf-slab__face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: var(--tgf-slab-radius);
    overflow: hidden;
    /* Intentionally transparent so an uploaded image with mismatched aspect,
       transparent edges, or a still-loading state doesn't show a dark band over
       the image. The dark placeholder lives on .tgf-slab__placeholder below. */
    background: transparent;
    box-shadow: var(--tgf-slab-shadow);
}

.tgf-slab__face--back {
    transform: rotateY(180deg);
}

/* Lock the image to fill the face exactly. Using absolute positioning + inset:0
   rather than just width/height:100% so theme-level <img> margin / vertical-align
   / line-height rules can't push it down and reveal the face background.

   object-fit: contain shows the WHOLE slab (no top/bottom crop) — switched from
   `cover` because uploaded slab photos vary in aspect ratio and `cover` was
   chopping the top and bottom of taller-than-2:3 images. The face background is
   transparent so the letterboxed space falls through to the page background. */
.tgf-slab__face img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    object-fit: contain;
    object-position: center center;
}

.tgf-slab__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.55);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 14px;
    background:
        linear-gradient(135deg, #1f2329 0%, #2d3138 100%);
}

/* Holographic shine layer */
.tgf-slab__shine {
    position: absolute;
    inset: 0;
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 0;
    background:
        radial-gradient(
            circle at var(--shine-x, 50%) var(--shine-y, 50%),
            rgba(255,255,255,0.55) 0%,
            rgba(255,200,120,0.20) 25%,
            rgba(120,200,255,0.10) 45%,
            transparent 70%
        );
    transition: opacity 0.25s ease;
}
.tgf-slab:hover .tgf-slab__shine,
.tgf-slab.is-tilting .tgf-slab__shine {
    opacity: 1;
}

/* Flip button */
.tgf-slab__flip {
    position: absolute;
    bottom: -14px;
    right: -14px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--tgf-slab-accent);
    color: #fff;
    border: 3px solid #fff;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
    z-index: 2;
}
.tgf-slab__flip:hover {
    transform: scale(1.08);
}
.tgf-slab__flip-icon {
    font-size: 18px;
    line-height: 1;
    display: inline-block;
    transition: transform 0.6s ease;
}
.tgf-slab.is-flipped .tgf-slab__flip-icon {
    transform: rotate(180deg);
}

/* Caption / meta */
.tgf-slab__meta {
    margin-top: 22px;
    text-align: center;
    width: 100%;
}
.tgf-slab__title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.tgf-slab__caption {
    margin-top: 4px;
    font-size: 13px;
    opacity: 0.8;
}
.tgf-slab__chip {
    /* Flex with an explicit gap so prefix ("From"), amount ("R825.00") and suffix
       ("add-on") never run together because of whitespace collapse or themes that
       reset spacing inside inline-block elements. */
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 10px;
    padding: 5px 14px;
    border-radius: 999px;
    /* GradeIt teal + charcoal — ~10:1 contrast vs the previous coral + white (3.7:1).
       Same readability win we applied to the Company Explorer's option-price pill. */
    background: #60C7CB;
    color: #0D0908;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.tgf-slab__chip-prefix,
.tgf-slab__chip-suffix {
    opacity: 0.85;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.tgf-slab__chip-amount {
    font-weight: 800;
}

/* Hero variant */
.tgf-slab--hero {
    max-width: 420px;
}
.tgf-slab--hero .tgf-slab__viewport {
    /* Slightly tighter aspect to feel monumental */
}

/* Grid layout */
.tgf-slab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 40px 24px;
    align-items: start;
    padding: 24px 0;
}
.tgf-slab-grid--empty {
    text-align: center;
    color: #8a8f99;
    padding: 40px 0;
}

@media (max-width: 600px) {
    .tgf-slab-grid {
        grid-template-columns: 1fr;
        gap: 36px;
    }
    .tgf-slab {
        max-width: 260px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .tgf-slab__card { transition: none; }
    .tgf-slab__shine { display: none; }
}
