/* ===========================
   MOBILE FIRST APPROACH
   =========================== */

/* Base styles - Mobile */
html {
    scroll-behavior: smooth;
    font-size: 16px;
}

html,
body {
    min-width: 320px;
    margin: 0;
    padding: 0;
    color: #2c3e50;
    background-color: #fff;
    font-family: 'Open Sans', Arial, sans-serif;
    line-height: 1.6;
}

/* Botones optimizados para mobile */
button {
    background-color: #3498db;
    color: white;
    border-radius: 12px;
    cursor: pointer;
    min-width: 140px;
    min-height: 48px; /* Área táctil mínima recomendada */
    font-size: 1rem;
    font-weight: 600;
    border: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

button:hover,
button:focus {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

button:active {
    transform: translateY(0);
}

/* Navegación mobile-first */
#navbar {
    position: sticky;
    top: 0;
    background-color: #fff;
    border-bottom: 3px solid #3498db;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    width: 100%;
    padding: 0;
}

#navbar ul {
    padding: 0;
    margin: 0;
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

#navbar ul.open {
    max-height: 100vh;
    overflow-y: auto;
}

#navbar li {
    border-bottom: 1px solid #ecf0f1;
    list-style: none;
}

#navbar a {
    display: block;
    padding: 16px 20px;
    color: #2c3e50;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    /* Área táctil adecuada */
    min-height: 48px;
}

#navbar a:hover,
#navbar a:focus {
    background-color: #ecf0f1;
    color: #3498db;
    padding-left: 28px;
}

#navbar a:active {
    background-color: #d5dbdb;
}

/* Headers optimizados */
header {
    color: #2c3e50;
    margin: 1.5rem 0;
    text-align: left;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
}

#main-doc header {
    text-align: left;
    margin: 1.5rem 0 1rem;
    border-left: 4px solid #3498db;
    padding-left: 1rem;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 1rem 0;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #34495e;
    margin: 1.25rem 0 0.75rem;
}

h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #34495e;
    margin: 1rem 0 0.5rem;
}

/* Contenido principal mobile */
#main-doc {
    position: relative;
    padding: 1.25rem;
    margin-bottom: 80px;
    max-width: 100%;
}

/* Artículos y contenido */
section {
    margin-bottom: 2rem;
}

section article {
    color: #2c3e50;
    margin: 0;
    font-size: 1rem;
    line-height: 1.7;
}

section article p {
    margin: 1rem 0;
    text-align: justify;
}

section li {
    margin: 0.75rem 0 0.75rem 1.25rem;
    line-height: 1.6;
}

section ul,
section ol {
    padding-left: 1rem;
}

/* Separadores */
.separador {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 1rem;
    padding: 0.75rem;
    background-color: #ecf0f1;
    border-radius: 8px;
    margin: 0.5rem 0;
    font-weight: 600;
    color: #3498db;
}

/* Links en separadores */
a[href="#top"] {
    text-decoration: none;
}

hr {
    border: none;
    border-top: 2px solid #ecf0f1;
    margin: 1.5rem 0;
}

/* Listas mejoradas */
ul li strong,
ol li strong {
    color: #2c3e50;
    font-weight: 600;
}

/* Code blocks */
code {
    display: block;
    text-align: left;
    white-space: pre-line;
    word-break: normal;
    word-wrap: normal;
    line-height: 1.5;
    background-color: #f7f7f7;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 8px;
    border-left: 3px solid #3498db;
    font-size: 0.9rem;
}

/* Imágenes responsivas */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===========================
   TABLET & DESKTOP (768px+)
   =========================== */
@media only screen and (min-width: 768px) {
    html {
        font-size: 17px;
    }

    #navbar {
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        height: 100vh;
        border-right: 3px solid #3498db;
        border-bottom: none;
        overflow-y: auto;
    }

    #navbar ul {
        max-height: none;
        overflow-y: auto;
        height: calc(100vh - 100px);
    }

    #main-doc {
        margin-left: 320px;
        padding: 2rem 2.5rem;
        max-width: 1000px;
    }

    section article {
        font-size: 1.05rem;
    }

    h1 {
        font-size: 2rem;
    }

    header {
        font-size: 2rem;
    }
}

/* ===========================
   DESKTOP LARGE (1200px+)
   =========================== */
@media only screen and (min-width: 1200px) {
    #main-doc {
        margin-left: 340px;
        padding: 2.5rem 3rem;
        max-width: 1100px;
    }

    section article {
        font-size: 1.1rem;
    }
}

/* ===========================
   MEJORAS DE ACCESIBILIDAD
   =========================== */

/* Focus visible para navegación por teclado */
a:focus,
button:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Mejorar contraste para lectura */
::selection {
    background-color: #3498db;
    color: white;
}

/* Smooth transitions */
* {
    -webkit-tap-highlight-color: transparent;
}

.main-section {
    transition: transform 0.2s ease;
}

/* ===========================
   FOOTER - REDES SOCIALES
   =========================== */
.footer-social {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.footer-social .social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ecf0f1;
    color: #2c3e50;
    text-decoration: none;
    border: 1px solid #dfe6e9;
    transition: all 0.2s ease;
}

.footer-social .social-link:hover,
.footer-social .social-link:focus {
    background: #e8f6ff;
    color: #3498db;
    transform: translateY(-2px);
}