/* ===========================================================
   I.E. SAN RAMÓN — Sistema de diseño
   Turquesa + Blanco
   =========================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Tipografía */
  --font-display: 'Gambetta', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --font-body: 'General Sans', system-ui, -apple-system, sans-serif;

  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 4.5rem);

  /* Espaciado */
  --space-1: 0.25rem;  --space-2: 0.5rem;   --space-3: 0.75rem;
  --space-4: 1rem;     --space-5: 1.25rem;  --space-6: 1.5rem;
  --space-8: 2rem;     --space-10: 2.5rem;  --space-12: 3rem;
  --space-16: 4rem;    --space-20: 5rem;    --space-24: 6rem;
  --space-32: 8rem;

  --radius-sm: 5px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);

  --maxw: 1200px;
  --gutter: clamp(1.25rem, 5vw, 4rem);
}

/* ---------- Color: claro ---------- */
:root,
:root {
  --color-bg: #ffffff;
  --color-surface: #f4fbfb;
  --color-surface-2: #e7f6f7;
  --color-surface-deep: #0b3d43;

  --color-text: #0d2427;
  --color-text-muted: #5b7276;
  --color-text-faint: #9db0b3;
  --color-text-inverse: #ffffff;

  --color-border: #d3e8ea;
  --color-divider: #e6f2f3;

  --color-primary: #07727d;
  --color-primary-hover: #055a63;
  --color-primary-deep: #04434a;
  --color-primary-soft: #d9f1f3;
  --color-accent: #14b8c4;

  --shadow-sm: 0 1px 2px rgba(11, 61, 67, 0.06), 0 2px 8px rgba(11, 61, 67, 0.04);
  --shadow-md: 0 4px 12px rgba(11, 61, 67, 0.08), 0 12px 32px rgba(11, 61, 67, 0.06);
  --shadow-lg: 0 12px 24px rgba(11, 61, 67, 0.1), 0 32px 64px rgba(11, 61, 67, 0.1);
  --header-bg: rgba(255, 255, 255, 0.82);
}

/* ---------- Color: oscuro ---------- */


/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.4s var(--ease-out), color 0.4s var(--ease-out);
}

img, picture, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 500; line-height: 1.14; letter-spacing: -0.008em; }

/* ---------- Utilidades ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: clamp(var(--space-16), 9vw, var(--space-32)); }
.section--tight { padding-block: clamp(var(--space-12), 6vw, var(--space-20)); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}
.eyebrow::before {
  content: '';
  width: 24px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.section-title {
  font-family: var(--font-body);
  font-size: var(--text-2xl);
  max-width: 22ch;
  margin-bottom: var(--space-4);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.08;
}
.section-lead {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 62ch;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 200;
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm);
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: var(--space-4); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 0.9em 1.7em;
  border-radius: 4px;
  letter-spacing: 0.01em;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease-out),
    box-shadow 0.25s var(--ease-out), color 0.25s var(--ease-out);
  will-change: transform;
}
.btn svg { width: 18px; height: 18px; transition: transform 0.3s var(--ease); }
.btn:hover svg { transform: translateX(3px); }

.btn--primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  box-shadow: 0 6px 18px -6px color-mix(in oklab, var(--color-primary) 70%, transparent);
}
.btn--primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px -8px color-mix(in oklab, var(--color-primary) 75%, transparent);
}
.btn--ghost {
  border: 1.5px solid var(--color-border);
  color: var(--color-text);
  background: color-mix(in oklab, var(--color-bg) 60%, transparent);
}
.btn--ghost:hover { border-color: var(--color-primary); color: var(--color-primary); transform: translateY(-2px); }

.btn--light {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(6px);
}
.btn--light:hover { background: rgba(255, 255, 255, 0.28); transform: translateY(-2px); }

/* ===========================================================
   HEADER
   =========================================================== */
.header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  transition: transform 0.4s var(--ease), background 0.35s var(--ease-out),
    box-shadow 0.35s var(--ease-out), border-color 0.35s var(--ease-out);
  border-bottom: 1px solid transparent;
}
.header--scrolled {
  background: var(--header-bg);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom-color: var(--color-divider);
  box-shadow: var(--shadow-sm);
}
.header--hidden { transform: translateY(-105%); }

.header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  min-height: 76px;
}

.brand { display: flex; align-items: center; gap: var(--space-3); margin-right: auto; }
.brand__mark {
  width: 60px;
  height: 60px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: transform 0.5s var(--ease), box-shadow 0.4s var(--ease);
}
.brand__mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand:hover .brand__mark { transform: rotate(-8deg) scale(1.06); }
.header--over-hero:not(.header--scrolled) .brand__mark {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 8px 22px -8px rgba(0, 0, 0, 0.5);
  background: #fff;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  color: var(--color-text);
}
.brand__sub {
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 500;
}
.header--over-hero:not(.header--scrolled) .brand__name { color: #fff; }
.header--over-hero:not(.header--scrolled) .brand__sub { color: rgba(255, 255, 255, 0.75); }
.header--over-hero:not(.header--scrolled) .brand__mark { color: #fff; }
.header--over-hero:not(.header--scrolled) .nav__link { color: rgba(255, 255, 255, 0.9); }
.header--over-hero:not(.header--scrolled) .icon-btn { color: #fff; border-color: rgba(255, 255, 255, 0.35); }

.nav { display: flex; align-items: center; gap: var(--space-1); }
.nav__link {
  position: relative;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: color 0.25s var(--ease-out);
}
.nav__link::after {
  content: '';
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.nav__link:hover { color: var(--color-primary); }
.nav__link:hover::after,
.nav__link[aria-current='true']::after { transform: scaleX(1); }
.nav__link[aria-current='true'] { color: var(--color-primary); }

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

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1.5px solid var(--color-border);
  color: var(--color-text-muted);
  transition: color 0.25s, border-color 0.25s, transform 0.25s var(--ease), background 0.25s;
}
.icon-btn:hover { color: var(--color-primary); border-color: var(--color-primary); transform: rotate(-15deg); }
.icon-btn svg { width: 18px; height: 18px; }

.burger { display: none; position: relative; width: 44px; height: 44px; }
.burger span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 2px;
  margin-left: -11px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.35s var(--ease), opacity 0.2s;
}
.burger span:nth-child(1) { transform: translateY(-7px); }
.burger span:nth-child(2) { transform: translateY(0); }
.burger span:nth-child(3) { transform: translateY(7px); }
.burger[aria-expanded='true'] span:nth-child(1) { transform: translateY(0) rotate(45deg); }
.burger[aria-expanded='true'] span:nth-child(2) { opacity: 0; transform: scaleX(0.2); }
.burger[aria-expanded='true'] span:nth-child(3) { transform: translateY(0) rotate(-45deg); }

/* ===========================================================
   HERO — con animación de imagen
   =========================================================== */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: end;
  isolation: isolate;
  overflow: hidden;
  background: var(--color-surface-deep);
}
.hero__media { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.hero__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 116%;
  object-fit: cover;
  object-position: center 42%;
  opacity: 0;
  transform: scale(1.14);
  transition: opacity 1.4s var(--ease);
  will-change: transform, opacity;
}
.hero__img.is-active {
  opacity: 1;
  animation: kenburns 7.6s var(--ease-out) forwards;
}
@keyframes kenburns {
  0%   { transform: scale(1.16) translate3d(-1.4%, 0.8%, 0); }
  100% { transform: scale(1.02) translate3d(1.4%, -1.4%, 0); }
}

/* Indicadores del carrusel */
.hero__dots {
  position: absolute;
  right: max(6vw, calc((100vw - 1200px) / 2));
  bottom: calc(var(--space-8) + 4px);
  display: flex;
  gap: 10px;
  z-index: 3;
  padding: 7px 14px;
  border-radius: 4px;
  background: rgba(4, 26, 30, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}
.hero__dot {
  width: 42px;
  height: 22px;
  padding: 9px 0;
  background: none;
  border: 0;
  cursor: pointer;
  display: block;
}
.hero__dot span {
  display: block;
  height: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  width: 100%;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.4);
  position: relative;
  overflow: hidden;
  transition: background 0.3s var(--ease);
}
.hero__dot:hover span { background: rgba(255, 255, 255, 0.6); }
.hero__dot span::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  transform-origin: left center;
  transform: scaleX(0);
}
.hero__dot.is-active span::after { animation: dotFill 7s linear forwards; }
@keyframes dotFill {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to top, rgba(4, 26, 30, 0.94) 0%, rgba(4, 26, 30, 0.62) 38%, rgba(4, 26, 30, 0.22) 68%, rgba(4, 26, 30, 0.5) 100%),
    linear-gradient(105deg, rgba(7, 90, 99, 0.55) 0%, rgba(7, 90, 99, 0) 60%);
}

