/* ==========================================================================
   DESIGN SYSTEM & GLOBAL STYLES - FMDA
   ========================================================================== */

/* Import premium Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;700;800&display=swap');

:root {
  /* Brand Colors (Exact Hex values from fmda.cl) */
  --brand-burgundy: #800c30;
  --brand-sage: #bab983;
  --brand-violet: #8e0d52;
  --brand-gold: #f3bd12;
  --brand-dark: #0f1317;
  --brand-slate: #223544;
  
  /* Premium Linear Gradients */
  --gradient-burgundy: linear-gradient(135deg, #800c30 0%, #54031c 100%);
  --gradient-gold: linear-gradient(135deg, #f3bd12 0%, #cfa00b 100%);
  --gradient-gold-light: linear-gradient(135deg, rgba(243, 189, 18, 0.15) 0%, rgba(207, 160, 11, 0.05) 100%);
  --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.7) 100%);

  /* HSL Tailored Theme System */
  --bg-primary: #f6f8fa; /* Soft off-white / light slate gray background */
  --bg-card: #ffffff;    /* Pure white cards to float over the soft bg */
  --text-primary: #1e2229;
  --text-secondary: #5a6578;
  --border-color: rgba(15, 19, 23, 0.08);
  --border-glass: rgba(255, 255, 255, 0.6);
  
  /* Multi-layered Soft Shadows */
  --shadow-sm: 0 2px 8px rgba(15, 19, 23, 0.04), 0 1px 2px rgba(15, 19, 23, 0.02);
  --shadow-md: 0 10px 30px rgba(15, 19, 23, 0.06), 0 4px 12px rgba(15, 19, 23, 0.03);
  --shadow-lg: 0 20px 50px rgba(15, 19, 23, 0.1), 0 10px 20px rgba(15, 19, 23, 0.05);
  --shadow-gold: 0 10px 30px rgba(243, 189, 18, 0.15);
  
  /* Category colors */
  --cat-institucional: var(--brand-burgundy);
  --cat-estudiantes: var(--brand-sage);
  --cat-docentes: var(--brand-violet);
  --cat-publicaciones: var(--brand-gold);

  /* Fonts */
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Layout */
  --header-height: 70px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --header-bg: rgba(255, 255, 255, 0.8);
  --header-bg-scrolled: rgba(255, 255, 255, 0.88);
}

[data-theme="dark"] {
  --bg-primary: #0b0e14;
  --bg-card: #151a24;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glass: rgba(15, 26, 36, 0.6);
  --gradient-glass: linear-gradient(135deg, rgba(21, 26, 36, 0.85) 0%, rgba(15, 20, 28, 0.8) 100%);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6), 0 10px 20px rgba(0, 0, 0, 0.4);
  --header-bg: rgba(11, 14, 20, 0.8);
  --header-bg-scrolled: rgba(11, 14, 20, 0.88);
}

/* ==========================================================================
   ACCESSIBILITY MODES (Toggled via JS)
   ========================================================================== */

/* High Contrast Mode */
body.accessibility-high-contrast {
  --bg-primary: #000000 !important;
  --bg-card: #121212 !important;
  --text-primary: #ffffff !important;
  --text-secondary: #dddddd !important;
  --border-color: #ffffff !important;
  --brand-gold: #ffff00 !important; /* High contrast yellow */
  --brand-burgundy: #ffffff !important;
  --brand-sage: #ffffff !important;
  --brand-violet: #ffffff !important;
  --shadow-sm: none !important;
  --shadow-md: none !important;
  --shadow-lg: none !important;
}

body.accessibility-high-contrast img {
  filter: grayscale(100%) contrast(120%);
}

/* Dyslexia Friendly Mode */
body.accessibility-dyslexia {
  --font-title: 'Comic Sans MS', 'Arial', sans-serif !important;
  --font-body: 'Comic Sans MS', 'Arial', sans-serif !important;
  word-spacing: 0.15em !important;
  letter-spacing: 0.05em !important;
  line-height: 1.8 !important;
}

/* ==========================================================================
   BASE & RESET
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  background-image: radial-gradient(rgba(15, 19, 23, 0.065) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  position: relative;
}

[data-theme="dark"] body {
  background-image: radial-gradient(rgba(255, 255, 255, 0.035) 1.5px, transparent 1.5px);
}

/* Ambient Floating Canvas Glows */
body::before, body::after {
  content: "";
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -2;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: multiply;
  will-change: transform;
}
body::before {
  background: var(--brand-burgundy);
  top: -10%;
  left: -10%;
  animation: ambientFloat1 25s infinite alternate ease-in-out;
}
body::after {
  background: var(--brand-gold);
  bottom: -15%;
  right: -10%;
  animation: ambientFloat2 30s infinite alternate ease-in-out;
}

