/*
 * FILE: assets/css/base.css
 * PURPOSE: Reset, custom properties (tokens), y estilos base globales
 *
 * Convención de clases: BEM estricto
 *   Bloque:    .block
 *   Elemento:  .block__element
 *   Modificador: .block--modifier
 *
 * Design tokens: variables CSS en :root
 * Naming de variables: --{categoria}-{propiedad}-{variante?}
 */

/* ============================================================
   0. CUSTOM PROPERTIES (Design Tokens)
   ============================================================ */
:root {
    /* ── Paleta oficial — Presupuesto Participativo ── */
    --color-brand-dark:    #003824;   /* Verde oscuro    */
    --color-brand-forest:  #205F3E;   /* Verde bosque    */
    --color-brand-emerald: #45A85A;   /* Verde esmeralda */
    --color-brand-magenta: #E94E89;   /* Magenta accent  */

    /* Colors — Primarios (sistema anterior, compatibilidad) */
    --color-primary-100: #E8F4FD;
    --color-primary-200: #B3D8F7;
    --color-primary-400: #4A90D9;
    --color-primary-500: #2B6CB0;  /* Principal */
    --color-primary-700: #1A4A7A;
    --color-primary-900: #0D2645;

    /* Colors — Secundarios / Accent */
    --color-accent-400: #F6AD55;
    --color-accent-500: #ED8936;
    --color-accent-700: #C05621;

    /* Colors — Neutros */
    --color-neutral-0:   #FFFFFF;
    --color-neutral-50:  #F9FAFB;
    --color-neutral-100: #F3F4F6;
    --color-neutral-200: #E5E7EB;
    --color-neutral-400: #9CA3AF;
    --color-neutral-600: #4B5563;
    --color-neutral-800: #1F2937;
    --color-neutral-900: #111827;

    /* Colors — Semánticos */
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-danger:  #EF4444;
    --color-info:    #3B82F6;

    /* Colors — Estado obras */
    --color-estado-en-ejecucion: #10B981;
    --color-estado-finalizada:   #6366F1;
    --color-estado-pendiente:    #F59E0B;

    /* Typography */
    --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
    --font-serif:   'Merriweather', Georgia, serif;
    --font-mono:    'JetBrains Mono', 'Courier New', monospace;

    --text-xs:   0.75rem;    /* 12px */
    --text-sm:   0.875rem;   /* 14px */
    --text-base: 1rem;       /* 16px */
    --text-lg:   1.125rem;   /* 18px */
    --text-xl:   1.25rem;    /* 20px */
    --text-2xl:  1.5rem;     /* 24px */
    --text-3xl:  1.875rem;   /* 30px */
    --text-4xl:  2.25rem;    /* 36px */
    --text-5xl:  3rem;       /* 48px */

    --font-weight-normal:   400;
    --font-weight-medium:   500;
    --font-weight-semibold: 600;
    --font-weight-bold:     700;

    --line-height-tight:  1.25;
    --line-height-normal: 1.5;
    --line-height-loose:  1.75;

    /* Spacing scale (base 4px) */
    --space-1:  0.25rem;   /* 4px  */
    --space-2:  0.5rem;    /* 8px  */
    --space-3:  0.75rem;   /* 12px */
    --space-4:  1rem;      /* 16px */
    --space-5:  1.25rem;   /* 20px */
    --space-6:  1.5rem;    /* 24px */
    --space-8:  2rem;      /* 32px */
    --space-10: 2.5rem;    /* 40px */
    --space-12: 3rem;      /* 48px */
    --space-16: 4rem;      /* 64px */
    --space-20: 5rem;      /* 80px */
    --space-24: 6rem;      /* 96px */

    /* Border radius */
    --radius-sm:   0.25rem;
    --radius-md:   0.5rem;
    --radius-lg:   0.75rem;
    --radius-xl:   1rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm:  0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md:  0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg:  0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl:  0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Transitions */
    --transition-fast:   150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow:   400ms ease;

    /* Layout */
    --container-max:    1200px;
    --container-narrow: 768px;
    --container-px:     var(--space-6);

    /* Z-index scale */
    --z-base:    0;
    --z-dropdown: 100;
    --z-sticky:   200;
    --z-navbar:   300;
    --z-modal:    400;
    --z-toast:    500;

    /* Navbar tokens */
    --navbar-height:         80px;
    --navbar-height-solid:   72px;
    --navbar-radius:         16px;
    --navbar-offset:         16px;
    --navbar-fg:             rgba(255, 255, 255, 0.92);
    --navbar-fg-strong:      #ffffff;
    --navbar-fg-muted:       rgba(255, 255, 255, 0.65);
    --navbar-bg:             transparent;
    --navbar-active:         #45A85A;
    --navbar-border:         rgba(255, 255, 255, 0.25);
    --navbar-shadow:         0 2px 12px rgba(0, 0, 0, 0.08);
}

/* ============================================================
   1. RESET (modern)
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--line-height-normal);
    color: var(--color-neutral-800);
    background-color: var(--color-neutral-0);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, svg, video {
    display: block;
    max-width: 100%;
}

input, button, textarea, select {
    font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
}

ul[role="list"],
ol[role="list"] {
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-primary-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ============================================================
   2. UTILIDADES GLOBALES
   ============================================================ */

/* Container */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--container-px);
}