.hero__content { padding-block: clamp(var(--space-20), 14vh, var(--space-32)) clamp(var(--space-16), 18vh, var(--space-32)); }
.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
  padding: 0.55em 1.05em;
  border-radius: 3px;
  margin-bottom: var(--space-6);
}
.hero__badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--color-accent) 70%, transparent);
  animation: pulse 2.4s var(--ease-out) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in oklab, var(--color-accent) 70%, transparent); }
  70%  { box-shadow: 0 0 0 12px rgba(20, 184, 196, 0); }
  100% { box-shadow: 0 0 0 0 rgba(20, 184, 196, 0); }
}

.hero__title {
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.05;
  font-size: var(--text-2xl);
  color: #fff;
  max-width: 16ch;
  margin-bottom: var(--space-5);
  text-wrap: balance;
}
.hero__title .accent { color: var(--color-accent); display: inline-block; }
.hero__lead {
  font-size: var(--text-base);
  color: rgba(255, 255, 255, 0.86);
  max-width: 52ch;
  margin-bottom: var(--space-8);
  line-height: 1.5;
}
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* Aparición escalonada del hero */
.hero__badge, .hero__title, .hero__lead, .hero__cta {
  opacity: 0;
  transform: translateY(28px);
  animation: heroIn 1s var(--ease) forwards;
}
.hero__badge { animation-delay: 0.15s; }
.hero__title { animation-delay: 0.3s; }
.hero__lead  { animation-delay: 0.45s; }
.hero__cta   { animation-delay: 0.6s; }
@keyframes heroIn { to { opacity: 1; transform: translateY(0); } }

.hero__scroll {
  z-index: 3;
  position: absolute;
  left: 50%;
  bottom: var(--space-8);
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  gap: var(--space-2);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.hero__scroll .line {
  width: 1px; height: 44px;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.8));
  animation: scrollLine 2s var(--ease-out) infinite;
  transform-origin: top;
}
@keyframes scrollLine {
  0%   { transform: scaleY(0); opacity: 0; }
  40%  { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1) translateY(44px); opacity: 0; }
}

/* ---------- Barra de estadísticas ---------- */
.stats {
  background: var(--color-surface-deep);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.stats::before {
  content: '';
  position: absolute;
  inset: -50% -10% auto auto;
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(20, 184, 196, 0.28), transparent 68%);
  filter: blur(10px);
}
.stats__grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-8);
  padding-block: var(--space-12);
}
.stat__num {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-accent);
  line-height: 1;
  margin-bottom: var(--space-2);
}
.stat__label { font-size: var(--text-sm); color: rgba(255, 255, 255, 0.7); }

/* ===========================================================
   NOSOTROS
   =========================================================== */
.about__grid {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: clamp(var(--space-8), 5vw, var(--space-20));
  align-items: center;
}
.about__body p + p { margin-top: var(--space-4); }
.about__body p { color: var(--color-text-muted); }

/* Marco de imagen animado */
.figure {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  isolation: isolate;
}
.figure img {
  width: 100%;
  aspect-ratio: 4 / 3.6;
  object-fit: cover;
  transition: transform 1.1s var(--ease), filter 0.6s var(--ease-out);
  will-change: transform;
}
.figure:hover img { transform: scale(1.06); }
.figure::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.32) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform 0.9s var(--ease);
  pointer-events: none;
}
.figure:hover::after { transform: translateX(120%); }

.about__gallery {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  grid-template-rows: repeat(2, minmax(150px, 1fr));
  gap: var(--space-4);
  position: relative;
}

.about__gallery figure {
  overflow: hidden;
  min-height: 0;
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  box-shadow: var(--shadow-md);
}

.about__gallery-main {
  grid-row: 1 / span 2;
}

.about__gallery-item:last-child {
  grid-column: 1 / -1;
}

.about__gallery img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease), filter 0.5s var(--ease-out);
}

.about__gallery figure:hover img {
  transform: scale(1.06);
  filter: saturate(1.08);
}

html.motion .about__gallery figure {
  opacity: 0;
  transform: translateY(22px) scale(0.96);
  transition: opacity 0.7s var(--ease), transform 0.8s var(--ease);
}

html.motion .about__gallery.is-in figure {
  opacity: 1;
  transform: translateY(0) scale(1);
}

html.motion .about__gallery.is-in figure:nth-child(2) {
  transition-delay: 120ms;
}

html.motion .about__gallery.is-in figure:nth-child(3) {
  transition-delay: 220ms;
}

html.motion .about__gallery.is-in figure:nth-child(4) {
  transition-delay: 320ms;
}

.about__gallery::before {
  content: '';
  position: absolute;
  right: -14px;
  bottom: -14px;
  width: 42%;
  height: 38%;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-lg);
  z-index: -1;
}

.mv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
  margin-top: clamp(var(--space-12), 6vw, var(--space-20));
}
.mv__card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  overflow: hidden;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease-out), border-color 0.3s;
}
.mv__card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: var(--color-primary); }
.mv__card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--color-primary);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.5s var(--ease);
}
.mv__card:hover::before { transform: scaleY(1); }
.mv__icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  margin-bottom: var(--space-5);
  transition: transform 0.5s var(--ease);
}
.mv__card:hover .mv__icon { transform: rotate(-8deg) scale(1.08); }
.mv__icon svg { width: 24px; height: 24px; }
.mv__card h3 { font-size: var(--text-lg); margin-bottom: var(--space-3); }
.mv__card p { color: var(--color-text-muted); font-size: var(--text-sm); line-height: 1.7; }

/* ===========================================================
   SERVICIOS
   =========================================================== */
.services { background: var(--color-surface); }
.services__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-12);
}
.service {
  position: relative;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-7, 1.75rem) var(--space-6) var(--space-6);
  overflow: hidden;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease-out);
}
.service::after {
  content: '';
  position: absolute;
  inset: auto -40px -40px auto;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  transform: scale(0.2);
  opacity: 0;
  transition: transform 0.6s var(--ease), opacity 0.4s;
  z-index: 0;
}
.service:hover::after { transform: scale(1); opacity: 1; }
.service:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.service > * { position: relative; z-index: 1; }
.service__num {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-faint);
  letter-spacing: 0.05em;
}
.service__icon { color: var(--color-primary); margin: var(--space-4) 0 var(--space-5); }
.service__icon svg { width: 30px; height: 30px; transition: transform 0.5s var(--ease); }
.service:hover .service__icon svg { transform: translateY(-4px) scale(1.06); }
.service h3 { font-size: var(--text-lg); margin-bottom: var(--space-2); }
.service p { font-size: var(--text-sm); color: var(--color-text-muted); }