[data-theme="dark"] body::before {
  opacity: 0.28;
  mix-blend-mode: screen;
}
[data-theme="dark"] body::after {
  opacity: 0.18;
  mix-blend-mode: screen;
}

@keyframes ambientFloat1 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(120px, 80px, 0) scale(1.15); }
  100% { transform: translate3d(-60px, 150px, 0) scale(0.9); }
}
@keyframes ambientFloat2 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-140px, -70px, 0) scale(1.2); }
  100% { transform: translate3d(80px, -150px, 0) scale(0.95); }
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease, opacity 0.2s ease;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  line-height: 1.2;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: rgba(15, 19, 23, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 19, 23, 0.3);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Utility buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-title);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-burgundy {
  background-color: var(--brand-burgundy);
  color: white;
}
.btn-burgundy:hover {
  background-color: #630823;
  box-shadow: 0 4px 12px rgba(128, 12, 48, 0.2);
}

.btn-gold {
  background-color: var(--brand-gold);
  color: var(--brand-dark);
}
.btn-gold:hover {
  background-color: #d4a30e;
  box-shadow: 0 4px 12px rgba(243, 189, 18, 0.3);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--brand-gold);
  color: var(--brand-dark);
}
.btn-outline:hover {
  background-color: var(--brand-gold);
  color: var(--brand-dark);
}

/* ==========================================================================
   HEADER & NAVBAR (Narrow, Supereduc Style)
   ========================================================================== */
.main-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background-color: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  transition: background-color 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1), height 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-bottom-color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.main-header.scrolled {
  height: 60px;
  background-color: var(--header-bg-scrolled);
  box-shadow: 0 8px 32px rgba(15, 19, 23, 0.05);
  border-bottom-color: rgba(15, 19, 23, 0.03);
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-brand img {
  height: 48px;
  width: auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand-burgundy);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.nav-link {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  position: relative;
  padding: 6px 0;
  transition: color 0.25s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--gradient-gold);
  transition: width 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.nav-link:hover::after,
.nav-menu li.active .nav-link::after {
  width: 100%;
}

/* Dropdown Menu Styles */
.nav-item-dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  list-style: none;
  min-width: 220px;
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 1001;
}

.nav-item-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu li a {
  display: block;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.dropdown-menu li a:hover {
  background-color: var(--bg-primary);
  color: var(--brand-burgundy);
}

/* Mobile Nav Toggle */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.mobile-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--text-primary);
  margin-bottom: 6px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-toggle span:last-child {
  margin-bottom: 0;
}

/* Header Search */
.header-search-container {
  position: relative;
  margin-left: 12px;
}

.header-search-input {
  padding: 8px 16px 8px 36px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background-color: rgba(246, 248, 250, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-family: var(--font-body);
  font-size: 0.85rem;
  width: 180px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.header-search-input:focus {
  width: 240px;
  outline: none;
  background-color: #ffffff;
  border-color: var(--brand-gold);
  box-shadow: var(--shadow-gold);
}

.header-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

/* Search suggestions overlay */
.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  padding: 12px;
  z-index: 1002;
}

.search-suggestions.active {
  display: flex;
}

.suggestion-section {
  margin-bottom: 12px;
}

.suggestion-section:last-child {
  margin-bottom: 0;
}

.suggestion-title {
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
  margin-bottom: 6px;
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
}

.suggestion-item:hover {
  background-color: var(--bg-primary);
}

.suggestion-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  color: white;
}

/* ==========================================================================
   HOMEPAGE LAYOUT - BENTO & HERO
   ========================================================================== */
.homepage-hero {
  margin-top: calc(var(--header-height) + 24px);
  margin-bottom: 48px;
}

.bento-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

/* Hero Slider Card */
.hero-slider-card {
  background-color: var(--bg-card);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  position: relative;
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

.slider-container {
  position: relative;
  flex: 1;
  overflow: hidden;
  height: 100%;
}

.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.slide.active {
  opacity: 1;
  visibility: visible;
}

.slide.active .slide-img {
  transform: scale(1.04);
}

.slide-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  transform: scale(1);
  transition: transform 6s cubic-bezier(0.25, 1, 0.5, 1);
}

