﻿/* ============================================================
   COLEGIO JUAN XXIII — Estilos Principales
   Versión mejorada: hover effects, animaciones, micro-interacciones
   ============================================================ */

:root {
    --primary: #0a1e3d;
    --primary-light: #1a3a6e;
    --accent: #1e5fbb;
    --accent-hover: #174a99;
    --accent-glow: rgba(30,95,187,0.35);
    --accent-soft: rgba(30,95,187,0.12);
    --gold: #f0a11e;
    --gold-light: #f7c35e;
    --gold-glow: rgba(240,161,30,0.3);
    --white: #fff;
    --gray-100: #f4f7fc;
    --gray-200: #e2e6ef;
    --gray-300: #c5ccd9;
    --gray-400: #7a8396;
    --gray-500: #3d4659;
    --green: #22a65e;
    --red: #dc3545;
    /* Alias de nombres cortos. Antes se usaban --blue, --acc, --bg y
       --font-body en los bloques de noticias, niveles y asistente sin
       estar declarados acá: el navegador los daba por "sin definir" y
       esas reglas perdían color, fondo o tipografía. Ahora apuntan a los
       tokens reales, así que no hay dos fuentes de verdad para el mismo
       valor y un cambio de paleta sigue siendo un cambio en un solo lugar. */
    --blue: var(--primary);
    --acc: var(--accent);
    --bg: var(--gray-100);
    --font-body: var(--font-sans);
    --font-sans: 'Inter', sans-serif;
    --font-serif: 'Merriweather', serif;
    --radius-sm: 8px;
    --radius: 12px;
    --transition-fast: 0.2s cubic-bezier(0.22, 1, 0.36, 1);
    --transition-smooth: 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    --transition-dramatic: 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;      /* Safari/iOS no infla la tipografía al rotar */
    text-size-adjust: 100%;
}
body {
    font-family: var(--font-sans);
    color: var(--gray-500);
    background: var(--gray-100);
    overflow-x: hidden;                  /* red de seguridad, no una solución */
}

/* Una imagen nunca debe empujar el ancho de su contenedor. Los tamaños
   fijos viven en selectores de clase (.hero-slide-bg, .inst-foto img,
   .cms-sec-img, .news-card .card-img-top), que ganan por especificidad
   contra un selector de elemento, así que esta regla no pisa ninguno. */
img, svg, video { max-width: 100%; height: auto; }

/* Palabras largas (emails, URLs, nombres propios pegados) no rompen el
   bloque donde viven. */
h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

/* Foco visible al navegar con teclado, sobre fondos claros y oscuros. */
:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}
/* Bootstrap pone `outline: 0` en :focus de los campos, y ese selector
   gana por especificidad: sin esta confirmación el teclado deja de poder
   verse. El anillo se reafirma sobre input, select y textarea para que el
   foco nunca dependa del navegador. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--gold) !important;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   SCROLL REVEAL
   ============================================================ */
.scroll-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}
.stagger-1 { transition-delay: 0.05s; }
.stagger-2 { transition-delay: 0.1s; }
.stagger-3 { transition-delay: 0.15s; }
.stagger-4 { transition-delay: 0.2s; }
.stagger-5 { transition-delay: 0.25s; }
.stagger-6 { transition-delay: 0.3s; }

/* ============================================================
   TEXT GRADIENT
   ============================================================ */
.text-gradient {
    background: linear-gradient(135deg, var(--accent), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================================
   GLOW BORDER
   ============================================================ */
.glow-border {
    position: relative;
}
.glow-border::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--accent), var(--gold), var(--accent));
    background-size: 200% 200%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
    animation: glowRotate 3s linear infinite;
}
.glow-border:hover::after { opacity: 1; }
@keyframes glowRotate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ============================================================
   TOP BAR
   ============================================================ */
.top-bar {
    background: var(--primary);
    color: rgba(255,255,255,0.6);
    font-size: 0.82rem;
    padding: 10px 0;
    position: relative;
    overflow: hidden;
}
.top-bar::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--accent), var(--gold), var(--accent));
    background-size: 200% 100%;
    animation: shine 6s linear infinite;
}
@keyframes shine { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.top-bar a, .top-bar .bi {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: color 0.3s ease, transform 0.3s ease;
}
.top-bar a:hover { color: var(--gold); }
.top-bar a:hover .bi { transform: scale(1.3) rotate(5deg); }
.top-bar .separator { margin: 0 12px; opacity: 0.3; }
.top-bar-social a { font-size: 1.1rem; display: inline-block; }
.top-bar-social a:hover { animation: socialPulse 0.4s ease; }
@keyframes socialPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1.15); }
}

/* ============================================================
   NAVBAR
   ============================================================ */
.bg-primary-custom { background: var(--primary-light) !important; }
.navbar {
    padding: 0;
    transition: background 0.4s ease, box-shadow 0.4s ease, padding 0.3s ease;
}
.navbar.scrolled {
    background: var(--primary) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    padding: 0;
}
.navbar .nav-link {
    padding: 16px 18px !important;
    font-size: 0.88rem;
    font-weight: 500;
    position: relative;
    color: rgba(255,255,255,0.8);
    transition: color 0.3s ease, background 0.3s ease;
}
.navbar .nav-link::after {
    content: '';
    position: absolute;
    bottom: 8px; left: 50%;
    width: 0; height: 2.5px;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    border-radius: 2px;
    transform: translateX(-50%);
    transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.navbar .nav-link:hover::after,
.navbar .nav-link.active::after { width: 70%; }
.navbar .nav-link:hover {
    color: var(--gold-light) !important;
    background: rgba(255,255,255,0.06);
}
.navbar .nav-link.active {
    background: rgba(255,255,255,0.08);
}
.navbar-brand { padding: 8px 0; }
/* El atributo height="50" del HTML es solo un indicio de presentación
   (especificidad 0), así que esta regla lo pisa sin necesidad de
   !important y el logo se puede escalar por breakpoint. */
.navbar-brand img {
    width: auto;
    height: 50px;
    max-width: 150px;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.navbar-brand:hover img {
    transform: scale(1.08) rotate(-3deg);
}
.brand-text { display: inline-flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 800; font-size: 1.1rem; line-height: 1.2; overflow-wrap: break-word; }
.brand-sub { font-size: 0.65rem; opacity: 0.65; font-weight: 400; }

/* Dropdown */
.dropdown-menu {
    border: none;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.14);
    padding: 8px;
    margin-top: 8px;
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    transition: opacity 0.25s ease, transform 0.25s ease;
    backdrop-filter: blur(10px);
}
.dropdown-menu.show,
.dropdown:hover > .dropdown-menu {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.dropdown-item {
    border-radius: 8px;
    font-size: 0.85rem;
    padding: 10px 14px;
    position: relative;
    overflow: hidden;
    transition: all 0.25s ease;
}
.dropdown-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--accent), var(--gold));
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.3s ease;
    border-radius: 0 2px 2px 0;
}
.dropdown-item:hover {
    background: var(--accent-soft);
    color: var(--accent);
    padding-left: 20px;
}
.dropdown-item:hover::before { transform: scaleY(1); }
.dropdown-item.active { background: var(--accent); color: #fff; }

/* ============================================================
   SECTIONS
   ============================================================ */
.section { padding: clamp(40px, 6vw, 72px) 0; }
.section-alt { background: var(--white); }
.section-title {
    font-family: var(--font-serif);
    font-size: clamp(1.35rem, 4vw, 2.1rem);
    font-weight: 700;
    color: var(--primary);
    position: relative;
    display: inline-block;
    padding-bottom: 12px;
    max-width: 100%;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 60px; height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--gold));
    border-radius: 2px;
    transition: width 0.4s ease;
}
.section-title:hover::after { width: 100px; }
.section-subtitle {
    color: var(--gray-400);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 12px auto 0;
}

