/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
  --primary-purple: #4a148c;
  --hover-purple: #7c43bd;
  --accent-teal: #00bcd4;
  --text-dark: #333;
  --text-light: #f5f5f5;
  --white: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.4);
  --shadow-soft: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
  /* Fixed Gradient Background */
  background:
    radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
    radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
    radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
  background-color: #f0f2f5;
  background-attachment: fixed;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}
ul {
  list-style: none;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* =========================================
   2. LAYOUT & CONTAINERS
   ========================================= */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.section {
  margin-bottom: 40px;
}

/* Glassmorphism Panel Utility */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

/* =========================================
   3. HEADER & NAVIGATION
   ========================================= */
.header-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  background: rgba(255, 255, 255, 0.95); /* More opacity for readability */
  border-radius: 16px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  margin-bottom: 30px;
  position: relative;
}

.logo {
  height: 80px; /* Control logo height specifically */
  width: auto;
}

.main-nav ul {
  display: flex;
  gap: 20px;
  align-items: center;
}

.main-nav a {
  font-weight: 600;
  color: var(--primary-purple);
  padding: 8px 12px;
  border-radius: 8px;
}

.main-nav a:hover,
.main-nav a.btn-primary:hover {
  background: var(--primary-purple);
  color: var(--white);
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--primary-purple);
  color: var(--white) !important;
  padding: 8px 20px !important;
  box-shadow: 0 4px 6px rgba(74, 20, 140, 0.3);
}

.menu-toggle {
  display: none; /* Hidden on desktop */
  font-size: 1.5rem;
  background: none;
  border: none;
  color: var(--primary-purple);
  cursor: pointer;
}

/* =========================================
   4. CAROUSEL (FADE)
   ========================================= */
.carousel-section {
  width: 100%;
}

.carousel {
  position: relative;
  width: 100%;
  height: 500px; /* Fixed height for desktop */
  overflow: hidden;
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  background: #000;
}

.carousel-inner {
  width: 100%;
  height: 100%;
  position: relative;
}

.carousel-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s ease-in-out;
  z-index: 1;
}

.carousel-item.active {
  opacity: 1;
  z-index: 2;
}

.carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Crucial for responsiveness */
}

/* =========================================
   5. INFO COLUMNS & GRIDS
   ========================================= */
.info-columns,
.servicios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.column,
.servicio-card {
  background: var(--glass-bg);
  padding: 30px;
  border-radius: 16px;
  text-align: center;
  border: 1px solid var(--glass-border);
  transition: var(--transition);
}

.column:hover {
  transform: translateY(-10px);
  background: white;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.column img,
.servicio-card img {
  width: 80px; /* Prevent massive icons */
  height: 80px;
  object-fit: contain;
  margin-bottom: 20px;
}

.column h1,
.servicio-card h3 {
  color: var(--primary-purple);
  margin-bottom: 15px;
  font-size: 1.5rem;
}

/* Servicios Flip Card logic */
.servicio-card {
  perspective: 1000px;
  background: transparent;
  padding: 0;
  border: none;
  height: 350px; /* Fixed height for flip cards */
  cursor: pointer;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.servicio-card:hover .card-inner,
.servicio-card.is-flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.card-back {
  background: var(--primary-purple);
  color: white;
  transform: rotateY(180deg);
}

/* =========================================
   7. LIBRARY (BIBLIOTECA)
   ========================================= */
.heyzine-embed-container {
  width: 100%;
  height: 80vh; /* Ocupar buen alto de pantalla */
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-soft);
}

.fp-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Títulos en biblioteca que se veían oscuros */
.heyzine-title {
  color: var(--primary-purple);
  font-size: 2rem;
  text-align: center;
  margin-bottom: 10px;
}

.heyzine-subtitle {
  text-align: center;
  color: var(--text-dark);
  margin-bottom: 20px;
}

/* =========================================
   8. MEMORY GAME (CONTACTO)
   ========================================= */
.memory-game {
  width: 640px;
  height: 640px;
  margin: auto;
  display: flex;
  flex-wrap: wrap;
  perspective: 1000px;
}

.memory-card {
  width: calc(25% - 10px);
  height: calc(33.333% - 10px);
  margin: 5px;
  position: relative;
  cursor: pointer;
  transform: scale(1);
  transform-style: preserve-3d;
  transition: transform 0.5s;
}

.memory-card:active {
  transform: scale(0.97);
  transition: transform 0.2s;
}

.memory-card.flip {
  transform: rotateY(180deg);
}

.memory-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
}

