/* ============================================================
   FLACSO HOMEPAGE - MOBILE-FIRST OPTIMIZATION
   Optimizado para teléfonos móviles como principal medio de acceso
   ============================================================ */

:root {
    /* Espaciado móvil-first */
    --flacso-spacing-xs: 0.5rem;
    --flacso-spacing-sm: 0.75rem;
    --flacso-spacing-md: 1rem;
    --flacso-spacing-lg: 1.5rem;
    --flacso-spacing-xl: 2rem;
    
    /* Tipografía móvil */
    --flacso-font-size-xs: 0.75rem;
    --flacso-font-size-sm: 0.875rem;
    --flacso-font-size-base: 1rem;
    --flacso-font-size-lg: 1.125rem;
    --flacso-font-size-xl: 1.25rem;
}

/* ============================================================
   GENERAL - MOBILE OPTIMIZATION
   ============================================================ */

html, body {
    font-size: 16px;
    line-height: 1.6;
}

body {
    overflow-x: hidden;
}

/* Asegurar que los inputs sean legibles en móvil */
input, textarea, select {
    font-size: 16px !important;
    min-height: 44px;
}

/* ============================================================
   SECCIONES PRINCIPALES
   ============================================================ */

.flacso-home-layout {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.flacso-home-block {
    padding: 1.5rem 0;
}

/* Sin padding en el hero */
.flacso-home-block--hero {
    padding: 0 !important;
}

@media (min-width: 768px) {
    .flacso-home-block {
        padding: 2rem 0;
    }
}

@media (min-width: 1024px) {
    .flacso-home-block {
        padding: 2.5rem 0;
    }
}

/* Mejorar legibilidad de contenedores */
.flacso-content-shell {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 576px) {
    .flacso-content-shell {
        padding: 1.25rem;
    }
}

@media (min-width: 768px) {
    .flacso-content-shell {
        padding: 2rem;
    }
}

/* ============================================================
   TIPOGRAFÍA RESPONSIVA
   ============================================================ */

h1 {
    font-size: 1.75rem;
    line-height: 1.1;
    margin-bottom: 1rem;
}

@media (min-width: 576px) {
    h1 {
        font-size: 2.25rem;
    }
}

@media (min-width: 768px) {
    h1 {
        font-size: 2.75rem;
    }
}

@media (min-width: 1024px) {
    h1 {
        font-size: 3rem;
        margin-bottom: 1.5rem;
    }
}

h2 {
    font-size: 1.5rem;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

@media (min-width: 576px) {
    h2 {
        font-size: 1.75rem;
    }
}

@media (min-width: 768px) {
    h2 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
}

@media (min-width: 1024px) {
    h2 {
        font-size: 2.25rem;
    }
}

h3 {
    font-size: 1.15rem;
    line-height: 1.25;
    margin-bottom: 0.5rem;
}

@media (min-width: 576px) {
    h3 {
        font-size: 1.35rem;
    }
}

@media (min-width: 768px) {
    h3 {
        font-size: 1.55rem;
        margin-bottom: 0.75rem;
    }
}

h4 {
    font-size: 1rem;
    line-height: 1.3;
}

@media (min-width: 768px) {
    h4 {
        font-size: 1.15rem;
    }
}

p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    p {
        font-size: 1rem;
    }
}

/* ============================================================
   BOTONES - MOBILE OPTIMIZED
   ============================================================ */

a.btn, button, input[type="button"], input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: normal;
    transition: all 0.2s ease;
}