/* ============================================================
   HERO SLIDER
   ============================================================ */
.hero-slider {
    position: relative;
    width: 100%;
    /* Fluido: 220px en un teléfono angosto, 460px como techo. Antes el
       alto era fijo (420px) y el bloque responsive lo pisaba dos veces
       en la misma media query (260px y después 200px), así que ganaba
       el último valor sin que nadie lo hubiera decidido. */
    height: clamp(220px, 42vw, 460px);
    overflow: hidden;
}
.hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: scale(1.08);
    transition: opacity 1.2s ease, transform 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.hero-slide.active { opacity: 1; transform: scale(1); }
.hero-slide::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(10,30,61,0.7));
    z-index: 1;
}
.hero-slide-bg {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 3s ease;
}
.hero-slide:hover .hero-slide-bg { transform: scale(1.05); }
.hero-slide-content {
    position: absolute;
    bottom: clamp(16px, 5vw, 40px);
    left: 0; right: 0;
    color: var(--white);
    text-align: center;
    z-index: 2;
    padding: 0 12px;
}
.hero-slide.active .hero-slide-content {
    animation: fadeUp 1s ease forwards;
}
@keyframes fadeUp {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}
.hero-dots {
    position: absolute;
    bottom: 20px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 10px;
    z-index: 3;
}
.hero-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    border: 2px solid rgba(255,255,255,0.2);
    cursor: pointer;
    transition: all 0.35s ease;
}
.hero-dot.active {
    background: var(--gold);
    border-color: var(--gold);
    transform: scale(1.4);
    box-shadow: 0 0 16px var(--gold-glow);
}
.hero-dot:hover {
    background: rgba(255,255,255,0.8);
    border-color: rgba(255,255,255,0.8);
    transform: scale(1.2);
}

/* ============================================================
   BUTTONS — glow, ripple, magnetic
   ============================================================ */
.btn-accent {
    position: relative;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: var(--white);
    border: none;
    border-radius: 12px;
    padding: 12px 26px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
    display: inline-block;
    text-decoration: none;
    cursor: pointer;
}
.btn-accent::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}
.btn-accent:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--primary-light));
    color: var(--white);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px var(--accent-glow), 0 0 60px rgba(30,95,187,0.15);
}
.btn-accent:hover::before { left: 100%; }
.btn-accent:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 4px 12px var(--accent-glow);
}

/* Ripple on click */
.ripple {
    position: relative;
    overflow: hidden;
}
.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    transform: scale(0);
    animation: rippleAnim 0.6s ease-out;
    pointer-events: none;
}
@keyframes rippleAnim {
    to { transform: scale(4); opacity: 0; }
}

/* Button loading state */
.btn-loading {
    pointer-events: none;
    opacity: 0.8;
}
.btn-loading::after {
    content: '';
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-outline-accent {
    position: relative;
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
    border-radius: 12px;
    padding: 10px 22px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    display: inline-block;
    text-decoration: none;
    overflow: hidden;
}
.btn-outline-accent::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: -1;
}
.btn-outline-accent:hover {
    color: var(--white);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}
.btn-outline-accent:hover::after { transform: scaleX(1); }
.btn-outline-accent:active {
    transform: translateY(0) scale(0.97);
}

.btn-outline-light {
    border-color: rgba(255,255,255,0.3);
    color: #fff;
    transition: all 0.3s ease;
}
.btn-outline-light:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.6);
    color: #fff;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 8px 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}
.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220,53,69,0.3);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 0.82rem;
    border-radius: 8px;
}
.btn-lg {
    padding: 14px 28px;
    font-size: 0.95rem;
    border-radius: 12px;
}

/* ============================================================
   VALUE CARDS
   ============================================================ */
.value-card {
    background: var(--white);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    transition: all 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    height: 100%;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}
.value-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--gold));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.value-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    border: 2px solid transparent;
    background: linear-gradient(135deg, var(--accent-soft), transparent) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.value-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}
.value-card:hover::before { transform: scaleX(1); }
.value-card:hover::after { opacity: 1; }
.value-card .icon {
    width: 56px; height: 56px;
    background: var(--accent-soft);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.5rem; color: var(--accent);
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.value-card:hover .icon {
    background: linear-gradient(135deg, var(--accent), var(--gold));
    color: var(--white);
    transform: scale(1.12) rotate(-5deg);
    box-shadow: 0 6px 20px var(--accent-glow);
}
.value-card h5 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; color: var(--primary); }
.value-card p { font-size: 0.85rem; color: var(--gray-400); margin: 0; }

