/* ============================================================
   CLOUD THEME — Layout & Global Styles
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg:            #070b18;
    --bg-elev:       #0b1226;
    --panel:         rgba(11,18,38,.50);
    --panel-solid:   rgba(11,18,38,.85);

    --text:          #dbe4f5;
    --text-muted:    #9fb0cc;
    --text-faint:    #6b7a93;
    --text-strong:   #eaf1ff;

    --accent:        #3b82f6;
    --accent-cyan:   #22d3ee;
    --accent-light:  #60a5fa;
    --grad:          linear-gradient(135deg, #3b82f6, #22d3ee);
    --grad-text:     linear-gradient(90deg, #60a5fa, #22d3ee);

    --border:        rgba(96,165,250,.16);
    --border-strong: rgba(96,165,250,.30);
    --border-hover:  rgba(96,165,250,.55);

    --grid-line:     rgba(59,130,246,.06);
    --glow-blue:     rgba(59,130,246,.18);
    --glow-cyan:     rgba(34,211,238,.10);

    --radius:        14px;
    --radius-sm:     8px;
    --radius-pill:   999px;
    --shadow-btn:    0 14px 32px rgba(59,130,246,.40);
    --shadow-node:   0 0 40px rgba(59,130,246,.30);

    --font-sans: 'Sora', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    scrollbar-color: var(--accent) rgba(11,18,38,.50);
    scrollbar-width: thin;
    /* Prevent occasional horizontal scroll caused by positioned elements */
    overflow-x: hidden;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-elev); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-light); }

/* ── BACKGROUND LAYERS (fixed, behind everything) ── */
.bg-halos, .bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}
.bg-halos {
    background:
        radial-gradient(ellipse 60% 50% at 75% 12%, rgba(59,130,246,.18), transparent 60%),
        radial-gradient(ellipse 50% 40% at 10% 80%, rgba(34,211,238,.10), transparent 60%);
}
.bg-grid {
    background-image:
        linear-gradient(rgba(59,130,246,.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59,130,246,.06) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, #000, transparent);
    mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, #000, transparent);
}

section, .contact-page, .detalle-page {
    position: relative;
    z-index: 1;
}

/* ── NAV ── */
nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 3rem;
    height: 60px;
    background: rgba(7,11,24,.88);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: fixed;
    z-index: 100;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: .95rem;
    font-weight: 700;
    color: var(--text-strong);
    transition: opacity .25s;
}
.nav-logo:hover { opacity: .8; }

.nav-logo-icon {
    width: 31px; height: 31px;
    border-radius: 9px;
    background: var(--grad);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: #04122e;
    flex-shrink: 0;
    letter-spacing: -.05em;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2.5rem;
}
nav ul a {
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: .69rem;
    font-weight: 500;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-faint);
    transition: color .2s;
}
nav ul a:hover,
nav ul a.active { color: var(--accent-light); }

/* Nav toggle (mobile) */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: .5rem;
    flex-direction: column;
    gap: 5px;
    z-index: 101;
}
.nav-toggle span {
    display: inline-block;
    width: 22px; height: 2px;
    background: var(--text);
    transition: all .3s ease;
    transform-origin: center;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── HELPERS ── */
.kicker {
    font-family: var(--font-mono);
    font-size: .69rem;
    font-weight: 500;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--accent-light);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: .7rem;
}
.kicker::before {
    content: '';
    display: inline-block;
    width: 2rem; height: 1px;
    background: var(--accent);
    opacity: .4;
}

.section-title {
    font-family: var(--font-sans);
    font-size: clamp(2rem, 3.5vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.1;
    color: var(--text-strong);
    margin-bottom: 1.5rem;
}

.grad-text {
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ── BUTTONS ── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: var(--grad);
    color: #04122e;
    font-family: var(--font-mono);
    font-size: .78rem;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 10px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
    letter-spacing: .02em;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-btn); }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: .78rem;
    font-weight: 500;
    padding: 11px 23px;
    border-radius: 10px;
    text-decoration: none;
    border: 1px solid var(--border-strong);
    cursor: pointer;
    transition: border-color .2s, color .2s;
    letter-spacing: .02em;
}
.btn-ghost:hover { border-color: var(--accent-light); color: var(--text); }