.slide-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(20, 3, 8, 0.98) 0%, rgba(15, 19, 23, 0.5) 60%, transparent 100%);
  z-index: 2;
}

.slide-content {
  position: relative;
  z-index: 3;
  padding: 40px;
  color: #ffffff;
}

.slide-tag {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  letter-spacing: 0.5px;
}

.slide-tag.tag-institucional {
  background-color: rgba(128, 12, 48, 0.35);
  color: #ffffff;
  border: 1px solid rgba(128, 12, 48, 0.6);
}
.slide-tag.tag-estudiantes {
  background-color: rgba(186, 185, 131, 0.35);
  color: #ffffff;
  border: 1px solid rgba(186, 185, 131, 0.6);
}
.slide-tag.tag-docentes {
  background-color: rgba(142, 13, 82, 0.35);
  color: #ffffff;
  border: 1px solid rgba(142, 13, 82, 0.6);
}
.slide-tag.tag-publicaciones {
  background-color: rgba(243, 189, 18, 0.35);
  color: #ffffff;
  border: 1px solid rgba(243, 189, 18, 0.6);
}

.slide-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.15;
}

.slide-excerpt {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 20px;
  max-width: 600px;
}

/* Slider navigation dots */
.slider-dots {
  position: absolute;
  bottom: 24px;
  right: 40px;
  display: flex;
  gap: 8px;
  z-index: 4;
}

.slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  transition: background-color 0.3s cubic-bezier(0.25, 1, 0.5, 1), width 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease;
}

.slider-dot.active {
  background-color: var(--brand-gold);
  border-color: var(--brand-gold);
  width: 24px;
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(243, 189, 18, 0.4);
}

/* Right Column Cards (Metrics & Featured widgets) */
.hero-widgets {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.widget-card {
  background: var(--gradient-glass);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.widget-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.85);
}

.widget-card:has(.widget-banner-blue):hover {
  box-shadow: 0 15px 35px rgba(34, 53, 68, 0.08), var(--shadow-md);
  border-color: rgba(34, 53, 68, 0.2);
}

.widget-card:has(.widget-banner-gold):hover {
  box-shadow: 0 15px 35px rgba(243, 189, 18, 0.12), var(--shadow-md);
  border-color: rgba(243, 189, 18, 0.3);
}

.widget-banner {
  height: 8px;
  width: 100%;
}

.widget-banner-blue { background-color: var(--brand-slate); }
.widget-banner-gold { background-color: var(--brand-gold); }
.widget-banner-violet { background-color: var(--brand-violet); }
.widget-banner-burgundy { background-color: var(--brand-burgundy); }

.widget-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.widget-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.widget-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 1.2rem !important;
  background-color: rgba(15, 19, 23, 0.05);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.widget-icon[style*="var(--brand-slate)"] {
  background-color: rgba(34, 53, 68, 0.1) !important;
}

.widget-icon[style*="var(--brand-gold)"] {
  background-color: rgba(243, 189, 18, 0.15) !important;
  color: #c99c00 !important;
}

.widget-card:hover .widget-icon {
  transform: scale(1.1);
}

