/* ==========================================================================
   CompassArt Drupal 10/11 Corporate Portal Theme - Impeccable Design System
   Palette: Magenta (#D4397D), Dark (#B62E68), Accent (#FF6B9D), Slate (#0F172A)
   Typography: Poppins (Headings), Inter (Body)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@500;600;700;800;900&display=swap');

:root {
  /* Brand Colors */
  --primary-magenta: #D4397D;
  --primary-magenta-dark: #B62E68;
  --primary-magenta-light: #E874A8;
  --primary-magenta-glow: rgba(212, 57, 125, 0.22);
  --accent-pink: #FF6B9D;
  --accent-rose: #FF85B3;
  --magenta-gradient: linear-gradient(135deg, #D4397D 0%, #B62E68 100%);
  --magenta-gradient-bright: linear-gradient(135deg, #FF6B9D 0%, #D4397D 100%);

  /* Neutrals */
  --bg-primary: #F8FAFC;
  --bg-white: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-dark: #0F172A;
  --bg-dark-surface: #1E293B;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-on-dark: #F8FAFC;

  --border-color: #E2E8F0;
  --border-color-hover: #CBD5E1;
  --border-focus: #D4397D;

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.88);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.08);

  /* Semantics */
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-danger: #EF4444;

  /* Typography */
  --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Shadows */
  --shadow-xs: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 25px -5px rgba(212, 57, 125, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 35px -10px rgba(212, 57, 125, 0.18), 0 10px 20px -8px rgba(15, 23, 42, 0.06);
  --shadow-glow: 0 0 25px rgba(212, 57, 125, 0.35);

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  /* Layout & Animation */
  --max-width: 1280px;
  --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.15s ease;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

a {
  color: var(--primary-magenta);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-magenta-dark);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Topbar Header (Drupal Top Header Region) */
.portal-topbar {
  background: #0B0F17;
  color: #CBD5E1;
  font-size: 13px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.portal-topbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar-info {
  display: flex;
  align-items: center;
  gap: 22px;
  font-weight: 500;
}

.topbar-info span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lang-selector select {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #F8FAFC;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.lang-selector select:hover {
  border-color: var(--primary-magenta-light);
  background: rgba(255, 255, 255, 0.14);
}

.topbar-btn {
  background: var(--magenta-gradient);
  color: #FFF !important;
  padding: 5px 16px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(212, 57, 125, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.topbar-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

/* Main Header Navbar with Scroll Glassmorphism */
.portal-header {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--primary-magenta), var(--accent-pink), var(--primary-magenta)) 1;
  transition: var(--transition);
}

.portal-header.is-scrolled {
  box-shadow: var(--shadow-md);
  background: rgba(255, 255, 255, 0.95);
}

.portal-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 84px;
  transition: var(--transition);
}

.portal-header.is-scrolled .container {
  height: 68px;
}

.brand-logo {
  display: flex;
  align-items: center;
}

.brand-logo-img {
  height: 50px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  transition: var(--transition);
}

.brand-logo-img.logo-dark {
  display: none !important;
}
.brand-logo-img.logo-light {
  display: block !important;
}

[data-theme="dark"] .brand-logo-img.logo-light,
html[data-theme="dark"] .brand-logo-img.logo-light,
body[data-theme="dark"] .brand-logo-img.logo-light {
  display: none !important;
}

[data-theme="dark"] .brand-logo-img.logo-dark,
html[data-theme="dark"] .brand-logo-img.logo-dark,
body[data-theme="dark"] .brand-logo-img.logo-dark {
  display: block !important;
}

.portal-header.is-scrolled .brand-logo-img {
  height: 42px;
}

.brand-logo:hover .brand-logo-img {
  transform: scale(1.03);
}

.footer-logo-img {
  height: 46px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  margin-bottom: 16px;
  display: block;
  transition: var(--transition);
}

.footer-logo-img:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

.theme-toggle-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #FFF;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.04);
}

.nav-theme-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-xs);
}

.nav-theme-btn:hover {
  background: var(--primary-magenta);
  color: #FFF;
  border-color: var(--primary-magenta);
}

