/* =========================================
   VARIABLES & GLOBAL CONFIG
   ========================================= */
:root {
    --msx-blue-dark:   #1A237E;
    --msx-blue-medium: #283593;
    --msx-cyan-accent: #68A3E2;
    --msx-text-light:  #F0F0F0;
    --msx-white:       #FFFFFF;

    --bg-color: var(--msx-blue-dark);
    --card-bg-color: var(--msx-blue-medium);
    --accent-color: var(--msx-cyan-accent);
    --text-color: var(--msx-text-light);
    --header-color: var(--msx-white);
    --border-color: rgba(104, 163, 226, 0.25);

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    color: var(--text-color);
    line-height: 1.7;
    background-color: var(--bg-color);
    background-image: 
        linear-gradient(rgba(8, 16, 32, 0.50), rgba(8, 16, 32, 0.50)),
        url('images/bg_msx.webp');
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

main { max-width: 960px; margin: 40px auto; padding: 0 20px; }
section { margin-bottom: 60px; }

/* =========================================
   TYPOGRAPHY & BASIC LINKS
   ========================================= */
h2, h3 { font-family: var(--font-mono); color: var(--header-color); line-height: 1.3; margin-bottom: 20px; }
h2 { font-size: 2rem; border-bottom: 2px solid var(--border-color); padding-bottom: 10px; }
h3 { font-size: 1.25rem; color: var(--accent-color); }
p { margin-bottom: 15px; }

/* Enlaces generales (dentro de párrafos) */
a { 
    color: var(--accent-color); 
    text-decoration: none; 
    font-weight: bold; 
    padding: 2px 6px; 
    margin: -2px -6px; 
    border-radius: 4px; 
    transition: background-color 0.2s ease, color 0.2s ease; 
}
a:hover { background-color: rgba(104, 163, 226, 0.15); color: var(--msx-white); }
img { max-width: 100%; height: auto; display: block; border-radius: 8px; }

/* =========================================
   HERO SECTION & ACTION BUTTONS
   ========================================= */
.hero { text-align: center; padding: 40px 20px 0 20px; background-color: transparent; }
.hero-image { max-width: 600px; margin: 0 auto; }

/* Contenedor de la botonera */
.hero-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    margin-bottom: 40px;
    width: 100%;
}

/* Grupo de botones principales */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

/* Estilo Base Botón */
.btn {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 1rem;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    text-align: center;
    /* Reseteo de márgenes de enlace genérico */
    margin: 0; 
}

/* Botón Primario (Descarga) */
.btn-primary {
    background-color: var(--accent-color);
    color: var(--bg-color);
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(104, 163, 226, 0.4);
}
.btn-primary:hover {
    background-color: var(--msx-white);
    color: var(--bg-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(104, 163, 226, 0.6);
}

/* Botones Secundarios (Docs/Ghost) */
.btn-secondary {
    background-color: transparent;
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.btn-secondary:hover {
    background-color: rgba(104, 163, 226, 0.15);
    color: var(--msx-white);
    border-color: var(--msx-white);
}

/* Switch de Idioma */
.lang-switch {
    font-size: 0.85rem;
    color: #aaa;
    border: 1px solid #444;
    padding: 5px 12px;
    border-radius: 20px;
    background-color: rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    /* Sobrescribir estilos de enlace genérico */
    margin: 0;
}
.lang-switch:hover {
    background-color: var(--card-bg-color);
    color: var(--msx-white);
    border-color: var(--accent-color);
}

/* =========================================
   CONTENT BLOCKS (Grid, Video, Features)
   ========================================= */
.link-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; text-align: center; }
.link-box { background-color: var(--card-bg-color); padding: 20px; border-radius: 8px; border: 1px solid var(--border-color); }
.link-box img { max-height: 80px; margin: 0 auto 15px auto; }

.video-wrapper { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; background: #000; border-radius: 8px; }
.video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.feature-item { background-color: var(--card-bg-color); padding: 25px; border-radius: 8px; border-left: 8px solid var(--accent-color); }

/* =========================================
   GALLERIES
   ========================================= */
.screenshot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 40px 0; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; }

/* Reset de enlaces para imágenes */
.screenshot-grid a, .gallery-grid a { display: block; margin: 0; padding: 0; border-radius: 8px; }
.screenshot-grid a:hover, .gallery-grid a:hover { background-color: transparent; }

.screenshot-grid img, .gallery-grid img { border: 1px solid var(--border-color); transition: transform 0.3s ease, box-shadow 0.3s ease; cursor: zoom-in; }
.screenshot-grid a:hover img, .gallery-grid a:hover img { transform: scale(1.05); box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); }

/* =========================================
   CALL TO ACTION (Footer Area)
   ========================================= */
.call-to-action { text-align: center; background-color: var(--card-bg-color); padding: 40px 20px; border-radius: 8px; }
.call-to-action .button { 
    display: inline-block; 
    background-color: var(--accent-color); 
    color: var(--bg-color); 
    padding: 15px 30px; 
    font-family: var(--font-mono); 
    font-size: 1.1rem; 
    border-radius: 5px; 
    margin-top: 15px; 
    text-decoration: none; 
    transition: background-color 0.3s ease; 
}
.call-to-action .button:hover { background-color: var(--msx-white); color: var(--bg-color); }

/* =========================================
   FOOTER
   ========================================= */
footer {
    text-align: center;
    background-color: var(--card-bg-color);
    padding: 30px 20px;
    margin-top: 60px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
footer p { margin-bottom: 0; font-size: 0.9rem; color: #ddd; }
.footer-separator { color: var(--border-color); margin: 0 10px; }
footer a { color: #bbb; font-weight: bold; }
footer a:hover { background-color: rgba(104, 163, 226, 0.15); color: var(--msx-white); }

/* =========================================
   MOBILE RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
    body { font-size: 15px; }
    main { margin: 20px auto; padding: 0 15px; }
    h2 { font-size: 1.6rem; }
    .hero { padding-top: 20px; }
    .hero-image { max-width: 90%; }
    
    #external-links, .screenshot-grid { grid-template-columns: 1fr; }
    .feature-item, .link-box, .call-to-action, footer { padding: 20px; }
    
    /* Enlaces genéricos en móvil (texto corrido) */
    a {
        padding: 0;
        margin: 0;
        text-decoration: underline;
        text-underline-offset: 3px;
        background-color: transparent;
    }
    a:hover { background-color: transparent; color: var(--accent-color); }

    /* Excepción para botones de llamada a la acción y botonera */
    .call-to-action .button,
    .call-to-action .button:hover {
        text-decoration: none;
    }

    /* AJUSTE BOTONERA HERO EN MÓVIL (Full Width & Touch Friendly) */
    .hero-actions { padding: 0; }
    .hero-actions .btn-group { flex-direction: column; width: 100%; gap: 10px; }
    
    .hero-actions .btn {
        width: 100%;
        display: block;
        text-decoration: none !important; /* Fuerza sin subrayado */
        padding: 14px;
        margin: 0;
    }

    /* Switch idioma móvil */
    .lang-switch {
        width: 100%;
        justify-content: center;
        padding: 12px;
        margin-top: 10px;
        text-decoration: none !important;
    }
}