/* ===========================================================
   CURSOS
   =========================================================== */
.courses__head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-12);
}
.courses__grid {
  /* 6 columnas base: cada tarjeta ocupa 2 (= 3 por fila).
     Así la última fila puede reacomodarse sin dejar huecos. */
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-5);
}
.course { grid-column: span 2; }
/* Si la última fila queda con 2 tarjetas, se reparten el ancho completo */
.course:nth-child(3n + 1):nth-last-child(2),
.course:nth-child(3n + 1):nth-last-child(2) + .course { grid-column: span 3; }
/* Si queda 1 sola, se centra */
.course:nth-child(3n + 1):last-child { grid-column: 3 / span 2; }
.course {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 340px;
  display: flex;
  align-items: end;
  isolation: isolate;
  background: var(--color-surface-deep);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease-out);
}
.course:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); }
.course img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform 1.2s var(--ease), filter 0.6s;
  filter: saturate(0.9);
}
.course:hover img { transform: scale(1.12); filter: saturate(1.1); }
.course::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to top, rgba(4, 26, 30, 0.92) 0%, rgba(4, 26, 30, 0.62) 34%, rgba(4, 26, 30, 0.18) 68%, rgba(4, 26, 30, 0.02) 100%);
  transition: background 0.5s;
}
.course:hover::before {
  background: linear-gradient(to top, rgba(4, 26, 30, 0.94) 0%, rgba(7, 90, 99, 0.64) 34%, rgba(4, 26, 30, 0.2) 68%, rgba(4, 26, 30, 0.03) 100%);
}
.course__body { padding: var(--space-6); color: #fff; }
.course__tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}
.course__body h3 { font-size: var(--text-lg); color: #fff; margin-bottom: var(--space-3); }
.course__body p {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.82);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.6s var(--ease), opacity 0.4s var(--ease-out);
}
.course:hover p, .course:focus-within p { max-height: 12em; opacity: 1; }

/* ===========================================================
   GALERÍA
   =========================================================== */
.gallery { background: var(--color-surface); }
.gallery__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 190px;
  gap: var(--space-4);
  margin-top: var(--space-12);
}
.tile {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--color-surface-2);
  transition: box-shadow 0.4s var(--ease-out);
}
.tile img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 1s var(--ease), filter 0.5s var(--ease-out);
}
.tile:hover img { transform: scale(1.09) rotate(0.6deg); }
.tile:hover { box-shadow: var(--shadow-lg); }
.tile__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: end;
  padding: var(--space-5);
  background: linear-gradient(to top, rgba(4, 26, 30, 0.88), rgba(4, 26, 30, 0.1) 55%, transparent);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
}
.tile:hover .tile__overlay, .tile:focus-visible .tile__overlay { opacity: 1; }
.tile__caption {
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  transform: translateY(12px);
  transition: transform 0.45s var(--ease);
}
.tile:hover .tile__caption { transform: translateY(0); }
.tile--wide { grid-column: span 2; }
.tile--tall { grid-row: span 2; }
.tile--big { grid-column: span 2; grid-row: span 2; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: rgba(3, 18, 21, 0.92);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease-out), visibility 0.35s;
}
.lightbox[data-open='true'] { opacity: 1; visibility: visible; }
.lightbox img {
  max-width: min(1000px, 100%);
  max-height: 80vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transform: scale(0.94);
  transition: transform 0.45s var(--ease);
}
.lightbox[data-open='true'] img { transform: scale(1); }
.lightbox__cap { color: rgba(255, 255, 255, 0.8); margin-top: var(--space-4); font-size: var(--text-sm); text-align: center; }
.lightbox__close {
  position: absolute;
  top: var(--space-6); right: var(--space-6);
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  transition: transform 0.3s var(--ease), background 0.3s;
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.15); transform: rotate(90deg); }

/* ===========================================================
   EQUIPO
   =========================================================== */
.team__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-12);
}
.member {
  position: relative;
  text-align: center;
  padding: var(--space-8) var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease-out), border-color 0.35s;
  animation: memberIn 0.7s var(--ease) both;
  animation-delay: calc(var(--stagger, 0) * 0.12s);
}
@media (prefers-reduced-motion: reduce) {
  .member { animation: none; }
}
@keyframes memberIn {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.member::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(160deg, var(--color-surface) 0%, transparent 55%);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
}
.member:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}
.member:hover::before { opacity: 1; }
.member:hover::after { transform: scaleX(1); }

.member--lead {
  border-color: var(--color-primary-soft);
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 45%);
}
.member__rank {
  position: absolute;
  top: var(--space-4); right: var(--space-4);
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  box-shadow: var(--shadow-sm);
  animation: rankPop 0.6s var(--ease) 0.5s both;
}
.member__rank svg { width: 15px; height: 15px; }
@keyframes rankPop {
  0% { opacity: 0; transform: scale(0.4) rotate(-20deg); }
  70% { opacity: 1; transform: scale(1.15) rotate(6deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.member__avatar {
  position: relative;
  width: 180px; height: 180px;
  margin: 0 auto var(--space-5);
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border: 3px solid var(--color-bg);
  box-shadow: 0 0 0 3px var(--color-primary-soft), var(--shadow-sm);
  transition: transform 0.5s var(--ease), box-shadow 0.4s;
}
.member__avatar img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.member__initials {
  position: relative;
  z-index: 0;
}
.member__avatar--photo {
  padding: 0;
  background: var(--color-primary-soft);
}
.member__avatar--photo img {
  position: static;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.member:hover .member__avatar {
  transform: scale(1.05) rotate(-3deg);
  box-shadow: 0 0 0 3px var(--color-primary), var(--shadow-md);
}
.member h3 {
  font-size: var(--text-base);
  margin-bottom: var(--space-2);
  min-height: 2.6em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-wrap: balance;
}
.member__role {
  display: inline-block;
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-primary);
  padding: 3px var(--space-3);
  border-radius: 999px;
  background: var(--color-primary-soft);
  transition: background 0.35s, color 0.35s, transform 0.35s var(--ease);
}
.member:hover .member__role {
  background: var(--color-primary);
  color: #fff;
  transform: translateY(-1px);
}

/* ===========================================================
   CTA / CONTACTO
   =========================================================== */
.cta {
  position: relative;
  overflow: hidden;
  background: var(--color-surface-deep);
  color: #fff;
}
.cta__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.cta__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(4, 26, 30, 0.9) 0%, rgba(4, 26, 30, 0.7) 55%, rgba(4, 26, 30, 0.5) 100%);
}
.cta__bg img { width: 100%; height: 100%; object-fit: cover; opacity: 0.4; animation: kenburns 26s var(--ease-out) infinite alternate; }
.cta__inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(var(--space-8), 6vw, var(--space-20));
  align-items: start;
}
.cta h2 { font-size: var(--text-xl); color: #fff; margin-bottom: var(--space-4); max-width: 18ch; }
.cta p { color: rgba(255, 255, 255, 0.78); max-width: 48ch; }
.cta .eyebrow { color: var(--color-accent); }

.contact-list { display: grid; gap: var(--space-4); }
.contact-item {
  display: flex;
  gap: var(--space-4);
  align-items: start;
  padding: var(--space-5);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: background 0.3s, transform 0.35s var(--ease), border-color 0.3s;
}
.contact-item:hover { background: rgba(255, 255, 255, 0.11); transform: translateX(6px); border-color: rgba(255, 255, 255, 0.3); }
.contact-item svg { width: 20px; height: 20px; color: var(--color-accent); flex: none; margin-top: 3px; }
.contact-item__label {
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 2px;
}
.contact-item__value { font-size: var(--text-sm); color: #fff; font-weight: 500; }

/* ===========================================================
   FOOTER
   =========================================================== */
.footer { background: var(--color-bg); border-top: 1px solid var(--color-divider); }
.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(2, 1fr);
  gap: var(--space-10);
  padding-block: var(--space-16) var(--space-10);
}
.footer__about { color: var(--color-text-muted); font-size: var(--text-sm); max-width: 40ch; margin-top: var(--space-4); }
.footer h4 {
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text);
  font-weight: 600;
  margin-bottom: var(--space-4);
}
.footer ul { list-style: none; padding: 0; display: grid; gap: var(--space-2); }
.footer a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  transition: color 0.25s, transform 0.25s var(--ease);
  display: inline-block;
}
.footer a:hover { color: var(--color-primary); transform: translateX(4px); }
.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: space-between;
  align-items: center;
  padding-block: var(--space-6);
  border-top: 1px solid var(--color-divider);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ===========================================================
   REVELADO AL HACER SCROLL
   El estado inicial solo se aplica cuando el JS confirma soporte
   (html.motion), de modo que sin JS todo el contenido es visible.
   Se animan opacity y transform: no generan desplazamiento de layout.
   =========================================================== */