.brand-icon::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
  transform: rotate(30deg);
  transition: transform 0.6s ease;
}

.brand-logo:hover .brand-icon::after {
  transform: rotate(30deg) translate(40%, 40%);
}

.brand-logo:hover .brand-icon {
  transform: scale(1.05) rotate(-2deg);
}

.brand-text h1 {
  font-size: 24px;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  line-height: 1.1;
}

.brand-text h1 span {
  color: var(--primary-magenta);
}

.brand-text p {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  font-weight: 600;
  margin-top: 1px;
}

/* Main Navigation Menu */
.primary-nav {
  display: flex !important;
  align-items: center !important;
  flex: 1;
  justify-content: center;
}

.primary-nav .block,
.primary-nav .block-menu,
.primary-nav nav {
  display: flex !important;
  align-items: center !important;
}

.primary-nav ul,
.primary-nav .menu,
.primary-nav div > ul {
  display: flex !important;
  flex-direction: row !important;
  list-style: none !important;
  gap: 28px !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

.primary-nav li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Hide unstyled search block forms if Drupal renders them inside primary_menu region */
.primary-nav form,
.primary-nav .search-block-form,
.primary-nav h2 {
  display: none !important;
}

.primary-nav a {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 15px;
  position: relative;
  padding: 8px 0;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.primary-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0%;
  height: 3px;
  background: var(--magenta-gradient);
  transition: var(--transition);
  border-radius: 3px;
}

.primary-nav a:hover,
.primary-nav a.is-active {
  color: var(--primary-magenta);
}

.primary-nav a:hover::after,
.primary-nav a.is-active::after {
  width: 100%;
}

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

.node-image-wrap {
  height: 200px;
  overflow: hidden;
  background: #1E293B;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.node-image-wrap > div,
.node-image-wrap > picture {
  width: 100%;
  height: 100%;
}

.node-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.search-toggle-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}

.search-toggle-btn:hover {
  background: var(--primary-magenta);
  color: #FFF;
  border-color: var(--primary-magenta);
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(212, 57, 125, 0.3);
}

/* Mobile Toggle */
.mobile-nav-toggle {
  display: none;
  position: relative;
  z-index: 2000;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  font-size: 22px;
  cursor: pointer;
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.mobile-nav-toggle:hover {
  background: var(--primary-magenta);
  color: #FFF;
}

/* Highlighted Bar (Drupal Highlighted Region) */
.region-highlighted {
  background: linear-gradient(90deg, #0F172A 0%, #1E293B 50%, #0F172A 100%);
  color: #FFF;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.region-highlighted .container {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.notice-badge {
  background: var(--magenta-gradient);
  color: #FFF;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  box-shadow: 0 2px 8px rgba(212, 57, 125, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.notice-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #FFF;
  border-radius: 50%;
  animation: pulseDot 1.8s infinite;
}

@keyframes pulseDot {
  0% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0.4; transform: scale(0.8); }
}

/* Hero Section (Drupal Hero Region) */
.region-hero {
  background: radial-gradient(circle at 80% 20%, rgba(212, 57, 125, 0.08) 0%, transparent 40%),
              radial-gradient(circle at 10% 80%, rgba(255, 107, 157, 0.06) 0%, transparent 35%),
              linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  padding: 85px 0 95px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.region-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(rgba(148, 163, 184, 0.15) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FFF;
  border: 1px solid rgba(212, 57, 125, 0.25);
  padding: 7px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-magenta);
  margin-bottom: 24px;
  box-shadow: 0 4px 15px rgba(212, 57, 125, 0.08);
}

.hero-title {
  font-size: clamp(34px, 4.5vw, 52px);
  letter-spacing: -1.2px;
  margin-bottom: 22px;
  color: #0F172A;
  line-height: 1.15;
}

.hero-title span {
  background: var(--magenta-gradient-bright);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.hero-lead {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 36px;
  line-height: 1.7;
  max-width: 620px;
}

.hero-ctas {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--magenta-gradient);
  color: #FFF !important;
  padding: 15px 34px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  color: #FFF !important;
}

.btn-secondary {
  background: #FFF;
  color: var(--text-primary) !important;
  border: 2px solid var(--border-color);
  padding: 15px 30px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  border-color: var(--primary-magenta);
  color: var(--primary-magenta) !important;
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .btn-secondary {
  background: transparent;
  color: var(--primary-magenta) !important;
  border: 2px solid var(--primary-magenta);
}

[data-theme="dark"] .btn-secondary:hover {
  background: var(--primary-magenta-glow);
}

/* Hero Image Block (replaces stats card) */
.hero-image-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-image-wrap::before {
  content: '';
  position: absolute;
  inset: -16px;
  border-radius: calc(var(--radius-lg) + 16px);
  background: var(--magenta-gradient);
  opacity: 0.12;
  filter: blur(32px);
  z-index: 0;
  animation: heroPulse 4s ease-in-out infinite;
}

@keyframes heroPulse {
  0%, 100% { opacity: 0.10; transform: scale(1); }
  50% { opacity: 0.18; transform: scale(1.04); }
}

.hero-main-img {
  width: 100%;
  max-width: 430px;
  height: auto;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  z-index: 1;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  display: block;
}

.hero-main-img:hover {
  transform: translateY(-6px) scale(1.012);
}

/* Keep badge-drupal for potential reuse */
.badge-drupal {
  background: linear-gradient(135deg, #0678BE 0%, #005993 100%);
  color: #FFF;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(6, 120, 190, 0.3);
}

/* Main Content Layout with Sidebar */
.portal-main-layout {
  padding: 70px 0;
}

.portal-grid-sidebar {
  display: block;
  width: 100%;
}

/* Section Titles */
.section-header {
  margin-bottom: 36px;
}

.section-title {
  font-size: clamp(24px, 3vw, 32px);
  color: var(--text-primary);
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  display: block;
  width: 56px;
  height: 4px;
  background: var(--magenta-gradient);
  margin-top: 10px;
  border-radius: 2px;
}

.section-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 10px;
}

/* Drupal Node Cards Feed */
.nodes-grid,
.main-content-area .views-element-container > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
}

.node-card {
  background: #FFF;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.node-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-magenta-light);
}

.node-image-wrap {
  height: 190px;
  background: linear-gradient(135deg, #1E1B2E 0%, #0F172A 100%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.5);
  overflow: hidden;
}

.node-image-wrap svg {
  transition: transform 0.5s ease;
}

.node-card:hover .node-image-wrap svg {
  transform: scale(1.12) rotate(3deg);
  color: var(--accent-pink);
}

.node-category-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--magenta-gradient);
  color: #FFF;
  font-weight: 700;
  font-size: 11px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

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

.node-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  gap: 14px;
  font-weight: 500;
}

.node-title {
  font-size: 20px;
  margin-bottom: 12px;
  line-height: 1.35;
}

.node-title a {
  color: var(--text-primary);
}

.node-title a:hover {
  color: var(--primary-magenta);
}

.node-summary {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 22px;
  flex: 1;
  line-height: 1.6;
}

.node-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
}