.card-front-face,
.card-back-face {
  width: 100%;
  height: 100%;
  position: absolute;
  border-radius: 5px;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.3);
}

.card-front-face {
  background: white;
  transform: rotateY(180deg);
  font-size: 3rem;
  color: var(--primary-purple);
}

.card-back-face {
  background: var(--glass-bg);
  padding: 20px;
}

.card-back-face img {
  width: 80%;
  height: auto;
  object-fit: contain;
}

#reset-game-btn {
  display: block;
  margin: 20px auto;
  padding: 10px 20px;
  font-size: 1.2rem;
  background-color: var(--accent-teal);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#reset-game-btn:hover {
  background-color: #0097a7;
}

#reset-game-btn.hidden {
  display: none;
}

@media (max-width: 768px) {
  .memory-game {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
  }
}

/* =========================================
   9. INTERACTIVE TIMELINE (NOSOTROS)
   ========================================= */
.timeline-section {
  position: relative;
  max-width: 1000px;
  margin: 50px auto;
  padding: 20px 0;
}

/* Vertical Line */
.timeline-section::after {
  content: "";
  position: absolute;
  width: 6px;
  background-color: var(--white);
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -3px;
  border-radius: 3px;
  box-shadow: var(--shadow-soft);
}

.timeline-item {
  padding: 20px 40px;
  position: relative;
  background: inherit;
  width: 50%;
  opacity: 0; /* Hidden initially */
  transform: translateY(50px);
  transition: all 0.8s ease-out;
}

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

/* Left/Right Positioning */
.timeline-item.left {
  left: 0;
  text-align: right;
}

.timeline-item.right {
  left: 50%;
  text-align: left;
}

/* Dots on the line */
.timeline-item::after {
  content: "";
  position: absolute;
  width: 25px;
  height: 25px;
  right: -13px; /* Adjust for left items */
  background-color: var(--white);
  border: 4px solid var(--accent-teal);
  top: 25px;
  border-radius: 50%;
  z-index: 1;
}

.timeline-item.right::after {
  left: -12px; /* Adjust for right items */
}

/* Content Box */
.timeline-content {
  padding: 20px 30px;
  background: var(--glass-bg);
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
}

.timeline-year {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-purple);
  margin-bottom: 10px;
  display: block;
}

@media (max-width: 768px) {
  /* Mobile: Line to the left */
  .timeline-section::after {
    left: 31px;
  }

  .timeline-item {
    width: 100%;
    padding-left: 70px;
    padding-right: 25px;
  }

  .timeline-item.left,
  .timeline-item.right {
    left: 0;
    text-align: left;
  }

  .timeline-item::after {
    left: 18px; /* Align dots with line */
  }
}

/* =========================================
   6. FOOTER & EXTRAS
   ========================================= */
.footer-section {
  margin-top: auto; /* Push to bottom */
  background: var(--primary-purple);
  color: white;
  padding: 40px 20px;
  border-radius: 20px 20px 0 0;
  text-align: center;
}

.social-links {
  margin-bottom: 20px;
}
.social-links a {
  color: white;
  font-size: 1.5rem;
  margin: 0 10px;
  display: inline-block;
}
.social-links a:hover {
  color: var(--accent-teal);
  transform: scale(1.2);
}

.whatsapp-float {
  position: fixed;
  width: 60px;
  height: 60px;
  bottom: 30px;
  right: 30px;
  background-color: #25d366;
  color: #fff;
  border-radius: 50%;
  text-align: center;
  font-size: 30px;
  box-shadow: 2px 2px 3px #999;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.whatsapp-float:hover {
  background-color: #128c7e;
  color: white;
  transform: scale(1.1);
}

/* =========================================
   7. RESPONSIVE MEDIA QUERIES
   ========================================= */
@media (max-width: 768px) {
  .header-section {
    padding: 15px;
    flex-wrap: wrap;
  }

  .logo {
    height: 60px;
  }

  .menu-toggle {
    display: block;
    order: 2;
  }

  .main-nav {
    display: none;
    width: 100%;
    order: 3;
    margin-top: 15px;
  }

  .main-nav.active {
    display: block;
  }

  .main-nav ul {
    flex-direction: column;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  }

  .carousel {
    height: 250px;
  } /* Smaller carousel on mobile */

  .column img {
    width: 60px;
    height: 60px;
  }
}

/* Header Logo Right */
.header-logo-right {
  position: absolute;
  top: 20px;
  right: 30px;
  height: 60px;
  width: auto;
  z-index: 1000;
}

@media (max-width: 768px) {
  .header-logo-right {
    height: 40px;
    right: 15px;
    top: 15px;
  }
}
