/* =============================================================================
   CTU Mega 20 — Scroll-Driven Frame Animation
   Prepended above the homepage fold. Isolated styles — all CTU rules use
   #ctu- / .ctu- prefixes to avoid conflicts with the rest of the page.
   ============================================================================= */

/* Lenis handles smooth scroll; disable native smooth to prevent conflicts */
html { scroll-behavior: auto !important; }


/* ── LOADER ──────────────────────────────────────────────────────────────── */

#ctu-loader {
  position: fixed;
  inset: 0;
  background: #0B2A4A;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  z-index: 2000;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#ctu-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.ctu-loader-brand {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.ctu-loader-product {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  line-height: 1;
}

#ctu-loader-bar {
  width: 220px;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

#ctu-loader-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #25A4DA, #C8A96A);
  border-radius: 2px;
  transition: width 0.15s ease;
}

#ctu-loader-percent {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
}


/* ── CTU HERO STANDALONE (100vh, dark navy, first viewport) ──────────────── */

#ctu-hero {
  position: relative;
  height: 100dvh;
  background: #0B2A4A;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 0 8vw;
  overflow: hidden;
  z-index: 0;
}

/* Radial glow atmosphere */
#ctu-hero::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 70vw;
  height: 70vw;
  background: radial-gradient(ellipse, rgba(37, 164, 218, 0.08) 0%, transparent 65%);
  pointer-events: none;
}

#ctu-hero::after {
  content: '';
  position: absolute;
  bottom: -10%;
  left: -5%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(ellipse, rgba(200, 169, 106, 0.05) 0%, transparent 60%);
  pointer-events: none;
}

/* Grain texture overlay */
#ctu-hero .ctu-grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.6;
}

/* Hero label */
#ctu-hero .ctu-hero-label {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #25A4DA;
  margin-bottom: 1.75rem;
  opacity: 0;
  transform: translateY(16px);
  animation: ctu-fade-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

/* Hero brand subtitle — "Bienvenido a Medical Rhapsody" */
#ctu-hero .ctu-hero-brand {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  margin-bottom: 0.75rem;
  opacity: 0;
  transform: translateY(16px);
  animation: ctu-fade-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.28s forwards;
}

/* Hero heading — brand hierarchy */
#ctu-hero .ctu-hero-heading {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(4rem, 10vw, 10rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: #ffffff;
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(30px);
  animation: ctu-fade-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.42s forwards;
}

/* Hero tagline */
#ctu-hero .ctu-hero-tagline {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: clamp(0.875rem, 1.1vw, 1.125rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.55);
  max-width: 360px;
  line-height: 1.6;
  opacity: 0;
  animation: ctu-fade-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.75s forwards;
}

/* Scroll indicator */
#ctu-hero .ctu-scroll-indicator {
  position: absolute;
  bottom: 2.5rem;
  left: 8vw;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  opacity: 0;
  animation: ctu-fade-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 1s forwards;
}

#ctu-hero .ctu-scroll-indicator span {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
}

.ctu-scroll-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  animation: ctu-bounce 1.8s ease-in-out 1.5s infinite;
}

.ctu-scroll-arrow span {
  display: block;
  width: 1.5px;
  height: 6px;
  background: rgba(37, 164, 218, 0.6);
  border-radius: 2px;
  letter-spacing: 0 !important;
}

/* Vertical line decoration */
#ctu-hero .ctu-hero-line {
  position: absolute;
  right: 8vw;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 40vh;
  background: linear-gradient(to bottom, transparent, rgba(37, 164, 218, 0.3), transparent);
  opacity: 0;
  animation: ctu-fade-in 1s ease 0.9s forwards;
}


/* ── CANVAS WRAP (fixed, full viewport) ──────────────────────────────────── */

#ctu-canvas-wrap {
  position: fixed;
  inset: 0;
  z-index: 1;
  clip-path: circle(0% at 50% 50%);
  will-change: clip-path, opacity;
  transition: opacity 0.3s ease;
}

#ctu-canvas {
  width: 100%;
  height: 100%;
  display: block;
}


/* ── DARK OVERLAY (for stats section) ───────────────────────────────────── */

#ctu-dark-overlay {
  position: fixed;
  inset: 0;
  background: #081F38;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  will-change: opacity;
}


/* ── MARQUEE (fixed) ─────────────────────────────────────────────────────── */

#ctu-marquee-wrap {
  position: fixed;
  bottom: 3rem;
  left: 0;
  right: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  white-space: nowrap;
}

#ctu-marquee-wrap.visible {
  opacity: 1;
}

.ctu-marquee-text {
  display: inline-block;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(3rem, 6vw, 7rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
  will-change: transform;
}


/* ── SCROLL CONTAINER (800vh) ────────────────────────────────────────────── */

#ctu-scroll-container {
  position: relative;
  height: 800vh;
  z-index: 4;
}


/* ── SCROLL SECTIONS ─────────────────────────────────────────────────────── */

