/* ===== HelpGroup — Mundo 3D con scroll =====
   El scroll mueve una cámara a través de un archipiélago de islas
   (una por servicio). Lo dibuja world.js con Three.js. */

.hgw {
    --hgw-accent: #ff5400;
    --hgw-accent-2: #159eee;
    --hgw-ink: #fff7ef;
    --hgw-ink-soft: rgba(255, 247, 239, 0.74);
    --hgw-bg: #0d0d0d;
    --hgw-nav: 0px;
    position: relative;
    background: var(--hgw-bg);
    color: var(--hgw-ink);
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
}

.hgw-stage {
    position: sticky;
    top: var(--hgw-nav);
    height: calc(100vh - var(--hgw-nav));
    height: calc(100svh - var(--hgw-nav));
    overflow: hidden;
    background:
        radial-gradient(120% 70% at 60% 100%, #ff7a3d 0%, rgba(255, 122, 61, 0) 55%),
        linear-gradient(180deg, #0b1630 0%, #1d2a52 45%, #6b3c4e 80%, #c4603b 100%);
}

.hgw-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.hgw.is-ready .hgw-canvas { opacity: 1; }

/* póster: primer cuadro del 3D mientras la escena no cargó */
.hgw-poster img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: opacity 1.2s ease;
}

.hgw.is-ready .hgw-poster img { opacity: 0; }

/* alto provisorio (≈ el real) hasta que world/server.js calcule el exacto */
.hgw--server.is-pending { height: 815vh; }

@media (max-width: 860px) {
    .hgw--server.is-pending { height: 745vh; }
}

.hgw:not(.is-loading) .hgw-loader { display: none; }
.hgw.is-static .hgw-poster { display: none; }
.hgw.is-static { height: auto !important; }

/* viñeta suave para que el texto siempre lea */
.hgw-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(130% 90% at 50% 45%, rgba(0, 0, 0, 0) 55%, rgba(5, 8, 20, 0.55) 100%),
        linear-gradient(90deg, rgba(8, 12, 28, 0.55) 0%, rgba(8, 12, 28, 0) 42%);
    z-index: 1;
}

/* ---------- Tarjetas de texto ---------- */
.hgw-cards { position: absolute; inset: 0; z-index: 2; pointer-events: none; }

.hgw-card {
    position: absolute;
    left: clamp(20px, 6vw, 96px);
    top: 50%;
    width: min(440px, 40vw);
    transform: translate3d(0, calc(-50% + var(--hgw-shift, 24px)), 0);
    opacity: 0;
    visibility: hidden;
    transition: none;
    will-change: opacity, transform;
}

.hgw-card.is-on { visibility: visible; pointer-events: auto; }

/* antes de que cargue el 3D, la portada ya se ve */
.hgw:not(.is-live) .hgw-card--hero,
.hgw:not(.is-live) .hgw-card[data-key="intro"] { opacity: 1; visibility: visible; pointer-events: auto; transform: translate3d(0, -50%, 0); }

@media (max-width: 860px) {
    .hgw:not(.is-live) .hgw-card[data-key="intro"] { transform: none; }
}

.hgw-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--hgw-accent);
    margin: 0 0 14px;
}

.hgw-eyebrow::before {
    content: "";
    width: 28px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}

.hgw-card h2,
.hgw-card .hgw-title {
    font-size: clamp(30px, 3.6vw, 52px);
    line-height: 1.04;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--hgw-ink);
    margin: 0 0 16px;
    text-shadow: 0 2px 24px rgba(5, 8, 20, 0.6);
}

.hgw-card h2 span,
.hgw-card .hgw-title span { color: var(--hgw-accent); }

.hgw-card p {
    font-size: clamp(15px, 1.15vw, 17px);
    line-height: 1.6;
    color: var(--hgw-ink-soft);
    margin: 0 0 20px;
    text-shadow: 0 1px 12px rgba(5, 8, 20, 0.7);
}