/* CE Member cards */
.ce-miembro-card {
    background: var(--white);
    border-radius: 16px;
    padding: 28px 16px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
}
.ce-miembro-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--gold));
    transform: scaleX(0);
    transition: transform 0.4s ease;
}
.ce-miembro-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 36px rgba(0,0,0,0.12);
}
.ce-miembro-card:hover::before { transform: scaleX(1); }
.ce-miembro-avatar {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--white);
    font-weight: 700; font-size: 1.3rem;
    margin: 0 auto 12px;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.ce-miembro-card:hover .ce-miembro-avatar {
    transform: scale(1.12) rotate(-5deg);
    box-shadow: 0 0 0 5px var(--accent-soft), 0 8px 20px var(--accent-glow);
}
.ce-miembro-nombre { font-size: 0.9rem; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.ce-miembro-rol { font-size: 0.78rem; color: var(--accent); font-weight: 600; display: block; }
.ce-miembro-curso { font-size: 0.72rem; color: var(--gray-400); display: block; margin-top: 4px; }

/* Títulos largos dentro de tarjetas: la tarjeta tiene overflow:hidden, así
   que sin esto la palabra se recortaba en vez de partirse. */
.value-card h5,
.news-card .card-title,
.ce-miembro-nombre { overflow-wrap: break-word; }

/* Generic hover lift */
.hover-lift {
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
}
.hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 32px rgba(0,0,0,0.12);
}

/* News cards */
.news-card {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    height: 100%;
    background: var(--white);
}
.news-card:hover {
    transform: translateY(-8px) perspective(800px) rotateX(1deg);
    box-shadow: 0 20px 50px rgba(0,0,0,0.12);
}
.news-card .card-img-top {
    height: clamp(150px, 24vw, 200px);
    object-fit: cover;
    transition: transform 0.6s ease, filter 0.5s ease;
}
.news-card:hover .card-img-top {
    transform: scale(1.08);
    filter: brightness(1.05);
}
.news-card .card-body {
    display: flex;
    flex-direction: column;
}
.news-card .card-text { flex: 1; }

/* Filter buttons */
.filter-btn {
    border: 1.5px solid var(--accent);
    color: var(--accent);
    background: transparent;
    padding: 7px 20px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.filter-btn:hover, .filter-btn.active {
    background: var(--accent);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--accent-glow);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control {
    border-radius: 12px;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-200);
    font-size: 0.9rem;
    transition: all 0.35s ease;
    background: var(--white);
}
.form-control:hover { border-color: var(--gray-300); }
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft), 0 2px 8px rgba(30,95,187,0.08);
    outline: none;
}
.form-control-lg { padding: 14px 18px; font-size: 1rem; }

/* Error state */
.input-error {
    border-color: var(--red) !important;
    animation: inputShake 0.4s ease;
}
@keyframes inputShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-4px); }
}

/* Success state */
.input-success {
    border-color: var(--green) !important;
    box-shadow: 0 0 0 3px rgba(34,166,94,0.15);
}

.form-select {
    border-radius: 12px;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-200);
    font-size: 0.9rem;
    transition: all 0.35s ease;
}
.form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.form-select:hover { border-color: var(--gray-300); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    border-radius: 12px;
    border: none;
    animation: fadeInUp 0.4s ease;
}
.alert-success { background: #e6f7ed; color: #1b7a3d; }
.alert-danger { background: #fce4ec; color: #c62828; }
.alert-warning { background: #fff8e1; color: #8a6d00; }
.alert-info { background: #e8f0fe; color: var(--accent); }
@keyframes fadeInUp {
    0% { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb { background: transparent; padding: 0; margin: 0; }
.breadcrumb-item a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease, padding-left 0.3s ease;
}
.breadcrumb-item a:hover { color: var(--gold); padding-left: 4px; }
.breadcrumb-item.active { color: var(--gray-400); }

/* ============================================================
   COMENTARIOS / NOTICIA
   ============================================================ */
.comentario-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-200);
    transition: background 0.3s ease;
}
.comentario-item:last-child { border-bottom: none; }
.comentario-item:hover { background: rgba(30,95,187,0.02); }
.comentario-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--accent-soft));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem;
    color: var(--accent);
    flex-shrink: 0;
    transition: all 0.35s ease;
}
.comentario-item:hover .comentario-avatar {
    transform: scale(1.15) rotate(-5deg);
    box-shadow: 0 4px 12px var(--accent-glow);
}
/* ============================================================
   NOTICIAS — TIPOGRAFÍA COMPLETA
   ------------------------------------------------------------
   Antes .noticia-contenido solo tenía 2 reglas (line-height y un
   margin), así que los <h2>, <ul>, <blockquote> y <img> que
   escribe el editor salían con el estilo por defecto del
   navegador. Acá está el sistema completo.
   ============================================================ */
.noticia-contenido {
    line-height: 1.85;
    font-size: 1.06rem;
    color: #2b3444;
    max-width: 72ch;              /* medida legible: ni líneas de más de 75 caracteres */
}
/* Párrafos */
.noticia-contenido p { margin-bottom: 1.25rem; }
.noticia-contenido p:last-child { margin-bottom: 0; }

/* Titulares */
.noticia-contenido h1,
.noticia-contenido h2,
.noticia-contenido h3,
.noticia-contenido h4,
.noticia-contenido h5,
.noticia-contenido h6 {
    font-family: var(--font-serif);
    color: var(--blue);
    font-weight: 700;
    line-height: 1.25;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}
.noticia-contenido h1 { font-size: 2.1rem; }
.noticia-contenido h2 {
    font-size: 1.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--accent-soft);
}
.noticia-contenido h3 { font-size: 1.3rem; }
.noticia-contenido h4 { font-size: 1.12rem; font-family: var(--font-body); font-weight: 700; }
.noticia-contenido h5,
.noticia-contenido h6 { font-size: 1rem; font-family: var(--font-body); font-weight: 700; }

/* Primer elemento sin margen superior: se pega al borde del bloque */
.noticia-contenido > :first-child { margin-top: 0; }

/* Listas */
.noticia-contenido ul,
.noticia-contenido ol { margin-bottom: 1.25rem; padding-left: 1.4rem; }
.noticia-contenido ul { list-style: none; padding-left: 0; }
.noticia-contenido ul > li {
    position: relative;
    padding-left: 1.75rem;
    margin-bottom: 0.55rem;
}
.noticia-contenido ul > li::before {
    content: '\F26E';             /* bi-check-circle-fill */
    font-family: 'bootstrap-icons';
    position: absolute;
    left: 0;
    top: 0.1em;
    color: var(--accent);
    font-size: 0.95em;
}
.noticia-contenido ol { list-style: decimal; }
.noticia-contenido ol > li { margin-bottom: 0.55rem; padding-left: 0.3rem; }
.noticia-contenido ol > li::marker { color: var(--accent); font-weight: 700; }
/* Listas anidadas: vuelve al guion, sin check repetido */
.noticia-contenido ul ul > li::before {
    content: '\2022';
    color: var(--accent);
    font-family: inherit;
    font-size: 1.3em;
    line-height: 0.6;
    top: -0.1em;
}

