* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #222221;
    --secondary-color: #2e2d2a;
    --dark-bg: #cadec9;
    --darker-bg: #b9d3b9;
    --card-bg: #4a764e;
    --text-primary: #000000;
    --text-secondary: #131313;
    --danger-color: #ff0055;
    --warning-color: #ffaa00;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--darker-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* FONDO DE MAÍZ ANIMADO */
.corn-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.corn-bg span {
    position: absolute;
    bottom: -50px;
    font-size: 1.2rem;
    animation: cornFloat 12s linear infinite;
    opacity: 0.3;
}

@keyframes cornFloat {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(-110vh) translateX(20px);
        opacity: 0;
    }
}

/* HEADER Y NAVBAR */

.header {
    position: fixed;
    top: 0;
    width: 100%;
    background: #125a24;
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 255, 157, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo img {
    max-width: 64px;
    height: auto;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 0 20px rgba(0, 255, 157, 0.5);
}

/* Menú escritorio */

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

.nav-menu a:hover::after {
    width: 100%;
}

/* BOTÓN MENÚ MÓVIL */

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.2);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(6px);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    padding: 6px;
    transition: background 0.3s ease, transform 0.2s ease;
}

.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: #ffffff;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Animación del icono al abrir */

.menu-toggle.open span:nth-child(1) {
    transform: translateY(4px) rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
    transform: translateY(-4px) rotate(-45deg);
}

/* HERO */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8rem 2rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
    gap: 3rem;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.glitch {
    font-size: 4rem;
    font-weight: 900;
    text-transform: uppercase;
    position: relative;
    color: var(--primary-color);
    letter-spacing: 3px;
    animation: glitch 2s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
}

.glitch::before {
    animation: glitchTop 3s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
}

.glitch::after {
    animation: glitchBottom 2.5s infinite;
    clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
}

@keyframes glitch {
    0%, 100% { text-shadow: 0 0 20px rgba(0, 255, 157, 0.5); }
    10%, 30%, 50%, 70%, 90% { text-shadow: 0 0 20px rgba(0, 255, 157, 0.5); }
    20%, 40%, 60% { text-shadow: -2px 0 rgba(255, 0, 85, 0.7), 2px 0 rgba(0, 212, 255, 0.7); }
}

@keyframes glitchTop {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, -2px); }
    40% { transform: translate(-2px, 2px); }
    60% { transform: translate(2px, -2px); }
    80% { transform: translate(2px, 2px); }
}

@keyframes glitchBottom {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(2px, 2px); }
    40% { transform: translate(2px, -2px); }
    60% { transform: translate(-2px, 2px); }
    80% { transform: translate(-2px, -2px); }
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin: 1rem 0 2rem;
}

.cta-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.btn-primary, .btn-secondary {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--darker-bg);
    box-shadow: 0 0 20px rgba(0, 255, 157, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 255, 157, 0.5);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--darker-bg);
    transform: translateY(-3px);
}

.hero-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.shield-animation {
    position: relative;
    width: 300px;
    height: 300px;
}

.shield-layer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 240px;
    border: 2px solid var(--primary-color);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    animation: shieldPulse 3s ease-in-out infinite;
    opacity: 0.6;
}

.shield-layer:nth-child(2) {
    width: 240px;
    height: 280px;
    border-color: var(--secondary-color);
    animation-delay: 1s;
}

.shield-layer:nth-child(3) {
    width: 280px;
    height: 320px;
    border-color: var(--primary-color);
    animation-delay: 2s;
}

@keyframes shieldPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.2;
    }
}

/* SECCIONES Y GRIDS */

.stats {
    background: rgba(117, 195, 117, 0.5);
    padding: 3rem 2rem;
    backdrop-filter: blur(10px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary-color);
    text-shadow: 0 0 20px rgba(0, 255, 157, 0.5);
}

.stat-item p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 0.5rem;
}

.services {
    padding: 6rem 2rem;
}

