/* =========================================================================
   ERA GAMER — Botón "Reactor Core"
   Estilo cyberpunk gaming. Sin dependencias.
   ========================================================================= */

:root {
    --egs-atp-main: #00f0ff;
    --egs-atp-alt:  #ff00aa;
    --egs-atp-led:  #00ff66;
    --egs-atp-bg-1: #06081a;
    --egs-atp-bg-2: #0e0420;
    --egs-atp-ink:  #ffffff;
}

/* ---- Reset local del enlace ---- */
.egs-atp,
.egs-atp:visited,
.egs-atp:focus,
.egs-atp:hover {
    color: var(--egs-atp-ink);
    text-decoration: none;
    outline: none;
}

/* =========================================================================
   BOTÓN BASE
   ========================================================================= */
.egs-atp {
    --egs-atp-clip: polygon(
        14px 0,
        100% 0,
        100% calc(100% - 14px),
        calc(100% - 14px) 100%,
        0 100%,
        0 14px
    );

    position: relative;
    display: inline-flex;
    align-items: stretch;
    isolation: isolate;
    padding: 2px;                       /* hueco para el borde animado */
    font-family: "Rajdhani", "Orbitron", "Segoe UI", system-ui, sans-serif;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    clip-path: var(--egs-atp-clip);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
                filter    0.25s ease;
    will-change: transform, filter;
    filter: drop-shadow(0 0 18px color-mix(in srgb, var(--egs-atp-main) 40%, transparent));
}

.egs-atp--block { display: flex; width: 100%; }

/* ---- Tamaños ---- */
.egs-atp--sm { font-size: 12px; }
.egs-atp--md { font-size: 14px; }
.egs-atp--lg { font-size: 16px; }
.egs-atp--xl { font-size: 20px; }

/* =========================================================================
   VARIANTE MEGA — botón banner-style para reemplazar texto hero del slider
   ========================================================================= */
.egs-atp--mega {
    --egs-atp-clip: polygon(
        24px 0,
        calc(100% - 24px) 0,
        100% 50%,
        calc(100% - 24px) 100%,
        24px 100%,
        0 50%
    );
    display: flex;
    width: 100%;
    max-width: 880px;
    margin-left: auto;
    margin-right: auto;
    font-size: 18px;
    padding: 3px;
}

/* Wrapper para forzar centrado horizontal en cualquier contexto (shortcode dentro de <p>, slider, etc.) */
.egs-atp-mega-wrap {
    width: 100%;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}
.egs-atp--mega .egs-atp__core {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 1.4em;
    padding: 1.4em 2.4em;
    min-height: 110px;
}
.egs-atp--mega .egs-atp__icon { width: 3.2em; height: 3.2em; }
.egs-atp--mega .egs-atp__text {
    align-items: flex-start;
    gap: 0.35em;
}
.egs-atp--mega .egs-atp__pretitle {
    display: inline-flex;
    align-items: center;
    gap: 0.7em;
    font-size: 0.62em;
    font-weight: 600;
    letter-spacing: 0.36em;
    color: var(--egs-atp-main);
    text-transform: uppercase;
    opacity: 0.9;
}
.egs-atp--mega .egs-atp__pretitle::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--egs-atp-led);
    box-shadow: 0 0 6px var(--egs-atp-led), 0 0 12px color-mix(in srgb, var(--egs-atp-led) 70%, transparent);
    animation: egs-atp-led 1.4s ease-in-out infinite;
}
.egs-atp--mega .egs-atp__label {
    font-family: "Orbitron", "Rajdhani", sans-serif;
    font-size: 2.1em;
    font-weight: 900;
    letter-spacing: 0.1em;
    line-height: 0.95;
    text-shadow:
        0 0 14px color-mix(in srgb, var(--egs-atp-main) 75%, transparent),
        0 0 2px rgba(255,255,255,0.8);
}
.egs-atp--mega .egs-atp__sub {
    font-size: 0.78em;
    letter-spacing: 0.28em;
    margin-top: 0.2em;
}
.egs-atp--mega .egs-atp__led { margin-left: 0; }

/* Brackets HUD laterales (solo mega) */
.egs-atp--mega .egs-atp__brackets {
    position: absolute;
    inset: 18px 28px;
    z-index: 4;
    pointer-events: none;
    display: block;
}
.egs-atp--mega .egs-atp__brackets i {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--egs-atp-main);
    filter: drop-shadow(0 0 5px color-mix(in srgb, var(--egs-atp-main) 70%, transparent));
    opacity: 0.9;
}
.egs-atp--mega .egs-atp__brackets i.b-tl { top: 0; left: 0;    border-right: none; border-bottom: none; }
.egs-atp--mega .egs-atp__brackets i.b-tr { top: 0; right: 0;   border-left:  none; border-bottom: none; }
.egs-atp--mega .egs-atp__brackets i.b-bl { bottom: 0; left: 0; border-right: none; border-top:    none; }
.egs-atp--mega .egs-atp__brackets i.b-br { bottom: 0; right: 0;border-left:  none; border-top:    none; }