/* Énfasis */
.noticia-contenido strong,
.noticia-contenido b { color: var(--blue); font-weight: 700; }
.noticia-contenido em { color: #4a5468; }
.noticia-contenido mark {
    background: #fff3cd;
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

/* Cita */
.noticia-contenido blockquote {
    margin: 1.75rem 0;
    padding: 1rem 1.35rem;
    background: var(--bg);
    border-left: 4px solid var(--accent);
    border-radius: 0 10px 10px 0;
    font-family: var(--font-serif);
    font-style: italic;
    color: #4a5468;
    font-size: 1.05rem;
}
.noticia-contenido blockquote p:last-child { margin-bottom: 0; }

/* Imágenes y Links */
.noticia-contenido img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1.5rem 0;
    box-shadow: 0 6px 24px rgba(10, 30, 61, 0.12);
}
.noticia-contenido a {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid var(--accent-soft);
    transition: border-color 0.25s ease;
}
.noticia-contenido a:hover { border-bottom-color: var(--accent); }

/* Tablas simples (fechas, horarios) */
.noticia-contenido table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}
.noticia-contenido th,
.noticia-contenido td {
    border: 1px solid var(--gray-200, #e2e6ef);
    padding: 0.6rem 0.8rem;
    text-align: left;
}
.noticia-contenido th { background: var(--bg); color: var(--blue); font-weight: 700; }

/* Separador */
.noticia-contenido hr {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-soft), transparent);
    margin: 2rem 0;
}
.noticia-contenido small { color: #7a8396; }

/* En celular la tipografía se achica para no romper el layout */
@media (max-width: 768px) {
    .noticia-contenido { font-size: 1rem; }
    .noticia-contenido h1 { font-size: 1.6rem; }
    .noticia-contenido h2 { font-size: 1.35rem; }
    .noticia-contenido h3 { font-size: 1.15rem; }
}

/* ============================================================
   NIVELES — tarjetas, subniveles y navegación anidada
   ============================================================ */
.nivel-imagen {
    border: 1px solid rgba(10, 30, 61, 0.06);
    background: var(--bg);
}
.nivel-card { transition: transform 0.3s ease, box-shadow 0.3s ease; }
.nivel-nietos {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px dashed var(--gray-200, #e2e6ef);
}
.nivel-nieto {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bg);
    color: var(--blue);
    border-radius: 20px;
    padding: 4px 11px;
    font-size: 0.75rem;
    font-weight: 600;
}
.nivel-nieto i { color: var(--accent); }

/* Menú de Niveles con 3 niveles de submenú */
.niveles-menu { min-width: 260px; }
.niveles-menu .dropdown-item { font-size: 0.88rem; }
.niveles-menu .dropdown-item i { color: var(--accent); }
.niveles-menu .ver-completo {
    font-size: 0.78rem;
    color: var(--accent) !important;
    letter-spacing: 0.2px;
}
.niveles-menu .ver-completo:hover { background: var(--accent-soft); }
.niveles-menu .submenu-arrow {
    font-size: 0.65rem;
    color: #9aa3b4;
    transition: transform 0.25s ease;
}
.niveles-menu .dropdown-submenu.show > .dropdown-item > .submenu-arrow {
    transform: rotate(90deg);
}
/* El submenú se abre al hover en escritorio */
@media (min-width: 992px) {
    .dropdown-submenu {
        position: relative;
        margin: 0 !important;
    }
    .dropdown-submenu > .dropdown-menu {
        top: 0;
        left: 100%;
        margin-top: 0;
        display: none;
    }
    .dropdown-submenu:hover > .dropdown-menu {
        display: block;
    }
    .dropdown-menu-deep { min-width: 230px; }
}
/* En celular los submenús se abren con clic (ver el handler
   [data-toggle="submenu-toggle"] en assets/js/main.js).
   Antes el bloque de abajo dejaba el submenú en position:static pero
   seguía con display:none de Bootstrap, así que en el teléfono los
   niveles con hijos (ciclo, modalidad, especialidad) eran inalcanzables:
   el toggle no tenía a quién abrir. Acá se abre con .show y la flecha
   gira como en escritorio. */
@media (max-width: 991.98px) {
    .dropdown-submenu .dropdown-menu {
        position: static !important;
        inset: auto !important;
        transform: none !important;
        float: none;
        margin: 4px 0 6px !important;
        border: 0;
        border-radius: var(--radius-sm);
        box-shadow: none;
        padding-left: 1rem;
        background: transparent;
        /* El <ul> del submenú nunca recibe .show de Bootstrap (el .show
           lo lleva el <li> padre), así que la opacidad base lo dejaba
           invisible incluso con display:block. */
        opacity: 1;
        backdrop-filter: none;
    }
    .dropdown-submenu.show > .dropdown-menu { display: block; }
    .dropdown-submenu .dropdown-item { padding-left: 1.75rem; }
    /* Espejo del hover de escritorio: la flecha señala que está abierto. */
    .dropdown-submenu.show > .dropdown-item > .submenu-arrow,
    .dropdown-submenu.show > a > .submenu-arrow {
        transform: rotate(90deg);
        color: var(--accent);
    }
    /* Los links del submenú tienen que leerse sobre el menú blanco. */
    .dropdown-submenu .dropdown-menu .dropdown-item { color: var(--gray-500); }
    .dropdown-submenu .dropdown-menu .dropdown-item:hover,
    .dropdown-submenu .dropdown-menu .dropdown-item:focus {
        color: var(--accent);
        background: var(--accent-soft);
    }
    .dropdown-submenu .dropdown-menu .dropdown-item.active {
        color: #fff;
        background: var(--accent);
    }
    .dropdown-submenu .dropdown-divider { border-color: var(--gray-200); }
    .dropdown-submenu .ver-completo { color: var(--accent) !important; }
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    transition: transform 0.3s ease;
}
.badge:hover { transform: scale(1.05); }
.campo-badge {
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
}

/* ============================================================
   PARALLAX
   ============================================================ */
.parallax-section {
    position: relative;
    overflow: hidden;
}
.parallax-section::before {
    content: '';
    position: absolute;
    inset: -20%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, var(--accent) 100%);
    /* main.js escribe --parallax-y en cada scroll. Antes el JS chequeaba
       el.querySelector('::before'), que nunca matchea nada, así que el
       transform jamas se aplicaba y el efecto era cero. */
    transform: translateY(var(--parallax-y, 0));
    z-index: 0;
    transition: transform 0.1s linear;
}
.parallax-section > * { position: relative; z-index: 1; }