.hgw-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; padding: 0; list-style: none; }

.hgw-tags li {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--hgw-ink);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.hgw-link,
.hgw-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none !important;
    border-radius: 999px;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.hgw-link {
    color: var(--hgw-ink) !important;
    padding: 11px 20px;
    background: rgba(255, 84, 0, 0.14);
    border: 1px solid rgba(255, 84, 0, 0.55);
}

.hgw-link:hover { background: rgba(255, 84, 0, 0.28); transform: translateY(-2px); }
.hgw-link i, .hgw-btn i { transition: transform 0.25s ease; }
.hgw-link:hover i, .hgw-btn:hover i { transform: translateX(4px); }

.hgw-btn {
    color: #fff !important;
    padding: 15px 28px;
    background: var(--hgw-accent);
    box-shadow: 0 10px 30px rgba(255, 84, 0, 0.45);
}

.hgw-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(255, 84, 0, 0.6); }

.hgw-btn--ghost {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: none;
}

.hgw-btn--ghost:hover { background: rgba(255, 255, 255, 0.16); box-shadow: none; }

.hgw-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Portada y cierre: centradas */
.hgw-card--hero,
.hgw-card--cta {
    left: 50%;
    width: min(760px, 88vw);
    text-align: center;
    transform: translate3d(-50%, calc(-50% + var(--hgw-shift, 24px)), 0);
}

.hgw-card--hero { top: 44%; }

.hgw-card--hero::before,
.hgw-card--cta::before {
    content: "";
    position: absolute;
    inset: -18% -22%;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(closest-side, rgba(8, 10, 24, 0.72), rgba(8, 10, 24, 0.45) 55%, rgba(8, 10, 24, 0) 100%);
}
.hgw-card--hero .hgw-eyebrow,
.hgw-card--cta .hgw-eyebrow { justify-content: center; }
.hgw-card--hero .hgw-eyebrow::after,
.hgw-card--cta .hgw-eyebrow::after { content: ""; width: 28px; height: 2px; border-radius: 2px; background: currentColor; }
.hgw-card--hero .hgw-title { font-size: clamp(54px, 9vw, 128px); line-height: 0.95; margin-bottom: 18px; }
.hgw-card--hero p,
.hgw-card--cta p { max-width: 560px; margin-left: auto; margin-right: auto; }
.hgw-card--hero .hgw-actions,
.hgw-card--cta .hgw-actions { justify-content: center; }
.hgw-card--cta h2 { font-size: clamp(34px, 4.6vw, 64px); }

.hgw-stats {
    display: flex;
    justify-content: center;
    gap: clamp(18px, 4vw, 48px);
    margin: 0 0 26px;
}

.hgw-stats div { display: flex; flex-direction: column; align-items: center; }
.hgw-stats strong { font-size: clamp(22px, 2.4vw, 32px); font-weight: 800; color: var(--hgw-ink); }
.hgw-stats span { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--hgw-ink-soft); }

.hgw .hgw-num {
    display: block;
    font-size: 64px;
    font-weight: 800;
    line-height: 1;
    margin: 0 0 10px;
    color: transparent !important;
    -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.35);
    letter-spacing: -0.02em;
    pointer-events: none;
}

/* ---------- Indicador de scroll ---------- */
.hgw-hint {
    position: absolute;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--hgw-ink-soft);
    white-space: nowrap;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.hgw-hint span {
    width: 24px;
    height: 38px;
    border-radius: 14px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    position: relative;
}

.hgw-hint span::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 7px;
    width: 4px;
    height: 8px;
    margin-left: -2px;
    border-radius: 2px;
    background: var(--hgw-accent);
    animation: hgw-wheel 1.8s ease-in-out infinite;
}

@keyframes hgw-wheel {
    0% { transform: translateY(0); opacity: 1; }
    70% { transform: translateY(12px); opacity: 0; }
    100% { transform: translateY(0); opacity: 0; }
}