/* Skip link (accesibilidad) */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    background: var(--color-primary-500);
    color: var(--color-neutral-0);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-weight: var(--font-weight-semibold);
    z-index: var(--z-toast);
    transition: top var(--transition-fast);
}
.skip-link:focus {
    top: var(--space-4);
}

/* ============================================================
   3. TIPOGRAFÍA BASE
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
}
h1 { font-size: var(--text-4xl); font-weight: 800; line-height: var(--line-height-tight); }
h2 { font-size: var(--text-3xl); font-weight: 800; line-height: var(--line-height-tight); }
h3 { font-size: var(--text-xl);  font-weight: 700; line-height: var(--line-height-tight); }
h4 { font-size: var(--text-lg);  font-weight: 700; }
h5 { font-size: var(--text-base); font-weight: 700; }
h6 { font-size: var(--text-sm);  font-weight: 600; }

/* ============================================================
   4. BOTONES (sistema base)
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    transition:
        background-color var(--transition-fast),
        border-color     var(--transition-fast),
        color            var(--transition-fast),
        box-shadow       var(--transition-fast);
    white-space: nowrap;
}

.btn--primary {
    background-color: #45A85A;
    border-color:     #45A85A;
    color:            var(--color-neutral-0);
}
.btn--primary:hover {
    background-color: #205F3E;
    border-color:     #205F3E;
}

.btn--secondary {
    background-color: var(--color-accent-500);
    border-color:     var(--color-accent-500);
    color:            var(--color-neutral-0);
}
.btn--secondary:hover {
    background-color: var(--color-accent-700);
    border-color:     var(--color-accent-700);
}

.btn--outline {
    background-color: transparent;
    border-color:     #45A85A;
    color:            #45A85A;
}
.btn--outline:hover {
    background-color: #45A85A;
    color:            var(--color-neutral-0);
}

.btn--ghost {
    background-color: transparent;
    border-color:     var(--color-neutral-200);
    color:            var(--color-neutral-800);
}
.btn--ghost:hover {
    background-color: var(--color-neutral-100);
}

.btn--sm  { padding: var(--space-2) var(--space-4); font-size: var(--text-sm); }
.btn--lg  { padding: var(--space-4) var(--space-8); font-size: var(--text-lg); }

.btn__icon {
    margin-left: 4px;
    display: inline-block;
}

/* ============================================================
   5. BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.025em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge--light    { background: rgba(255,255,255,0.2); color: var(--color-neutral-0); }
.badge--period   { background: rgba(69, 168, 90, 0.12); color: #205F3E; }
.badge--eje      { background: rgba(69, 168, 90, 0.12); color: #205F3E; }
.badge--categoria { background: var(--color-accent-400); color: var(--color-neutral-900); }

/* ============================================================
   6. SECTION (helpers compartidos)
   ============================================================ */
.section {
    padding-block: var(--space-20);
}

.section--alt-bg {
    background-color: var(--color-neutral-50);
}

.section__header {
    margin-bottom: var(--space-12);
}

.section__header--centered {
    text-align: center;
}

.section__header--split {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.section__title {
    color: var(--color-neutral-900);
    margin-bottom: var(--space-4);
}

.section__lead {
    font-size: var(--text-lg);
    color: var(--color-neutral-600);
    max-width: 65ch;
}

.section__lead--centered {
    margin-inline: auto;
}

.section__body {
    color: var(--color-neutral-600);
    line-height: var(--line-height-loose);
    margin-bottom: var(--space-6);
}

.section__cta-center {
    text-align: center;
    margin-top: var(--space-12);
}

.section-label {
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #45A85A;
    margin-bottom: var(--space-3);
}

/* ============================================================
   7. PROGRESS BAR
   ============================================================ */
.progress-bar {
    height: 6px;
    background-color: var(--color-neutral-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-2);
}

.progress-bar__fill {
    height: 100%;
    background-color: var(--color-primary-500);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress-bar__fill--complete {
    background-color: var(--color-success);
}

.progress-bar__label {
    font-size: var(--text-xs);
    color: var(--color-neutral-600);
    font-weight: var(--font-weight-medium);
}

/* ============================================================
   8. FEATURE LIST
   ============================================================ */
.feature-list {
    list-style: none;
    margin-block: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.feature-list__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--color-neutral-700);
}

.feature-list__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background-color: rgba(69, 168, 90, 0.12);
    color: #205F3E;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-bold);
    flex-shrink: 0;
}

/* ============================================================
   9. SITE HEADER (top bar)
   ============================================================ */
.site-header {
    position: relative;
    z-index: calc(var(--z-navbar) - 1);
    background: linear-gradient(135deg, #003824 0%, #002a1c 100%);
    padding-block: var(--space-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
}

.site-header__brand {
    flex-shrink: 0;
}

.site-header__logo-link {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    text-decoration: none;
}

.site-header__logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.site-header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-5);
}

.site-header__login-link {
    display: inline-flex;
    align-items: center;
    padding: var(--space-3) var(--space-5);
    color: var(--color-neutral-0);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    transition:
        background-color var(--transition-normal),
        border-color     var(--transition-normal),
        transform        var(--transition-fast),
        box-shadow       var(--transition-fast);
}

.site-header__login-link:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.45);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ============================================================
   10. BODY LOCK (menu mobile abierto)
   ============================================================ */
.body--menu-open {
    overflow: hidden;
}
