:root {
    --primary: #00d4ff;
    --primary-dark: #0099cc;
    --secondary: #6c63ff;
    --dark: #0a0a0f;
    --darker: #050508;
    --gray: #1a1a2e;
    --text-muted: rgba(255, 255, 255, 0.72);
    --neon-glow: 0 0 10px rgba(0, 212, 255, 0.5), 0 0 20px rgba(0, 212, 255, 0.25);
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --radius: 16px;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
    --nav-height: 4.25rem;
}

@supports (padding-top: env(safe-area-inset-top)) {
    :root {
        --nav-height: calc(4.25rem + env(safe-area-inset-top, 0px));
    }
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
}

body {
    background: var(--darker);
    color: #fff;
    font-family: var(--font-sans);
    overflow-x: hidden;
    line-height: 1.65;
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 10000;
    padding: 0.75rem 1rem;
    background: var(--primary);
    color: var(--darker);
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
}

.skip-link:focus {
    top: 1rem;
}

/* Loader */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: var(--darker);
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-loader--hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 212, 255, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#networkCanvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.12;
    pointer-events: none;
}

#particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    bottom: -10px;
    width: 2px;
    height: 2px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.4;
    animation: floatParticle linear infinite;
}

@keyframes floatParticle {
    0% { transform: translateY(0); opacity: 0; }
    20% { opacity: 0.5; }
    100% { transform: translateY(-100vh) translateX(30px); opacity: 0; }
}

#app {
    position: relative;
    z-index: 1;
}

/* Navbar */
.navbar {
    background: rgba(5, 5, 8, 0.92);
    backdrop-filter: blur(12px);
    padding: 1rem 0;
    transition: var(--transition);
    border-bottom: 1px solid transparent;
}

