/* ═══════════════════════════════════════════════════════════
   HEX-VIZ — Konvergenz-Visualisierung + Result-Karte
   (1:1 aus signal-from-noise.html übernommen)
   Hex-Grid-BG liegt global auf body (siehe base.css).
   ═══════════════════════════════════════════════════════════ */

/* ── Viz Container ──────────────────────────────────────── */

.viz {
    position: relative;
    aspect-ratio: 1 / 0.85;
    width: 100%;
    max-width: 580px;
    margin-left: auto;
}

.viz__stage {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 16px;
}

/* Glow hinter dem Zentrum */
.viz__stage::before {
    content: '';
    position: absolute;
    width: 70%;
    aspect-ratio: 1;
    background: radial-gradient(circle, var(--teal-glow), transparent 60%);
    filter: blur(50px);
    pointer-events: none;
    opacity: 0.8;
    animation: glow-pulse 5s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%      { opacity: 1; transform: scale(1.1); }
}

/* ── Partikel (werden per JS eingefügt) ────────────────── */

.particle {
    position: absolute;
    width: var(--size, 10px);
    aspect-ratio: 1 / 1.1547;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--color, var(--teal));
    opacity: 0;
    transform: translate(var(--x), var(--y));
    animation: converge var(--duration, 5s) cubic-bezier(0.22, 0.61, 0.36, 1) var(--delay, 0s) infinite;
}

@keyframes converge {
    0%   { transform: translate(var(--x), var(--y)) scale(1) rotate(var(--rot, 0deg)); opacity: 0; }
    15%  { opacity: var(--max-opacity, 0.45); }
    65%  { transform: translate(calc(var(--x) * 0.18), calc(var(--y) * 0.18)) scale(0.75) rotate(calc(var(--rot, 0deg) * 0.3)); opacity: var(--max-opacity, 0.45); }
    85%  { transform: translate(0, 0) scale(0.3) rotate(0); opacity: 0.9; }
    100% { transform: translate(0, 0) scale(0) rotate(0); opacity: 0; }
}

/* ── Zentrale Ergebnis-Karte ────────────────────────────── */

.viz__result {
    position: relative;
    z-index: 2;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.2rem 1.4rem;
    min-width: 280px;
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--line-soft);
    animation: result-in 0.8s cubic-bezier(0.34, 1.2, 0.64, 1) 0.4s both;
}

@keyframes result-in {
    from { opacity: 0; transform: translateY(10px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.viz__result-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--teal);
    margin-bottom: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.viz__result-label::before {
    content: '';
    width: 6px; height: 6px;
    background: var(--teal);
    border-radius: 50%;
    animation: ping 1.8s ease-in-out infinite;
}

@keyframes ping {
    0%, 100% { box-shadow: 0 0 0 0 var(--teal-glow); }
    50%      { box-shadow: 0 0 0 5px transparent; }
}

.viz__result-product {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: 0.8rem;
}

.viz__result-thumb {
    width: 44px; height: 44px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.viz__result-info { flex: 1; min-width: 0; }

.viz__result-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.015em;
    margin-bottom: 0.1rem;
}

.viz__result-meta {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.viz__result-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--teal);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.viz__result-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.4rem;
}

.viz__result-stat {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.viz__result-stat-val {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.viz__result-stat-label {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Skeleton-Variante für Coming-Soon */
.viz__result--skeleton .viz__result-name,
.viz__result--skeleton .viz__result-meta,
.viz__result--skeleton .viz__result-price {
    color: transparent;
    background: linear-gradient(90deg, var(--surface-2) 30%, var(--line) 50%, var(--surface-2) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.6s ease-in-out infinite;
    border-radius: 4px;
    display: inline-block;
}

.viz__result--skeleton .viz__result-name  { width: 10rem; height: 1em; }
.viz__result--skeleton .viz__result-meta  { width: 7rem;  height: 0.8em; margin-top: 0.35rem; }
.viz__result--skeleton .viz__result-price { width: 3.5rem; height: 1.2em; }

.viz__result--skeleton .viz__result-stat-val {
    color: transparent;
    background: linear-gradient(90deg, var(--surface-2) 30%, var(--line) 50%, var(--surface-2) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.6s ease-in-out infinite;
    border-radius: 3px;
    width: 2rem; height: 0.85em;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.viz__result--skeleton .viz__result-label { color: var(--text-muted); }
.viz__result--skeleton .viz__result-label::before { background: var(--text-muted); animation: none; }

/* ── Viz Legend ─────────────────────────────────────────── */

.viz__legend {
    position: absolute;
    bottom: -2.5rem;
    left: 0; right: 0;
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.viz__legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.viz__legend-dot {
    width: 10px;
    aspect-ratio: 1 / 1.1547;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--teal);
    opacity: 0.6;
}

.viz__legend-dot--alt { background: var(--indigo); }

/* ── Hex-Avatar (generische Form) ───────────────────────── */

.hex-avatar {
    display: grid;
    place-items: center;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(135deg, var(--teal), var(--teal-hover));
    color: #fff;
    font-weight: 600;
    font-family: var(--font-sans);
    flex-shrink: 0;
}

[data-theme="dark"] .hex-avatar { color: #050505; }

.hex-avatar--sm  { width: 24px; aspect-ratio: 1 / 1.1547; font-size: 0.66rem; }
.hex-avatar--md  { width: 36px; aspect-ratio: 1 / 1.1547; font-size: 0.85rem; }
.hex-avatar--lg  { width: 48px; aspect-ratio: 1 / 1.1547; font-size: 1.1rem; }

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 960px) {
    .viz { max-width: 420px; margin: 0 auto; }
}