/* ---------- Riel de ruta ---------- */
.hgw-rail {
    position: absolute;
    right: clamp(16px, 2.4vw, 36px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hgw-rail button {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    width: 100%;
    padding: 6px 0;
    background: none;
    border: 0;
    cursor: pointer;
    color: var(--hgw-ink-soft);
    font: 600 12px/1 'Inter', sans-serif;
    letter-spacing: 0.04em;
}

.hgw-rail button span {
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}

.hgw-rail button i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
    flex: none;
}

.hgw-rail button:hover span,
.hgw-rail button.is-active span { opacity: 1; transform: none; }
.hgw-rail button.is-active { color: var(--hgw-ink); }
.hgw-rail button.is-active i {
    background: var(--hgw-accent);
    border-color: var(--hgw-accent);
    box-shadow: 0 0 0 5px rgba(255, 84, 0, 0.22);
}

.hgw-rail button:focus-visible { outline: 2px solid var(--hgw-accent); outline-offset: 4px; border-radius: 4px; }

.hgw-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 3px;
    width: 100%;
    z-index: 3;
    transform-origin: 0 50%;
    transform: scaleX(0);
    background: linear-gradient(90deg, var(--hgw-accent), #ffb347);
}

.hgw-loader {
    position: absolute;
    left: 50%;
    bottom: 90px;
    transform: translateX(-50%);
    z-index: 3;
    width: 120px;
    height: 2px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
    transition: opacity 0.6s ease;
}

.hgw-loader::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 40%;
    background: var(--hgw-accent);
    animation: hgw-load 1.1s ease-in-out infinite;
}

@keyframes hgw-load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.hgw.is-ready .hgw-loader { opacity: 0; }

/* transición del mundo al resto de la página */
.hgw-fade {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 18vh;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(13, 13, 13, 0), var(--hgw-bg));
    opacity: 0;
}

