/* ══════════════════════════════════════════════════════════
   🔍 QUIROMANCIA SUPREMA — MANOS DE LA GUÍA v17
   1 · Escenario del render 3D mejorado (marco, aura, pista de clic)
   2 · Etiquetas en cápsula legible (antes se perdían sobre la piel)
   3 · Visor ampliado (lightbox) con zoom para ver las líneas en grande
   Se carga DESPUÉS de styles.css / pixar3d.css para poder ajustar
   solo lo necesario sin reescribir esos bloques.
   ══════════════════════════════════════════════════════════ */

/* ═══ 1 · ESCENARIO ═══════════════════════════════════════ */

/* El render nuevo tiene mucho más detalle: se le da algo más de
   superficie para que las líneas se aprecien sin abrir el visor. */
.hand-svg-container { max-width: 250px; }

.hand-render-stage {
    border: 1px solid rgba(196, 160, 255, 0.28);
    box-shadow:
        inset 0 0 44px rgba(0, 0, 0, 0.5),
        0 12px 30px rgba(6, 2, 18, 0.5);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.45s ease, border-color 0.45s ease;
}

/* ⚠️ v17: el render nuevo (`hand-3d-left.png`) YA es una mano izquierda
   (pulgar a la derecha), al contrario que el PNG anterior. Se invierte
   por tanto qué lado se refleja: la izquierda va nativa y la derecha es
   la reflejada. Así se sigue sirviendo un único PNG para las dos tarjetas. */
.hand-render-stage[data-side="left"] .hand-render  { scale: 1 1; }
.hand-render-stage[data-side="right"] .hand-render { scale: -1 1; }

/* Es pulsable: se anuncia con cursor, foco visible y una leve elevación */
.hand-render-stage.is-zoomable { cursor: zoom-in; }
.hand-render-stage.is-zoomable:hover,
.hand-render-stage.is-zoomable:focus-visible {
    transform: translateY(-4px);
    border-color: rgba(244, 221, 154, 0.6);
    box-shadow:
        inset 0 0 44px rgba(0, 0, 0, 0.45),
        0 18px 40px rgba(109, 40, 217, 0.42);
}
.hand-render-stage.is-zoomable:focus-visible {
    outline: 2px solid #f4dd9a;
    outline-offset: 3px;
}

/* Pista «toca para ampliar»: discreta, se realza al pasar el puntero */
.hr-zoom-hint {
    position: absolute;
    right: 8px;
    top: 8px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 50px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #ffe9b0;
    background: rgba(12, 3, 32, 0.72);
    border: 1px solid rgba(244, 221, 154, 0.42);
    backdrop-filter: blur(4px);
    pointer-events: none;
    opacity: 0.85;
    transition: opacity 0.35s ease, background 0.35s ease;
}
.hand-demo-card:hover .hr-zoom-hint,
.hand-render-stage:focus-visible .hr-zoom-hint {
    opacity: 1;
    background: rgba(109, 40, 217, 0.72);
}

/* ═══ 2 · ETIQUETAS EN CÁPSULA ════════════════════════════
   Antes eran texto suelto con contorno: sobre la piel clara del
   render se leían mal y chocaban con los trazos. Ahora van en una
   cápsula oscura con el borde del color de su línea. */
.hr-lbl {
    padding: 2.5px 7px;
    border-radius: 50px;
    font-size: 0.58rem;
    background: rgba(10, 3, 24, 0.78);
    border: 1px solid currentColor;
    box-shadow: 0 2px 10px rgba(4, 1, 14, 0.55);
    backdrop-filter: blur(3px);
    stroke: none;
    -webkit-text-stroke: 0;
}

/* Trazos algo más finos y luminosos: el render ya aporta el volumen,
   la línea solo debe señalar el pliegue real. */
.hr-line {
    stroke-width: 1.35;
    opacity: 0.95;
    filter: drop-shadow(0 0 2px currentColor);
}

/* ═══ 3 · VISOR AMPLIADO ══════════════════════════════════ */
.hz-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(ellipse at 50% 40%, rgba(46, 16, 101, 0.82), rgba(4, 1, 14, 0.96));
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
    overscroll-behavior: contain;
}
.hz-overlay.is-open { opacity: 1; }

.hz-dialog {
    position: relative;
    width: min(1040px, 100%);
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 22px;
    padding: 22px;
    border-radius: 22px;
    background: linear-gradient(160deg, rgba(24, 10, 54, 0.96), rgba(9, 3, 24, 0.98));
    border: 1px solid rgba(196, 160, 255, 0.32);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
    overflow: auto;
    transform: translateY(14px) scale(0.97);
    transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}
.hz-overlay.is-open .hz-dialog { transform: none; }

.hz-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 6;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(244, 221, 154, 0.4);
    background: rgba(12, 3, 32, 0.8);
    color: #ffe9b0;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.25s ease;
}
.hz-close:hover { background: rgba(220, 38, 38, 0.7); transform: rotate(90deg); }

