/* ─────────────────────────────────────────────────────────────────────────
   Public site — Modelação 3D showcase
   Mirrors the structural rhythm of the Web Design page (hero + sticky
   filter pills + zigzag case studies) but the centre piece is an A-Frame
   3D viewer stage instead of a desktop+mobile mockup cluster. The stage
   itself stays flat (no 3D rotation on the wrapper) so the viewer's own
   look-controls keep mapping mouse coordinates correctly.
   ──────────────────────────────────────────────────────────────────────── */

/* ── Hero ───────────────────────────────────────────────────────────────── */
.modeling3d-showcase .m3-hero {
    padding: clamp(3rem, 8vw, 6rem) 0 clamp(2rem, 4vw, 3rem);
    border-bottom: 1px solid var(--am-border-soft, rgba(255,255,255,.08));
    position: relative;
    overflow: hidden;
}
.modeling3d-showcase .m3-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60% 60% at 90% 10%, rgba(201,169,110,.07) 0%, transparent 70%),
        radial-gradient(40% 60% at 0% 100%, rgba(203,191,176,.04) 0%, transparent 70%);
    pointer-events: none;
}
.modeling3d-showcase .m3-hero__eyebrow {
    font-family: var(--am-font-sub, sans-serif);
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: .72rem;
    color: var(--am-text-muted, #888);
    margin-bottom: .5rem;
}
.modeling3d-showcase .m3-hero__title {
    font-family: var(--am-font-heading, serif);
    font-weight: 300;
    font-size: clamp(2.6rem, 6vw, 5rem);
    line-height: 1.05;
    margin: 0 0 1rem;
    color: var(--am-base, #fff);
}
.modeling3d-showcase .m3-hero__lead {
    max-width: 56ch;
    color: var(--am-text, #ccc);
    font-size: 1.05rem;
    line-height: 1.6;
}
.modeling3d-showcase .m3-hero__meta {
    display: flex;
    gap: 2.5rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.modeling3d-showcase .m3-hero__metric {
    font-family: var(--am-font-heading, serif);
    font-size: 3rem;
    line-height: 1;
    color: var(--am-base, #fff);
}
.modeling3d-showcase .m3-hero__metric-label {
    font-family: var(--am-font-sub, sans-serif);
    font-size: .75rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--am-text-muted, #888);
}

/* ── Filter pills ───────────────────────────────────────────────────────── */
.modeling3d-showcase .m3-filters {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--am-border-soft, rgba(255,255,255,.06));
    position: sticky;
    top: 0;
    z-index: 5;
    background: color-mix(in srgb, var(--am-bg, #161c18) 92%, transparent);
    backdrop-filter: saturate(140%) blur(8px);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
}
.modeling3d-showcase .m3-filters__scroll {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: .25rem;
}
.modeling3d-showcase .m3-filters__scroll::-webkit-scrollbar { display: none; }

.modeling3d-showcase .m3-pill {
    flex-shrink: 0;
    border: 1px solid var(--am-border, rgba(255,255,255,.15));
    background: transparent;
    color: var(--am-text, #ccc);
    padding: .5rem 1rem;
    border-radius: var(--am-radius-pill, 999px);
    font-family: var(--am-font-sub, sans-serif);
    font-size: .82rem;
    letter-spacing: .04em;
    cursor: pointer;
    transition: background .25s ease, color .25s ease, border-color .25s ease;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}
.modeling3d-showcase .m3-pill:hover {
    border-color: var(--am-base, #fff);
    color: var(--am-base, #fff);
}
.modeling3d-showcase .m3-pill.is-active {
    background: var(--am-base, #fff);
    color: var(--am-contrast, #111);
    border-color: var(--am-base, #fff);
}
.modeling3d-showcase .m3-pill__count {
    font-size: .7rem;
    opacity: .7;
    background: rgba(0,0,0,.15);
    border-radius: var(--am-radius-pill, 999px);
    padding: .05rem .45rem;
}
.modeling3d-showcase .m3-pill.is-active .m3-pill__count {
    background: rgba(0,0,0,.12);
    opacity: .9;
}

/* ── Cases ──────────────────────────────────────────────────────────────── */
.modeling3d-showcase .m3-cases {
    padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2rem, 5vw, 4rem);
}
.modeling3d-showcase .m3-case {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 4rem);
    align-items: center;
    padding: clamp(2rem, 5vw, 4rem) 0;
    border-bottom: 1px solid var(--am-border-soft, rgba(255,255,255,.06));
}
.modeling3d-showcase .m3-case:last-of-type { border-bottom: none; }

.modeling3d-showcase .m3-case.is-right .m3-case__visual { order: 2; }
.modeling3d-showcase .m3-case.is-right .m3-case__copy   { order: 1; }

@media (max-width: 900px) {
    .modeling3d-showcase .m3-case {
        grid-template-columns: 1fr;
    }
    .modeling3d-showcase .m3-case.is-right .m3-case__visual,
    .modeling3d-showcase .m3-case.is-right .m3-case__copy {
        order: unset;
    }
}

/* ── Copy column ────────────────────────────────────────────────────────── */
.modeling3d-showcase .m3-case__type {
    font-family: var(--am-font-sub, sans-serif);
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: .72rem;
    color: var(--am-text-muted, #888);
    margin: 0 0 .75rem;
}
.modeling3d-showcase .m3-case__title {
    font-family: var(--am-font-heading, serif);
    font-weight: 300;
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    line-height: 1.1;
    margin: 0 0 .5rem;
}
.modeling3d-showcase .m3-case__title a {
    color: var(--am-base, #fff);
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-position: 0 100%;
    background-size: 0 1px;
    background-repeat: no-repeat;
    transition: background-size .35s ease;
}
.modeling3d-showcase .m3-case__title a:hover {
    background-size: 100% 1px;
}
.modeling3d-showcase .m3-case__client {
    color: var(--am-text-muted, #888);
    font-size: .9rem;
    margin: 0 0 1rem;
}
.modeling3d-showcase .m3-case__desc {
    color: var(--am-text, #ccc);
    line-height: 1.7;
    margin: 0 0 1.5rem;
}
.modeling3d-showcase .m3-case__actions {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.modeling3d-showcase .m3-case__link {
    font-family: var(--am-font-sub, sans-serif);
    text-decoration: none;
    font-size: .9rem;
    letter-spacing: .04em;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--am-text-muted, #888);
    transition: gap .25s ease, color .25s ease;
}
.modeling3d-showcase .m3-case__link:hover {
    color: var(--am-base, #fff);
    gap: .8rem;
}

/* ── 3D stage ──────────────────────────────────────────────────────────── */
/* Container for the A-Frame viewer (or fallback image). Stays flat — the
   model rotates inside the viewer itself, providing the 3D feel without
   breaking pointer mapping in look-controls. */
.modeling3d-showcase .m3-case__visual {
    position: relative;
    min-height: 320px;
}

/* Gold breathing glow behind the stage. Lower intensity here than on the
   webdesign page because there's no opaque card to contain it — too strong
   would smear across the layout. */
.modeling3d-showcase .m3-case__visual::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 65%;
    height: 65%;
    transform: translate(-50%, -50%) scale(.85);
    background: radial-gradient(
        ellipse at center,
        var(--am-photo-gold, #C9A96E) 0%,
        rgba(201, 169, 110, .25) 35%,
        transparent 70%
    );
    opacity: .15;
    filter: blur(55px);
    z-index: 0;
    pointer-events: none;
    transition: opacity .85s cubic-bezier(.22, 1, .36, 1),
                transform .85s cubic-bezier(.22, 1, .36, 1);
}
.modeling3d-showcase .m3-case:hover .m3-case__visual::before {
    animation: m3-glow-pulse 2.8s ease-in-out infinite;
}

@keyframes m3-glow-pulse {
    0%, 100% {
        opacity: .3;
        transform: translate(-50%, -50%) scale(.95);
    }
    50% {
        opacity: .5;
        transform: translate(-50%, -50%) scale(1.12);
    }
}

/* Clean stage by default — no card, no shadow, no border. The model floats
   directly on the page background; the gold glow behind (::before on the
   visual) is the only ambience. */
.modeling3d-showcase .m3-stage {
    position: relative;
    z-index: 1;
    aspect-ratio: 1 / 1;
    background: transparent;
    border-radius: 0;
    overflow: hidden;
    transition:
        transform .85s cubic-bezier(.22, 1, .36, 1);
    will-change: transform;
}
.modeling3d-showcase .m3-case:hover .m3-stage {
    transform: translateY(-4px);
}

/* When the admin explicitly sets a model_background_color, the stage opts
   into the "card" look — rounded, contained, with a soft shadow. */
.modeling3d-showcase .m3-stage.has-bg {
    background: var(--m3-stage-bg, var(--am-bg-alt, #1e2420));
    border-radius: 18px;
    box-shadow:
        0 30px 60px -20px rgba(0,0,0,.55),
        0 20px 30px -10px rgba(0,0,0,.35),
        0 0 0 1px rgba(255,255,255,.04) inset,
        0 0 0 rgba(201, 169, 110, 0);
    transition:
        transform   .85s cubic-bezier(.22, 1, .36, 1),
        box-shadow  .85s cubic-bezier(.22, 1, .36, 1);
}
.modeling3d-showcase .m3-case:hover .m3-stage.has-bg {
    box-shadow:
        0 36px 70px -20px rgba(0,0,0,.6),
        0 22px 32px -10px rgba(0,0,0,.4),
        0 0 0 1px rgba(201, 169, 110, .25) inset,
        0 0 80px -10px rgba(201, 169, 110, .45);
}

/* Pedestal applies only to card-mode stages, where the dark surface gives
   the shadow somewhere to land. In transparent mode it would look like
   a stripe on the page background, so we skip it. */
.modeling3d-showcase .m3-stage.has-bg::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 35%;
    background: radial-gradient(
        ellipse at 50% 100%,
        rgba(0,0,0,.45) 0%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 1;
}

.modeling3d-showcase .m3-stage__viewer,
.modeling3d-showcase .m3-stage__image {
    position: relative;
    z-index: 2;            /* over the pedestal gradient */
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.modeling3d-showcase .m3-stage__placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    color: var(--am-text-muted, #888);
    z-index: 2;
}
.modeling3d-showcase .m3-stage__placeholder i {
    font-size: 3rem;
    opacity: .5;
}

/* "arrasta" hint pill — appears on hover, sits bottom-right inside the stage */
.modeling3d-showcase .m3-stage__hint {
    position: absolute;
    right: .8rem;
    bottom: .8rem;
    z-index: 3;
    background: rgba(0,0,0,.65);
    color: #fff;
    font-family: var(--am-font-sub, sans-serif);
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: .25rem .55rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .35s ease, transform .35s ease;
}
.modeling3d-showcase .m3-case:hover .m3-stage__hint {
    opacity: 1;
    transform: translateY(0);
}

/* Reuse the existing .aframe-fallback hook from aframe_loader.js for the
   mobile/reduced-motion poster + tap-to-load button. */
.modeling3d-showcase .m3-stage .aframe-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.modeling3d-showcase .m3-stage .aframe-fallback img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.modeling3d-showcase .m3-stage .aframe-promote {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.modeling3d-showcase .m3-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--am-text, #ccc);
}
.modeling3d-showcase .m3-empty i {
    font-size: 3rem;
    opacity: .35;
}

/* ── Accessibility / responsive ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .modeling3d-showcase .m3-case:hover .m3-case__visual::before {
        animation: none !important;
    }
}