.widget-title {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.metrics-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.metric-item {
  display: flex;
  flex-direction: column;
}

.metric-number {
  font-family: var(--font-title);
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(135deg, #e5b018 0%, #b88d00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.metric-number-blue {
  background: linear-gradient(135deg, var(--brand-slate) 0%, #3d5a73 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 4px;
}

.widget-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================================================
   NEWS CAROUSELS
   ========================================================================== */
.section-news-carousel {
  margin-bottom: 32px;
}

/* ==========================================================================
   QUICK LINKS RIBBON (CINTA DE ICONOS DE ACCESO DIRECTO)
   ========================================================================== */
.quick-links-ribbon {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 48px;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.quick-link-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: var(--text-primary);
  padding: 16px 12px;
  border-radius: 12px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.quick-link-item:hover {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  transform: translateY(-4px);
  box-shadow: var(--shadow-xs);
}

.quick-link-icon-wrapper {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 12px;
  transition: all 0.25s ease;
}

/* Individual Icon Colors */
.quick-link-item.intranet .quick-link-icon-wrapper {
  background-color: rgba(245, 158, 11, 0.08);
  color: #f59e0b;
}
.quick-link-item.analitica .quick-link-icon-wrapper {
  background-color: rgba(139, 92, 246, 0.08);
  color: #8b5cf6;
}
.quick-link-item.empleos .quick-link-icon-wrapper {
  background-color: rgba(141, 14, 25, 0.08);
  color: var(--brand-burgundy);
}
.quick-link-item.trabajador .quick-link-icon-wrapper {
  background-color: rgba(22, 163, 74, 0.08);
  color: #16a34a;
}
.quick-link-item.inventarios .quick-link-icon-wrapper {
  background-color: rgba(14, 165, 233, 0.08);
  color: #0ea5e9;
}
.quick-link-item.otros .quick-link-icon-wrapper {
  background-color: rgba(100, 116, 139, 0.08);
  color: #64748b;
}

.quick-link-item:hover .quick-link-icon-wrapper {
  transform: scale(1.1);
}

.quick-link-title {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--text-primary);
}

.quick-link-desc {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.3;
}

/* Responsive Ribbon */
@media (max-width: 992px) {
  .quick-links-ribbon {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
}
@media (max-width: 576px) {
  .quick-links-ribbon {
    grid-template-columns: repeat(2, 1fr);
    padding: 16px;
    gap: 8px;
  }
  .quick-link-item {
    padding: 12px 8px;
  }
  .quick-link-icon-wrapper {
    width: 52px;
    height: 52px;
    font-size: 1.5rem;
  }
  .quick-link-title {
    font-size: 0.8rem;
  }
  .quick-link-desc {
    display: none;
  }
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--brand-burgundy);
  text-transform: uppercase;
  letter-spacing: -0.5px;
  position: relative;
  padding-bottom: 8px;
  margin-top: 10px;
}

.section-title::before {
  content: '★ PORTAL INFORMATIVO';
  display: block;
  font-family: var(--font-title);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--brand-gold);
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 3px;
  background: var(--gradient-gold);
  border-radius: 2px;
}

.carousel-controls {
  display: flex;
  gap: 8px;
}

.carousel-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: var(--gradient-glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-primary);
}

.carousel-btn:hover {
  background: var(--gradient-gold);
  border-color: var(--brand-gold);
  color: #15191f;
  transform: scale(1.08);
  box-shadow: var(--shadow-gold);
}

/* Scroll Container */
.carousel-track-container {
  overflow: hidden;
  margin: 0 -20px;
  padding: 10px 20px;
}

.carousel-track {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none; /* Firefox */
}

.carousel-track::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* News Cards */
.news-card {
  flex: 0 0 280px; /* Exact card width */
  background: var(--gradient-glass);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.news-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 40px rgba(15, 19, 23, 0.08), var(--shadow-gold);
  border-color: rgba(243, 189, 18, 0.25);
}

.card-img-container {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.news-card:hover .card-img {
  transform: scale(1.08);
  filter: brightness(1.03) contrast(1.02);
}

.card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.card-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag-institucional {
  background-color: rgba(128, 12, 48, 0.08);
  color: var(--brand-burgundy);
}
.tag-estudiantes {
  background-color: rgba(186, 185, 131, 0.15);
  color: #6a693c;
}
.tag-docentes {
  background-color: rgba(142, 13, 82, 0.08);
  color: var(--brand-violet);
}
.tag-publicaciones {
  background-color: rgba(243, 189, 18, 0.15);
  color: #ab8200;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 4.1em;
  transition: color 0.3s ease;
}

.news-card:hover .card-title {
  color: var(--brand-burgundy);
}

.card-excerpt {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand-burgundy);
}

.card-footer span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-footer span i {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.news-card:hover .card-footer span i {
  transform: translateX(4px);
}

/* Category-specific card accents */
.news-card-institucional { border-top: 3px solid var(--cat-institucional); }
.news-card-estudiantes { border-top: 3px solid var(--cat-estudiantes); }
.news-card-docentes { border-top: 3px solid var(--cat-docentes); }
.news-card-publicaciones { border-top: 3px solid var(--cat-publicaciones); }

/* ==========================================================================
   DETAIL PAGE (Dynamic Template Reader)
   ========================================================================== */
.article-container {
  margin-top: calc(var(--header-height) + 40px);
  margin-bottom: 64px;
}

.article-layout {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 40px;
}

.article-main,
.about-main {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 40px;
}

.article-header {
  margin-bottom: 24px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.article-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  color: white;
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.article-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.article-title {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 16px;
}

.article-author-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.article-hero-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 32px;
}

.article-content {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-primary);
}

.article-content p {
  margin-bottom: 20px;
}

.article-content h3 {
  font-size: 1.5rem;
  margin: 32px 0 16px;
}

.article-content blockquote {
  border-left: 4px solid var(--brand-gold);
  padding-left: 20px;
  margin: 24px 0;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--brand-burgundy);
}