@media (min-width: 768px) {
    a.btn, button, input[type="button"], input[type="submit"] {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

/* Botones full-width en móvil */
@media (max-width: 575px) {
    .btn-block, .btn.btn-block, button.btn-block {
        width: 100%;
        display: flex;
    }
}

/* ============================================================
   TARJETAS
   ============================================================ */

.card {
    border-radius: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .card {
        border-radius: 1rem;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    }
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
}

.card-body {
    padding: 1rem;
}

@media (min-width: 768px) {
    .card-body {
        padding: 1.5rem;
    }
}

.card-img-top {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

/* ============================================================
   GRILLAS Y LAYOUTS
   ============================================================ */

.row {
    display: grid;
    gap: 0.75rem;
    margin: 0;
}

@media (min-width: 576px) {
    .row {
        gap: 1rem;
    }
}

@media (min-width: 768px) {
    .row {
        gap: 1.25rem;
    }
}

@media (min-width: 1024px) {
    .row {
        gap: 1.5rem;
    }
}

/* Mobile first: single column */
.row > [class*="col"] {
    flex: 1 1 100%;
}

/* Small screens (tablets) */
@media (min-width: 576px) {
    .row-cols-sm-2 > * {
        flex: 0 0 calc(50% - 0.5rem);
    }
    
    .row-cols-sm-3 > * {
        flex: 0 0 calc(33.333% - 0.5rem);
    }
}

/* Medium screens */
@media (min-width: 768px) {
    .row-cols-md-2 > * {
        flex: 0 0 calc(50% - 0.625rem);
    }
    
    .row-cols-md-3 > * {
        flex: 0 0 calc(33.333% - 0.625rem);
    }
    
    .row-cols-md-4 > * {
        flex: 0 0 calc(25% - 0.625rem);
    }
}

/* Large screens (desktop) */
@media (min-width: 992px) {
    .row-cols-lg-2 > * {
        flex: 0 0 calc(50% - 0.75rem);
    }
    
    .row-cols-lg-3 > * {
        flex: 0 0 calc(33.333% - 0.75rem);
    }
    
    .row-cols-lg-4 > * {
        flex: 0 0 calc(25% - 0.75rem);
    }
}

/* ============================================================
   IMÁGENES
   ============================================================ */

img, picture {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============================================================
   BADGES Y PÍLDORAS
   ============================================================ */

.badge {
    display: inline-block;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.35rem;
    white-space: nowrap;
    line-height: 1;
    letter-spacing: 0.05em;
}

@media (min-width: 768px) {
    .badge {
        padding: 0.45rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* ============================================================
   FORMULARIOS
   ============================================================ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
textarea,
select {
    width: 100%;
    max-width: 100%;
    padding: 0.6rem;
    font-size: 16px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 0.35rem;
    line-height: 1.5;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

@media (min-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    input[type="date"],
    input[type="time"],
    textarea,
    select {
        padding: 0.75rem;
        border-radius: 0.5rem;
    }
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--global-palette1, #1d3a72);
    box-shadow: 0 0 0 3px rgba(29, 58, 114, 0.1);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

@media (min-width: 768px) {
    label {
        margin-bottom: 0.75rem;
        font-size: 0.95rem;
    }
}

/* ============================================================
   ACCESIBILIDAD
   ============================================================ */

a:focus-visible, 
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--global-palette1, #1d3a72);
    outline-offset: 2px;
}

/* ============================================================
   UTILIDADES
   ============================================================ */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-auto { margin-top: auto; }
.mb-auto { margin-bottom: auto; }

.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }

.flex-column { flex-direction: column; }

/* ============================================================
   BREAKPOINTS - Utilities
   ============================================================ */

@media (min-width: 576px) {
    .d-sm-none { display: none; }
    .d-sm-block { display: block; }
    .d-sm-flex { display: flex; }
    .d-sm-grid { display: grid; }
}

@media (min-width: 768px) {
    .d-md-none { display: none; }
    .d-md-block { display: block; }
    .d-md-flex { display: flex; }
    .d-md-grid { display: grid; }
}

@media (min-width: 992px) {
    .d-lg-none { display: none; }
    .d-lg-block { display: block; }
    .d-lg-flex { display: flex; }
    .d-lg-grid { display: grid; }
}

@media (min-width: 1200px) {
    .d-xl-none { display: none; }
    .d-xl-block { display: block; }
    .d-xl-flex { display: flex; }
    .d-xl-grid { display: grid; }
}

/* ============================================================
   ANIMACIONES - Respeta preferencias de movimiento
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