/* ============================================================
   PARTICLE BACKGROUND (CSS-only)
   ============================================================ */
.particle-bg {
    position: relative;
    overflow: hidden;
}
.particle-bg::before,
.particle-bg::after {
    content: '';
    position: absolute;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: var(--accent-soft);
    opacity: 0.3;
    animation: particleFloat 8s ease-in-out infinite;
}
.particle-bg::before {
    top: -50px; left: -50px;
    animation-delay: 0s;
}
.particle-bg::after {
    bottom: -50px; right: -50px;
    animation-delay: 4s;
    width: 150px; height: 150px;
}
@keyframes particleFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -20px) scale(1.1); }
    50% { transform: translate(-10px, 20px) scale(0.95); }
    75% { transform: translate(20px, 10px) scale(1.05); }
}

/* ============================================================
   SMOOTH SHADOW
   ============================================================ */
.smooth-shadow {
    box-shadow:
        0 1px 1px rgba(0,0,0,0.02),
        0 2px 2px rgba(0,0,0,0.02),
        0 4px 4px rgba(0,0,0,0.02),
        0 8px 8px rgba(0,0,0,0.02),
        0 16px 16px rgba(0,0,0,0.02);
}
.smooth-shadow:hover {
    box-shadow:
        0 1px 1px rgba(0,0,0,0.03),
        0 2px 2px rgba(0,0,0,0.03),
        0 4px 4px rgba(0,0,0,0.03),
        0 8px 8px rgba(0,0,0,0.03),
        0 16px 16px rgba(0,0,0,0.03),
        0 32px 32px rgba(0,0,0,0.03);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: var(--primary);
    padding: 40px 0 0;
    position: relative;
}
.site-footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--gold), var(--accent));
    background-size: 200% 100%;
    animation: shine 4s linear infinite;
}
.footer-social a {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.35s ease;
}
.footer-social a:hover {
    color: var(--gold);
    background: rgba(255,255,255,0.08);
    border-color: var(--gold);
    transform: translateY(-3px);
    box-shadow: 0 0 20px var(--gold-glow);
}
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 18px 0;
    margin-top: 36px;
}
.footer-bottom p { font-size: 0.82rem; color: rgba(255,255,255,0.4); }

/* ============================================================
   TABLE
   ============================================================ */
.table { border-collapse: separate; border-spacing: 0; }
.table thead th {
    background: var(--gray-100);
    border-bottom: 2px solid var(--gray-200);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.table tbody tr {
    transition: background 0.2s ease;
}
.table tbody tr:hover {
    background: rgba(30,95,187,0.03);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.bg-white { background: var(--white); }
.text-accent { color: var(--accent) !important; }
.rounded { border-radius: 12px !important; }
.shadow-sm { box-shadow: 0 2px 12px rgba(0,0,0,0.04); }

/* Card generic */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    background: var(--white);
    transition: box-shadow 0.3s ease;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent-soft), var(--accent));
    border-radius: 5px;
    border: 2px solid var(--gray-100);
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent), var(--primary-light));
}

/* ============================================================
   SELECTION
   ============================================================ */
::selection {
    background: var(--accent);
    color: #fff;
}

/* ============================================================
   COUNTER (for stats)
   ============================================================ */
.counter {
    display: inline-block;
}

/* ============================================================
   RESPONSIVE
   ============================================================
   El bloque que estaba acá declaraba dos veces la misma propiedad
   en la misma media query (.hero-slider 260px y después 200px;
   .section-title 1.5rem y después 1.3rem), y nada más. El último
   valor ganaba por orden de cascada: un descuido, no una decisión.
   Ahora lo que se puede medir se resuelve con clamp() y lo que
   necesita reordenar (navbar, tablas, footer) tiene su breakpoint.
   Los cortes son los de Bootstrap: 1199.98 / 991.98 / 767.98 /
   575.98 px, así que heredan sus variables sin estar a mano.
   ------------------------------------------------------------ */

/* ---- ≥1200px y menos: notebook angosto / tablet horizontal ---- */
@media (max-width: 1199.98px) {
    /* La barra superior tiene dos bloques (info + redes). Si no entran
       juntos, que salten de línea en vez de apretarse. */
    .top-bar .container { flex-wrap: wrap; row-gap: 6px; }
    .top-bar-info { min-width: 0; overflow-wrap: break-word; }
    .navbar .nav-link { padding: 14px 14px !important; font-size: 0.85rem; }
    .site-footer { padding: 34px 0 0; }
    .footer-bottom { margin-top: 28px; }
}

/* ---- <992px: el navbar colapsa y los dropdowns se muestran en cascada ---- */
@media (max-width: 991.98px) {
    /* El colapso es oscuro (--primary-light), así que los links siguen
       en blanco pero con padding de item de menú, no de barra. */
    .navbar-collapse { padding-top: 4px; padding-bottom: 10px; }
    .navbar .nav-link { padding: 11px 12px !important; font-size: 0.88rem; }
    /* La línea dorada debajo del link no tiene sentido cuando el menú
       es una lista vertical: queda siempre dibujada o nunca. */
    .navbar .nav-link::after { display: none; }
    .navbar-brand img { height: 42px; max-width: 120px; }

    /* Bootstrap posiciona el dropdown con Popper, que escribe
       position/top/left/transform/margin como estilos inline. Un
       !important es la única forma de ganar ahí y de que el menú se
       acomode dentro del colapso en vez de flotar sobre la página. */
    .navbar-collapse .dropdown-menu {
        position: static !important;
        inset: auto !important;
        transform: none !important;
        width: 100%;
        max-width: 100%;
        margin: 0 0 8px !important;
        float: none;
        border: 0;
        border-radius: var(--radius);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
        background: var(--white);
        opacity: 1;
        backdrop-filter: none;
    }
    /* Contraste explícito: el item es oscuro sobre el menú blanco, sin
       depender de qué variable de Bootstrap resuelva cada versión. */
    .navbar-collapse .dropdown-menu .dropdown-item { color: var(--gray-500); }
    .navbar-collapse .dropdown-menu .dropdown-item:hover,
    .navbar-collapse .dropdown-menu .dropdown-item:focus {
        color: var(--accent);
        background: var(--accent-soft);
    }
    .navbar-collapse .dropdown-menu .dropdown-item.active {
        color: #fff;
        background: var(--accent);
    }
    .navbar-collapse .dropdown-menu .dropdown-divider { border-color: var(--gray-200); }

    /* El submenú anidado cae sobre un panel apenas tonto para que se
       lea el escalón (nivel > ciclo > modalidad > especialidad) en vez
       de ser una lista blanca sobre otra lista blanca. */
    .navbar-collapse .dropdown-submenu .dropdown-menu {
        width: 100%;
        margin: 4px 0 6px !important;
        padding-left: 0.6rem;
        border-left: 2px solid var(--gray-200);
        border-radius: var(--radius-sm);
        background: var(--gray-100);
    }
}