/* Sidebar */
.article-sidebar {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.sidebar-widget {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.sidebar-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 8px;
}

.related-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  list-style: none;
}

.related-item {
  display: flex;
  gap: 12px;
}

.related-img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.related-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.related-headline {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   ESTABLECIMIENTOS PAGE (Interactive Finder)
   ========================================================================== */
.finder-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 32px;
  margin-bottom: 48px;
}

.finder-sidebar {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: fit-content;
}

.search-filter-title {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.filter-input {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.filter-input:focus {
  outline: none;
  border-color: var(--brand-gold);
}

.type-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.type-btn {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.type-btn.active, .type-btn:hover {
  background-color: var(--brand-burgundy);
  color: white;
  border-color: var(--brand-burgundy);
}

/* Map & Results Container */
.finder-main {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.map-container {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.svg-map-wrapper {
  width: 100%;
  height: 350px;
  background-color: var(--bg-primary);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* SVG map style overrides */
.map-region {
  fill: #dbe2e9;
  stroke: #ffffff;
  stroke-width: 1.5px;
  cursor: pointer;
  transition: fill 0.2s ease;
}

.map-region:hover, .map-region.active {
  fill: var(--brand-gold);
}

.map-tooltip {
  position: absolute;
  padding: 6px 12px;
  background-color: var(--brand-dark);
  color: white;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.school-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s;
}

.school-card:hover {
  transform: translateY(-2px);
}

.school-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.school-name {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand-burgundy);
}

.school-type-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  color: white;
  text-transform: uppercase;
}

.school-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.school-info-row i {
  color: var(--brand-gold);
  width: 16px;
}

.school-card .btn {
  margin-top: auto;
  font-size: 0.8rem;
  padding: 8px 16px;
}

/* ==========================================================================
   CONTACT PAGE & VALIDATIONS
   ========================================================================== */
.contact-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  margin-bottom: 64px;
}

.contact-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 40px;
  box-shadow: var(--shadow-sm);
}

.contact-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.contact-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--brand-gold);
}

/* Premium Dynamic Validation Styles using CSS selectors */
.form-input:user-valid {
  border-color: #2ec4b6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232ec4b6' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-input:user-invalid {
  border-color: #e71d36;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23e71d36' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.validation-error {
  font-size: 0.75rem;
  font-weight: 500;
  color: #e71d36;
  display: none;
}

.form-input:user-invalid + .validation-error {
  display: block;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.main-footer {
  background-color: var(--brand-dark);
  color: rgba(255, 255, 255, 0.8);
  padding: 40px 0 20px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 24px;
}

.footer-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-brand img {
  height: 48px;
}

.footer-brand-title {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffffff;
}

.footer-text {
  font-size: 0.85rem;
  line-height: 1.5;
}

.footer-title {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #ffffff;
  letter-spacing: 0.5px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
}

.footer-links a {
  font-size: 0.85rem;
}

.footer-links a:hover {
  color: var(--brand-gold);
}

.footer-info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
}

.footer-info-row i {
  color: var(--brand-gold);
  margin-top: 4px;
}

.footer-socials {
  display: flex;
  gap: 12px;
}

.footer-social-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: background-color 0.2s, color 0.2s;
}

.footer-social-btn:hover {
  background-color: var(--brand-gold);
  color: var(--brand-dark);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   ACCESSIBILITY CONTROLS (FLOAT PANEL)
   ========================================================================== */
.accessibility-panel-toggle {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--brand-burgundy);
  color: white;
  border: none;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  transition: transform 0.2s;
}

.accessibility-panel-toggle:hover {
  transform: scale(1.05);
}

.accessibility-panel {
  position: fixed;
  bottom: 80px;
  left: 24px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  width: 260px;
  display: none;
  flex-direction: column;
  gap: 16px;
  z-index: 9999;
  animation: slideUp 0.2s ease-out;
}

.accessibility-panel.active {
  display: flex;
}

.acc-section-title {
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}

.acc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.acc-btn-group {
  display: flex;
  gap: 6px;
}

