/* ============================================================================
   LAMARTINE — BASE
   ============================================================================
   Reset moderno + estilos globales del sitio.
   Se importa DESPUÉS de variables.css en todas las páginas.
   ============================================================================ */


/* ============================================================================
   RESET MODERNO
   ============================================================================ */

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

body {
    font-family: var(--font-body);
    font-size: var(--fs-base);
    font-weight: var(--fw-regular);
    line-height: var(--lh-normal);
    color: var(--color-negro);
    min-height: 100vh;
    overflow-x: hidden;
    
    /* Fondo: gradiente sutil que va del crema durazno al blanco roto */
    background-color: var(--color-crema);
    background-image:
        /* Marca de agua "Lamartine" — muy sutil, letra L central */
        radial-gradient(
            ellipse 60% 80% at 50% 40%,
            rgba(255, 255, 255, 0.55) 0%,
            transparent 100%
        ),
        /* Gradiente suave top→bottom: crema cálido arriba, casi blanco abajo */
        linear-gradient(
            175deg,
            #FFECD1 0%,
            #FFF8EE 40%,
            #FFFDF8 100%
        );
    background-attachment: fixed;
}

/* Marca de agua tipográfica — pseudo-elemento en el body */
body::before {
    content: 'L';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-style: italic;
    font-weight: var(--fw-regular);
    font-size: min(80vw, 80vh);
    line-height: 1;
    color: rgba(109, 58, 60, 0.028); /* vino terracota ultra-transparente */
    pointer-events: none;
    user-select: none;
    z-index: -1;
    white-space: nowrap;
}

/* Quitar herencia para listas con rol nav/menu */
ul[role="list"],
ol[role="list"] {
    list-style: none;
}

/* Imágenes responsive por defecto */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Formularios heredan tipografía */
input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: none;
    cursor: pointer;
}

/* Romper palabras largas para no desbordar */
p, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
}

/* Respetar preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


/* ============================================================================
   TIPOGRAFÍA
   ============================================================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--fw-regular);
    line-height: var(--lh-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--color-negro);
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-md); }

p {
    margin-bottom: var(--space-4);
}

p:last-child {
    margin-bottom: 0;
}

a {
    color: var(--color-tierra);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--color-acento);
}

strong, b {
    font-weight: var(--fw-semibold);
}

small {
    font-size: var(--fs-sm);
}


/* ============================================================================
   SELECCIÓN DE TEXTO
   ============================================================================ */

::selection {
    background: var(--color-acento);
    color: var(--color-blanco);
}


/* ============================================================================
   SCROLLBAR PERSONALIZADA (sutil)
   ============================================================================ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-beige-claro);
}

::-webkit-scrollbar-thumb {
    background: var(--color-arena);
    border-radius: var(--radius-full);
    border: 2px solid var(--color-beige-claro);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-taupe);
}


/* ============================================================================
   UTILIDADES DE LAYOUT
   ============================================================================ */

.container {
    width: 100%;
    max-width: var(--container-xl);
    margin-inline: auto;
    padding-inline: var(--container-padding);
}

.container-narrow {
    max-width: var(--container-md);
}

.container-wide {
    max-width: var(--container-max);
}

.section {
    padding-block: var(--space-16);
}

.section-sm {
    padding-block: var(--space-10);
}

.section-lg {
    padding-block: var(--space-24);
}


/* ============================================================================
   FLEX Y GRID HELPERS
   ============================================================================ */

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.grid { display: grid; }
.hidden { display: none !important; }


/* ============================================================================
   ACCESIBILIDAD — Screen reader only
   ============================================================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible elegante */
:focus-visible {
    outline: 2px solid var(--color-acento);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}


/* ============================================================================
   ANIMACIONES COMPARTIDAS
   ============================================================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-fade-in {
    animation: fadeIn var(--duration-slow) var(--ease-out) both;
}

.animate-fade-in-up {
    animation: fadeInUp var(--duration-slow) var(--ease-out) both;
}


/* ============================================================================
   ESTADOS DE CARGA
   ============================================================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-beige-claro) 0%,
        var(--color-beige) 50%,
        var(--color-beige-claro) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--color-beige);
    border-top-color: var(--color-acento);
    border-radius: var(--radius-full);
    animation: spin 0.6s linear infinite;
}


/* ============================================================================
   TOAST / NOTIFICACIONES (contenedor global)
   ============================================================================ */

.toast-container {
    position: fixed;
    top: calc(var(--nav-height) + var(--space-4));
    right: var(--space-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
    max-width: 400px;
}

.toast {
    background: var(--color-blanco);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--color-acento);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: var(--fs-sm);
    color: var(--color-tierra);
    pointer-events: auto;
    animation: fadeInUp var(--duration-normal) var(--ease-out);
    min-width: 260px;
}

.toast--success { border-left-color: var(--color-exito); }
.toast--error { border-left-color: var(--color-error); }
.toast--warning { border-left-color: var(--color-alerta); }
.toast--info { border-left-color: var(--color-info); }


/* ============================================================================
   OVERLAY (para modales)
   ============================================================================ */

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 21, 18, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--z-overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-normal) var(--ease-out);
}

.overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}


/* ============================================================================
   ESTADOS VACÍOS
   ============================================================================ */

.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-4);
    color: var(--color-gris-medio);
}

.empty-state__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    opacity: 0.4;
}

.empty-state__title {
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    color: var(--color-tierra);
    margin-bottom: var(--space-2);
}

.empty-state__text {
    font-size: var(--fs-sm);
    max-width: 360px;
    margin-inline: auto;
}