/* — Lienzo de la mano ampliada — */
.hz-viewport {
    position: relative;
    align-self: start;
    border-radius: 18px;
    overflow: hidden;
    background: #07021a;
    cursor: zoom-in;
    touch-action: none;
    aspect-ratio: 3 / 4;
}
.hz-viewport.is-zoomed { cursor: grab; }
.hz-viewport.is-panning { cursor: grabbing; }

.hz-stagewrap {
    position: absolute;
    inset: 0;
    transform-origin: 0 0;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}
.hz-viewport.is-panning .hz-stagewrap { transition: none; }

/* La figura clonada ocupa todo el lienzo; se le quitan el borde y la
   animación de respiración para que el zoom sea nítido y estable. */
.hz-stagewrap .hand-render-stage {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transform: none !important;
    cursor: inherit;
}
.hz-stagewrap .hand-render-stage .hand-render { animation: none !important; }
.hz-stagewrap .hr-zoom-hint { display: none; }
.hz-stagewrap .hr-lbl { font-size: 0.82rem; padding: 4px 11px; }
.hz-stagewrap .hr-up { font-size: 0.8rem; top: 14px; }
.hz-stagewrap .hr-side { font-size: 1.05rem; padding: 34px 10px 14px; }
.hz-stagewrap .hr-line { stroke-width: 1.15; }

/* Trazado progresivo al abrir: las líneas se «dibujan» sobre la palma */
.hz-stagewrap .hr-line {
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
    animation: hzDraw 1.15s cubic-bezier(0.33, 1, 0.68, 1) forwards;
}
.hz-stagewrap .hr-heart { animation-delay: 0.05s; }
.hz-stagewrap .hr-head  { animation-delay: 0.22s; }
.hz-stagewrap .hr-life  { animation-delay: 0.39s; }
.hz-stagewrap .hr-fate  { animation-delay: 0.56s; }
@keyframes hzDraw { to { stroke-dashoffset: 0; } }

.hz-zoombar {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 50px;
    background: rgba(8, 2, 22, 0.78);
    border: 1px solid rgba(196, 160, 255, 0.3);
    backdrop-filter: blur(6px);
}
.hz-zoombtn {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(196, 160, 255, 0.28);
    background: rgba(109, 40, 217, 0.32);
    color: #f3e8ff;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s ease;
}
.hz-zoombtn:hover { background: rgba(139, 92, 246, 0.6); }
.hz-zoomval {
    min-width: 44px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #d8c4ff;
}

/* — Panel explicativo — */
.hz-info { min-width: 0; padding-right: 4px; }
.hz-title {
    margin: 0 0 4px;
    padding-right: 44px;
    font-family: 'Cinzel', serif;
    font-size: 1.15rem;
    color: #f4dd9a;
    letter-spacing: 0.02em;
}
.hz-sub {
    margin: 0 0 14px;
    font-size: 0.8rem;
    line-height: 1.5;
    color: rgba(226, 214, 255, 0.72);
}
.hz-lines { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.hz-lineitem {
    display: grid;
    grid-template-columns: 12px 1fr;
    gap: 10px;
    align-items: start;
    padding: 9px 11px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(196, 160, 255, 0.16);
}
.hz-swatch {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 10px currentColor;
}
.hz-lineitem strong { display: block; font-size: 0.84rem; margin-bottom: 2px; }
.hz-lineitem span { font-size: 0.75rem; line-height: 1.45; color: rgba(226, 214, 255, 0.72); }
.hz-item-life  { color: #ff8f7f; }
.hz-item-head  { color: #8fdcff; }
.hz-item-heart { color: #ff9ac4; }
.hz-item-fate  { color: #ffdd8a; }

.hz-tip {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    line-height: 1.5;
    color: rgba(255, 233, 176, 0.9);
    background: rgba(244, 221, 154, 0.08);
    border: 1px solid rgba(244, 221, 154, 0.24);
}

/* — Responsive: en móvil el panel va debajo del lienzo — */
@media (max-width: 860px) {
    .hz-dialog {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
        border-radius: 18px;
    }
    .hz-viewport { max-height: 58vh; }
    .hz-title { font-size: 1rem; }
    .hz-stagewrap .hr-lbl { font-size: 0.68rem; padding: 3px 8px; }
}
@media (max-width: 480px) {
    .hz-overlay { padding: 10px; }
    .hz-lineitem { padding: 8px 10px; }
}

/* Respeta la preferencia de menos movimiento */
@media (prefers-reduced-motion: reduce) {
    .hz-overlay, .hz-dialog, .hz-stagewrap { transition: none; }
    .hz-stagewrap .hr-line { animation: none; stroke-dashoffset: 0; }
    .hand-render-stage.is-zoomable:hover { transform: none; }
}