.reveal,
.reveal-clip,
[data-reveal] { opacity: 1; }

html.motion .reveal,
html.motion [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition:
    opacity 0.85s var(--ease) var(--rd, 0ms),
    transform 0.85s var(--ease) var(--rd, 0ms);
}
html.motion .reveal.is-in,
html.motion [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* Variante de mascarilla: la imagen se descubre de abajo hacia arriba */
html.motion .reveal-clip {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.1s var(--ease) var(--rd, 0ms);
}
html.motion .reveal-clip.is-in { clip-path: inset(0 0 0 0); }

/* Variante de desenfoque: para cifras y titulares destacados */
html.motion [data-reveal='blur'] {
  filter: blur(9px);
  transition:
    opacity 0.9s var(--ease) var(--rd, 0ms),
    transform 0.9s var(--ease) var(--rd, 0ms),
    filter 0.9s var(--ease) var(--rd, 0ms);
}
html.motion [data-reveal='blur'].is-in { filter: blur(0); }

/* El guion del eyebrow se traza cuando su bloque entra en pantalla */
html.motion .reveal .eyebrow::before,
html.motion [data-reveal] .eyebrow::before,
html.motion .eyebrow[data-reveal]::before {
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.7s var(--ease) 0.25s;
}
html.motion .reveal.is-in .eyebrow::before,
html.motion [data-reveal].is-in .eyebrow::before,
html.motion .eyebrow[data-reveal].is-in::before {
  transform: scaleX(1);
}

/* Punto de la línea de tiempo: aparece con un pequeño rebote */
html.motion .tl.reveal::before {
  transform: scale(0);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) calc(var(--rd, 0ms) + 160ms),
    box-shadow 0.4s var(--ease);
}
html.motion .tl.reveal.is-in::before {
  transform: scale(1);
  animation: tlPointPulse 1.4s var(--ease-out);
}
html.motion .tl.reveal.is-in:hover::before { transform: scale(1.35); }

/* Parallax suave del hero (JS establece --sy) */
.hero__media { transform: translate3d(0, calc(var(--sy, 0) * 0.28px), 0); }

/* ===========================================================
   RESPONSIVE
   =========================================================== */
@media (max-width: 1000px) {
  .about__grid { grid-template-columns: 1fr; }
  .about__gallery { max-width: 760px; margin-inline: auto; width: 100%; }
  .cta__inner { grid-template-columns: 1fr; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .gallery__grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 170px; }
  .tile--big { grid-column: span 2; grid-row: span 2; }
  .tile--wide { grid-column: span 2; }
}

@media (max-width: 1080px) {
  .burger { display: block; }
  .nav {
    position: fixed;
    inset: 0 0 auto 0;
    top: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 96px var(--gutter) var(--space-10);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-divider);
    box-shadow: var(--shadow-lg);
    transform: translateY(-102%);
    transition: transform 0.45s var(--ease);
    z-index: -1;
  }
  .nav[data-open='true'] { transform: translateY(0); }
  .nav__link {
    font-size: var(--text-lg);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-divider);
    color: var(--color-text);
  }
  .nav__link::after { display: none; }
  .header--over-hero:not(.header--scrolled) .nav__link { color: var(--color-text); }
  .header--over-hero:not(.header--scrolled) .burger { color: #fff; }

  /* Con el menú abierto el encabezado vuelve a colores sólidos */
  .header--menu .brand__name,
  .header--menu .burger { color: var(--color-text) !important; }
  .header--menu .brand__sub { color: var(--color-text-muted) !important; }
  .header--menu .brand__mark { color: var(--color-primary) !important; }
  .header--menu .icon-btn {
    color: var(--color-text-muted) !important;
    border-color: var(--color-border) !important;
  }
  .header--menu { background: var(--color-bg); }
}

@media (max-width: 860px) {
  .hero { min-height: 92svh; }
  .hero__title { max-width: 100%; }
}

@media (max-width: 640px) {
  .footer__grid { grid-template-columns: 1fr; gap: var(--space-8); }
  .about__gallery {
    grid-template-columns: 1.25fr 0.75fr;
    grid-template-rows: repeat(2, 130px);
    gap: var(--space-3);
  }
  .gallery__grid { grid-template-columns: 1fr; grid-auto-rows: 220px; }
  .member h3 { min-height: 0; }
  .tile--big, .tile--wide, .tile--tall { grid-column: span 1; grid-row: span 1; }
  .figure--offset::before { display: none; }
  .hero__scroll {
  z-index: 3; display: none; }

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

  .tl__media {
    min-height: 160px;
  }
}

@media (max-width: 860px) {
  .hero__dots {
    right: auto;
    left: 6vw;
    bottom: 18px;
  }
  .hero__scroll { display: none; }
}

.brand__mark--footer { width: 52px; height: 52px; }

/* ===========================================================
   HISTORIA
   =========================================================== */
.history { background: var(--color-surface); }
.history__head,
.anniv__head {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(var(--space-6), 5vw, var(--space-16));
  align-items: end;
  margin-bottom: var(--space-12);
}
.history__head .section-lead,
.anniv__head .section-lead { margin-bottom: 6px; }

.history__intro {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(var(--space-8), 6vw, var(--space-16));
  align-items: center;
  margin-bottom: clamp(var(--space-12), 8vw, var(--space-24));
}
.history__text p { color: var(--color-text-muted); margin-bottom: var(--space-4); }
.history__text strong { color: var(--color-text); font-weight: 600; }
.history__intro .figure img { aspect-ratio: 1 / 1.08; }

