/* ==========================================================
   PILARES · Los cimientos (Programación · IA · Diseño · Marketing)
   ========================================================== */
.pillars {
    --p-h: clamp(260px, 38vh, 380px);   /* alto del fuste */
    --p-w: clamp(96px, 8.5vw, 128px);   /* ancho del fuste */
    position: relative;
    isolation: isolate;
    /* clip (no hidden): un contenedor hidden puede desplazarse al enfocar o al pasar el cursor por un pilar */
    overflow: hidden;
    overflow: clip;
    min-height: 100vh;
    padding: clamp(72px, 10vh, 120px) clamp(16px, 4vw, 48px) 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(28px, 5vh, 56px);
    background:
        radial-gradient(ellipse 60% 40% at 50% 0%, rgba(139, 92, 246, 0.14), transparent 70%),
        radial-gradient(ellipse 50% 35% at 50% 100%, rgba(43, 245, 176, 0.08), transparent 70%),
        #020406;
    color: var(--a-text, #e7fff6);
    font-family: var(--a-font-body, 'Exo 2', sans-serif);
}
/* empalme suave con el hero */
.pillars::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 160px;
    background: linear-gradient(#020406, transparent);
    z-index: -1;
    pointer-events: none;
}

/* Colores por pilar */
.pillar--code { --c: #2bf5b0; --c-rgb: 43, 245, 176; --c2: #10b981; }
.pillar--ai { --c: #a970ff; --c-rgb: 169, 112, 255; --c2: #e048ff; }
.pillar--design { --c: #ff5bd8; --c-rgb: 255, 91, 216; --c2: #8b5cf6; }
.pillar--marketing { --c: #3ddcff; --c-rgb: 61, 220, 255; --c2: #2bf5b0; }

/* ---------- Fondo: suelo agrietado ---------- */
.pillars__bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; overflow: clip; }
.pillars__floor {
    position: absolute;
    left: -50%;
    right: -50%;
    bottom: -10%;
    height: 55%;
    transform: perspective(600px) rotateX(68deg);
    transform-origin: bottom;
    background-image:
        linear-gradient(rgba(43, 245, 176, 0.13) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 92, 246, 0.13) 1px, transparent 1px);
    background-size: 70px 70px;
    mask-image: linear-gradient(to top, #000 10%, transparent 85%);
    -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 85%);
    animation: pillars-floor 18s linear infinite;
}
@keyframes pillars-floor { to { background-position: 0 70px, 0 0; } }
.pillars__cracks {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 34%;
    fill: none;
    stroke: rgba(43, 245, 176, 0.35);
    stroke-width: 1.2;
    filter: drop-shadow(0 0 4px rgba(43, 245, 176, 0.7));
    stroke-dasharray: 900;
    stroke-dashoffset: 900;
    transition: stroke-dashoffset 2.4s ease-out 0.6s;
}
.pillars.is-visible .pillars__cracks { stroke-dashoffset: 0; }

/* ---------- Paneles holográficos laterales ---------- */
.pillars__holo {
    position: absolute;
    top: clamp(64px, 9vh, 110px);
    width: 214px;
    padding: 12px 14px;
    font-family: var(--a-font-mono, monospace);
    font-size: 0.62rem;
    color: rgba(143, 179, 168, 0.8);
    border: 1px solid rgba(43, 245, 176, 0.18);
    background: linear-gradient(160deg, rgba(8, 28, 24, 0.45), rgba(14, 10, 32, 0.35));
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
    opacity: 0;
    transition: opacity 1s 0.9s, transform 1s 0.9s;
    pointer-events: none;
}
.pillars__holo--left { left: clamp(12px, 2.5vw, 40px); transform: translateX(-20px); }
.pillars__holo--right { right: clamp(12px, 2.5vw, 40px); transform: translateX(20px); border-color: rgba(139, 92, 246, 0.25); }
.pillars.is-visible .pillars__holo { opacity: 1; transform: none; }
.pillars__code { margin: 0; white-space: pre; line-height: 1.55; color: rgba(43, 245, 176, 0.65); font: inherit; }
.pillars__chart { width: 100%; height: 60px; fill: none; stroke: #a970ff; stroke-width: 1.4; filter: drop-shadow(0 0 4px #a970ff); }
.pillars__chart .b { stroke: #2bf5b0; opacity: 0.6; filter: drop-shadow(0 0 4px #2bf5b0); }
.pillars__holo-row { display: flex; justify-content: space-between; margin-top: 4px; }
.pillars__holo-row b { color: #e7fff6; font-weight: 500; transition: color 0.3s; }
.pillars__holo-title { display: flex; justify-content: space-between; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid rgba(43, 245, 176, 0.14); letter-spacing: 0.18em; color: rgba(43, 245, 176, 0.9); }
.pillars__holo--right .pillars__holo-title { color: #b79cff; border-color: rgba(139, 92, 246, 0.22); }
.pillars__holo-title b { font-weight: 500; color: #e7fff6; }
.pillars__code { min-height: 9.3em; }
.pillars__code .k { color: #b79cff; }
.pillars__code .v { color: #e7fff6; }
.pillars__code .caret { display: inline-block; width: 0.55em; background: rgba(43, 245, 176, 0.8); animation: holo-caret 1s steps(1) infinite; }
@keyframes holo-caret { 50% { opacity: 0; } }
.pillars__holo-row--note { color: rgba(143, 179, 168, 0.65); font-size: 0.58rem; }
#holoMetricValue { font-size: 0.9rem; color: #2bf5b0; text-shadow: 0 0 8px rgba(43, 245, 176, 0.6); }

/* ---------- Encabezado ---------- */
.pillars__head { text-align: center; max-width: 720px; }
.pillars__overline {
    margin: 0 0 10px;
    font-family: var(--a-font-mono, monospace);
    font-size: 0.72rem;
    letter-spacing: 0.4em;
    color: #2bf5b0;
}
.pillars .pillars__title {
    margin: 0;
    opacity: 1;
    transform: none;
    font-family: var(--a-font-display, 'Orbitron', sans-serif);
    font-weight: 800;
    font-size: clamp(1.7rem, 4.4vw, 3.4rem);
    line-height: 1.12;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: linear-gradient(100deg, #c9b3ff 0%, #a970ff 35%, #e048ff 60%, #2bf5b0 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 18px rgba(169, 112, 255, 0.45));
    animation: pillars-shine 8s ease-in-out infinite alternate;
}
.pillars .pillars__title::after { display: none; }
@keyframes pillars-shine { to { background-position: 100% 0; } }
.pillars__lead { margin: 14px auto 0; color: #8fb3a8; font-size: clamp(0.95rem, 1.2vw, 1.08rem); line-height: 1.6; }

.pillars__head > * { opacity: 0; transform: translateY(18px); transition: opacity 0.8s, transform 0.8s; }
.pillars.is-visible .pillars__head > * { opacity: 1; transform: none; }
.pillars.is-visible .pillars__head > :nth-child(2) { transition-delay: 0.12s; }
.pillars.is-visible .pillars__head > :nth-child(3) { transition-delay: 0.24s; }

/* ---------- Fila de pilares ---------- */
.pillars__row {
    position: relative;
    width: min(1240px, 100%);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
}
.pillars__row:has(.pillar.is-open) .pillar:not(.is-open) { opacity: 0.35; filter: saturate(0.5); }

.pillar {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    outline: none;
    cursor: pointer;
    transition: opacity 0.45s, filter 0.45s;
    -webkit-tap-highlight-color: transparent;
}
.pillar:focus-visible .pillar__shaft { box-shadow: 0 0 0 2px rgba(var(--c-rgb), 0.8), 0 0 30px rgba(var(--c-rgb), 0.5); }

.pillar__num {
    margin: 0;
    font-family: var(--a-font-mono, monospace);
    font-size: 0.64rem;
    letter-spacing: 0.34em;
    color: rgba(var(--c-rgb), 0.75);
}

/* aparición desde el suelo */
.pillar__column, .pillar__num, .pillar__name {
    opacity: 0;
    transform: translateY(70px);
    transition: opacity 1s cubic-bezier(.2, .8, .2, 1), transform 1.1s cubic-bezier(.2, .8, .2, 1);
    transition-delay: calc(var(--i, 0) * 0.18s + 0.2s);
}
.pillar--code { --i: 0; }
.pillar--ai { --i: 1; }
.pillar--design { --i: 2; }
.pillar--marketing { --i: 3; }
.pillars.is-visible .pillar__column,
.pillars.is-visible .pillar__num,
.pillars.is-visible .pillar__name { opacity: 1; transform: none; }

.pillar__column {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--c);
}
/* reflejo / resplandor en el suelo */
.pillar__column::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -26px;
    width: calc(var(--p-w) * 2.6);
    height: 46px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(var(--c-rgb), 0.45), transparent 70%);
    filter: blur(6px);
    opacity: 0.55;
    transition: opacity 0.5s;
    z-index: -1;
}
.pillar.is-open .pillar__column::after { opacity: 1; }

/* capitel y basa (SVG) */
.pillar__capital, .pillar__base {
    display: block;
    width: calc(var(--p-w) * 1.72);
    height: auto;
    fill: rgba(var(--c-rgb), 0.08);
    stroke: currentColor;
    stroke-width: 1.4;
    filter: drop-shadow(0 0 5px rgba(var(--c-rgb), 0.85));
    transition: transform 0.6s cubic-bezier(.2, .8, .2, 1), filter 0.5s;
    position: relative;
    z-index: 2;
}
.pillar__capital path { fill: none; }
.pillar__base { width: calc(var(--p-w) * 1.66); }
.pillar.is-open .pillar__capital { transform: translateY(-14px); filter: drop-shadow(0 0 10px rgba(var(--c-rgb), 1)); }
.pillar.is-open .pillar__base { filter: drop-shadow(0 0 10px rgba(var(--c-rgb), 1)); }

/* fuste */
.pillar__shaft {
    position: relative;
    width: var(--p-w);
    height: var(--p-h);
    margin: -2px 0;
    perspective: 700px;
    transition: box-shadow 0.4s;
}
.pillar__core {
    position: absolute;
    inset: 0 6px;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(var(--c-rgb), 0.35), transparent 30%, transparent 70%, rgba(var(--c-rgb), 0.35)),
        radial-gradient(ellipse at center, rgba(var(--c-rgb), 0.28), rgba(2, 4, 6, 0.95) 75%);
    box-shadow: inset 0 0 30px rgba(var(--c-rgb), 0.45);
}
.pillar__fx { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.55; transition: opacity 0.5s; }
.pillar.is-open .pillar__fx { opacity: 1; }

.pillar__word {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-family: var(--a-font-display, 'Orbitron', sans-serif);
    font-weight: 800;
    font-size: clamp(1rem, 1.6vw, 1.45rem);
    letter-spacing: -0.08em;
    color: #fff;
    text-shadow: 0 0 10px rgba(var(--c-rgb), 1), 0 0 26px rgba(var(--c-rgb), 0.9), 0 0 60px rgba(var(--c-rgb), 0.6);
    opacity: 0;
    clip-path: inset(50% 0 50% 0);
    transition: clip-path 0.7s cubic-bezier(.2, .8, .2, 1) 0.2s, opacity 0.3s 0.2s, letter-spacing 0.9s 0.2s;
}
.pillar--ai .pillar__word { font-size: clamp(2.4rem, 4vw, 3.4rem); letter-spacing: 0; }
.pillar.is-open .pillar__word { opacity: 1; clip-path: inset(0 0 0 0); letter-spacing: 0.02em; }

/* puertas acanaladas que se abren */
.pillar__door {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    background:
        repeating-linear-gradient(90deg, rgba(var(--c-rgb), 0.55) 0 1.5px, rgba(var(--c-rgb), 0.08) 1.5px 9px, rgba(255, 255, 255, 0.05) 9px 10px, rgba(var(--c-rgb), 0.1) 10px 14px),
        linear-gradient(180deg, rgba(var(--c-rgb), 0.28), rgba(var(--c-rgb), 0.12) 50%, rgba(var(--c-rgb), 0.3));
    backdrop-filter: blur(2px);
    border: 1px solid rgba(var(--c-rgb), 0.8);
    box-shadow: 0 0 14px rgba(var(--c-rgb), 0.55), inset 0 0 18px rgba(var(--c-rgb), 0.35);
    transition: transform 0.85s cubic-bezier(.65, .05, .25, 1), opacity 0.85s;
    z-index: 1;
}
.pillar__door::after {
    /* destello que recorre el fuste */
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.35) 50%, transparent);
    background-size: 100% 30%;
    background-repeat: no-repeat;
    animation: pillar-scan 4.5s linear infinite;
    animation-delay: calc(var(--i) * 0.7s);
    mix-blend-mode: overlay;
}
@keyframes pillar-scan { from { background-position: 0 -40%; } to { background-position: 0 140%; } }
.pillar__door--l { left: 0; transform-origin: left center; border-right-width: 0.5px; }
.pillar__door--r { right: 0; transform-origin: right center; border-left-width: 0.5px; }
.pillar.is-open .pillar__door--l { transform: translateX(-38%) rotateY(-68deg); opacity: 0.75; }
.pillar.is-open .pillar__door--r { transform: translateX(38%) rotateY(68deg); opacity: 0.75; }

.pillar__name {
    margin: 22px 0 0;
    font-family: var(--a-font-display, 'Orbitron', sans-serif);
    font-size: clamp(0.78rem, 1.15vw, 1rem);
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--c);
    text-shadow: 0 0 14px rgba(var(--c-rgb), 0.7);
    text-align: center;
}

/* ---------- Panel de competencias ---------- */
.pillar__panel {
    position: absolute;
    top: 22%;
    left: calc(50% + var(--p-w) / 2 + 34px);
    width: 230px;
    padding: 14px 16px 16px;
    background: linear-gradient(160deg, rgba(6, 22, 20, 0.92), rgba(16, 10, 36, 0.9));
    border: 1px solid rgba(var(--c-rgb), 0.55);
    box-shadow: 0 0 24px rgba(var(--c-rgb), 0.25), inset 0 0 24px rgba(var(--c-rgb), 0.06);
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
    backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-14px);
    transition: opacity 0.4s 0.25s, transform 0.5s 0.25s, visibility 0s 0.75s;
    z-index: 5;
    cursor: default;
}
/* línea que conecta el pilar con el panel */
.pillar__panel::before {
    content: '';
    position: absolute;
    top: 28px;
    right: 100%;
    width: 34px;
    height: 1px;
    background: var(--c);
    box-shadow: 0 0 6px var(--c);
}
/* los dos pilares de la derecha abren su panel hacia la izquierda */
.pillar:nth-child(n+3) .pillar__panel { left: auto; right: calc(50% + var(--p-w) / 2 + 34px); transform: translateX(14px); }
.pillar:nth-child(n+3) .pillar__panel::before { right: auto; left: 100%; }
.pillar.is-open .pillar__panel { opacity: 1; visibility: visible; transform: none; transition: opacity 0.4s 0.25s, transform 0.5s 0.25s, visibility 0s; }

.pillar__panel-title {
    margin: 0 0 10px;
    font-family: var(--a-font-mono, monospace);
    font-size: 0.66rem;
    letter-spacing: 0.24em;
    color: var(--c);
}
.pillar__panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.pillar__panel li {
    position: relative;
    padding-left: 16px;
    font-size: 0.86rem;
    line-height: 1.4;
    color: #d6ece5;
}
.pillar__panel li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5em;
    width: 6px;
    height: 6px;
    background: var(--c);
    box-shadow: 0 0 6px var(--c);
    transform: rotate(45deg);
}
.pillar__ask {
    margin-top: 14px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(var(--c-rgb), 0.6);
    border-radius: 6px;
    background: rgba(var(--c-rgb), 0.1);
    color: #fff;
    font-family: var(--a-font-display, 'Orbitron', sans-serif);
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}
.pillar__ask:hover, .pillar__ask:focus-visible { background: rgba(var(--c-rgb), 0.25); box-shadow: 0 0 16px rgba(var(--c-rgb), 0.5); outline: none; }

/* ---------- Siguiente sección ---------- */
.pillars__next {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #c9b3ff;
    text-decoration: none;
    font-family: var(--a-font-display, 'Orbitron', sans-serif);
    font-size: 0.72rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
}
.pillars__next svg { width: 26px; height: 26px; color: #2bf5b0; animation: pillars-bob 1.8s ease-in-out infinite; filter: drop-shadow(0 0 6px #2bf5b0); }
.pillars__next:hover { color: #fff; }
@keyframes pillars-bob { 50% { transform: translateY(5px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
    .pillars__holo { display: none; }
}
/* Pantallas medianas: el panel se muestra debajo del pilar */
@media (max-width: 1024px) {
    .pillars { --p-h: clamp(230px, 34vh, 320px); }
    .pillar__panel,
    .pillar:nth-child(n+3) .pillar__panel {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        width: min(260px, 100%);
        margin-top: 4px;
        opacity: 1;
        visibility: visible;
        transform: none;
    }
    .pillar__panel::before { display: none; }
    .pillars__row { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 56px 18px; }
    .pillars__row:has(.pillar.is-open) .pillar:not(.is-open) { opacity: 1; filter: none; }
}
@media (max-width: 700px) {
    .pillars { --p-h: 230px; --p-w: 92px; padding-top: 64px; }
    .pillars__row { grid-template-columns: 1fr; gap: 56px; }
    .pillar__panel { width: 100%; max-width: 340px; }
}

@media (prefers-reduced-motion: reduce) {
    .pillars *, .pillars *::before, .pillars *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
    }
}
