/* --- RESET Y ESTILOS GLOBALES --- */
/* (Header eliminado para experiencia inmersiva) */

:root {
    --brand: #ef7145;
    --navy: #071a3d;
    --blue: #0b4fe0;
    --color-success: #28a745;
    --color-info: #17a2b8;
    --color-warning: #fd7e14;
}

/* Respeta la preferencia de movimiento reducido del sistema operativo */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

html {
    /* Esto hace que el salto sea una animación fluida en navegadores modernos */
    scroll-behavior: smooth;
}

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

body {
    font-family: 'Arimo', Arial, sans-serif;
    color: #333;
    line-height: 1.6;
    background-color: #fff;
}

/* Contenedor principal para centrar contenido */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

h1,
h2,
h3,
h4 {
    color: var(--navy);
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
}

p {
    color: #555;
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    color: inherit;
}

a:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 3px;
    border-radius: 2px;
}

/* --- UTILIDAD DE ANIMACIÓN GLOBAL (SCROLL REVEAL) --- */
/* Por defecto el contenido es visible: si JS no corre, no debe quedar oculto. */
.js .reveal-up {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    /* Curva suave y elegante */
    will-change: opacity, transform;
}

.js .reveal-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- SECCIÓN 4: SOBRE MÍ (Texto + Imagen) --- */
.about {
    display: flex;
    align-items: center;
    gap: 60px;
    margin-top: 50px;
    margin-bottom: 20px;
    background-color: #f9f9f9;
    /* Fondo sutil para diferenciar */
}

.about-text {
    flex: 1;
}

.brand-logo {
    display: block;
    width: 140px;
    height: auto;
    margin-bottom: 25px;
}

.about-text h1 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    line-height: 1.3;
}

.about-image {
    flex: 1;
}

.about-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.btn-link {
    display: inline-block;
    margin-top: 10px;
    font-weight: 600;
    color: var(--brand);
    border-bottom: 2px solid var(--brand);
}

/* --- SECCIÓN PROYECTOS (X-RAY GALLERY) --- */
.projects {
    padding: 20px 0 100px 0;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 40px;
}

/* Tarjeta Base */
.project-card {
    position: relative;
    height: 350px;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.8s cubic-bezier(0.2, 1, 0.3, 1);
    background-color: #f0f0f0;
    /* Fallback */
}

/* Estado inicial animación entrada (solo si JS corre) */
.js .project-card {
    opacity: 0;
    transform: translateY(30px);
}

.js .project-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

/* Overlay & Header */
.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.8) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    transition: background 0.3s ease;
}

.project-card:hover .card-overlay {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.9) 100%);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2;
}

.card-header h3 {
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 0;
}

.card-header h3 a {
    transition: color 0.2s ease;
}

.card-header h3 a:hover,
.card-header h3 a:focus-visible,
.project-card:hover .card-header h3 a {
    color: var(--brand);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Toda la tarjeta es clickeable: el link del título se estira sobre la tarjeta */
.card-header h3 a::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* El switch del panel técnico queda por encima del link */
.admin-toggle {
    position: relative;
    z-index: 2;
}

.project-summary {
    color: #f0f0f0;
    text-align: center;
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 500;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.8);
    margin: auto;
    max-width: 90%;

    /* Legibilidad mejorada */
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    padding: 10px 15px;
    border-radius: 8px;
}

/* Hint de descubribilidad del modo admin */
.admin-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-toggle-icon {
    font-size: 0.95rem;
    line-height: 1;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Switch (Modo Admin) */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch input:focus-visible+.slider {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: .4s;
    backdrop-filter: blur(4px);
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--brand);
    border-color: var(--brand);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Panel X-Ray (Admin Mode) */
.admin-panel {
    position: absolute;
    inset: 0;
    background: rgba(7, 26, 61, 0.92);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1;
    pointer-events: none;
    /* Dejar pasar clicks si está oculto */
}

/* Clase activa controlada por JS (Selector Hermano no funcionaría bien por estructura, usaremos JS) */
.admin-panel.is-active {
    opacity: 1;
    pointer-events: auto;
}

.console-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: #ccc;
    text-align: left;
    width: 100%;
}

.console-text p {
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 4px;
    color: #e0e0e0;
}

.status-online {
    color: var(--color-success);
    font-weight: bold;
}

.status-legacy {
    color: var(--color-info);
    font-weight: bold;
}

.status-building {
    color: var(--color-warning);
    font-weight: bold;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    50% {
        opacity: 0.5;
    }
}

/* Cartas Especiales */
.building-card {
    background: linear-gradient(135deg, #0e2a5c 0%, var(--navy) 100%);
    border: 1px dashed var(--blue);
}

.promo-card {
    background: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.card-content {
    padding: 20px;
    color: #fff;
}

.card-content h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #fff;
}

.btn-start {
    display: inline-block;
    padding: 10px 25px;
    background: #fff;
    color: var(--brand);
    font-weight: 700;
    border-radius: 30px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-start:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* --- SECCIÓN 7: FOOTER / CTA --- */
.footer-logo {
    display: block;
    width: 160px;
    height: auto;
    margin-bottom: 20px;
}

.footer-cta {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 60px 0;
    border-top: 1px solid #eee;
}

.cta-left h2 {
    font-size: 2.5rem;
    max-width: 300px;
    line-height: 1.1;
}

.cta-right {
    text-align: right;
}

.cta-socials {
    margin-bottom: 20px;
}

.cta-socials p,
.cta-contact p {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: #999;
}

/* Links de Contacto y Redes (Unificados) */
.btn-contact-nav {
    font-weight: 700;
    margin-left: 10px;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.btn-contact-nav:hover {
    color: var(--brand);
}

/* Resaltado al llegar desde el botón "Empezar" */
.cta-contact.is-highlighted .btn-contact-nav {
    animation: contactPulse 0.9s ease-in-out 0.4s 3;
}

@keyframes contactPulse {
    50% {
        color: var(--brand);
    }
}

/* --- ANIMACIONES DE TÍTULOS (Estilo Premium) --- */
.title-animate {
    position: relative;
    display: table;
    /* Fallback para fit-content */
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.js .title-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.2s ease-out, transform 1.2s ease-out;
}

/* Pseudo-elemento para el subrayado dinámico */
.title-animate::after {
    content: '';
    position: absolute;
    bottom: -10px;
    /* Separación del texto */
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    /* Ancho final estético (visible por defecto sin JS) */
    height: 4px;
    /* Grosor de la línea */
    background-color: var(--brand);
    border-radius: 2px;
}

.js .title-animate::after {
    width: 0;
    /* Empieza invisible, solo si JS corre */
    transition: width 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    transition-delay: 0.4s;
    /* Espera a que el texto suba un poco */
}

/* Estado Visible (Activado por JS) */
.title-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

.js .title-animate.visible::after {
    width: 60px;
    /* Ancho final estético */
}

/* --- RESPONSIVE (Móvil) --- */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    section {
        padding: 60px 0;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        padding: 0 10px;
    }

    .projects {
        padding-bottom: 0;
        margin-bottom: 120px;
    }

    .about {
        flex-direction: column;
        text-align: center;
    }

    .about-image,
    .about-text {
        width: 100%;
        margin: 0;
    }

    .brand-logo,
    .footer-logo {
        margin-left: auto;
        margin-right: auto;
    }

    .footer-cta {
        flex-direction: column;
        align-items: center;
        gap: 30px;
        text-align: center;
        margin-top: 50px;
    }

    .cta-right {
        text-align: center;
    }

    .social-icons {
        justify-content: center;
    }
}