.quote {
  margin-top: var(--space-6);
  padding: var(--space-5) var(--space-6);
  border-left: 3px solid var(--color-primary);
  background: var(--color-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.quote p {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--color-primary-deep);
  margin-bottom: var(--space-2);
  line-height: 1.35;
}
.quote cite {
  font-style: normal;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  font-weight: 600;
}

.figure figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: var(--space-8) var(--space-5) var(--space-4);
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.92);
  background: linear-gradient(to top, rgba(4, 26, 30, 0.86), rgba(4, 26, 30, 0));
}

/* Línea de tiempo */
.timeline {
  list-style: none;
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  padding-left: clamp(var(--space-8), 6vw, var(--space-16));
}
.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(to bottom, var(--color-primary), var(--color-border));
  border-radius: 2px;
}
.tl { position: relative; padding-bottom: var(--space-10); }
.tl:last-child { padding-bottom: 0; }
.tl::before {
  content: '';
  position: absolute;
  left: calc(clamp(var(--space-8), 6vw, var(--space-16)) * -1 + 1px);
  top: 7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 3px solid var(--color-primary);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.tl:hover::before {
  transform: scale(1.35);
  box-shadow: 0 0 0 6px var(--color-primary-soft);
}
.tl--now::before { background: var(--color-primary); }
.tl__year {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  padding: 5px 12px;
  border-radius: 3px;
  margin-bottom: var(--space-3);
}

html.motion .tl__year {
  opacity: 0;
  transform: translateY(14px) scale(0.72);
  transform-origin: center bottom;
  transition: opacity 0.3s var(--ease) calc(var(--rd, 0ms) + 300ms),
    transform 0.75s cubic-bezier(0.34, 1.56, 0.64, 1) calc(var(--rd, 0ms) + 300ms);
}

html.motion .tl.reveal.is-in .tl__year {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.tl__body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(200px, 0.8fr);
  gap: var(--space-5);
  align-items: center;
}

.tl__content {
  min-width: 0;
}

.tl__body h3 {
  font-size: 1.1875rem;
  margin-bottom: var(--space-2);
}

.tl__body p {
  color: var(--color-text-muted);
  max-width: 62ch;
}

.tl__media {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-bg);
  box-shadow: var(--shadow-sm);
  min-height: 180px;
}

.tl__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  aspect-ratio: 4 / 3;
  transform: scale(1.06);
  transition: transform 0.9s var(--ease), filter 0.9s var(--ease);
  filter: saturate(0.95);
}

.tl__media--single {
  height: 100%;
}

html.motion .tl__content {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition: opacity 0.8s var(--ease) var(--rd, 0ms), transform 0.8s var(--ease) var(--rd, 0ms);
}

html.motion .tl__content.is-in {
  opacity: 1;
  transform: none;
}

html.motion .tl__media.reveal-clip {
  opacity: 1;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1s var(--ease) calc(var(--rd, 0ms) + 120ms), box-shadow 0.5s var(--ease);
}

html.motion .tl__media.reveal-clip.is-in {
  clip-path: inset(0 0 0 0);
}

html.motion .tl__media.reveal-clip.is-in img {
  transform: scale(1);
  filter: saturate(1);
}

/* Logros */
.awards { margin-top: clamp(var(--space-12), 8vw, var(--space-24)); }
.awards__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  text-align: center;
  margin-bottom: var(--space-8);
}
.awards__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
}
.award {
  padding: var(--space-6);
  border-radius: var(--radius);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.3s;
}
.award:hover {
  transform: translateY(-6px);
  border-color: var(--color-primary);
  box-shadow: 0 18px 40px -22px rgba(4, 67, 74, 0.45);
}
.award__tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}
.award h4 { font-family: var(--font-display); font-size: 1.0625rem; margin-bottom: var(--space-2); line-height: 1.3; }
.award p { font-size: var(--text-sm); color: var(--color-text-muted); }

/* ===========================================================
   ANIVERSARIO
   =========================================================== */
.events {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}
.event {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease), border-color 0.3s;
}
.event:hover {
  transform: translateY(-8px);
  border-color: var(--color-primary);
  box-shadow: 0 26px 50px -26px rgba(4, 67, 74, 0.5);
}
.event__media { overflow: hidden; aspect-ratio: 16 / 10; flex: none; }
.event__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease-out);
}
.event:hover .event__media img { transform: scale(1.07); }
.event__body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}
.event__tag {
  align-self: start;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  padding: 5px 10px;
  border-radius: 3px;
}
.event h3 { font-family: var(--font-display); font-size: var(--text-lg); line-height: 1.2; }
.event p { font-size: var(--text-sm); color: var(--color-text-muted); }

/* Tarjeta destacada: imagen a la izquierda */
.event--wide {
  grid-column: span 2;
  flex-direction: row;
}
.event--wide .event__media { width: 52%; aspect-ratio: auto; }
.event--wide .event__body { justify-content: center; padding: var(--space-8); }
.event--wide h3 { font-size: var(--text-xl); }
.event--wide p { font-size: 1rem; }

.more-events {
  list-style: none;
  margin-top: clamp(var(--space-10), 6vw, var(--space-16));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4) var(--space-8);
}
.more-events li {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding-block: var(--space-4);
  border-top: 1px solid var(--color-divider);
  font-size: var(--text-sm);
  color: var(--color-text);
  transition: color 0.3s, border-color 0.3s;
}
.more-events li:hover { color: var(--color-primary); border-color: var(--color-primary); }
.more-events span {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  flex: none;
}

@media (max-width: 1100px) {
  .awards__grid { grid-template-columns: repeat(2, 1fr); }
  .events { grid-template-columns: repeat(2, 1fr); }
  .event--wide { grid-column: span 2; }
  .more-events { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1000px) {
  .history__head, .anniv__head, .history__intro { grid-template-columns: 1fr; align-items: start; }
  .history__head .section-lead, .anniv__head .section-lead { margin-bottom: 0; }
}
@media (max-width: 700px) {
  .awards__grid { grid-template-columns: 1fr; }
  .events { grid-template-columns: 1fr; }
  .event--wide { grid-column: span 1; flex-direction: column; }
  .event--wide .event__media { width: 100%; aspect-ratio: 16 / 10; }
  .event--wide .event__body { padding: var(--space-6); }
  .event--wide h3 { font-size: var(--text-lg); }
  .event--wide p { font-size: var(--text-sm); }
  .more-events { grid-template-columns: 1fr; }

  .timeline {
    padding-left: 2.25rem;
    max-width: 100%;
  }
  .timeline::before {
    left: 6px;
  }
  .tl {
    padding-bottom: 2.5rem;
  }
  .tl::before {
    left: -1.65rem;
    width: 12px;
    height: 12px;
    border-width: 2px;
  }
  .tl__year {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    padding: 0.35rem 0.7rem;
    margin-bottom: 0.85rem;
  }
  .tl__body {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .tl__content h3 {
    font-size: 1.05rem;
    margin-bottom: 0.6rem;
  }
  .tl__content p {
    font-size: 0.96rem;
    line-height: 1.6;
  }
  .tl__media {
    min-height: 170px;
    border-radius: 14px;
  }
}


/* ===========================================================
   ENCABEZADO
   =========================================================== */
/* Filete fino turquesa bajo el encabezado cuando está sólido */
.header--scrolled { border-bottom: 1px solid var(--color-border); }
.header--scrolled::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent) 55%, transparent);
}
.header { position: fixed; }

/* ===========================================================
   ESPECIALIDADES TÉCNICAS
   =========================================================== */
.section--tint { background: var(--color-surface); }