.node-footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.2s ease;
}

.node-card:hover .node-footer a {
  gap: 10px;
}

/* Sidebar Blocks */
.sidebar-block {
  background: #FFF;
  border-radius: var(--radius-md);
  padding: 28px;
  margin-bottom: 30px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.sidebar-block-title {
  font-size: 19px;
  border-bottom: 2px solid var(--bg-primary);
  padding-bottom: 14px;
  margin-bottom: 18px;
  position: relative;
}

.sidebar-block-title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 44px;
  height: 3px;
  background: var(--magenta-gradient);
  border-radius: 2px;
}

.quick-links-list {
  list-style: none;
}

.quick-links-list li {
  border-bottom: 1px dashed var(--border-color);
}

.quick-links-list li:last-child {
  border-bottom: none;
}

.quick-links-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
}

.quick-links-list a:hover {
  color: var(--primary-magenta);
  padding-left: 8px;
}

/* Services Pillars Grid (Content Bottom Region) */
.region-content-bottom {
  background: var(--bg-white);
  padding: 85px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 36px;
}

.pillar-card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  position: relative;
}

.pillar-card:hover {
  background: #FFF;
  border-color: var(--primary-magenta);
  box-shadow: var(--shadow-lg);
  transform: translateY(-8px);
}

.pillar-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  background: var(--magenta-gradient);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 26px;
  box-shadow: 0 10px 20px rgba(212, 57, 125, 0.28);
  transition: var(--transition);
}