.navbar.scrolled {
    padding: 0.6rem 0;
    border-bottom-color: rgba(0, 212, 255, 0.15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.navbar-toggler {
    border-color: rgba(0, 212, 255, 0.4);
    padding: 0.4rem 0.55rem;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.35);
}

.navbar-toggler-icon {
    filter: invert(1);
}

.nav-link {
    color: #fff !important;
    font-weight: 500;
    padding: 0.5rem 0.75rem !important;
    position: relative;
}

.nav-link:hover,
.nav-link:focus-visible {
    color: var(--primary) !important;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0.75rem;
    right: 0.75rem;
    height: 2px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform 0.25s ease;
}

.nav-link:hover::after,
.nav-link:focus-visible::after {
    transform: scaleX(1);
}

/* Hero — contenido alineado arriba (evita hueco bajo el menú en tablet) */
.hero-section {
    position: relative;
    display: block;
    min-height: auto;
    padding: calc(var(--nav-height) + 1rem) 0 2.5rem;
    overflow: hidden;
}

.hero-section .hero-container,
.hero-section .hero-row {
    height: auto;
    min-height: 0;
}

.hero-section .hero-row {
    align-items: flex-start;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(0, 212, 255, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(108, 99, 255, 0.08), transparent);
    z-index: 0;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-visual {
    position: relative;
    z-index: 2;
}

.hero-image-wrap {
    margin-bottom: 1rem;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid rgba(0, 212, 255, 0.25);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.hero-image-wrap picture {
    display: block;
    width: 100%;
    line-height: 0;
}

.hero-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 280px;
}

.hero-image-wrap.hero-image--fallback {
    background: linear-gradient(135deg, var(--gray), var(--darker));
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-image-wrap.hero-image--fallback .hero-image {
    display: none;
}

.tech-badge {
    display: inline-block;
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.35);
    padding: 0.45rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

.neon-text {
    color: var(--primary);
    text-shadow: var(--neon-glow);
}

.typed-text {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 600;
    color: #fff;
}

.hero-buttons .btn {
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    color: var(--darker);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: linear-gradient(135deg, #33ddff, var(--primary));
    color: var(--darker);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.35);
}

.btn-outline-light {
    border-color: rgba(255, 255, 255, 0.35);
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.tech-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-item .counter {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
    font-variant-numeric: tabular-nums;
}

.stat-item .stat-text {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.stat-item span:last-child {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.holographic-card {
    perspective: 1000px;
}

.floating-dashboard {
    background: rgba(10, 10, 15, 0.75);
    backdrop-filter: blur(16px);
    border-radius: var(--radius);
    border: 1px solid rgba(0, 212, 255, 0.25);
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.dashboard-preview {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.dashboard-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(0, 212, 255, 0.04) 50%,
        transparent 100%
    );
    background-size: 100% 200%;
    animation: chartScan 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

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

.dashboard-preview .dashboard-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-family: var(--font-mono);
    position: relative;
    z-index: 2;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00ff88;
    box-shadow: 0 0 8px #00ff88;
    animation: livePulse 1.4s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.live-badge {
    margin-left: auto;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    background: rgba(0, 212, 255, 0.12);
    border: 1px solid rgba(0, 212, 255, 0.35);
    color: var(--primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease, transform 0.3s ease;
}

.live-badge.is-updating {
    transform: scale(1.06);
}

#heroChart {
    width: 100% !important;
    height: 200px !important;
    position: relative;
    z-index: 2;
}

/* Sections */
.section-padding {
    padding: 4rem 0;
    position: relative;
}

#perfil.section-padding {
    padding-top: 3rem;
}

.section-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.section-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.section-subtitle {
    color: var(--text-muted);
    max-width: 640px;
    margin: 1rem auto 0;
}

.title-line {
    width: 56px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), transparent);
    margin: 0 auto;
    border-radius: 2px;
}

.glassmorphism {
    background: rgba(26, 26, 46, 0.55);
    backdrop-filter: blur(12px);
    border-radius: var(--radius);
    padding: 2rem;
    border: 1px solid rgba(0, 212, 255, 0.15);
    transition: var(--transition);
    height: 100%;
}

.glassmorphism:hover {
    border-color: rgba(0, 212, 255, 0.4);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.profile-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.tech-skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tech-skills-list span {
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.2);
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    font-size: 0.82rem;
    transition: var(--transition);
}

.tech-skills-list span:hover {
    border-color: rgba(0, 212, 255, 0.45);
    background: rgba(0, 212, 255, 0.12);
}

.profile-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.profile-card p {
    color: var(--text-muted);
    font-size: 1.02rem;
}

.experience-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    height: 100%;
}

.exp-card {
    background: rgba(26, 26, 46, 0.55);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    border: 1px solid rgba(0, 212, 255, 0.12);
    transition: var(--transition);
}

.exp-card:hover {
    border-color: rgba(0, 212, 255, 0.35);
    transform: translateY(-4px);
}

.exp-card i {
    font-size: 1.75rem;
    color: var(--primary);
}

.exp-card h4 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.5rem 0 0.25rem;
}

.exp-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.service-card,
.project-card {
    background: rgba(10, 10, 15, 0.7);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 1.75rem;
    border: 1px solid rgba(0, 212, 255, 0.1);
    transition: var(--transition);
}

.service-card:hover,
.project-card:hover {
    transform: translateY(-6px);
    border-color: rgba(0, 212, 255, 0.35);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.service-icon,
.project-image {
    color: var(--primary);
    margin-bottom: 1rem;
}

.service-icon {
    font-size: 2.25rem;
}

.service-tech {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--primary);
    margin-top: 1rem;
    opacity: 0.9;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1rem;
}

.project-tags span {
    background: rgba(0, 212, 255, 0.12);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
}

.skills-cloud {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.skill-item {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.08), rgba(108, 99, 255, 0.08));
    border: 1px solid rgba(0, 212, 255, 0.25);
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.skill-item:hover {
    transform: scale(1.04);
    box-shadow: var(--neon-glow);
}

.dashboard-showcase {
    padding: 3rem 0;
    background: rgba(0, 0, 0, 0.25);
}

.live-dashboard {
    background: rgba(5, 5, 8, 0.85);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.live-dashboard h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

#liveDashboard {
    width: 100% !important;
    height: 260px !important;
}

.dashboard-metrics {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.metric {
    background: rgba(0, 212, 255, 0.06);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.metric-value {
    color: var(--primary);
    font-weight: 600;
}

.contact-section {
    background: linear-gradient(180deg, var(--dark), var(--darker));
}

.contact-info {
    font-style: normal;
    margin-top: 1.5rem;
}

.contact-info div {
    margin: 0.75rem 0;
}

.contact-info a {
    color: #fff;
    text-decoration: none;
}

.contact-info a:hover {
    color: var(--primary);
}

.glass-form {
    background: rgba(26, 26, 46, 0.5);
    backdrop-filter: blur(12px);
    padding: 1.75rem;
    border-radius: var(--radius);
    border: 1px solid rgba(0, 212, 255, 0.15);
}

.glass-form .form-label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.glass-form .form-control {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(0, 212, 255, 0.25);
    color: #fff;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
}

.glass-form .form-control::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.glass-form .form-control:focus {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
    color: #fff;
}

.glass-form select.form-control option {
    background: var(--dark);
    color: #fff;
}

.form-alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.form-alert--error {
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid rgba(220, 53, 69, 0.4);
    color: #f8a5ae;
}

.form-alert--success {
    background: rgba(25, 135, 84, 0.15);
    border: 1px solid rgba(25, 135, 84, 0.4);
    color: #a3cfbb;
}

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.site-toast {
    padding: 0.85rem 1.25rem;
    border-radius: 10px;
    background: var(--gray);
    border: 1px solid var(--primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    max-width: 320px;
}

.site-toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.site-toast--success {
    border-color: #198754;
}

footer {
    background: #050508;
    padding: 2rem 0;
    border-top: 1px solid rgba(0, 212, 255, 0.12);
}

footer small {
    color: var(--text-muted);
}

.scroll-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
    margin: 2rem auto 0;
    padding: 0.25rem 0.5rem;
    z-index: 2;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.scroll-indicator:hover .mouse,
.scroll-indicator:focus-visible .mouse {
    border-color: var(--primary);
    box-shadow: 0 0 14px rgba(0, 212, 255, 0.45);
}

.scroll-indicator__label {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

.scroll-indicator:hover .scroll-indicator__label,
.scroll-indicator:focus-visible .scroll-indicator__label {
    color: var(--primary);
}

.mouse {
    display: block;
    width: 28px;
    height: 44px;
    border: 2px solid rgba(0, 212, 255, 0.65);
    border-radius: 14px;
    position: relative;
    background: rgba(0, 212, 255, 0.06);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

.mouse::before {
    content: '';
    width: 5px;
    height: 9px;
    background: var(--primary);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 9px;
    border-radius: 3px;
    animation: mouse-wheel 2s ease-in-out infinite;
}

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

/* Tablet / iPad (incl. iPad Pro en portrait ~1024px y landscape ~1366px) */
@media (max-width: 1199px) {
    .hero-section {
        padding-top: calc(var(--nav-height) + 0.75rem);
        padding-bottom: 1.25rem;
    }

    .hero-visual {
        margin-top: 0.25rem;
    }

    .floating-dashboard {
        margin-top: 0.5rem;
    }

    .tech-stats {
        margin-top: 1.5rem !important;
    }

    .scroll-indicator {
        margin-top: 1.5rem;
    }
}

@media (min-width: 1200px) {
    .hero-section {
        padding-top: calc(var(--nav-height) + 1.25rem);
        padding-bottom: 1.5rem;
    }

    .scroll-indicator {
        margin-top: 2.25rem;
    }
}

@media (max-width: 991px) {
    .hero-section {
        padding-top: calc(var(--nav-height) + 0.5rem);
    }

    .hero-content h1,
    .hero-content .display-4 {
        font-size: clamp(1.75rem, 5vw, 2.25rem);
    }
}

@media (max-width: 768px) {
    .section-padding {
        padding: 3.5rem 0;
    }

    .tech-stats {
        justify-content: center;
    }

    .experience-grid {
        grid-template-columns: 1fr;
    }

    .toast-container {
        left: 1rem;
        right: 1rem;
    }

    .site-toast {
        max-width: none;
    }
}

@media (max-width: 576px) {
    .hero-buttons .btn {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
    }
}