.acc-btn {
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.acc-btn:hover, .acc-btn.active {
  background-color: var(--brand-gold);
  color: var(--brand-dark);
  border-color: var(--brand-gold);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 22px;
}

.slider-toggle:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider-toggle {
  background-color: var(--brand-gold);
}

input:checked + .slider-toggle:before {
  transform: translateX(22px);
}

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

/* ==========================================================================
   MEDIA QUERIES (RESPONSIVENESS)
   ========================================================================== */
@media (max-width: 992px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }
  .finder-layout {
    grid-template-columns: 1fr;
  }
  .contact-layout {
    grid-template-columns: 1fr;
  }
  .article-layout {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1.5fr 1fr;
  }
}

@media (max-width: 768px) {
  .nav-menu {
    position: fixed;
    top: var(--header-height);
    right: -100%;
    width: 280px;
    height: calc(100vh - var(--header-height));
    background-color: #ffffff;
    box-shadow: -4px 0 16px rgba(0,0,0,0.05);
    flex-direction: column;
    align-items: flex-start;
    padding: 32px 24px;
    gap: 24px;
    transition: right 0.3s ease;
    overflow-y: auto;
  }

  .nav-menu.active {
    right: 0;
  }

  .mobile-toggle {
    display: block;
  }

  .header-search-container {
    margin-left: 0;
    margin-right: 12px;
  }

  .header-search-input {
    width: 130px;
  }

  .header-search-input:focus {
    width: 160px;
  }

  .hero-slider-card {
    min-height: 380px;
  }

  .slide-content {
    padding: 24px;
  }

  .slide-title {
    font-size: 1.45rem;
  }

  .slide-excerpt {
    font-size: 0.85rem;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .brand-sub {
    display: none;
  }
}

/* ==========================================================================
   REVISTA MODAL & SIDEBAR MAGAZINE CARD
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 19, 23, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background-color: var(--bg-card);
  width: 90%;
  max-width: 1000px;
  height: 85vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-primary);
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s ease;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--brand-burgundy);
}

.modal-header-desc {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-primary);
}

.modal-header-desc h3 {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal-iframe-container {
  flex: 1;
  width: 100%;
  height: 100%;
  background-color: #525659; /* Standard PDF reader background gray */
}

.modal-iframe-container iframe {
  border: none;
  display: block;
  width: 100%;
  height: 100%;
}

/* Magazine Card Hover Zoom */
.widget-card-magazine:hover .magazine-cover-container {
  transform: scale(1.04) translateY(-5px);
  box-shadow: 0 20px 35px rgba(243, 189, 18, 0.35), 0 8px 20px rgba(0, 0, 0, 0.2) !important;
}

/* FLIPBOOK SPECIFIC STYLES */
#magazine-flipbook {
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  background-color: #2b2b2b;
  width: 90vw;
  height: 65vh;
  max-width: 1000px;
  max-height: 700px;
}

.flip-page {
  background-color: white;
  width: 100%;
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.flip-page canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: white;
  display: block;
}

/* Biblioteca Hemeroteca Modal Styles */
.shelf-cover-wrapper {
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), border-color 0.3s ease;
}

.shelf-item:hover .shelf-cover-wrapper {
  transform: translateY(-8px) scale(1.05);
  box-shadow: 0 15px 30px rgba(243, 189, 18, 0.28), 0 8px 20px rgba(0, 0, 0, 0.25);
  border-color: var(--brand-gold) !important;
}

.shelf-item:hover .shelf-cover-overlay {
  opacity: 1 !important;
}

.shelf-item span {
  transition: color 0.2s ease;
}

.shelf-item:hover span:first-of-type {
  color: var(--brand-gold) !important;
}

/* Acordeón de Transparencia */
details.transparency-details summary::-webkit-details-marker {
  display: none;
}

details.transparency-details summary {
  list-style: none;
}

details[open] summary i {
  transform: rotate(180deg);
}

/* Directorio en una Sola Fila */
.directorio-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  width: 100%;
}

@media (max-width: 992px) {
  .directorio-row {
    grid-template-columns: repeat(5, minmax(200px, 1fr));
    overflow-x: auto;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }
  
  .directorio-row > .school-card {
    scroll-snap-align: start;
  }
}

/* Modal y Timeline Histórico */
.history-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 19, 23, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2100;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.history-modal-overlay.active {
  opacity: 1;
}

.history-modal-content {
  background-color: var(--bg-card);
  width: 92%;
  max-width: 900px;
  height: 85vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border-color);
}

.history-modal-overlay.active .history-modal-content {
  transform: scale(1);
}

.history-modal-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-body);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-modal-body {
  padding: 32px;
  overflow-y: auto;
  flex: 1;
  background: var(--bg-card);
  scroll-behavior: smooth;
}