.pillar-card:hover .pillar-icon {
  transform: scale(1.1) rotate(-4deg);
}

.pillar-title {
  font-size: 22px;
  margin-bottom: 14px;
}

.pillar-desc {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 26px;
  line-height: 1.6;
}

/* Footer Section */
.portal-footer {
  background: #0B0F17;
  color: #94A3B8;
  padding-top: 70px;
}

.footer-grid {
  display: grid !important;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 56px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-grid > div:first-child img {
  content: url("../images/logo_blanco.png");
  opacity: 0.05;
  width: 100%;
  max-width: 250px;
  transform: scale(1.2);
  transform-origin: center left;
  display: block;
}

.footer-grid > div:not(:first-child) {
  display: contents;
}

.footer-grid > div:first-child {
  /* Remove display: contents for the first child so we can style its background */
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.footer-grid > div:first-child::before {
  content: "";
  position: absolute;
  top: 0;
  left: -20px;
  width: 150%;
  height: 150%;
  background-image: url("../images/logo_blanco.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: top left;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.footer-grid > div:first-child > * {
  z-index: 1;
  position: relative;
}

.footer-grid > div:first-child img {
  display: none !important;
}

/* Hide 4th column (Portal Institucional) */
.footer-grid > div:nth-child(4) {
  display: none !important;
}

#toggleDrupalRegions {
  display: none !important;
}

.footer-brand h3 {
  color: #FFF;
  font-size: 24px;
  margin-bottom: 14px;
}

.footer-brand h3 span {
  color: var(--primary-magenta-light);
}

.footer-brand p {
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.7;
}

.footer-col h4 {
  color: #FFF;
  font-size: 17px;
  margin-bottom: 22px;
  position: relative;
  padding-bottom: 10px;
}

.footer-col h4::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 34px;
  height: 3px;
  background: var(--magenta-gradient);
  border-radius: 2px;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 12px;
}

.footer-links a {
  color: #94A3B8;
  font-size: 14px;
  transition: var(--transition);
}

.footer-links a:hover {
  color: #FFF;
  padding-left: 4px;
}

.footer-bottom {
  padding: 28px 0;
  font-size: 13.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-bottom > div,
.footer-bottom > div > div {
  display: contents;
}

/* Drupal Inspector Toggle Overlay */
.region-debug-badge {
  outline: 2px dashed var(--primary-magenta) !important;
  outline-offset: 4px;
  position: relative;
}

.region-debug-badge::before {
  content: "📍 Region: " attr(data-region);
  position: absolute;
  top: 6px;
  right: 12px;
  background: var(--primary-magenta);
  color: #FFF;
  font-size: 11px;
  font-family: monospace;
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  font-weight: 700;
  z-index: 100;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Search Modal Overlay with Blur & Quick Tags */
.search-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.search-modal.is-open {
  display: flex;
  opacity: 1;
}

.search-box {
  background: #FFF;
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 92%;
  max-width: 640px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-modal.is-open .search-box {
  transform: scale(1);
}

.search-input-wrap {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.search-input-wrap input {
  flex: 1;
  padding: 15px 20px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-family: var(--font-body);
  transition: var(--transition);
}

.search-input-wrap input:focus {
  border-color: var(--primary-magenta);
  outline: none;
  box-shadow: 0 0 0 4px var(--primary-magenta-glow);
}

.quick-search-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
}

.quick-tag {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
}

.quick-tag:hover {
  background: var(--primary-magenta);
  color: #FFF;
  border-color: var(--primary-magenta);
}

/* Mobile Drawer Overlay */
.mobile-drawer-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
}

.mobile-drawer-overlay.is-active {
  display: block;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .portal-grid-sidebar {
    grid-template-columns: 1fr;
  }
  .pillars-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .portal-topbar {
    display: none;
  }
  .primary-nav {
    display: none !important;
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: #FFF;
    padding: 80px 24px 32px;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
    z-index: 1999;
    overflow-y: auto;
  }
  .primary-nav.is-open {
    display: block !important;
  }
  .primary-nav ul {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 20px;
  }
  .primary-nav a {
    font-size: 17px;
  }
  .mobile-nav-toggle {
    display: flex;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  .hero-card-preview {
    padding: 24px;
  }
}

@media (max-width: 520px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* ==========================================================================
   Dark Mode Theme Overrides ([data-theme="dark"])
   ========================================================================== */
[data-theme="dark"],
html[data-theme="dark"],
body[data-theme="dark"] {
  --bg-primary: #090D16 !important;
  --bg-white: #131B29 !important;
  --bg-card: #131B29 !important;
  --bg-dark: #06090F !important;

  --text-primary: #F1F5F9 !important;
  --text-secondary: #94A3B8 !important;
  --text-muted: #64748B !important;

  --border-color: #1E293B !important;
  --border-color-hover: #334155 !important;

  --glass-bg: rgba(19, 27, 41, 0.96) !important;
  --glass-border: rgba(255, 255, 255, 0.1) !important;
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4) !important;

  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.35) !important;
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.45) !important;
  --shadow-lg: 0 20px 35px -10px rgba(0, 0, 0, 0.6) !important;
}

html[data-theme="dark"] body,
body[data-theme="dark"] {
  background-color: #090D16 !important;
  color: #F1F5F9 !important;
}

html[data-theme="dark"] .portal-header,
body[data-theme="dark"] .portal-header,
html[data-theme="dark"] .portal-header.is-scrolled,
body[data-theme="dark"] .portal-header.is-scrolled {
  background: #131B29 !important;
  border-bottom: 2px solid var(--primary-magenta) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="dark"] .brand-logo-img.logo-light,
body[data-theme="dark"] .brand-logo-img.logo-light {
  display: none !important;
}

html[data-theme="dark"] .brand-logo-img.logo-dark,
body[data-theme="dark"] .brand-logo-img.logo-dark {
  display: block !important;
}

html[data-theme="dark"] .primary-nav a,
body[data-theme="dark"] .primary-nav a {
  color: #E2E8F0 !important;
}

html[data-theme="dark"] .primary-nav a:hover,
html[data-theme="dark"] .primary-nav a.is-active,
body[data-theme="dark"] .primary-nav a:hover,
body[data-theme="dark"] .primary-nav a.is-active {
  color: var(--primary-magenta-light) !important;
}

html[data-theme="dark"] .nav-theme-btn,
html[data-theme="dark"] .search-toggle-btn,
html[data-theme="dark"] .mobile-nav-toggle,
body[data-theme="dark"] .nav-theme-btn,
body[data-theme="dark"] .search-toggle-btn,
body[data-theme="dark"] .mobile-nav-toggle {
  background: #1E293B !important;
  border-color: #334155 !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] .nav-theme-btn:hover,
html[data-theme="dark"] .search-toggle-btn:hover,
body[data-theme="dark"] .nav-theme-btn:hover,
body[data-theme="dark"] .search-toggle-btn:hover {
  background: var(--primary-magenta) !important;
  color: #FFF !important;
  border-color: var(--primary-magenta) !important;
}

html[data-theme="dark"] .region-hero,
body[data-theme="dark"] .region-hero {
  background: radial-gradient(circle at 80% 20%, rgba(212, 57, 125, 0.14) 0%, transparent 40%),
              radial-gradient(circle at 10% 80%, rgba(255, 107, 157, 0.08) 0%, transparent 35%),
              linear-gradient(180deg, #0F172A 0%, #090D16 100%) !important;
  border-color: #1E293B !important;
}

html[data-theme="dark"] .region-hero::before,
body[data-theme="dark"] .region-hero::before {
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px) !important;
}

html[data-theme="dark"] .hero-title,
body[data-theme="dark"] .hero-title {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .hero-lead,
body[data-theme="dark"] .hero-lead {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .hero-tag,
html[data-theme="dark"] .hero-card-preview,
html[data-theme="dark"] .node-card,
html[data-theme="dark"] .sidebar-block,
html[data-theme="dark"] .pillar-card,
html[data-theme="dark"] .search-box,
body[data-theme="dark"] .hero-tag,
body[data-theme="dark"] .hero-card-preview,
body[data-theme="dark"] .node-card,
body[data-theme="dark"] .sidebar-block,
body[data-theme="dark"] .pillar-card,
body[data-theme="dark"] .search-box {
  background: #131B29 !important;
  border-color: #1E293B !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] .stat-box,
body[data-theme="dark"] .stat-box {
  background: #090D16 !important;
  border-color: var(--primary-magenta) !important;
}

html[data-theme="dark"] .stat-box h4,
body[data-theme="dark"] .stat-box h4 {
  color: var(--primary-magenta-light) !important;
}

html[data-theme="dark"] .stat-box p,
body[data-theme="dark"] .stat-box p {
  color: #94A3B8 !important;
}

html[data-theme="dark"] .node-title a,
html[data-theme="dark"] .pillar-title,
html[data-theme="dark"] .sidebar-block-title,
html[data-theme="dark"] .quick-links-list a,
body[data-theme="dark"] .node-title a,
body[data-theme="dark"] .pillar-title,
body[data-theme="dark"] .sidebar-block-title,
body[data-theme="dark"] .quick-links-list a {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .quick-links-list a:hover,
body[data-theme="dark"] .quick-links-list a:hover {
  color: var(--primary-magenta-light) !important;
}

html[data-theme="dark"] .region-content-bottom,
body[data-theme="dark"] .region-content-bottom,
html[data-theme="dark"] .portal-wrapper,
body[data-theme="dark"] .portal-wrapper,
html[data-theme="dark"] .portal-main-layout,
body[data-theme="dark"] .portal-main-layout {
  background: #090D16 !important;
  border-color: #1E293B !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] .section-title,
body[data-theme="dark"] .section-title {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .section-subtitle,
body[data-theme="dark"] .section-subtitle {
  color: #94A3B8 !important;
}

html[data-theme="dark"] #contacto,
body[data-theme="dark"] #contacto {
  background: #090D16 !important;
}

html[data-theme="dark"] #contacto form,
body[data-theme="dark"] #contacto form {
  background: #131B29 !important;
  border-color: #1E293B !important;
}

html[data-theme="dark"] form input,
html[data-theme="dark"] form select,
html[data-theme="dark"] form textarea,
body[data-theme="dark"] form input,
body[data-theme="dark"] form select,
body[data-theme="dark"] form textarea {
  background: #090D16 !important;
  color: #F8FAFC !important;
  border-color: #1E293B !important;
}

html[data-theme="dark"] form label,
body[data-theme="dark"] form label {
  color: #E2E8F0 !important;
}

html[data-theme="dark"] .quick-tag,
body[data-theme="dark"] .quick-tag {
  background: #090D16 !important;
  border-color: #1E293B !important;
  color: #94A3B8 !important;
}

html[data-theme="dark"] .quick-tag:hover,
body[data-theme="dark"] .quick-tag:hover {
  background: var(--primary-magenta) !important;
  color: #FFF !important;
}

@media (max-width: 768px) {
  html[data-theme="dark"] .primary-nav,
  body[data-theme="dark"] .primary-nav {
    background: #131B29 !important;
  }
}

/* Article Detail View */
.node-detail-view {
  background: var(--bg-white);
  padding-bottom: 80px;
}

.article-hero-image {
  width: 100%;
  height: 50vh;
  min-height: 350px;
  max-height: 600px;
  overflow: hidden;
  margin-bottom: 50px;
  background: #1E293B;
}

.article-hero-image > * {
  width: 100%;
  height: 100%;
}

.article-hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.article-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

.article-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 24px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  font-size: 15px;
  color: var(--text-secondary);
}

.meta-author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

.article-body-content {
  font-size: 17px;
  line-height: 1.8;
  color: var(--text-primary);
  text-align: justify !important;
  text-justify: inter-word;
}

.article-body-content p,
.article-body-content div,
.article-body-content span {
  text-align: justify !important;
  text-justify: inter-word;
}

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

.article-body-content h2, 
.article-body-content h3 {
  margin-top: 48px;
  margin-bottom: 20px;
  color: var(--text-primary);
  font-weight: 700;
}

.article-footer {
  margin-top: 60px;
  padding-top: 30px;
  border-top: 1px solid var(--border-color);
}

html[data-theme="dark"] .node-detail-view,
body[data-theme="dark"] .node-detail-view {
  background: transparent !important;
}

/* --- Impeccable Animations --- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px) scale(0.98);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* --- Impeccable Hover Micro-interactions --- */
.btn-primary:hover,
.button-primary:hover {
  transform: translateY(-3px);
  /* Optional: we keep existing box-shadow or add the one from design.json */
  box-shadow: 0 20px 35px -10px rgba(212, 57, 125, 0.18);
}

.pillar-card {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pillar-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 35px -10px rgba(212, 57, 125, 0.18);
  border-color: #D4397D;
}

.pillar-card .pillar-icon,
.pillar-card .icon {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pillar-card:hover .pillar-icon,
.pillar-card:hover .icon {
  transform: scale(1.1) rotate(-4deg);
}

/* --- App Educativa Premium Aesthetics --- */
.app-educativa-detail {
  --app-gradient: linear-gradient(135deg, var(--primary-magenta) 0%, var(--accent-pink) 100%);
  --app-glow: rgba(212, 57, 125, 0.15);
  background: var(--bg-primary);
  min-height: 100vh;
}

[data-theme="dark"] .app-educativa-detail,
html[data-theme="dark"] .app-educativa-detail,
body[data-theme="dark"] .app-educativa-detail {
  background: var(--bg-dark);
}

.app-hero-section {
  position: relative;
  padding: 100px 0 80px;
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
}

.app-hero-bg-glow {
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 1200px;
  height: 600px;
  background: radial-gradient(circle, var(--app-glow) 0%, transparent 60%);
  z-index: 0;
  pointer-events: none;
  animation: pulseGlow 6s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
  0% { opacity: 0.6; transform: translateX(-50%) scale(0.95); }
  100% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}

.app-hero-container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: flex-start;
}

@media (max-width: 992px) {
  .app-hero-container {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

.app-tags {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.app-badge {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.app-badge.primary {
  background: var(--app-gradient);
  color: #FFF;
  box-shadow: 0 4px 12px rgba(212, 57, 125, 0.25);
}

.app-badge.secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .app-badge.secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #FFF;
}

.app-title {
  font-size: clamp(28px, 3.5vw, 42px);
  line-height: 1.15;
  margin-bottom: 24px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

[data-theme="dark"] .app-title {
  color: #FFF;
}

.app-body-content {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

[data-theme="dark"] .app-body-content {
  color: var(--text-muted);
}

.app-body-content .field {
  margin-bottom: 20px;
}

.app-body-content .field__label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary-magenta);
  margin-bottom: 6px;
}

.app-excerpt {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 400;
  line-height: 1.6;
}

[data-theme="dark"] .app-excerpt {
  color: #FFF;
  border-color: rgba(255, 255, 255, 0.1);
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .glass-panel {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.app-image-wrapper {
  padding: 16px;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.app-image-wrapper:hover {
  transform: translateY(-8px) scale(1.02);
}

.app-main-image,
.app-image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.app-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 400px;
  color: var(--primary-magenta);
}

.app-details-section {
  padding: 80px 0;
  position: relative;
}

.app-details-container {
  max-width: 900px;
  margin: 0 auto;
}

.app-full-content {
  padding: 40px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
}

[data-theme="dark"] .app-full-content {
  color: rgba(255, 255, 255, 0.85);
}

.app-description-block,
.app-body-block {
  margin-bottom: 40px;
}
.app-description-block:last-child,
.app-body-block:last-child {
  margin-bottom: 0;
}

.app-footer-links {
  margin-top: 40px;
  text-align: center;
}

.app-full-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 24px 0;
}
