/* ════════════════════════════════════════════════════════════════════
   DeliciaAR · Hologramas descriptivos anclados al plato 3D
   Se usan en la carta, la vista AR, el editor del admin y el portal.
   ════════════════════════════════════════════════════════════════════ */

.holo-host {
    --holo-glow: #67e8f9;
    --holo-ink: #ecfeff;
    --holo-glass: rgba(8, 24, 38, 0.62);
    --min-hotspot-opacity: 0.3; /* model-viewer: atenúa los que quedan detrás del plato */
}

/* ── Ancla: el punto sobre el plato ─────────────────────────────────── */
.holo-anchor {
    position: relative;
    width: 12px;
    height: 12px;
    padding: 0;
    border: 0;
    background: transparent;
    pointer-events: none;
    --holo-c: #34d399;
}

.holo-stem {
    opacity: 0;
    transition: opacity .35s ease calc(var(--i, 0) * 110ms + .15s);
}
.holo-dot,
.holo-card {
    opacity: 0;
    transition:
        opacity .35s ease calc(var(--i, 0) * 110ms),
        transform .55s cubic-bezier(.2, .9, .25, 1.25) calc(var(--i, 0) * 110ms),
        filter .45s ease calc(var(--i, 0) * 110ms);
}

.holo-dot {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle, #fff 0 22%, var(--holo-c) 30% 62%, transparent 66%);
    box-shadow: 0 0 10px var(--holo-c), 0 0 22px color-mix(in srgb, var(--holo-c) 60%, transparent);
    transform: scale(.2);
}
.holo-dot::after {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 1.5px solid var(--holo-c);
    opacity: 0;
}

/* Línea guía: el JS fija su largo y ángulo hacia la tarjeta en cada cuadro */
.holo-stem {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 1.5px;
    margin-top: -.75px;
    background: linear-gradient(90deg, var(--holo-c), color-mix(in srgb, var(--holo-glow) 75%, transparent));
    box-shadow: 0 0 6px var(--holo-glow);
    transform-origin: 0 50%;
}

/* ── Tarjeta holográfica ────────────────────────────────────────────── */
.holo-card {
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: 176px;
    padding: 7px 11px 7px 7px;
    border-radius: 12px;
    color: var(--holo-ink);
    background:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, .045) 0 1px, transparent 1px 3px),
        linear-gradient(135deg, rgba(103, 232, 249, .16), rgba(8, 24, 38, 0) 55%),
        var(--holo-glass);
    border: 1px solid color-mix(in srgb, var(--holo-glow) 70%, transparent);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, .06) inset,
        0 0 18px color-mix(in srgb, var(--holo-glow) 45%, transparent),
        0 10px 28px rgba(0, 0, 0, .35);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    backdrop-filter: blur(10px) saturate(140%);
    font-family: 'Outfit', 'Inter', system-ui, sans-serif;
    line-height: 1.15;
    text-align: left;
    transform: scale(.86);
    filter: blur(4px);
    overflow: hidden;
}
/* Capa fija (no la transforma model-viewer): tarjetas y líneas en píxeles enteros */
.holo-layer { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.holo-card.holo-l { transform-origin: right center; }
.holo-card.holo-r { transform-origin: left center; }
/* hasta que el JS la ubica, la tarjeta no se muestra */
.holo-card:not(.is-placed),
.holo-stem:not(.is-placed) { visibility: hidden; }

/* Franja de fichas generales (maridaje, origen, nutrición): no se anclan a un punto del plato */
.holo-chips {
    position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 2;
    display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; pointer-events: none;
}
.holo-chips:empty { display: none; }
.holo-card.holo-chip { position: relative; left: auto; top: auto; transform-origin: center bottom; }

/* brillo que recorre la tarjeta */
.holo-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .22) 50%, transparent 65%);
    transform: translateX(-120%);
}

.holo-ico {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    color: #0b1220;
    background: var(--holo-c);
    box-shadow: 0 0 12px color-mix(in srgb, var(--holo-c) 70%, transparent);
    font-size: .72rem;
}