/* Estilos de la Línea de Tiempo */
.timeline-container {
  position: relative;
  padding-left: 32px;
  margin-left: 16px;
  border-left: 3px solid var(--border-color);
}

.timeline-item {
  position: relative;
  margin-bottom: 40px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-dot {
  position: absolute;
  left: -41px;
  top: 6px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background-color: var(--brand-gold);
  border: 3px solid var(--bg-card);
  box-shadow: 0 0 0 3px var(--brand-burgundy);
  transition: transform 0.3s ease;
}

.timeline-item:hover .timeline-dot {
  transform: scale(1.3);
  background-color: var(--brand-burgundy);
  box-shadow: 0 0 0 3px var(--brand-gold);
}

.timeline-year {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--brand-burgundy);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.timeline-card {
  background-color: var(--bg-body);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.timeline-card:hover {
  transform: translateX(6px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-gold-dark);
}

.timeline-card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.6;
}

.timeline-card strong {
  color: var(--brand-burgundy);
}

/* ==========================================================================
   PUBLICATIONS COVER IMAGE OVERRIDES (LARGER & DYNAMIC HOVER EFFECTS)
   ========================================================================== */
.pub-grid .school-card > div > div:first-child,
.split-grid-container .school-card > div > div:first-child {
  height: 220px !important;
  transition: background-color 0.2s ease;
}

.pub-grid .school-card > div > div:first-child img,
.split-grid-container .school-card > div > div:first-child img {
  height: 92% !important;
  width: auto !important;
  object-fit: contain;
  box-shadow: -4px 4px 12px rgba(0, 0, 0, 0.16) !important;
  transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.2s ease !important;
}

/* Micro-animation hover zoom on publication cover images */
.pub-grid .school-card:hover > div > div:first-child img,
.split-grid-container .school-card:hover > div > div:first-child img {
  transform: scale(1.05) rotate(-1deg);
  box-shadow: -6px 6px 18px rgba(0, 0, 0, 0.22) !important;
}

/* ==========================================================================
   PUBLICATIONS HOMEPAGE BANNER & COLLAGE
   ========================================================================== */
.publications-home-banner {
  background: linear-gradient(135deg, var(--brand-burgundy), #3d0516);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  position: relative;
  padding: 24px 36px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.publications-home-banner::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(217, 119, 6, 0.05) 0%, transparent 60%);
  pointer-events: none;
}

.btn-gold-home:hover {
  background-color: white !important;
  color: var(--brand-burgundy) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35) !important;
}