/* ---- <768px: teléfono / tablet vertical ---- */
@media (max-width: 767.98px) {
    /* Barra superior: la info arriba, las redes abajo, todo centrado.
       Los separadores "|" sobran cuando el contenido se parte en dos
       líneas, así que se ocultan. */
    .top-bar { padding: 8px 0; font-size: 0.78rem; }
    .top-bar .container {
        flex-direction: column;
        justify-content: center;
        row-gap: 6px;
        text-align: center;
    }
    .top-bar-info { max-width: 100%; overflow-wrap: break-word; }
    .top-bar .separator { display: none; }
    .top-bar-social { justify-content: center; }
    .top-bar-social a { font-size: 1rem; }

    /* Hero: con 42vw el slide ya baja solo; lo que falta es que los
       puntos y el texto no se pisen con tan poco alto. */
    .hero-dots { bottom: 12px; gap: 8px; }
    .hero-dot { width: 10px; height: 10px; }

    /* Tablas anchas (horarios, cumpleaños, personal) no entran en un
       teléfono. display:block + overflow-x las vuelve una caja que
       scrollea sola, sin romper el layout que las contiene. */
    .table,
    .noticia-contenido table,
    .ed-area table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .noticia-contenido table { font-size: 0.9rem; }
    .ed-area table { font-size: 0.85rem; }

    /* Footer: centrado y con menos aire. El texto ya viene en
       text-center de Bootstrap; el social necesita lo mismo. */
    .site-footer { padding: 26px 0 0; }
    .footer-social { justify-content: center !important; }
    .footer-bottom { padding: 14px 0; margin-top: 22px; }
    .footer-bottom p { font-size: 0.78rem; }
}

/* ---- <576px: teléfono angosto (320px es el piso de referencia) ---- */
@media (max-width: 575.98px) {
    /* El subtítulo del logo es la primera cosa que sobra cuando el
       navbar queda en 320px, y el nombre largo se parte solo. */
    .navbar-brand { padding: 6px 0; max-width: calc(100% - 58px); }
    .navbar-brand img { height: 34px; max-width: 92px; }
    .brand-sub { display: none; }
    .brand-name { font-size: 0.98rem; }

    /* Padding de tarjeta más chico: a 320px el contenedor deja 296px y
       30px de padding por lado se comía un quinto de la tarjeta. */
    .value-card { padding: 22px 18px; }
    .ce-miembro-card { padding: 22px 12px; }
    .value-card .icon { width: 48px; height: 48px; font-size: 1.3rem; margin-bottom: 12px; }
    .filter-btn { padding: 6px 14px; font-size: 0.8rem; }

    /* Los campos por debajo de 16px hacen zoom automático en iOS y
       después la página queda con un desplazamiento lateral que no
       vuelve nunca a su lugar. */
    .form-control,
    .form-select,
    .form-control-lg,
    textarea { font-size: 16px; }
}

/* ============================================================
   ASISTENTE (menú conversacional)
   ============================================================
   Burbujas de chat con scroll propio, botón flotante y chips
   de pregunta. Pensado para no romper en móvil: el panel ocupa
   casi todo el ancho en pantallas chicas y se cierra con Esc.
   ============================================================ */
.asistente-fab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 58px;
    height: 58px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--acc, #1e5fbb), #174a99);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1060;
    box-shadow: 0 8px 24px rgba(23, 74, 153, .35);
    transition: transform .25s ease, opacity .2s ease;
}
.asistente-fab:hover { transform: scale(1.08); }
.asistente-fab:focus-visible { outline: 3px solid #c9a84c; outline-offset: 2px; }
.asistente-fab.oculto { opacity: 0; pointer-events: none; transform: scale(.6); }
/* Puntito de "hay ayuda": si no, el usuario no lo ve en mobile */
.asistente-fab-dot {
    position: absolute;
    top: 3px; right: 3px;
    width: 11px; height: 11px;
    border-radius: 50%;
    background: #e03e3e;
    border: 2px solid #fff;
}

#asistentePanel {
    position: fixed;
    right: 22px;
    bottom: 90px;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: min(620px, calc(100vh - 120px));
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(10, 30, 61, .22);
    border: 1px solid #e2e6ef;
    z-index: 1059;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(.97);
    transition: opacity .22s ease, transform .22s ease, visibility .22s;
}
#asistentePanel.abierto { opacity: 1; visibility: visible; transform: none; }