/* ── HOME ── */
#inicio {
    min-height: calc(100vh - 60px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--border);
}

.hero-l {
    padding: 6rem 4rem 6rem 3rem;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    animation: fade-up .8s ease both;
}
.hero-r {
    padding: 5rem 3rem 5rem 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    animation: fade-up .8s .15s ease both;
}

.hero-kicker {
    font-family: var(--font-mono);
    font-size: .69rem; font-weight: 500;
    letter-spacing: .2em; text-transform: uppercase;
    color: var(--accent-light);
    margin-bottom: 2rem;
    display: flex; align-items: center; gap: .7rem;
}
.hero-kicker::before { content: ''; width: 2rem; height: 1px; background: var(--accent); opacity: .4; }

.hero-name {
    font-size: clamp(2.2rem, 4vw, 3.75rem);
    font-weight: 700;
    line-height: 1.04;
    letter-spacing: -.02em;
    color: var(--text-strong);
    margin-bottom: .6rem;
}
.hero-sub {
    font-size: clamp(1.2rem, 2.2vw, 1.7rem);
    font-weight: 300;
    line-height: 1.3;
    margin-bottom: 1.8rem;
}
.hero-bio {
    font-size: .96rem;
    font-weight: 400;
    color: var(--text-muted);
    max-width: 440px;
    line-height: 1.7;
    margin-bottom: 2rem;
}
.hero-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ── DIAGRAM ── */
.diagram-wrap {
    position: relative;
    width: 100%;
    max-width: 560px;
    height: 430px;
    margin: 0 auto;
}
.conn {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    overflow: visible;
    pointer-events: none;
    z-index: 1;
}
.conn line {
    stroke-width: 1.5;
    stroke-dasharray: 6 7;
    opacity: .65;
    animation: dash-flow 1.6s linear infinite;
}
.conn line:nth-child(2) { animation-duration: 1.8s; }
.conn line:nth-child(3) { animation-duration: 2.0s; }
.conn line:nth-child(4) { animation-duration: 1.5s; }

/* Data packets traveling along lines */
.conn .data-dot {
    fill: var(--accent-cyan);
    filter: drop-shadow(0 0 4px var(--accent-cyan));
}

.node {
    position: absolute;
    z-index: 2;
    border-radius: 0;
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: left;
    padding: .9rem .75rem;
    border: 1px solid rgba(96,165,250,.3);
    background: var(--panel-solid);
    transition: border-color .3s, box-shadow .3s;
}
.node:hover { border-color: var(--border-hover); }

.node-center {
    left: 210px; top: 165px;
    width: 140px; height: 100px;
    background: linear-gradient(160deg, rgba(59,130,246,.25), rgba(34,211,238,.12)), var(--bg-elev);
    border: 1px solid rgba(96,165,250,.5);
    border-radius: 16px;
    backdrop-filter: blur(6px);
    box-shadow: var(--shadow-node);
    animation: node-glow 4s ease-in-out infinite;
    z-index: 3;
}
.node-center .node-glyph {
    font-family: var(--font-mono);
    font-size: 20px; font-weight: 700;
    color: white;
    margin-bottom: .25rem;
}
.node-center .node-label {
    font-family: var(--font-mono);
    font-size: 9px; font-weight: 500;
    letter-spacing: .1em; text-transform: uppercase;
    color: var(--text-muted);
}

.node-cloud  { left: 20px;  top: 40px;  border-color: rgba(96,165,250,.3); }
.node-devops { left: 380px; top: 40px;  border-color: rgba(34,211,238,.3); }
.node-finops { left: 20px;  top: 298px; border-color: rgba(34,211,238,.3); }
.node-iac    { left: 380px; top: 298px; border-color: rgba(96,165,250,.3); }
.node-cloud, .node-devops, .node-finops, .node-iac { width: 160px; height: 92px; }