/* ---------- Celular / tablet vertical ---------- */
@media (max-width: 860px) {
    .hgw-stage::after {
        background:
            linear-gradient(180deg, rgba(8, 12, 28, 0) 38%, rgba(8, 12, 28, 0.82) 100%);
    }

    .hgw-card {
        left: 16px;
        right: 16px;
        width: auto;
        top: auto;
        bottom: calc(22px + env(safe-area-inset-bottom, 0px));
        transform: translate3d(0, var(--hgw-shift, 24px), 0);
    }

    .hgw-card h2 { font-size: clamp(26px, 7.4vw, 36px); margin-bottom: 10px; }
    .hgw-card p { font-size: 15px; line-height: 1.5; margin-bottom: 14px; }
    .hgw-tags { margin-bottom: 14px; }
    .hgw-tags li { font-size: 11px; padding: 5px 10px; }
    .hgw .hgw-num { font-size: 40px; margin-bottom: 6px; }

    .hgw-card--hero,
    .hgw-card--cta {
        left: 16px;
        right: 16px;
        width: auto;
        transform: translate3d(0, var(--hgw-shift, 24px), 0);
    }

    .hgw-card--hero { top: auto; bottom: calc(118px + env(safe-area-inset-bottom, 0px)); }
    .hgw-card--hero .hgw-title { font-size: clamp(48px, 15vw, 72px); }
    .hgw-stats { gap: 18px; margin-bottom: 18px; }

    .hgw-rail {
        right: 50%;
        top: 14px;
        transform: translateX(50%);
        flex-direction: row;
        gap: 2px;
    }

    .hgw-rail button { padding: 6px; }
    .hgw-rail button span { display: none; }
    .hgw-rail button i { width: 8px; height: 8px; }
    .hgw-hint { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Sin WebGL o con movimiento reducido: versión estática ---------- */
.hgw.is-static { padding: 40px 0 20px; }
.hgw.is-static .hgw-track { display: none; }
.hgw.is-static .hgw-stage { position: relative; top: 0; height: auto; background: var(--hgw-bg); overflow: visible; }
.hgw.is-static .hgw-stage::after,
.hgw.is-static .hgw-canvas,
.hgw.is-static .hgw-rail,
.hgw.is-static .hgw-hint,
.hgw.is-static .hgw-loader,
.hgw.is-static .hgw-progress,
.hgw.is-static .hgw-fade { display: none; }
.hgw.is-static .hgw-cards { position: relative; inset: auto; display: grid; gap: 56px; padding: 0 20px; max-width: 1080px; margin: 0 auto; }

.hgw.is-static .hgw-card,
.hgw.is-static .hgw-card--hero,
.hgw.is-static .hgw-card--cta {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: auto;
    max-width: 620px;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.hgw.is-static .hgw-card--hero,
.hgw.is-static .hgw-card--cta { margin: 0 auto; }

/* ===== Variante: servidor que se desarma (world/server.js) ===== */
.hgw--server .hgw-stage {
    background:
        radial-gradient(70% 60% at 62% 45%, rgba(255, 90, 20, 0.16) 0%, rgba(255, 90, 20, 0) 70%),
        #07080c;
}

.hgw--server .hgw-stage::after {
    background:
        radial-gradient(130% 90% at 55% 45%, rgba(0, 0, 0, 0) 55%, rgba(3, 4, 8, 0.6) 100%),
        linear-gradient(90deg, rgba(5, 6, 10, 0.7) 0%, rgba(5, 6, 10, 0) 40%);
}

.hgw-card--lead .hgw-title { font-size: clamp(42px, 5.4vw, 80px); line-height: 0.98; }
.hgw-card--lead .hgw-stats { justify-content: flex-start; }
.hgw-card--lead .hgw-stats div { align-items: flex-start; }

.hgs-tags { position: absolute; inset: 0; z-index: 2; pointer-events: none; }

.hgs-tag {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    will-change: transform, opacity;
}

.hgs-tag i {
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: #ff5400;
    box-shadow: 0 0 0 4px rgba(255, 84, 0, 0.25), 0 0 16px rgba(255, 84, 0, 0.8);
    flex: none;
}

.hgs-tag span {
    position: relative;
    margin-left: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    font: 600 12px/1 'Inter', sans-serif;
    letter-spacing: 0.04em;
    color: #fff7ef !important;
    background: rgba(10, 12, 20, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.hgs-tag span::before {
    content: "";
    position: absolute;
    right: 100%;
    top: 50%;
    width: 34px;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 84, 0, 0.9), rgba(255, 255, 255, 0.35));
}

.hgs-txt { font-style: normal; }
.hgs-tag b { color: #ff7a2f !important; font-weight: 800; margin-right: 4px; }
.hgs-tag.is-focus span { background: rgba(255, 84, 0, 0.9); border-color: #ff5400; }
.hgs-tag.is-focus b { color: #fff !important; }

.hgs-tag.is-left { flex-direction: row-reverse; }
.hgs-tag.is-left i { margin: -5px -5px 0 0; }
.hgs-tag.is-left span { margin-left: 0; margin-right: 34px; }
.hgs-tag.is-left span::before { right: auto; left: 100%; background: linear-gradient(270deg, rgba(255, 84, 0, 0.9), rgba(255, 255, 255, 0.35)); }

@media (max-width: 860px) {
    .hgs-tag span { font-size: 11px; padding: 5px 10px; margin-left: 22px; }
    .hgs-tag.is-left span { margin-left: 0; margin-right: 22px; }
    .hgs-tag:not(.is-focus) .hgs-txt { display: none; }
    .hgs-tag:not(.is-focus) b { margin-right: 0; }
    .hgs-tag span::before { width: 22px; }
    .hgw--server .hgw-card--lead { bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
}

.hgw.is-static .hgs-tags { display: none; }