/* Flecha gaming animada */
.egs-atp--mega .egs-atp__arrow {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3em;
    height: 3em;
    color: var(--egs-atp-main);
    filter: drop-shadow(0 0 8px color-mix(in srgb, var(--egs-atp-main) 70%, transparent));
}
.egs-atp--mega .egs-atp__arrow svg {
    width: 100%;
    height: 100%;
    animation: egs-atp-arrow-pulse 1.8s ease-in-out infinite;
}
@keyframes egs-atp-arrow-pulse {
    0%, 100% { transform: translateX(0);   opacity: 1;   }
    50%      { transform: translateX(6px); opacity: 0.6; }
}

/* Banda scanlines extra en mega */
.egs-atp--mega .egs-atp__core::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent 0,
        transparent 60px,
        color-mix(in srgb, var(--egs-atp-main) 6%, transparent) 60px,
        color-mix(in srgb, var(--egs-atp-main) 6%, transparent) 62px
    );
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 0.5;
}

.egs-atp--mega:hover .egs-atp__arrow svg,
.egs-atp--mega:focus-visible .egs-atp__arrow svg {
    animation-duration: 0.8s;
}

/* Responsive mega */
@media (max-width: 720px) {
    .egs-atp--mega { font-size: 14px; }
    .egs-atp--mega .egs-atp__core {
        grid-template-columns: auto 1fr auto;
        padding: 1.1em 1.4em;
        gap: 0.9em;
        min-height: 90px;
    }
    .egs-atp--mega .egs-atp__led { display: none; }
    .egs-atp--mega .egs-atp__icon { width: 2.4em; height: 2.4em; }
    .egs-atp--mega .egs-atp__label { font-size: 1.6em; letter-spacing: 0.06em; }
    .egs-atp--mega .egs-atp__pretitle { font-size: 0.58em; letter-spacing: 0.24em; }
    .egs-atp--mega .egs-atp__sub { font-size: 0.7em; letter-spacing: 0.2em; }
    .egs-atp--mega .egs-atp__arrow { width: 2em; height: 2em; }
    .egs-atp--mega .egs-atp__brackets { inset: 10px 14px; }
    .egs-atp--mega .egs-atp__brackets i { width: 14px; height: 14px; }
}

/* =========================================================================
   FRAME — borde animado con conic-gradient corriendo el perímetro
   ========================================================================= */
.egs-atp__frame {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: conic-gradient(
        from var(--egs-atp-angle, 0deg),
        transparent 0deg,
        var(--egs-atp-main) 40deg,
        transparent 90deg,
        transparent 180deg,
        var(--egs-atp-alt) 220deg,
        transparent 270deg,
        transparent 360deg
    );
    animation: egs-atp-spin 4s linear infinite;
    clip-path: var(--egs-atp-clip);
    pointer-events: none;
}

@property --egs-atp-angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

@keyframes egs-atp-spin {
    to { --egs-atp-angle: 360deg; }
}

/* Fallback browsers sin @property: se anima 'background' por rotate via filter trick */
@supports not (background: conic-gradient(from 0deg, red, blue)) {
    .egs-atp__frame {
        background:
            linear-gradient(90deg, var(--egs-atp-main), var(--egs-atp-alt));
        animation: egs-atp-pulse 2.5s ease-in-out infinite;
    }
    @keyframes egs-atp-pulse {
        0%, 100% { opacity: 1; }
        50%      { opacity: 0.55; }
    }
}

/* =========================================================================
   SCANLINES — overlay CRT sutil
   ========================================================================= */
.egs-atp__scan {
    position: absolute;
    inset: 2px;
    z-index: 3;
    pointer-events: none;
    clip-path: var(--egs-atp-clip);
    background-image: repeating-linear-gradient(
        180deg,
        rgba(255,255,255,0.04) 0,
        rgba(255,255,255,0.04) 1px,
        transparent 1px,
        transparent 3px
    );
    mix-blend-mode: overlay;
    opacity: 0.6;
}

/* =========================================================================
   CORE — interior del botón
   ========================================================================= */
