:root {
    --transition-smooth: all 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    --radius-lg: 22px; --radius-md: 16px; --radius-sm: 12px;
    --radius-icon: 14px;
    --shadow-quiet: 0 4px 24px rgba(0, 0, 0, 0.04);
    --shadow-elevated: 0 20px 40px rgba(0, 0, 0, 0.08);
    font-size: 16px;
    --font-brand-weight: 500;
    --brand-gap-aulibre: 0;
    --brand-mark-size: 1.56rem;
    --brand-word-size: 1.38rem;
    --logo-word: #0c1520;
    --brand-text-nudge: 0;
}

body {
    --bg-main: #fafbfc;
    --bg-card: rgba(255, 255, 255, 0.75);
    --text-main: #0c1520;
    --text-muted: #64748b;
    --border: rgba(0, 0, 0, 0.06);
    --border-card: rgba(255, 255, 255, 0.6);
    --accent: #0a5f8c;
    --accent-bg: rgba(10, 95, 140, 0.06);
    --accent-shadow: rgba(10, 95, 140, 0.10);
    --nav-bg: rgba(250, 251, 252, 0.88);
    --aurora-gradient: linear-gradient(90deg, #0a5f8c, #6b9bc8, #0c1520, #0a5f8c);
    --semantic-success: #1a7a4a;
    --semantic-warning: #96650a;
    --semantic-danger: #8f3f37;
    --semantic-info: #1d5bbf;
    color-scheme: light;
}

body[data-theme="dark"] {
    --bg-main: #090a0f;
    --bg-card: rgba(25, 26, 30, 0.65);
    --text-main: #f1f5f9;
    --text-muted: #8b9aab;
    --border: rgba(255, 255, 255, 0.08);
    --border-card: rgba(255, 255, 255, 0.12);
    --accent: #6b9bc8;
    --accent-bg: rgba(107, 155, 200, 0.12);
    --accent-shadow: rgba(107, 155, 200, 0.16);
    --shadow-quiet: 0 4px 24px rgba(0, 0, 0, 0.2);
    --shadow-elevated: 0 30px 60px rgba(0, 0, 0, 0.4);
    --nav-bg: rgba(9, 10, 15, 0.88);
    --aurora-gradient: linear-gradient(90deg, #6b9bc8, #ffffff, #8eb4d4, #6b9bc8);
    --semantic-success: #7bc4a0;
    --semantic-warning: #f8c471;
    --semantic-danger: #bf736b;
    --semantic-info: #6b9bc8;
    color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Manrope', sans-serif; }

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.32s cubic-bezier(0.22, 1, 0.36, 1), color 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

/* HEADER / NAV */
.top-nav {
    position: sticky; top: 0; z-index: 1000;
    display: flex; align-items: center;
    padding: calc(1.15rem + env(safe-area-inset-top, 0px)) clamp(1.5rem, 5vw, 3.5rem) 1.15rem;
    background: var(--nav-bg);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: transform 0.35s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}
.nav-container {
    width: 100%; max-width: 1400px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
}
.brand-logo {
    font-size: 1.35rem; font-weight: var(--font-brand-weight, 500); letter-spacing: 0.02em;
    color: var(--text-main); text-decoration: none;
    display: flex; align-items: center; gap: var(--brand-gap-aulibre, 0);
    z-index: 1001; line-height: 1;
}
.brand-logo .brand-text { transform: translateY(var(--brand-text-nudge, 0)); }
.brand-icon {
    width: var(--brand-mark-size, 1.56rem); height: var(--brand-mark-size, 1.56rem);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    background: transparent; border: none; padding: 0;
}
.brand-icon .brand-mark { width: 100%; height: 100%; }
.nav-brand {
    display: flex; align-items: center; gap: 2.15rem; z-index: 1001;
}
.nav-brand .brand-logo { transform: translateY(-0.12rem); }
.nav-actions { display: flex; align-items: center; gap: 1.25rem; }

.btn-nav-ghost {
    color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 0.875rem;
    letter-spacing: 0.01em; padding: 0.75rem 0.25rem; min-height: 2.75rem;
    display: inline-flex; align-items: center; transition: var(--transition-smooth);
}
.btn-nav-ghost:hover, .btn-nav-ghost.is-active { color: var(--accent); }
.btn-nav-soft {
    color: var(--text-main); text-decoration: none; font-weight: 600; font-size: 0.875rem;
    letter-spacing: 0.01em; padding: 0.65rem 1.25rem; min-height: 2.75rem;
    border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
    display: inline-flex; align-items: center; justify-content: center;
    transition: var(--transition-smooth); background: transparent;
}
.btn-nav-soft:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

.mobile-menu-btn {
    display: none; background: transparent; border: 1px solid transparent;
    color: var(--text-main); cursor: pointer; padding: 0;
    width: 2.5rem; height: 2.5rem; border-radius: var(--radius-icon);
    align-items: center; justify-content: center; z-index: 1001;
}
.mobile-menu-btn svg { width: 1.5rem; height: 1.5rem; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

/* MENÚ MÓVIL */
.mobile-overlay {
    position: fixed; inset: 0; z-index: 1200;
    display: flex; align-items: center; justify-content: center;
    padding: max(1.25rem, env(safe-area-inset-top, 0px)) 1.25rem max(1.25rem, env(safe-area-inset-bottom, 0px));
    background: rgba(8, 9, 14, 0.85);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
body[data-theme="light"] .mobile-overlay {
    background: rgba(240, 243, 248, 0.88);
}
.mobile-overlay.active { opacity: 1; pointer-events: auto; }
.mobile-menu-sheet {
    position: relative; width: min(22rem, 100%);
    background: #12141d;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    padding: 3.8rem 1.35rem 1.5rem;
    display: flex; flex-direction: column; align-items: stretch; gap: 0.85rem;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
body[data-theme="light"] .mobile-menu-sheet {
    background: #ffffff;
    border-color: var(--border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.14);
}
.mobile-overlay.active .mobile-menu-sheet { transform: translateY(0) scale(1); }
.mobile-menu-close {
    position: absolute; top: 0.65rem; right: 0.65rem;
    width: 2.5rem; height: 2.5rem; border-radius: var(--radius-sm);
    border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
    background: transparent; color: var(--text-main);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition-smooth);
}
.mobile-menu-close:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-bg); }
.mobile-menu-close svg { width: 1.25rem; height: 1.25rem; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.mobile-menu-sheet .btn-nav-soft,
.mobile-menu-sheet a.ghost-link {
    width: 100%; max-width: none; box-sizing: border-box;
    justify-content: center; text-align: center;
    font-size: 1rem; padding: 0.9rem 1rem; min-height: 2.85rem;
}
.mobile-menu-sheet a.ghost-link {
    color: var(--text-main); font-weight: 600; text-decoration: none;
    border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
    border-radius: var(--radius-sm); display: inline-flex; align-items: center;
}

/* --- FOOTER INSTITUCIONAL COMPARTIDO --- */
.site-footer { background: var(--bg-main); border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent); margin-top: auto; }
.footer-top {
    max-width: 1400px; margin: 0 auto; width: 100%;
    padding: 4.5rem clamp(1.5rem, 5vw, 3.5rem) 3.5rem;
    display: flex; justify-content: space-between; align-items: flex-start; gap: 3rem; flex-wrap: wrap;
}
.footer-brand { display: flex; flex-direction: column; gap: 1.15rem; max-width: 26rem; }
.footer-brand .brand-logo { font-size: 1.5rem; justify-content: flex-start; }
.footer-tagline { color: var(--text-muted); font-size: 0.98rem; line-height: 1.6; margin: 0; }
.footer-links { display: flex; gap: 5rem; flex-wrap: wrap; }
.footer-col { display: flex; flex-direction: column; gap: 1.15rem; }
.footer-col-title { font-size: 0.95rem; font-weight: 700; color: var(--text-main); margin-bottom: 0.25rem; letter-spacing: 0.02em; }
.footer-col a { color: var(--text-muted); text-decoration: none; font-size: 0.92rem; font-weight: 500; transition: color 0.2s ease; }
.footer-col a:hover { color: var(--text-main); }
.footer-bottom {
    max-width: 1400px; margin: 0 auto; width: 100%;
    padding: 1.75rem clamp(1.5rem, 5vw, 3.5rem);
    border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
    display: flex; justify-content: center; align-items: center; text-align: center; gap: 1rem; flex-wrap: wrap;
    font-size: 0.85rem; color: var(--text-muted);
}

/* BOTÓN FLOTANTE TEMA */
.theme-toggle-floating {
    position: fixed; bottom: 1.5rem; left: 1.5rem; width: 3rem; height: 3rem; border-radius: 50%;
    background: var(--bg-card); border: 1px solid var(--border-card); color: var(--text-main);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: var(--shadow-quiet); z-index: 1000; transition: var(--transition-smooth);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
body[data-theme="dark"] .theme-toggle-floating {
    background: rgba(30, 33, 44, 0.85);
    border-color: rgba(255, 255, 255, 0.16);
    color: #f1f5f9;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
.theme-toggle-floating:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.theme-toggle-floating svg { width: 1.25rem; height: 1.25rem; stroke-width: 2; stroke: currentColor; fill: none; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 900px) {
    .nav-container { position: relative; justify-content: space-between; align-items: center; min-height: 2.5rem; }
    .nav-brand { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); gap: 0; z-index: 1; max-width: calc(100% - 7rem); justify-content: center; }
    .nav-brand .brand-logo { max-width: 100%; }
    .nav-brand .btn-nav-ghost { display: none; }
    .nav-actions { display: none !important; }
    .mobile-menu-btn { display: inline-flex !important; z-index: 2; }
    
    .footer-top { flex-direction: column; gap: 3rem; padding: 3rem 1.5rem; }
    .footer-links { width: 100%; justify-content: space-between; gap: 2rem; }
    .footer-col { flex: 1 1 calc(50% - 1rem); min-width: 120px; }
}