.node-title {
    font-family: var(--font-sans);
    font-size: 15px; font-weight: 600;
    margin-bottom: .25rem;
}
.node-cloud .node-title, .node-iac .node-title { color: var(--accent-light); }
.node-devops .node-title, .node-finops .node-title { color: var(--accent-cyan); }
.node-tech {
    font-family: var(--font-mono);
    font-size: 10px; color: var(--text-muted);
    line-height: 1.5;
}

/* KPI Cards */
.kpi-section { margin-top: 0rem; }
.kpi-section-label {
    font-family: var(--font-mono);
    font-size: .69rem; font-weight: 500;
    letter-spacing: .2em; text-transform: uppercase;
    color: var(--accent-light);
    margin-bottom: 1rem;
}
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .6rem;
}
.kpi-card {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    text-align: left;
    position: relative;
    overflow: visible;
    transition: transform .15s ease;
    cursor: default;
}
.kpi-card::after { display: none; }
.kpi-card:hover { transform: translateY(-2px); }
.kpi-value {
    font-family: var(--font-mono);
    font-size: 1.6rem; font-weight: 700;
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    margin: 0;
    line-height: 1;
}
.kpi-value.counter { background: none; font-variant-numeric: tabular-nums; -webkit-text-fill-color: var(--accent-light); color: var(--accent-light); }
.kpi-value.counter.done { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.kpi-label { display: inline-block; font-size: .78rem; color: var(--text-faint); }
/* ── FOOTER ── */
footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid rgba(96,165,250,.14);
    padding: 1.8rem 3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: .69rem;
    color: #5a6885;
}
.footer-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    text-decoration: none;
    font-family: var(--font-mono);
    font-weight: 700;
    color: #5a6885;
    transition: color .2s;
}
.footer-brand:hover { color: var(--accent-light); }
.footer-brand-icon {
    width: 24px; height: 24px;
    border-radius: 7px;
    background: var(--grad);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px; font-weight: 700;
    color: #04122e;
    letter-spacing: -.05em;
}
.footer-links {
    display: flex;
    gap: 2rem;
}
.footer-links a {
    font-family: var(--font-mono);
    color: #5a6885;
    text-decoration: none;
    font-size: .69rem;
    transition: color .2s;
}
.footer-links a:hover { color: var(--accent-light); }
.footer-copy { color: #5a6885; }

/* ── SCROLL REVEAL ── */
.reveal { opacity: 0; transform: translateY(18px); }
.reveal.active { animation: fade-up .65s cubic-bezier(.25,.46,.45,.94) forwards; }

/* ── KEYFRAMES ── */
@keyframes dash-flow  { to { stroke-dashoffset: -1000; } }
@keyframes flow       { to { background-position: -200% 0; } }
@keyframes pulse      { 0%,100%{ opacity:.55; transform:scale(1); } 50%{ opacity:1; transform:scale(1.35); } }
@keyframes node-glow  { 0%,100%{ box-shadow:0 0 30px rgba(59,130,246,.25); } 50%{ box-shadow:0 0 48px rgba(59,130,246,.45); } }
@keyframes glow-pulse { 0%,100%{ opacity:.35; } 50%{ opacity:.7; } }
@keyframes ring       { 0%{ transform:scale(.8); opacity:.7; } 100%{ transform:scale(2.4); opacity:0; } }
@keyframes pipe       { from{ top:0; opacity:0; } 10%{ opacity:1; } 90%{ opacity:1; } to{ top:100%; opacity:0; } }
@keyframes fade-up    { from{ opacity:0; transform:translateY(18px); } to{ opacity:1; transform:none; } }
@keyframes fade-in    { from{ opacity:0; } to{ opacity:1; } }
@keyframes slideUp    { from{ transform:translateY(100%); opacity:0; } to{ transform:none; opacity:1; } }
@keyframes dot-travel {
    0%   { offset-distance:0%;   opacity:0; }
    10%  { opacity:1; }
    90%  { opacity:1; }
    100% { offset-distance:100%; opacity:0; }
}

/* ── COOKIE BANNER ── */
.cookie-consent-banner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 999;
    background: var(--bg-elev);
    border-top: 1px solid var(--border-strong);
    padding: 1.5rem 3rem;
    box-shadow: 0 -4px 24px rgba(59,130,246,.12);
    animation: slideUp .3s ease both;
}
.cookie-consent-content {
    max-width: 1200px; margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: center;
}
.cookie-consent-text p { color: var(--text); font-size: .9rem; }
.cookie-consent-buttons { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .6rem; }