.section-title {
    text-align: center;
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 3rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.service-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid rgba(99, 179, 195, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.service-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 40px rgba(0, 255, 157, 0.2);
}

.service-icon {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.service-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.service-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.threats {
    padding: 6rem 2rem;
    background: rgba(123, 206, 126, 0.3);
}

.threats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.threat-item {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    border-left: 4px solid var(--danger-color);
}

.threat-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.threat-item h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.threat-item p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.threat-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.threat-level {
    height: 100%;
    background: linear-gradient(90deg, var(--warning-color), var(--danger-color));
    border-radius: 4px;
    animation: loadBar 2s ease-out forwards;
}

@keyframes loadBar {
    from { width: 0; }
}

.threat-percentage {
    color: var(--warning-color);
    font-size: 0.9rem;
    font-weight: 600;
}

/* CONTACTO */

.contact {
    padding: 6rem 2rem;
}

.contact-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

.contact-info h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.contact-info p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-detail-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
}

.contact-detail-item svg {
    color: var(--primary-color);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-form input,
.contact-form textarea {
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid rgba(0, 255, 157, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.2);
}

.contact-form textarea {
    resize: vertical;
    min-height: 120px;
}

/* FOOTER */

.footer {
    background: var(--darker-bg);
    text-align: center;
    padding: 2rem;
    border-top: 1px solid rgba(0, 255, 157, 0.1);
}

.footer p {
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

/* =========================
   MEDIA QUERIES
   ========================= */

/* Tablets / pantallas medianas */
@media (max-width: 992px) {
    .hero {
        padding: 7rem 1.5rem 3rem;
        gap: 2rem;
    }

    .glitch {
        font-size: 3rem;
    }

    .section-title {
        font-size: 2.4rem;
    }

    .contact-container {
        gap: 3rem;
    }
}

/* Móviles */
@media (max-width: 768px) {

    /* HEADER MÁS CÓMODO EN MÓVIL */
    .nav-container {
        padding: 0.4rem 0.9rem;
        gap: 0.5rem;
    }

    .logo img {
        max-width: 44px;
        height: auto;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    /* Mostrar botón hamburguesa */
    .menu-toggle {
        display: flex;
    }

    /* Menú desplegable, ya no todo apretado arriba */
    .nav-menu {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        margin: 0;
        padding: 0.8rem 1.3rem 1.3rem;
        flex-direction: column;
        gap: 0.7rem;
        background: rgba(18, 90, 36, 0.97);
        border-bottom-left-radius: 16px;
        border-bottom-right-radius: 16px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);

        /* truco para que se oculte/abra suave */
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transform: translateY(-10px);
        transition:
            max-height 0.3s ease,
            opacity 0.25s ease,
            transform 0.25s ease;
    }

    .nav-menu.open {
        max-height: 400px;   /* bastante para los 4 items, así "Acceder" siempre entra */
        opacity: 1;
        transform: translateY(0);
    }

    .nav-menu li {
        list-style: none;
    }

    .nav-menu a {
        display: block;
        width: 100%;
        padding: 0.35rem 0;
        font-size: 0.98rem;
    }

    .nav-menu a::after {
        bottom: 0;
    }

    /* HERO EN COLUMNA Y MÁS RESPIRABLE */
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 6.5rem 1.25rem 3rem; /* deja espacio para el header fijo */
        gap: 1.8rem;
    }

    .hero-content {
        max-width: 100%;
    }

    .glitch {
        font-size: 2.5rem;
        letter-spacing: 2px;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .cta-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-visual {
        margin-top: 1.5rem;
    }

    .shield-animation {
        width: 220px;
        height: 220px;
    }

    .shield-layer {
        width: 170px;
        height: 200px;
    }

    .shield-layer:nth-child(2) {
        width: 200px;
        height: 230px;
    }

    .shield-layer:nth-child(3) {
        width: 230px;
        height: 260px;
    }

    /* Ajustes generales de secciones en móvil */
    .services,
    .threats,
    .contact,
    .stats {
        padding: 4rem 1.25rem;
    }

    .section-title {
        font-size: 2.1rem;
        margin-bottom: 2rem;
    }

    .services-grid,
    .threats-container {
        grid-template-columns: 1fr;
    }

    .container {
        grid-template-columns: 1fr;
    }

    .stat-number {
        font-size: 2.4rem;
    }

    .contact-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {

    .logo-text {
        font-size: 1.2rem;
    }

    .logo img {
        max-width: 52px;
    }

    .hero {
        padding-top: 6rem;
        padding-inline: 1rem;
    }

    .glitch {
        font-size: 2.1rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .service-card,
    .threat-item {
        padding: 1.5rem;
    }

    .contact-info h3 {
        font-size: 1.6rem;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}