.egs-atp__core {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.8em;
    padding: 0.95em 1.6em 0.95em 1.2em;
    background:
        radial-gradient(ellipse at 20% 0%,
            color-mix(in srgb, var(--egs-atp-main) 18%, transparent) 0%,
            transparent 60%),
        radial-gradient(ellipse at 100% 100%,
            color-mix(in srgb, var(--egs-atp-alt) 20%, transparent) 0%,
            transparent 65%),
        linear-gradient(135deg, var(--egs-atp-bg-1) 0%, var(--egs-atp-bg-2) 100%);
    clip-path: var(--egs-atp-clip);
    overflow: hidden;
    width: 100%;
}

.egs-atp__core::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg,
        transparent 30%,
        color-mix(in srgb, var(--egs-atp-main) 30%, transparent) 50%,
        transparent 70%);
    transform: translateX(-130%);
    transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
}

/* =========================================================================
   ICONO — chip CPU
   ========================================================================= */
.egs-atp__icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9em;
    height: 1.9em;
    color: var(--egs-atp-main);
    flex-shrink: 0;
}
.egs-atp__icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 6px color-mix(in srgb, var(--egs-atp-main) 80%, transparent));
    animation: egs-atp-icon-pulse 2.5s ease-in-out infinite;
}
@keyframes egs-atp-icon-pulse {
    0%, 100% { transform: scale(1);    opacity: 1;    }
    50%      { transform: scale(1.08); opacity: 0.85; }
}

/* =========================================================================
   TEXTO + glitch chromatic aberration
   ========================================================================= */
.egs-atp__text {
    display: inline-flex;
    flex-direction: column;
    line-height: 1;
    gap: 0.3em;
}

.egs-atp__label {
    position: relative;
    display: inline-block;
    font-size: 1em;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--egs-atp-ink);
    text-shadow:
        0 0 8px color-mix(in srgb, var(--egs-atp-main) 70%, transparent),
        0 0 1px rgba(255,255,255,0.6);
}

/* Capas glitch (chromatic aberration) — invisibles hasta hover */
.egs-atp__label::before,
.egs-atp__label::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
}
.egs-atp__label::before {
    color: var(--egs-atp-alt);
    transform: translate(2px, 0);
    mix-blend-mode: screen;
    text-shadow: none;
}
.egs-atp__label::after {
    color: var(--egs-atp-main);
    transform: translate(-2px, 0);
    mix-blend-mode: screen;
    text-shadow: none;
}

.egs-atp__sub {
    font-size: 0.62em;
    font-weight: 500;
    letter-spacing: 0.32em;
    color: color-mix(in srgb, var(--egs-atp-main) 90%, white 10%);
    opacity: 0.85;
}

/* =========================================================================
   LED — punto pulsante de status
   ========================================================================= */
.egs-atp__led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--egs-atp-led);
    box-shadow:
        0 0 6px var(--egs-atp-led),
        0 0 14px color-mix(in srgb, var(--egs-atp-led) 70%, transparent);
    animation: egs-atp-led 1.6s ease-in-out infinite;
    flex-shrink: 0;
    margin-left: 0.4em;
}
@keyframes egs-atp-led {
    0%, 100% { opacity: 1;   transform: scale(1);    }
    50%      { opacity: 0.4; transform: scale(0.85); }
}

/* =========================================================================
   GLOW exterior — halo neón
   ========================================================================= */