.specs__head {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr);
  gap: var(--space-8) var(--space-16);
  align-items: end;
  margin-bottom: var(--space-12);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-border);
}
.specs { display: grid; gap: var(--space-12); }

.spec {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(var(--space-8), 4vw, var(--space-16));
  align-items: center;
}
.spec--reverse .spec__media { order: 2; }

.spec__media {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.spec__slides {
  position: relative;
  aspect-ratio: 3 / 2;
}
.spec__media :is(img, video) {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s var(--ease), transform 1.2s var(--ease);
}
.spec__media :is(img, video):not(:first-child) {
  position: absolute;
  inset: 0;
}
.spec__media :is(img, video).is-active {
  opacity: 1;
  position: absolute;
  inset: 0;
}
.spec:hover .spec__media :is(img, video) { transform: scale(1.045); }
.spec__arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(4, 26, 30, 0.65);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  transform: translateY(-50%);
  transition: background 0.25s, transform 0.25s var(--ease);
}
.spec__arrow:hover { background: var(--color-primary); transform: translateY(-50%) scale(1.08); }
.spec__arrow--prev { left: var(--space-3); }
.spec__arrow--next { right: var(--space-3); }
.spec__dots {
  position: absolute;
  left: 50%;
  bottom: var(--space-3);
  z-index: 2;
  display: flex;
  gap: 7px;
  transform: translateX(-50%);
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(4, 26, 30, 0.58);
}
.spec__dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  transition: transform 0.25s, background 0.25s;
}
.spec__dots button.is-active { background: #fff; transform: scale(1.25); }
.spec__index {
  position: absolute;
  top: 0;
  left: 0;
  background: var(--color-primary-deep);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 8px 16px;
}

.spec__body h3 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
.spec__lead { color: var(--color-text-muted); margin-bottom: var(--space-6); }
.spec__list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}
.spec__list li {
  position: relative;
  padding-left: var(--space-6);
  font-size: var(--text-sm);
  color: var(--color-text);
}
.spec__list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 10px;
  height: 2px;
  background: var(--color-primary);
}

.specs__note {
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 70ch;
}

@media (max-width: 900px) {
  .specs__head { grid-template-columns: 1fr; align-items: start; }
  .spec { grid-template-columns: 1fr; gap: var(--space-6); }
  .spec--reverse .spec__media { order: 0; }
}

/* ===========================================================
   DETALLES FORMALES
   =========================================================== */
.quote { position: relative; overflow: hidden; }
.quote::after {
  content: '\201D';
  position: absolute;
  right: 10px;
  bottom: -0.34em;
  font-family: var(--font-display);
  font-size: 8rem;
  line-height: 1;
  color: var(--color-primary);
  opacity: 0.1;
  pointer-events: none;
}
.quote p { font-style: italic; }

.eyebrow::before { border-radius: 0; width: 26px; height: 1.5px; }


/* Marca del encabezado: sin quiebres de línea */
.brand { flex: none; }
.brand__text { display: flex; flex-direction: column; }
.brand__name, .brand__sub { white-space: nowrap; }
.nav { flex: 1 1 auto; justify-content: flex-end; }
@media (min-width: 1081px) {
  .nav__link { padding-inline: 0.62em; font-size: 0.9375rem; }
}



/* ===========================================================
   UBICACIÓN / MAPA
   =========================================================== */
.map-sec { background: var(--color-surface); }
.map-sec__head {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr);
  gap: var(--space-8) var(--space-16);
  align-items: end;
  margin-bottom: var(--space-10);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-border);
}

.map {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  background: var(--color-surface-2);
}
.map iframe {
  display: block;
  width: 100%;
  height: clamp(340px, 46vw, 520px);
  border: 0;
  filter: saturate(0.92) contrast(1.02);
}

.map__card {
  position: absolute;
  left: var(--space-6);
  bottom: var(--space-6);
  z-index: 2;
  width: min(340px, calc(100% - var(--space-12)));
  padding: var(--space-6);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}
.map__label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}
.map__addr {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  line-height: 1.35;
  color: var(--color-text);
  margin-bottom: var(--space-5);
}
.map__btn { width: 100%; }

@media (max-width: 900px) {
  .map-sec__head { grid-template-columns: 1fr; align-items: start; }
}
@media (max-width: 640px) {
  .map__card {
    position: static;
    width: 100%;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    backdrop-filter: none;
    background: var(--color-bg);
    box-shadow: none;
  }
  .map iframe { height: 320px; }
}


/* ===========================================================
   EQUIPO · DIRECTIVOS Y PLANA DOCENTE
   =========================================================== */
.team__head {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr);
  gap: var(--space-8) var(--space-16);
  align-items: end;
  margin-bottom: var(--space-10);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-border);
}

.team__subtitle {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-6);
  padding-left: var(--space-4);
  border-left: 3px solid var(--color-primary);
  line-height: 1.2;
}
.team__subtitle--flush { margin-bottom: var(--space-3); }

.member__tel {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: var(--space-4);
  padding: 4px var(--space-3);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.25s, background 0.25s, transform 0.3s var(--ease);
}
.member__tel svg { width: 15px; height: 15px; color: var(--color-primary); flex: none; transition: transform 0.4s var(--ease); }
.member__tel:hover { color: var(--color-primary-hover); background: var(--color-primary-soft); transform: translateY(-1px); }
.member__tel:hover svg { transform: scale(1.15) rotate(-8deg); animation: telRing 0.6s var(--ease); }
@keyframes telRing {
  0%, 100% { transform: rotate(0deg) scale(1.15); }
  25% { transform: rotate(-14deg) scale(1.15); }
  50% { transform: rotate(10deg) scale(1.15); }
  75% { transform: rotate(-6deg) scale(1.15); }
}

/* --- Plana docente --- */
.faculty { margin-top: clamp(var(--space-12), 8vw, var(--space-24)); }
.faculty__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}
.faculty__lead { font-size: var(--text-sm); color: var(--color-text-muted); max-width: 56ch; }
.faculty__list {
  display: grid;
  gap: var(--space-3);
}

.area {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  transition: border-color 0.3s, box-shadow 0.35s var(--ease);
  scroll-margin-top: 120px;
}
.area:hover { border-color: var(--color-primary); }
.area[open] {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.area__sum {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.area__sum::-webkit-details-marker { display: none; }
.area__sum:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.area__name {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.25;
}
.area[open] .area__name { color: var(--color-primary-deep); }
.area__meta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  flex: none;
}
.area__count {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  padding: 5px 10px;
  border-radius: 3px;
  white-space: nowrap;
}
.area__chev {
  width: 18px;
  height: 18px;
  color: var(--color-primary);
  transition: transform 0.35s var(--ease);
}
.area[open] .area__chev { transform: rotate(180deg); }

.area__body {
  padding: 0 var(--space-6) var(--space-6);
  border-top: 1px solid var(--color-divider);
  margin-top: -1px;
  padding-top: var(--space-6);
  animation: areaIn 0.4s var(--ease-out) both;
}
@keyframes areaIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.teachers {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: var(--space-4);
}
.teacher {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius);
  background: var(--color-surface);
  transition: border-color 0.25s, background 0.25s, transform 0.3s var(--ease), box-shadow 0.3s var(--ease-out);
}
.teacher:hover {
  border-color: var(--color-primary);
  background: var(--color-bg);
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}
.teacher__photo {
  position: relative;
  width: 68px;
  height: 68px;
  flex: none;
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-primary);
  background: var(--color-primary-soft);
  border: 2px solid var(--color-bg);
  box-shadow: 0 0 0 2px var(--color-border);
  transition: box-shadow 0.3s, transform 0.35s var(--ease);
}
.teacher:hover .teacher__photo {
  box-shadow: 0 0 0 2px var(--color-primary);
  transform: scale(1.04);
}
.teacher__photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.teacher__initials { position: relative; z-index: 0; }
.teacher__name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.35;
}