.ctu-scroll-section {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;                    /* overridden per-section by JS */
  transform: translateY(-50%);
  z-index: 4;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.ctu-scroll-section.align-left {
  padding-left: 6vw;
  padding-right: 52vw;
  justify-content: flex-start;
}

.ctu-scroll-section.align-right {
  padding-left: 52vw;
  padding-right: 6vw;
  justify-content: flex-end;
}

/* Section inner panel — dark navy with teal accent border */
.ctu-section-inner {
  max-width: 38vw;
  background: rgba(8, 31, 56, 0.92);
  border-left: 3px solid rgba(37, 164, 218, 0.7);
  padding: 2rem 2rem 2rem 1.75rem;
  pointer-events: auto;
}

.ctu-scroll-section.align-right .ctu-section-inner {
  border-left: none;
  border-right: 3px solid rgba(200, 169, 106, 0.6);
  padding: 2rem 1.75rem 2rem 2rem;
}

/* Section label */
.ctu-section-label {
  display: block;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #25A4DA;
  margin-bottom: 0.875rem;
}

.ctu-scroll-section.align-right .ctu-section-label {
  color: #C8A96A;
}

/* Section heading */
.ctu-section-heading {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.625rem, 3vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: #ffffff;
  margin: 0 0 1rem;
}

/* Section body */
.ctu-section-body {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: clamp(0.875rem, 1.1vw, 1.0625rem);
  font-weight: 400;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
}


/* ── STATS SECTION ───────────────────────────────────────────────────────── */

.ctu-scroll-section.section-stats {
  padding-left: 0;
  padding-right: 0;
  justify-content: center;
  align-items: center;
}

.ctu-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 4vw;
}

.ctu-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.5rem 1.5rem;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.ctu-stat:last-child {
  border-right: none;
}

.ctu-stat-value {
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
}

.ctu-stat-number {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2.5rem, 5vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: #ffffff;
}

.ctu-stat-suffix {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: clamp(1rem, 1.8vw, 1.75rem);
  font-weight: 600;
  color: #25A4DA;
}

.ctu-stat-label {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 0.5rem;
}


/* ── CTA SECTION ─────────────────────────────────────────────────────────── */

.ctu-cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  background: #25A4DA;
  color: #ffffff;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: clamp(0.875rem, 1.1vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.875rem 1.75rem;
  border-radius: 4px;
  margin-top: 1.5rem;
  pointer-events: auto;
  transition: background 0.2s ease,
              box-shadow 0.2s ease,
              transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 16px rgba(37, 164, 218, 0.35);
}

.ctu-cta-button:hover {
  background: #1e8fbe;
  box-shadow: 0 4px 24px rgba(37, 164, 218, 0.55);
  transform: translateY(-1px);
}

.ctu-cta-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(37, 164, 218, 0.3);
}

.ctu-cta-button svg {
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ctu-cta-button:hover svg {
  transform: translateX(4px);
}


/* ── BLEND FADE (bottom of scroll container → white for end frame) ───────── */

.ctu-blend-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0; /* Canvas fading handled by JS, not CSS */
  pointer-events: none;
}

/* White-to-navy bridge between CTU section and existing hero */
.ctu-hero-bridge {
  height: 80px;
  background: linear-gradient(to bottom, #ffffff 0%, #0B2A4A 100%);
  position: relative;
  z-index: 10;
  pointer-events: none;
}


/* ── ENSURE EXISTING PAGE SECTIONS STACK ABOVE THE FIXED CANVAS ─────────── */

body > .nav-bar,
body > main > section:not(#ctu-hero),
body > main > .ctu-hero-bridge,
body > footer {
  position: relative;
  z-index: 10;
}

/* The hero section specifically needs its background to cover the canvas */
body > main > section.hero {
  position: relative;
  z-index: 10;
  background: linear-gradient(135deg, #0B2A4A 0%, #081F38 100%);
}


/* ── ANIMATIONS ──────────────────────────────────────────────────────────── */

@keyframes ctu-fade-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ctu-fade-in {
  to { opacity: 1; }
}

@keyframes ctu-bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(6px); }
}


/* ── MOBILE RESPONSIVE ───────────────────────────────────────────────────── */

@media (max-width: 768px) {
  #ctu-scroll-container {
    height: 550vh;
  }

  .ctu-scroll-section.align-left,
  .ctu-scroll-section.align-right {
    padding-left: 5vw;
    padding-right: 5vw;
    justify-content: flex-start;
  }

  .ctu-section-inner {
    max-width: 90vw;
    background: rgba(8, 31, 56, 0.94);
  }

  .ctu-stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding: 0 2vw;
  }

  .ctu-stat {
    padding: 1.5rem 0.75rem;
  }

  .ctu-stat-number {
    font-size: clamp(1.75rem, 7vw, 3rem);
  }

  #ctu-marquee-wrap {
    bottom: 1.5rem;
  }

  .ctu-marquee-text {
    font-size: 3.5rem;
  }

  #ctu-hero .ctu-hero-heading .word-ctu  { font-size: clamp(4rem, 18vw, 8rem); }
  #ctu-hero .ctu-hero-heading .word-mega { font-size: clamp(2rem, 8vw, 4rem); }
  #ctu-hero .ctu-hero-heading .word-20   { font-size: clamp(5rem, 22vw, 10rem); }
}