.egs-atp__glow {
    position: absolute;
    inset: -6px;
    z-index: -1;
    background: radial-gradient(ellipse at center,
        color-mix(in srgb, var(--egs-atp-main) 55%, transparent) 0%,
        transparent 70%);
    filter: blur(14px);
    opacity: 0.55;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* =========================================================================
   HOVER / FOCUS — el botón cobra vida
   ========================================================================= */
.egs-atp:hover,
.egs-atp:focus-visible {
    transform: translateY(-1px) scale(1.02);
    filter: drop-shadow(0 0 26px color-mix(in srgb, var(--egs-atp-main) 70%, transparent));
}

.egs-atp:hover .egs-atp__core::before,
.egs-atp:focus-visible .egs-atp__core::before {
    transform: translateX(130%);
}

.egs-atp:hover .egs-atp__glow,
.egs-atp:focus-visible .egs-atp__glow {
    opacity: 0.9;
}

.egs-atp:hover .egs-atp__frame,
.egs-atp:focus-visible .egs-atp__frame {
    animation-duration: 1.6s;
}

.egs-atp:hover .egs-atp__label::before,
.egs-atp:focus-visible .egs-atp__label::before {
    opacity: 0.9;
    animation: egs-atp-glitch-a 1.1s steps(2, end) infinite;
}
.egs-atp:hover .egs-atp__label::after,
.egs-atp:focus-visible .egs-atp__label::after {
    opacity: 0.9;
    animation: egs-atp-glitch-b 1.3s steps(2, end) infinite;
}

@keyframes egs-atp-glitch-a {
    0%   { clip-path: inset(0   0 70% 0); transform: translate(2px,  0); }
    20%  { clip-path: inset(30% 0 50% 0); transform: translate(-1px, 1px); }
    40%  { clip-path: inset(60% 0 10% 0); transform: translate(2px, -1px); }
    60%  { clip-path: inset(10% 0 60% 0); transform: translate(-2px, 0); }
    80%  { clip-path: inset(80% 0  5% 0); transform: translate(1px,  1px); }
    100% { clip-path: inset(0   0 90% 0); transform: translate(2px,  0); }
}
@keyframes egs-atp-glitch-b {
    0%   { clip-path: inset(70% 0  0  0); transform: translate(-2px, 0); }
    25%  { clip-path: inset(20% 0 50% 0); transform: translate( 2px, 1px); }
    50%  { clip-path: inset(50% 0 30% 0); transform: translate(-1px,-1px); }
    75%  { clip-path: inset( 5% 0 70% 0); transform: translate( 2px, 0); }
    100% { clip-path: inset(90% 0  0  0); transform: translate(-2px, 0); }
}

/* =========================================================================
   ACTIVE — pulso de click
   ========================================================================= */
.egs-atp:active {
    transform: translateY(0) scale(0.98);
    filter: brightness(1.25) drop-shadow(0 0 30px var(--egs-atp-main));
}
.egs-atp.is-clicked .egs-atp__core {
    animation: egs-atp-click 0.45s ease;
}
@keyframes egs-atp-click {
    0%   { box-shadow: inset 0 0 0 0 color-mix(in srgb, var(--egs-atp-main) 80%, transparent); }
    60%  { box-shadow: inset 0 0 60px 8px color-mix(in srgb, var(--egs-atp-main) 30%, transparent); }
    100% { box-shadow: inset 0 0 0 0 transparent; }
}

/* =========================================================================
   GLITCH ALEATORIO — disparado por JS (clase .is-glitching)
   ========================================================================= */
.egs-atp.is-glitching .egs-atp__label::before { opacity: 0.95; animation: egs-atp-glitch-a 0.35s steps(2, end); }
.egs-atp.is-glitching .egs-atp__label::after  { opacity: 0.95; animation: egs-atp-glitch-b 0.35s steps(2, end); }
.egs-atp.is-glitching .egs-atp__frame         { animation-duration: 0.8s; }

/* =========================================================================
   STICKY / FAB — botón flotante en todo el sitio
   ========================================================================= */
.egs-atp-fab {
    position: fixed;
    z-index: 9998;
    pointer-events: none;
}
.egs-atp-fab .egs-atp {
    pointer-events: auto;
    animation: egs-atp-fab-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.4s both;
}

.egs-atp-fab--bottom-right  { right: 22px;  bottom: 22px;  }
.egs-atp-fab--bottom-left   { left:  22px;  bottom: 22px;  }
.egs-atp-fab--bottom-center { left:  50%;   bottom: 22px;  transform: translateX(-50%); }

@keyframes egs-atp-fab-in {
    from { opacity: 0; transform: translateY(18px) scale(0.92); }
    to   { opacity: 1; transform: translateY(0)   scale(1);     }
}

.egs-atp-fab--bottom-center .egs-atp { transform-origin: 50% 100%; }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 600px) {
    .egs-atp--lg { font-size: 14px; }
    .egs-atp--xl { font-size: 16px; }
    .egs-atp__core { padding: 0.85em 1.3em 0.85em 1em; }
    .egs-atp-fab--bottom-right  { right: 12px; bottom: 12px; }
    .egs-atp-fab--bottom-left   { left:  12px; bottom: 12px; }
    .egs-atp-fab--bottom-center { bottom: 12px; }
}

.egs-atp-fab--no-mobile { display: block; }
@media (max-width: 768px) {
    .egs-atp-fab--no-mobile { display: none !important; }
}

/* =========================================================================
   ACCESIBILIDAD — respeta usuarios que prefieren menos movimiento
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
    .egs-atp,
    .egs-atp__frame,
    .egs-atp__icon svg,
    .egs-atp__led,
    .egs-atp__core::before,
    .egs-atp__label::before,
    .egs-atp__label::after,
    .egs-atp-fab .egs-atp {
        animation: none !important;
        transition: none !important;
    }
}

/* Focus visible accesible */
.egs-atp:focus-visible {
    outline: 2px solid var(--egs-atp-main);
    outline-offset: 4px;
}