.faculty__note {
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  max-width: 70ch;
}

.btn--ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}
.btn--ghost:hover { border-color: var(--color-primary); background: var(--color-primary-soft); }
.btn--sm { padding: 9px 16px; font-size: 0.8125rem; }

@media (max-width: 900px) {
  .team__head { grid-template-columns: 1fr; align-items: start; }
}
@media (max-width: 640px) {
  .area__sum { padding: var(--space-4) var(--space-5); gap: var(--space-3); align-items: flex-start; }
  .area__name { font-size: 0.9375rem; }
  .area__meta { flex-direction: column-reverse; align-items: flex-end; gap: 8px; margin-top: 2px; }
  .area__body { padding: var(--space-5) var(--space-5) var(--space-5); }
  .teachers { grid-template-columns: 1fr; }
  .faculty__tools { width: 100%; }
  .faculty__tools .btn { width: 100%; justify-content: center; }
}

/* ===========================================================
   NAVEGACIÓN CON DESPLEGABLE
   =========================================================== */
.nav__group { position: relative; display: flex; }
.nav__trigger {
  /* El botón «Equipo» debe verse idéntico a los demás enlaces del menú:
     no se usa «font: inherit» ni «color: inherit» porque anularían
     el tamaño, el grosor y el color definidos en .nav__link */
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  -webkit-font-smoothing: inherit;
}
.nav__caret { width: 13px; height: 13px; transition: transform 0.3s var(--ease); opacity: 0.8; }
.nav__group[data-open='true'] .nav__caret { transform: rotate(180deg); }

.nav__panel {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  width: 560px;
  padding: var(--space-5);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.28s var(--ease-out), transform 0.28s var(--ease-out), visibility 0.28s;
  z-index: 60;
}
.nav__group[data-open='true'] .nav__panel {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.nav__panel-head {
  display: block;
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.25s;
}
.nav__panel-head:hover { background: var(--color-primary-soft); }
.nav__panel-title {
  display: block;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
}
.nav__panel-sub {
  display: block;
  margin-top: 3px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.nav__panel-label {
  display: block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-bottom: var(--space-3);
  padding-inline: var(--space-2);
}
.nav__sub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px var(--space-3);
}
.nav__sub-link {
  display: block;
  padding: 8px var(--space-3);
  border-radius: 3px;
  font-size: 0.8438rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.nav__sub-link:hover {
  color: var(--color-primary-deep);
  background: var(--color-surface);
  border-left-color: var(--color-primary);
}

.nav__panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-primary);
  text-decoration: none;
}
.nav__panel-foot::after { content: '→'; transition: transform 0.25s var(--ease); }
.nav__panel-foot:hover::after { transform: translateX(4px); }

/* Encabezado transparente sobre el hero: mismo color que los demás enlaces */
.header--over-hero:not(.header--scrolled) .nav__trigger { color: rgba(255, 255, 255, 0.9); }

@media (max-width: 1080px) {
  .nav__group { display: block; width: 100%; }
  .nav__trigger {
    width: 100%;
    justify-content: space-between;
    padding-block: var(--space-3);
    font-size: 1.0625rem;
  }
  .nav__panel {
    position: static;
    width: 100%;
    padding: 0;
    margin-top: 2px;
    border: 0;
    border-left: 2px solid var(--color-primary-soft);
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .nav__group[data-open='true'] .nav__panel { display: block; animation: areaIn 0.35s var(--ease-out) both; }
  .nav__panel-head { margin-bottom: var(--space-3); padding: var(--space-3) var(--space-4); }
  .nav__panel-label { margin-bottom: var(--space-2); }
  .nav__sub-grid { grid-template-columns: 1fr; }
  .nav__sub-link { padding: 9px var(--space-4); font-size: 0.9375rem; }
  .nav__panel-foot { padding-inline: var(--space-4); }
  .header--over-hero:not(.header--scrolled) .nav__trigger { color: var(--color-text); }
}

@media (max-width: 1080px) {
  .nav {
    max-height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .nav__trigger { border-bottom: 1px solid var(--color-divider); }
  .nav__group[data-open='true'] .nav__trigger { border-bottom-color: transparent; }
  .nav__group[data-open='true'] .nav__panel {
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-divider);
  }
}

/* Panel de navegación móvil: se ancla justo debajo del encabezado */
@media (max-width: 1080px) {
  .nav {
    position: absolute;
    inset: auto 0 auto 0;
    top: 100%;
    padding: var(--space-5) var(--gutter) var(--space-8);
    max-height: 78dvh;
    z-index: 5;
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.32s var(--ease-out), transform 0.32s var(--ease-out), visibility 0.32s;
  }
  .nav[data-open='true'] {
    transform: none;
    opacity: 1;
    visibility: visible;
  }
  .header--menu { background: var(--color-bg); }
  .header--menu .header__inner { position: relative; z-index: 6; }
}

/* Titular del hero con el lema institucional */
.hero__title { max-width: 26ch; }
@media (max-width: 700px) {
  .hero__title { max-width: 100%; }
  .hero__title br { display: none; }
}

/* El botón «Equipo» debe verse igual que el resto de enlaces del menú móvil */
@media (max-width: 1080px) {
  .nav__trigger {
    font-family: inherit;
    font-size: var(--text-lg);
    font-weight: 500;
    letter-spacing: inherit;
    color: var(--color-text);
    padding: var(--space-4) 0;
    border-radius: 0;
  }
  .nav__caret { width: 16px; height: 16px; opacity: 1; color: var(--color-primary); }
}

/* ===========================================================
   ALIANZAS ESTRATÉGICAS
   =========================================================== */
.allies {
  background:
    radial-gradient(circle at 12% 18%, rgba(20, 184, 196, 0.12), transparent 28%),
    radial-gradient(circle at 88% 82%, rgba(7, 114, 125, 0.08), transparent 30%),
    var(--color-surface);
  border-top: 1px solid var(--color-divider);
}

.allies__head {
  max-width: 62ch;
  margin-bottom: var(--space-10);
}
.allies__head .section-lead { margin-top: var(--space-4); }

.allies__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-5);
}

.ally { display: flex; }

.ally__link {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-4);
  width: 100%;
  padding: var(--space-4) var(--space-4) var(--space-5);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 2px 4px rgba(13, 36, 39, 0.06), 0 12px 24px -10px rgba(13, 36, 39, 0.28);
  text-decoration: none;
  color: var(--color-text);
  transition:
    transform 0.35s var(--ease),
    box-shadow 0.35s var(--ease),
    border-color 0.35s var(--ease);
}

.ally__link:hover,
.ally__link:focus-visible {
  transform: translateY(-4px);
  border-color: var(--color-primary-soft);
  box-shadow: 0 4px 8px rgba(13, 36, 39, 0.08), 0 20px 38px -14px rgba(7, 114, 125, 0.42);
}
.ally__link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