.cover-collage {
  position: relative;
  width: 100%;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.cover-collage-item {
  position: absolute;
  width: 130px;
  border-radius: 6px;
  box-shadow: -6px 10px 20px rgba(0,0,0,0.45);
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s ease;
  border: 1px solid rgba(255,255,255,0.15);
  pointer-events: none;
  background-color: #f3f4f6;
}

.cover-collage-item:nth-child(1) {
  transform: translateX(-100px) rotate(-16deg) scale(0.85);
  z-index: 10;
  opacity: 0.75;
}

.cover-collage-item:nth-child(2) {
  transform: translateX(-60px) rotate(-10deg) scale(0.89);
  z-index: 20;
  opacity: 0.85;
}

.cover-collage-item:nth-child(3) {
  transform: translateX(-20px) rotate(-4deg) scale(0.93);
  z-index: 30;
  opacity: 0.9;
}

.cover-collage-item:nth-child(4) {
  transform: translateX(20px) rotate(2deg) scale(0.97);
  z-index: 40;
  opacity: 0.95;
}

.cover-collage-item:nth-child(5) {
  transform: translateX(60px) rotate(8deg) scale(1.01);
  z-index: 50;
  opacity: 0.98;
}

.cover-collage-item:nth-child(6) {
  transform: translateX(100px) rotate(14deg) scale(1.05);
  z-index: 60;
}

/* Spread hover effect triggered by parent hover */
.publications-home-banner:hover .cover-collage-item:nth-child(1) {
  transform: translateX(-145px) rotate(-24deg) scale(0.88);
  opacity: 0.88;
}

.publications-home-banner:hover .cover-collage-item:nth-child(2) {
  transform: translateX(-92px) rotate(-16deg) scale(0.92);
  opacity: 0.92;
}

.publications-home-banner:hover .cover-collage-item:nth-child(3) {
  transform: translateX(-38px) rotate(-8deg) scale(0.96);
  opacity: 0.96;
}

.publications-home-banner:hover .cover-collage-item:nth-child(4) {
  transform: translateX(16px) rotate(0deg) scale(1.0);
  opacity: 1;
}

.publications-home-banner:hover .cover-collage-item:nth-child(5) {
  transform: translateX(70px) rotate(8deg) scale(1.04);
  opacity: 1;
}

.publications-home-banner:hover .cover-collage-item:nth-child(6) {
  transform: translateX(124px) rotate(16deg) scale(1.08);
  box-shadow: -10px 14px 28px rgba(0,0,0,0.55);
}

@media (max-width: 768px) {
  .publications-home-banner {
    padding: 24px 20px;
    flex-direction: column;
    text-align: center;
  }
  .publications-home-banner a.btn-gold-home {
    align-self: center !important;
  }
  .cover-collage {
    height: 190px;
    margin-top: 10px;
  }
  .cover-collage-item {
    width: 92px;
  }
  .cover-collage-item:nth-child(1) { transform: translateX(-70px) rotate(-20deg) scale(0.8); }
  .cover-collage-item:nth-child(2) { transform: translateX(-42px) rotate(-12deg) scale(0.85); }
  .cover-collage-item:nth-child(3) { transform: translateX(-14px) rotate(-4deg) scale(0.9); }
  .cover-collage-item:nth-child(4) { transform: translateX(14px) rotate(4deg) scale(0.95); }
  .cover-collage-item:nth-child(5) { transform: translateX(48px) rotate(12deg) scale(1.0); }
  .cover-collage-item:nth-child(6) { transform: translateX(70px) rotate(20deg) scale(1.05); }
}

/* ==========================================================================
   PREMIUM REDESIGN V2 - GLASSMORPHISM, AMBIENT GLOW, BENTO GRID & DARK MODE
   ========================================================================== */

/* Scroll Reveal animations */
.reveal-hidden {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}
.reveal-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Bento Grid Systems Cards Hub */
.bento-hub-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 20px;
}

/* Horizontal scrollable row for tablets and mobile to keep them in one single line */
@media (max-width: 1200px) {
  .bento-hub-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 6px 4px 14px 4px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 16px;
  }
  .bento-hub-grid::-webkit-scrollbar {
    height: 6px;
  }
  .bento-hub-grid::-webkit-scrollbar-track {
    background: transparent;
  }
  .bento-hub-grid::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
  }
  .bento-hub-card {
    flex: 0 0 220px;
    scroll-snap-align: start;
  }
}
.bento-hub-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.3s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
}
.bento-hub-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, rgba(128, 12, 48, 0.05) 0%, rgba(243, 189, 18, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.bento-hub-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 24px rgba(243, 189, 18, 0.15);
  border-color: var(--brand-gold);
}
.bento-hub-card:hover::before {
  opacity: 1;
}
.bento-hub-card .icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background-color: rgba(128, 12, 48, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-burgundy);
  font-size: 1.3rem;
  transition: transform 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}
.bento-hub-card:hover .icon-wrapper {
  transform: scale(1.1);
  background-color: var(--brand-burgundy);
  color: white;
}
/* In dark mode, adjust hover and wrapper background */
[data-theme="dark"] .bento-hub-card .icon-wrapper {
  background-color: rgba(243, 189, 18, 0.1);
  color: var(--brand-gold);
}
[data-theme="dark"] .bento-hub-card:hover .icon-wrapper {
  background-color: var(--brand-gold);
  color: var(--brand-burgundy);
}

/* Ambient Glow behind the main slider */
.slider-glow-wrapper {
  position: relative;
  z-index: 1;
}
.slider-ambient-glow {
  position: absolute;
  top: -5%; left: -5%; width: 110%; height: 110%;
  filter: blur(60px);
  opacity: 0.25;
  z-index: -1;
  transition: background-image 1.2s cubic-bezier(0.25, 1, 0.5, 1);
  pointer-events: none;
  border-radius: var(--radius-md);
  background-size: cover;
  background-position: center;
}
/* Reduce opacity slightly in dark theme for a softer effect */
[data-theme="dark"] .slider-ambient-glow {
  opacity: 0.15;
}

/* Dark Mode Toggle Button */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}
.theme-toggle-btn:hover {
  background-color: var(--border-color);
  color: var(--brand-burgundy);
  border-color: var(--brand-burgundy);
}
[data-theme="dark"] .theme-toggle-btn:hover {
  color: var(--brand-gold);
  border-color: var(--brand-gold);
}