.holo-txt { display: flex; flex-direction: column; min-width: 0; }
.holo-k {
    font-size: .56rem;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--holo-c);
}
.holo-t {
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .1px;
    text-shadow: 0 0 10px rgba(103, 232, 249, .45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.holo-d {
    margin-top: 1px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: .64rem;
    font-weight: 500;
    color: rgba(236, 254, 255, .78);
}

/* ── Estado encendido ───────────────────────────────────────────────── */
.holo-on .holo-dot { opacity: 1; transform: scale(1); }
.holo-on .holo-dot::after { animation: holoPing 2.4s ease-out calc(var(--i, 0) * 300ms + .6s) infinite; }
.holo-on .holo-stem { opacity: .9; }
.holo-on .holo-card {
    opacity: 1;
    filter: none;
    transform: none;
}
.holo-on .holo-card::after { animation: holoShine 5s ease-in-out calc(var(--i, 0) * 500ms + 1s) infinite; }

/* Compacto (visores angostos / móvil): sin detalle, tarjetas más pequeñas */
.holo-compact .holo-card { max-width: 136px; gap: 6px; padding: 5px 8px 5px 5px; border-radius: 10px; }
.holo-compact .holo-ico { width: 20px; height: 20px; border-radius: 6px; font-size: .6rem; }
.holo-compact .holo-k { font-size: .5rem; letter-spacing: 1px; }
.holo-compact .holo-t { font-size: .7rem; }
.holo-compact .holo-d { display: none; }

/* ── Barrido de escaneo al encender ─────────────────────────────────── */
.holo-scan {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
}
.holo-scan::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -30%;
    height: 30%;
    background: linear-gradient(to bottom, transparent, rgba(103, 232, 249, .22) 70%, rgba(186, 250, 255, .85) 98%, transparent);
    filter: blur(1px);
}
.holo-scanning .holo-scan { opacity: 1; }
.holo-scanning .holo-scan::before { animation: holoSweep 1.2s cubic-bezier(.45, 0, .2, 1) forwards; }

@keyframes holoSweep { to { top: 100%; } }
/* Cambio de columna de una tarjeta: fundido en su nueva posición */
.holo-on .holo-card.holo-flip { animation: holoFlip .35s ease; }
@keyframes holoFlip { from { opacity: 0; } }
@keyframes holoPing {
    0% { opacity: .9; transform: scale(.5); }
    80%, 100% { opacity: 0; transform: scale(1.9); }
}
@keyframes holoShine {
    0%, 70% { transform: translateX(-120%); }
    100% { transform: translateX(120%); }
}

/* ── Botón de encendido reutilizable ────────────────────────────────── */
.holo-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px 7px 8px;
    border-radius: 999px;
    border: 1px solid rgba(103, 232, 249, .45);
    background: rgba(8, 24, 38, .72);
    color: #e0fbff;
    font: 800 .74rem/1 'Outfit', 'Inter', system-ui, sans-serif;
    letter-spacing: .3px;
    cursor: pointer;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    transition: background .25s, box-shadow .25s, border-color .25s, transform .15s;
    -webkit-tap-highlight-color: transparent;
}
.holo-toggle[hidden] { display: none !important; }
.holo-toggle:active { transform: scale(.96); }
.holo-toggle:focus-visible { outline: 2px solid #67e8f9; outline-offset: 2px; }
.holo-toggle .holo-sw {
    position: relative;
    width: 30px;
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    transition: background .25s;
    flex: 0 0 auto;
}
.holo-toggle .holo-sw::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    transition: transform .25s cubic-bezier(.3, 1.4, .5, 1);
}
.holo-toggle.is-on {
    border-color: #67e8f9;
    background: linear-gradient(135deg, rgba(14, 116, 144, .9), rgba(8, 47, 73, .9));
    box-shadow: 0 0 0 3px rgba(103, 232, 249, .18), 0 0 22px rgba(103, 232, 249, .45);
}
.holo-toggle.is-on .holo-sw { background: #22d3ee; }
.holo-toggle.is-on .holo-sw::after { transform: translateX(12px); }
.holo-toggle.holo-hint { animation: holoHint 2s ease-in-out infinite; }
@keyframes holoHint {
    0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, .25), 0 0 0 0 rgba(103, 232, 249, .55); }
    50% { box-shadow: 0 6px 18px rgba(0, 0, 0, .25), 0 0 0 8px rgba(103, 232, 249, 0); }
}

/* ── Selector iOS / Scene Viewer ────────────────────────────────────── */
.holo-chooser {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    background: rgba(2, 6, 23, .55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: holoFade .2s ease;
}
.holo-chooser-card {
    width: 100%;
    max-width: 400px;
    padding: 22px 18px calc(16px + env(safe-area-inset-bottom));
    border-radius: 22px;
    background: #0b1424;
    border: 1px solid rgba(103, 232, 249, .3);
    box-shadow: 0 0 40px rgba(103, 232, 249, .18), 0 20px 50px rgba(0, 0, 0, .5);
    color: #e2f3f8;
    text-align: center;
    font-family: 'Inter', system-ui, sans-serif;
    animation: holoUp .3s cubic-bezier(.2, .9, .3, 1.1);
}
.holo-chooser-ico {
    width: 46px;
    height: 46px;
    margin: 0 auto 10px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #0b1220;
    background: linear-gradient(135deg, #67e8f9, #22d3ee);
    box-shadow: 0 0 22px rgba(103, 232, 249, .5);
}
.holo-chooser-card h3 { font: 800 1.15rem/1.2 'Outfit', sans-serif; color: #fff; margin: 0 0 6px; }
.holo-chooser-card p { font-size: .82rem; color: rgba(226, 243, 248, .72); margin: 0 0 16px; line-height: 1.45; }
.holo-chooser-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .06);
    color: #fff;
    font: 700 .9rem/1.2 'Outfit', sans-serif;
    text-align: left;
    cursor: pointer;
}
.holo-chooser-btn small { margin-left: auto; font: 500 .7rem 'Inter', sans-serif; opacity: .7; }
.holo-chooser-btn.is-main {
    border-color: #67e8f9;
    background: linear-gradient(135deg, rgba(14, 116, 144, .95), rgba(8, 47, 73, .95));
    box-shadow: 0 0 20px rgba(103, 232, 249, .3);
}
.holo-chooser-x {
    margin-top: 2px;
    padding: 8px 16px;
    border: 0;
    background: none;
    color: rgba(226, 243, 248, .6);
    font: 600 .8rem 'Inter', sans-serif;
    cursor: pointer;
}
@keyframes holoFade { from { opacity: 0; } }
@keyframes holoUp { from { transform: translateY(40px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    .holo-dot, .holo-stem, .holo-card { transition-duration: .01ms; transition-delay: 0s; }
    .holo-on .holo-card, .holo-on .holo-card::after, .holo-on .holo-dot::after,
    .holo-scanning .holo-scan::before, .holo-toggle.holo-hint { animation: none; }
}