.asistente-header {
    background: linear-gradient(135deg, var(--blue, #0a1e3d), var(--acc, #1e5fbb));
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.asistente-avatar {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .16);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.asistente-header strong { display: block; font-size: .95rem; line-height: 1.2; }
.asistente-header span { font-size: .75rem; opacity: .78; }
.asistente-cerrar {
    background: none; border: none;
    color: rgba(255, 255, 255, .75);
    font-size: .95rem; cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: color .2s, background .2s;
}
.asistente-cerrar:hover { color: #fff; background: rgba(255, 255, 255, .12); }

.asistente-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f7f9fc;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.asistente-log::-webkit-scrollbar { width: 6px; }
.asistente-log::-webkit-scrollbar-thumb { background: #cbd4e2; border-radius: 4px; }

.asistente-msj { display: flex; flex-direction: column; max-width: 84%; }
.asistente-msj--user { align-self: flex-end; align-items: flex-end; }
.asistente-msj--bot  { align-self: flex-start; align-items: flex-start; }

.asistente-msj-cuerpo {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: .87rem;
    line-height: 1.55;
    box-shadow: 0 1px 3px rgba(10, 30, 61, .08);
    word-wrap: break-word;
}
.asistente-msj--user .asistente-msj-cuerpo {
    background: var(--acc, #1e5fbb);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.asistente-msj--bot .asistente-msj-cuerpo {
    background: #fff;
    color: #2f3a4d;
    border: 1px solid #e2e6ef;
    border-bottom-left-radius: 4px;
}
.asistente-msj-cuerpo strong { font-weight: 700; }
.asistente-msj-cuerpo code {
    background: #e8f0fe;
    color: var(--acc, #1e5fbb);
    padding: 1px 6px;
    border-radius: 5px;
    font-size: .82em;
}
/* Los links dentro de la burbuja no deben verse como del sitio */
.asistente-msj-cuerpo a { color: var(--acc, #1e5fbb); }
.asistente-msj--user .asistente-msj-cuerpo a { color: #fff; text-decoration: underline; }

.asistente-hora {
    font-size: .66rem;
    color: #8b94a7;
    margin: 3px 4px 0;
}

.asistente-puntos { display: flex; gap: 4px; padding: 14px; }
.asistente-puntos i {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #a9b3c6;
    animation: asistentePunto 1.1s infinite ease-in-out;
}
.asistente-puntos i:nth-child(2) { animation-delay: .18s; }
.asistente-puntos i:nth-child(3) { animation-delay: .36s; }
@keyframes asistentePunto {
    0%, 60%, 100% { transform: translateY(0); opacity: .5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

.asistente-guia {
    align-self: flex-end;
    font-size: .8rem;
    font-weight: 600;
    color: var(--acc, #1e5fbb);
    text-decoration: none;
    padding: 7px 12px;
    border-radius: 10px;
    background: #e8f0fe;
    transition: background .2s;
}
.asistente-guia:hover { background: #d4e3fd; }
.asistente-guia i { margin-left: 4px; }

.asistente-pie {
    flex-shrink: 0;
    border-top: 1px solid #e2e6ef;
    background: #fff;
    padding: 12px 14px;
}
.asistente-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    max-height: 168px;
    overflow-y: auto;
}
.asistente-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .79rem;
    font-weight: 500;
    color: #2f3a4d;
    background: #f4f7fc;
    border: 1.5px solid #e2e6ef;
    border-radius: 999px;
    padding: 7px 13px;
    cursor: pointer;
    text-align: left;
    transition: border-color .2s, background .2s, color .2s;
}
.asistente-chip i { color: var(--acc, #1e5fbb); font-size: .9rem; }
.asistente-chip:hover:not(:disabled) {
    border-color: var(--acc, #1e5fbb);
    background: #e8f0fe;
    color: var(--acc, #1e5fbb);
}
.asistente-chip:disabled { opacity: .45; cursor: default; }
.asistente-chip:focus-visible { outline: 2px solid #c9a84c; outline-offset: 1px; }

.asistente-nota {
    font-size: .68rem;
    color: #98a1b3;
    text-align: center;
    margin: 10px 0 0;
}

@media (max-width: 480px) {
    #asistentePanel {
        right: 12px;
        left: 12px;
        width: auto;
        height: min(70vh, calc(100vh - 100px));
        bottom: 82px;
    }
    .asistente-msj { max-width: 92%; }
    .asistente-fab { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .asistente-fab, #asistentePanel, .asistente-puntos i { transition: none; animation: none; }
}

/* ============================================================
   EDITOR DE CONTENIDO
   ============================================================
   El textarea queda oculto y esto es lo que se ve. El objetivo
   es que el que escribe no tenga que pensar en HTML.
   ============================================================ */
.ed {
    border: 1.5px solid #e2e6ef;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.ed:focus-within {
    border-color: var(--acc, #1e5fbb);
    box-shadow: 0 0 0 3px rgba(30, 95, 187, .07);
}

.ed-barra {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    padding: 8px;
    background: #f7f9fc;
    border-bottom: 1.5px solid #e2e6ef;
    position: sticky;
    top: 0;
    z-index: 2;
}
.ed-btn {
    width: 34px;
    height: 34px;
    border: 1.5px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #4a5568;
    font-size: .95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s, border-color .15s;
}
.ed-btn:hover { background: #e8f0fe; color: var(--acc, #1e5fbb); }
.ed-btn:active { transform: translateY(1px); }
.ed-btn:focus-visible { outline: 2px solid #c9a84c; outline-offset: 1px; }
.ed-btn--txt {
    width: auto;
    min-width: 38px;
    padding: 0 9px;
    font-weight: 700;
    font-size: .78rem;
    letter-spacing: .3px;
}
.ed-sep {
    width: 1px;
    height: 22px;
    background: #d9e0ec;
    margin: 0 4px;
}

.ed-area {
    padding: 16px 18px;
    min-height: 320px;
    max-height: 60vh;
    overflow-y: auto;
    font-size: .95rem;
    line-height: 1.7;
    color: #2f3a4d;
    outline: none;
}
.ed-area:empty::before,
.ed-area > p:only-child:empty::before {
    content: attr(data-placeholder);
    color: #a9b3c6;
}
/* El contenido se ve igual que va a verse en el sitio */
.ed-area > p { margin: 0 0 .9em; }
.ed-area > h2 { font-size: 1.35rem; font-weight: 800; color: var(--blue, #0a1e3d); margin: 1.1em 0 .5em; line-height: 1.3; }
.ed-area > h3 { font-size: 1.15rem; font-weight: 700; color: var(--blue, #0a1e3d); margin: 1em 0 .45em; }
.ed-area > h4 { font-size: 1rem; font-weight: 700; color: var(--blue, #0a1e3d); margin: .9em 0 .4em; }
.ed-area ul, .ed-area ol { margin: 0 0 .9em; padding-left: 1.5em; }
.ed-area li { margin-bottom: .35em; }
.ed-area a { color: var(--acc, #1e5fbb); }
.ed-area blockquote {
    margin: 1em 0;
    padding: .6em 1em;
    border-left: 4px solid var(--acc, #1e5fbb);
    background: #f7f9fc;
    border-radius: 0 8px 8px 0;
    color: #4a5568;
    font-style: italic;
}
.ed-area img { max-width: 100%; height: auto; border-radius: 10px; margin: .4em 0; }
.ed-area table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .9rem; }
.ed-area th, .ed-area td { border: 1px solid #e2e6ef; padding: 8px 10px; text-align: left; }
.ed-area th { background: #f7f9fc; font-weight: 700; }

.ed-pie {
    padding: 7px 14px;
    border-top: 1.5px solid #e2e6ef;
    background: #f7f9fc;
    font-size: .74rem;
    min-height: 30px;
    display: flex;
    align-items: center;
}
.ed-cuento { color: #8b94a7; }
.ed-aviso { color: #c62828; font-weight: 600; }
.ed-aviso i { margin-right: 4px; }

@media (max-width: 640px) {
    .ed-area { min-height: 240px; padding: 13px; font-size: .92rem; }
    .ed-btn { width: 30px; height: 30px; font-size: .88rem; }
}

/* Placeholder cuando un nivel todavia no tiene foto.
   Es preferible a un <img> que da 404: el navegador muestra el
   icono de imagen rota y se lee como si el sitio estuviera caido. */
.nivel-sin-foto {
    height: clamp(200px, 34vw, 300px);
    border-radius: 16px;
    background: linear-gradient(135deg, #eef3fb 0%, #e2e6ef 100%);
    border: 2px dashed #c5ccd9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #7a8396;
    text-align: center;
}
.nivel-sin-foto i { font-size: 2.6rem; color: #c5ccd9; }
.nivel-sin-foto span { font-weight: 700; font-size: 1.05rem; color: #3d4659; }
.nivel-sin-foto small { font-size: .78rem; letter-spacing: .5px; text-transform: uppercase; }

/* ============================================================
   GALERÍA DE INSTALACIONES
   ============================================================
   Las fotos salen solas de img/instalaciones/ (ver
   includes/instalaciones.php). La portada ocupa el ancho completo
   porque es la que da la primera impresión.
   ============================================================ */
.inst-foto {
    margin: 0;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .05);
    transition: transform .3s ease, box-shadow .3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.inst-foto:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .12);
}
.inst-foto img {
    width: 100%;
    height: clamp(130px, 22vw, 170px);
    object-fit: cover;
    display: block;
}
.inst-foto figcaption {
    padding: 11px 14px;
    font-size: .88rem;
    font-weight: 600;
    color: #0a1e3d;
    border-top: 1px solid #eef1f6;
}
/* La portada: ancha y más alta. */
.inst-foto--grande img { height: clamp(190px, 34vw, 320px); }
.inst-foto--grande figcaption {
    font-size: 1rem;
    padding: 14px 18px;
    background: #f8fafd;
}
/* El alto de las fotos ya es fluido con clamp(), así que el ajuste que
   estaba en un media query de 640px quedó sin efecto: el piso (130px /
   190px) ya cubre el teléfono angosto. */

/* ============================================================
   EDITOR DEL SITIO (CMS POR SECCIONES)
   ============================================================ */
.cms-lista-paginas { display: flex; flex-direction: column; gap: 2px; max-height: 420px; overflow-y: auto; }
.cms-item-pagina {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 11px;
    border-radius: 9px;
    color: #2f3a4d;
    text-decoration: none;
    font-size: .87rem;
    transition: background .15s, color .15s;
}
.cms-item-pagina:hover { background: #f0f4ff; color: #1e5fbb; }
.cms-item-pagina.activo { background: #1e5fbb; color: #fff; font-weight: 600; }
.cms-item-pagina span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cms-item-pagina small { font-size: .7rem; opacity: .7; white-space: nowrap; }

.cms-bloque { border: 1.5px solid #e2e6ef; border-radius: 12px; overflow: hidden; background: #fff; }
.cms-bloque.oculta { opacity: .62; border-style: dashed; }
.cms-bloque-cab {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    background: #f7f9fc;
    cursor: default;
}
.cms-bloque.abierto > .cms-bloque-cab { border-bottom: 1.5px solid #e2e6ef; }
.cms-bloque-tipo {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 700;
    color: #7b5fc0;
    background: #f3eeff;
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.cms-bloque-cab .btn { flex-shrink: 0; }
.cms-bloque:not(.abierto) .cms-bloque-cab .btn i { transform: rotate(-90deg); }
.cms-bloque-cuerpo { display: none; padding: 16px 14px; }
.cms-bloque.abierto .cms-bloque-cuerpo { display: block; }

/* ---- Render público ---- */
.cms-secciones > .cms-sec { margin-bottom: 40px; }
.cms-secciones > .cms-sec:last-child { margin-bottom: 0; }
.cms-sec-titulo {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0a1e3d;
    margin: 0 0 6px;
    line-height: 1.25;
}
.cms-sec-sub { color: #7a8396; font-size: 1.02rem; margin: 0 0 16px; }
.cms-sec-cuerpo { font-size: .97rem; line-height: 1.75; color: #3d4659; }
.cms-sec-cuerpo > *:first-child { margin-top: 0; }
.cms-sec-cuerpo > *:last-child { margin-bottom: 0; }
.cms-sec-cuerpo h2 { font-size: 1.28rem; font-weight: 700; color: #0a1e3d; margin: 1.2em 0 .5em; }
.cms-sec-cuerpo h3 { font-size: 1.1rem; font-weight: 700; color: #0a1e3d; margin: 1em 0 .45em; }
.cms-sec-cuerpo ul, .cms-sec-cuerpo ol { padding-left: 1.4em; margin: .7em 0; }
.cms-sec-cuerpo img { max-width: 100%; height: auto; border-radius: 12px; }

.cms-sec-fila { display: flex; gap: 26px; align-items: center; }
.cms-sec-fila--izq { flex-direction: row-reverse; }
.cms-sec-fila .cms-sec-texto { flex: 1; }
.cms-sec-img { border-radius: 14px; max-width: 100%; object-fit: cover; }
.cms-sec--imagen .cms-sec-img { width: 100%; max-height: 460px; }
.cms-sec-fila .cms-sec-img { width: 45%; height: auto; }

.cms-destacados { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.cms-destacado {
    background: #f8fafd;
    border: 1.5px solid #e2e6ef;
    border-left: 4px solid #1e5fbb;
    border-radius: 12px;
    padding: 16px 18px;
}
.cms-destacado strong { display: block; color: #0a1e3d; font-size: 1rem; margin-bottom: 5px; }
.cms-destacado p { margin: 0; font-size: .88rem; color: #7a8396; line-height: 1.6; }

@media (max-width: 768px) {
    .cms-sec-fila, .cms-sec-fila--izq { flex-direction: column; }
    .cms-sec-fila .cms-sec-img { width: 100%; }
}