.cookie-btn {
    font-family: var(--font-mono);
    font-size: .72rem; font-weight: 500;
    letter-spacing: .06em; text-transform: uppercase;
    padding: .6rem 1.2rem;
    border: none; cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    flex: 0 0 auto;
    border-radius: var(--radius-sm);
}
.cookie-btn-reject  { background: transparent; border: 1px solid var(--text-faint); color: var(--text-faint); }
.cookie-btn-reject:hover { border-color: var(--text); color: var(--text); }
.cookie-btn-essential { background: transparent; border: 1px solid var(--accent); color: var(--accent-light); }
.cookie-btn-essential:hover { background: rgba(59,130,246,.1); }
.cookie-btn-accept { background: var(--grad); color: #04122e; font-weight: 700; }
.cookie-btn-accept:hover { opacity: .85; }

/* ── ACCESSIBILITY ── */
@media (prefers-reduced-motion: reduce) {
    .conn line, .node-center, .radar-ring, .timeline-flow, .timeline-dot,
    .kpi-card::after, .cert-dot, .stack-cat-dot {
        animation: none !important;
    }
    .reveal { opacity: 1; transform: none; }
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
    nav { padding: 0 1.5rem; }
    .nav-toggle { display: flex; }
    nav ul {
        display: none;
        position: absolute;
        top: 60px; left: 0; right: 0;
        flex-direction: column;
        gap: 0;
        background: rgba(7,11,24,.97);
        backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--border);
        padding: .5rem 0;
    }
    nav.open ul { display: flex; }
    nav ul li { border-bottom: 1px solid var(--border); }
    nav ul li:last-child { border-bottom: none; }
    nav ul a { display: block; padding: .875rem 1.5rem; }

    #inicio { grid-template-columns: 1fr; }
    .hero-l {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 4rem 1.5rem 3rem;
    }
    .hero-r { padding: 3rem 1.5rem 4rem; }

    /* Keep the CORE INFRA diagram and its animated links on mobile.
       Node positions are percentages that match the SVG line endpoints
       (viewBox 560x430), and the wrap keeps that aspect ratio so the SVG
       fills it exactly — the lines stay connected to each node as it scales. */
    .diagram-wrap {
        height: auto;
        aspect-ratio: 560 / 430;
        max-width: 460px;
        margin: 1rem auto 0;
    }
    .node { padding: .5rem .4rem; }
    .node-center {
        left: 50%; top: 50%;
        transform: translate(-50%, -50%);
        width: 26%; height: auto;
        margin: 0;
    }
    .node-cloud, .node-devops, .node-finops, .node-iac {
        width: 30%; height: auto;
        transform: translate(-50%, -50%);
    }
    .node-cloud  { left: 17.857%; top: 20%; }
    .node-devops { left: 82.143%; top: 20%; }
    .node-finops { left: 17.857%; top: 80%; }
    .node-iac    { left: 82.143%; top: 80%; }
    .node-title { font-size: 13px; }
    .node-tech  { font-size: 9px; }
    .node-center .node-glyph { font-size: 18px; }

    .kpi-grid { grid-template-columns: repeat(2,1fr); }

    footer {
        padding: 1.5rem;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        text-align: center;
    }
    .footer-links { justify-content: center; }

    .cookie-consent-banner { padding: 1.2rem 1.5rem; }
    .cookie-consent-content { grid-template-columns: 1fr; gap: 1rem; }
    .cookie-consent-buttons { display: flex; flex-direction: column; align-items: stretch; gap: .5rem; }
    .cookie-btn { width: 100%; flex: none; margin: 0; padding: .6rem 1rem; font-size: .7rem; text-align: center; }
    .cookie-btn-reject,
    .cookie-btn-essential { margin: 0; }
}

@media (max-width: 600px) {
    nav { padding: 0 1rem; }
    .kpi-grid { grid-template-columns: 1fr; }
    .hero-name { font-size: 2rem; }
}