/* Sin recuadro: el logo se muestra libre, pero en una caja de altura fija
   para que todos los logos —sin importar su proporción original— queden
   alineados entre sí y el texto de abajo empiece siempre a la misma altura.
   Forzamos width/height al 100% de la caja + object-fit: contain para que
   el navegador use la proporción REAL de cada imagen (y no la que sugieren
   los atributos width/height del HTML, iguales para todos los logos). */
.ally__logo {
  display: grid;
  place-items: center;
  width: 100%;
  height: 108px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.ally__logo img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  /* Logos siempre a color y con plena opacidad */
  filter: none;
  opacity: 1;
  transition: transform 0.35s var(--ease);
}

.ally__link:hover .ally__logo img,
.ally__link:focus-visible .ally__logo img {
  transform: scale(1.04);
}

.ally__name {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 2.7em;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-align: center;
  text-wrap: balance;
  color: var(--color-text);
  transition: color 0.3s var(--ease-out);
}
.ally__link:hover .ally__name,
.ally__link:focus-visible .ally__name { color: var(--color-primary); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .allies__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .allies__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
}
@media (max-width: 620px) {
  .allies__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ally__link { padding: var(--space-4) var(--space-3); gap: var(--space-3); }
  .ally__logo { height: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  .ally__link,
  .ally__logo img,
  .ally__name { transition: none; }
  .ally__link:hover { transform: none; }
  .ally__link:hover .ally__logo img { transform: none; }
}


/* ---------- Cursos: áreas curriculares ---------- */
@media (max-width: 1000px) {
  /* 4 columnas base = 2 tarjetas por fila */
  .courses__grid { grid-template-columns: repeat(4, 1fr); }
  .courses__grid .course,
  .courses__grid .course:nth-child(3n + 1):nth-last-child(2),
  .courses__grid .course:nth-child(3n + 1):nth-last-child(2) + .course,
  .courses__grid .course:nth-child(3n + 1):last-child { grid-column: span 2; }
  /* Si sobra una tarjeta impar, ocupa la fila completa */
  .courses__grid .course:nth-child(2n + 1):last-child { grid-column: span 4; min-height: 300px; }
}

@media (max-width: 640px) {
  .courses__grid { grid-template-columns: 1fr; }
  .courses__grid .course,
  .courses__grid .course:nth-child(3n + 1):nth-last-child(2),
  .courses__grid .course:nth-child(3n + 1):nth-last-child(2) + .course,
  .courses__grid .course:nth-child(3n + 1):last-child,
  .courses__grid .course:nth-child(2n + 1):last-child { grid-column: span 1; min-height: 280px; }
}

/* En pantallas táctiles no hay hover: la descripción siempre visible */
@media (hover: none) {
  .course__body p { max-height: none; opacity: 1; overflow: visible; }
}


/* ===========================================================
   CAPA DE MOVIMIENTO — micro-interacciones y detalles finos
   Todo lo de abajo respeta prefers-reduced-motion mediante la
   regla global del reset y los bloques específicos del final.
   =========================================================== */

/* ---------- Anclas: el header fijo no tapa los títulos ---------- */
html { scroll-padding-top: clamp(76px, 9vw, 96px); }

/* ---------- Barra de progreso de lectura ---------- */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 150;
  pointer-events: none;
  background: transparent;
}
.progress__bar {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(var(--p, 0));
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  box-shadow: 0 0 10px rgba(20, 184, 196, 0.55);
  will-change: transform;
}

/* ---------- Botón "volver arriba" ---------- */
.to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 120;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 10px 24px -8px rgba(11, 61, 67, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.9);
  transition:
    opacity 0.35s var(--ease),
    transform 0.35s var(--ease),
    background 0.2s var(--ease-out),
    visibility 0.35s;
}
.to-top svg { width: 20px; height: 20px; transition: transform 0.3s var(--ease); }
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.to-top:hover { background: var(--color-primary-hover); transform: translateY(-3px) scale(1.04); }
.to-top:hover svg { transform: translateY(-2px); }
.to-top:active { transform: translateY(0) scale(0.94); }

/* ---------- Botones: brillo al pasar y hundido al pulsar ---------- */
.btn { position: relative; overflow: hidden; isolation: isolate; }
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.3) 50%, transparent 62%);
  transform: translateX(-130%);
  transition: transform 0.75s var(--ease-out);
  pointer-events: none;
}
.btn:hover::after { transform: translateX(130%); }
.btn--ghost::after { background: linear-gradient(105deg, transparent 38%, rgba(7, 114, 125, 0.12) 50%, transparent 62%); }
.btn:active { transform: translateY(0) scale(0.975); }

/* ---------- Trazado de la línea de tiempo al hacer scroll ---------- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .timeline::before {
      transform-origin: top center;
      animation: tlDraw linear both;
      animation-timeline: view();
      animation-range: entry 75% cover 84%;
      box-shadow: 0 0 18px rgba(7, 114, 125, 0.22);
    }
  }
}
@keyframes tlDraw {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}
@keyframes tlPointPulse {
  0% {
    transform: scale(0.72);
    box-shadow: 0 0 0 0 rgba(7, 114, 125, 0.26);
  }
  55% {
    transform: scale(1.28);
    box-shadow: 0 0 0 10px rgba(7, 114, 125, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(7, 114, 125, 0);
  }
}

/* ---------- Foco de luz que sigue al cursor en las tarjetas de curso ---------- */
.course__glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s var(--ease-out);
  background: radial-gradient(
    260px circle at var(--mx, 50%) var(--my, 50%),
    rgba(20, 184, 196, 0.28),
    transparent 68%
  );
}
@media (hover: hover) {
  .course:hover .course__glow { opacity: 1; }
}

/* ---------- Cifras: contador con tabular-nums para que no salte ---------- */
.stat__num { font-variant-numeric: tabular-nums; }

/* ---------- Lightbox: desenfoque del fondo y pie que sube ---------- */
.lightbox {
  backdrop-filter: blur(0px);
  transition:
    opacity 0.35s var(--ease-out),
    visibility 0.35s,
    backdrop-filter 0.45s var(--ease-out);
}
.lightbox[data-open='true'] { backdrop-filter: blur(6px); }
.lightbox__cap {
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.4s var(--ease) 0.15s,
    transform 0.4s var(--ease) 0.15s;
}
.lightbox[data-open='true'] .lightbox__cap { opacity: 1; transform: none; }

/* ---------- Logos de alianzas: entrada escalonada suave ---------- */
.ally__link { transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease-out), border-color 0.3s var(--ease-out); }
.ally__link:active { transform: translateY(0) scale(0.985); }

/* ---------- Enlaces del pie: subrayado que se traza ---------- */
.footer a:not(.brand) {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  transition: background-size 0.35s var(--ease), color 0.2s var(--ease-out);
}
.footer a:not(.brand):hover { background-size: 100% 1px; }

/* ---------- Preferencia de movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html.motion .reveal,
  html.motion .reveal-clip,
  html.motion [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    clip-path: none !important;
  }
  .progress { display: none; }
  .btn::after { display: none; }
  .course__glow { display: none; }
  .to-top { transition: opacity 0.01ms; }
}

/* ---------- Compatibilidad con animaciones previas ----------
   Las tarjetas del equipo tenían una entrada propia al cargar la página.
   Con el sistema de revelado activo se dispara al entrar en pantalla,
   que es donde realmente se ve. */
html.motion .member.reveal { animation: none; }
html.motion .member.reveal .member__rank { animation: none; }
html.motion .member.reveal.is-in .member__rank {
  animation: rankPop 0.6s var(--ease) calc(var(--rd, 0ms) + 350ms) both;
}
