/* --- VARIABLES DE COLOR --- */
:root {
    --color-red: #C20000;
    /* Rojo Construcción */
    --color-dark: #2B2B2B;
    /* Gris Oscuro / Negro */
    --color-light: #D9D9D9;
    /* Gris Claro Fondo */
    --color-blue: #0057B8;
    /* Azul Acción */
    --color-white: #FFFFFF;
    --transition-speed: 0.3s;
}

/* --- Reset y Estilos Base --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--color-light);
    color: var(--color-dark);
    min-height: 100vh;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* --- Nubes Decorativas  --- */
.cloud {
    position: absolute;
    opacity: 0.6;
    pointer-events: none;
    z-index: 1;
}

.cloud svg {
    width: 100%;
    height: auto;
    stroke: var(--color-dark);
    stroke-width: 2px;
    fill: var(--color-white);
}

.cloud-1 {
    top: 10%;
    width: 80px;
    animation: floatY 4s ease-in-out infinite alternate,
        driftRightToLeft 25s linear infinite;
}

.cloud-2 {
    top: 25%;
    width: 60px;
    animation: floatY 5s ease-in-out infinite alternate,
        driftRightToLeft 35s linear infinite;
}

.cloud-3 {
    top: 15%;
    width: 90px;
    animation: floatY 4.5s ease-in-out infinite alternate,
        driftLeftToRight 30s linear infinite;
}

.cloud-4 {
    bottom: 15%;
    width: 70px;
    animation: floatY 6s ease-in-out infinite alternate,
        driftLeftToRight 40s linear infinite;
}

/* Marca de agua de fondo */
.bg-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(10vw, 21vw, 240px);
    font-weight: 900;
    color: var(--color-dark);
    opacity: 0.05;
    z-index: 0;
    pointer-events: none;
    user-select: none;
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
}

/* --- Contenedor Principal --- */
.main-container {
    background-color: var(--color-white);
    padding: 3.75rem;
    border-radius: 4px;
    box-shadow: 0 1.25rem 3.75rem rgba(0, 0, 0, 0.2);
    text-align: center;
    z-index: 10;
    max-width: 37.5rem;
    width: 90%;
    position: relative;
    animation: containerEntry 1s ease-out 0.5s forwards;
    opacity: 0;
    transform: translateY(20px);
    border-top: 5px solid var(--color-red);
}

/* --- Ilustración SVG --- */
.illustration-wrapper {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
}

.main-svg {
    max-width: 100%;
    height: auto;
    overflow: visible;
}

.stroke-dark {
    stroke: var(--color-dark);
    stroke-width: 2.5px;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.fill-red {
    fill: var(--color-red);
    stroke: none;
}

.fill-blue {
    fill: var(--color-blue);
    stroke: none;
}

.no-stroke {
    stroke: none;
}

/* --- Animaciones SVG --- */
#crane-arm-group {
    transform-origin: 60px 40px;
    animation: craneSwing 8s ease-in-out infinite alternate;
}

#active-cable {
    transform-origin: 0 0;
    animation: cableStretch 8s linear infinite;
}

#active-hook {
    animation: hookMove 8s linear infinite;
}

#active-page {
    transform-box: fill-box;
    transform-origin: center;
    animation: pageMove 8s linear infinite;
}

/* Efecto Scanline */
.screen-overlay {
    position: absolute;
    top: 8.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: 11.25rem;
    height: 6.25rem;
    pointer-events: none;
    overflow: hidden;
    z-index: 15;
}

.screen-overlay::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
            transparent,
            rgba(0, 87, 184, 0.2) 50%,
            transparent);
    animation: scanline 8s linear infinite;
    opacity: 0.3;
}

/* --- Tipografía --- */
h1 {
    font-family: 'Roboto', sans-serif;
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    margin-bottom: 1rem;
    color: var(--color-dark);
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.2;
    font-weight: 700;
}

p {
    font-size: clamp(0.875rem, 2vw, 1rem);
    line-height: 1.6;
    color: #555;
    margin-bottom: 3rem;
}

/* --- Botones Principales --- */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2.5rem;
}

.btn {
    display: inline-block;
    text-decoration: none;
    color: var(--color-blue);
    font-weight: bold;
    font-size: 0.875rem;
    border: 2px solid var(--color-blue);
    padding: 0.875rem 2rem;
    border-radius: 4px;
    background-color: transparent;
    transition: all var(--transition-speed) ease;
    cursor: pointer;
    white-space: nowrap;
}

.btn:hover,
.btn:focus {
    background-color: var(--color-blue);
    color: var(--color-white);
    transform: scale(1.05);
    outline: 2px solid var(--color-blue);
    outline-offset: 2px;
}

.btn:active {
    transform: scale(0.98);
}

/* --- Links Secundarios --- */
.secondary-links {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.875rem;
    line-height: 1.8;
}

.secondary-links a {
    color: #888;
    text-decoration: none;
    transition: color var(--transition-speed) ease;
    padding: 0.25rem;
}

.secondary-links a:hover,
.secondary-links a:focus {
    color: var(--color-blue);
    text-decoration: underline;
    outline: none;
}

/* --- Animaciones Keyframes --- */
@keyframes containerEntry {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes floatY {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-15px);
    }
}

@keyframes driftRightToLeft {
    from {
        left: 100vw;
    }

    to {
        left: -200px;
    }
}

@keyframes driftLeftToRight {
    from {
        left: -200px;
    }

    to {
        left: 100vw;
    }
}

@keyframes craneSwing {
    0% {
        transform: rotate(-2deg);
    }

    100% {
        transform: rotate(2deg);
    }
}

@keyframes scanline {
    0% {
        top: -100%;
    }

    100% {
        top: 200%;
    }
}

@keyframes cableStretch {
    0% {
        transform: scaleY(1);
    }

    20% {
        transform: scaleY(3.2);
    }

    25% {
        transform: scaleY(3.2);
    }

    45% {
        transform: scaleY(1.7);
    }

    50% {
        transform: scaleY(1.7);
    }

    70% {
        transform: scaleY(3.2);
    }

    75% {
        transform: scaleY(3.2);
    }

    95% {
        transform: scaleY(1);
    }

    100% {
        transform: scaleY(1);
    }
}

@keyframes hookMove {
    0% {
        transform: translateY(0);
    }

    20% {
        transform: translateY(102px);
    }

    25% {
        transform: translateY(72px);
    }

    45% {
        transform: translateY(20px);
    }

    50% {
        transform: translateY(20px);
    }

    70% {
        transform: translateY(72px);
    }

    75% {
        transform: translateY(72px);
    }

    95% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(0);
    }
}

@keyframes pageMove {
    0% {
        transform: translateY(72px);
    }

    20% {
        transform: translateY(72px);
    }

    25% {
        transform: translateY(72px);
    }

    45% {
        transform: translateY(20px);
    }

    50% {
        transform: translateY(20px);
    }

    70% {
        transform: translateY(72px);
    }
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .main-container {
        padding: 2rem 1.5rem;
    }

    h1 {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }

    p {
        font-size: 0.875rem;
        margin-bottom: 2rem;
    }

    .btn {
        font-size: 0.8125rem;
        padding: 0.75rem 1.5rem;
    }

    .screen-overlay {
        display: none;
    }

    .btn-group {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .cloud {
        display: none;
    }

    .bg-watermark {
        font-size: 15vw;
    }
}

/* --- Mejoras de accesibilidad --- */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible para navegación por teclado */
:focus-visible {
    outline: 3px solid var(--color-blue);
    outline-offset: 2px;
}