/* -------------------------------------------------------------------------- */
/* CSS Variables & Theme (Premium Dark Mode - Apple/Framer Style)
/* -------------------------------------------------------------------------- */
:root {
  --color-bg: #000000;          /* Pitch Black */
  --color-surface: rgba(20, 20, 20, 0.6); /* Glassy Surface */
  --color-surface-hover: rgba(40, 40, 40, 0.8);
  --color-accent: #A0522D;      /* Zimt Copper */
  --color-accent-hover: #C06B42;
  --color-text-dark: #FFFFFF;   /* Flipped for dark mode */
  --color-text-light: #A1A1A6;  /* Apple gray */
  --color-text-muted: #86868B;
  --color-border: rgba(255, 255, 255, 0.1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --transition-smooth: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.5);
  --shadow-hover: 0 15px 50px rgba(0, 0, 0, 0.8);
  
  --section-padding: 120px 0;
  --container-width: 1200px;
}

.mobile-controls {
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.btn-mobile-config {
  border-color: var(--color-accent) !important;
  color: var(--color-accent-hover) !important;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  background-color: transparent;
  white-space: nowrap;
}

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

html {
  scroll-behavior: smooth;
  background-color: var(--color-bg);
  overflow-x: hidden;
}

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

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition-smooth);
}

/* Visible focus for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-accent-hover);
  outline-offset: 3px;
  border-radius: 4px;
}

ul {
  list-style: none;
}

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

/* -------------------------------------------------------------------------- */
/* Global Canvas (Scroll-Driven Video)
/* -------------------------------------------------------------------------- */
#scroll-video-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  object-fit: cover;
  z-index: -2; /* Behind everything */
  background-color: var(--color-bg); /* Fallback */
}

/* A dark overlay over the canvas so text is readable */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: radial-gradient(circle at center, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.8) 100%);
  z-index: -1;
  pointer-events: none;
}

.scroll-spacer {
  height: 150vh; /* Extended space for the video to play entirely before content overlaps */
  pointer-events: none;
}

.content-wrapper {
  position: relative;
  z-index: 1;
  /* Fades to black more smoothly so the final frame of the video stays visible longer */
  background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.5) 10%, var(--color-bg) 30%);
  padding-bottom: 2rem;
}

/* -------------------------------------------------------------------------- */
/* Header Navigation
/* -------------------------------------------------------------------------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 1.5rem 0;
  z-index: 1000;
  transition: var(--transition-smooth);
  background-color: transparent;
}

.navbar.scrolled {
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--color-text-dark);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.nav-menu ul {
  display: flex;
  gap: 2rem;
}

.nav-menu ul li a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-light);
  position: relative;
}

.nav-menu ul li a:hover {
  color: var(--color-text-dark);
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
}

.mobile-menu-toggle span {
  width: 24px;
  height: 2px;
  background-color: var(--color-text-dark);
  transition: var(--transition-smooth);
}

/* -------------------------------------------------------------------------- */
/* Buttons
/* -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.8rem;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 999px; /* Pill shape */
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
}

.btn-large {
  padding: 1rem 2.5rem;
  font-size: 1.05rem;
}

.btn-primary {
  background-color: var(--color-text-dark);
  color: var(--color-bg);
}

.btn-primary:hover {
  background-color: var(--color-text-light);
  transform: scale(1.02);
}

.btn-secondary {
  background-color: rgba(255,255,255,0.1);
  color: var(--color-text-dark);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background-color: rgba(255,255,255,0.2);
  transform: scale(1.02);
}

.btn-outline {
  border-color: var(--color-border);
  color: var(--color-text-dark);
}

.btn-outline:hover {
  background-color: var(--color-text-dark);
  color: var(--color-bg);
}

/* -------------------------------------------------------------------------- */
/* Hero Section (Fixed Overlay)
/* -------------------------------------------------------------------------- */
.hero {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
  text-align: center;
  /* Will be faded out by JS on scroll */
}

.hero-container {
  max-width: 900px;
}

.hero-title {
  font-size: clamp(3.5rem, 8vw, 6.5rem);
  margin-bottom: 1.5rem;
  letter-spacing: -0.04em;
  background: linear-gradient(180deg, #FFFFFF 0%, #A1A1A6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.05;
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--color-text-light);
  margin-bottom: 2.5rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  font-weight: 400;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* -------------------------------------------------------------------------- */
/* Sections Base
/* -------------------------------------------------------------------------- */
.section {
  padding: var(--section-padding);
}

.section-header {
  margin-bottom: 4rem;
  text-align: center;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.section-header h2 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: 1rem;
}

.section-header p {
  color: var(--color-text-light);
  font-size: 1.2rem;
}

/* -------------------------------------------------------------------------- */
/* Authority Bar
/* -------------------------------------------------------------------------- */
.authority-bar {
  padding: 4rem 0;
  overflow: hidden;
  text-align: center;
}

.authority-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

.logos {
  display: flex;
  white-space: nowrap;
}

.logos-slide {
  display: inline-flex;
  align-items: center;
  animation: slide 30s infinite linear;
}

.logos-slide img {
  height: 40px;
  margin: 0 40px;
  object-fit: contain;
  transition: var(--transition-smooth);
}

.logos-slide img.logo-transparent {
  filter: brightness(0) invert(1) opacity(0.5);
}
.logos-slide img.logo-transparent:hover {
  opacity: 1;
}

.logos-slide img.logo-solid {
  filter: grayscale(1) invert(1) opacity(0.6);
  mix-blend-mode: screen;
}
.logos-slide img.logo-solid:hover {
  opacity: 1;
}

@keyframes slide {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

/* -------------------------------------------------------------------------- */
/* Glass Cards (Bento Grid)
/* -------------------------------------------------------------------------- */
.glass-card, .bento-item {
  background: var(--color-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 3rem;
  transition: var(--transition-smooth);
}

.bento-item:hover, .glass-card:hover {
  background: var(--color-surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-5px);
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  grid-auto-rows: minmax(220px, auto); /* Reduced from 280px to avoid empty vertical space */
}

.bento-item h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.bento-item p {
  color: var(--color-text-light);
}

.bento-large {
  grid-column: span 2;
  grid-row: span 2;
}

.bento-large h3 {
  font-size: 2.5rem;
}

.bento-wide {
  grid-column: span 2;
}

/* -------------------------------------------------------------------------- */
/* Academy Section
/* -------------------------------------------------------------------------- */
.academy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.academy-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
}

.academy-card h3 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.academy-card p {
  margin-bottom: 2rem;
  color: var(--color-text-light);
  font-size: 1.1rem;
}

/* -------------------------------------------------------------------------- */
/* Projects Section
/* -------------------------------------------------------------------------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.project-card {
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--color-border);
}

.project-image {
  height: 400px;
  background-size: cover;
  background-position: center;
  transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.project-card:hover .project-image {
  transform: scale(1.05);
}

.project-info {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 2rem;
  background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
}

.tag {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent-hover); /* Más claro para contraste AA sobre fondo oscuro */
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.project-info h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.link-arrow {
  font-weight: 600;
  color: var(--color-text-dark);
}

.link-arrow:hover {
  color: var(--color-accent);
}

/* -------------------------------------------------------------------------- */
/* CTA / Contact Section
/* -------------------------------------------------------------------------- */
.cta-box {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  padding: 4rem;
}

.cta-box h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.cta-box p {
  color: var(--color-text-light);
  margin-bottom: 3rem;
  font-size: 1.1rem;
}

.modern-form {
  text-align: left;
}

.form-row {
  display: flex;
  gap: 1.5rem;
}

.form-row .form-group {
  flex: 1;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-light);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 1rem 1.2rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  color: var(--color-text-dark);
  font-family: var(--font-sans);
  font-size: 1rem;
  outline: none;
  transition: var(--transition-smooth);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--color-text-dark);
  background: rgba(255, 255, 255, 0.08);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.checkbox-group input {
  width: auto;
  accent-color: var(--color-text-dark);
}

.checkbox-group label {
  margin: 0;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
  padding: 1.2rem;
  font-size: 1.1rem;
  margin-top: 1rem;
}

.form-error {
  color: #FF4136;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

@keyframes privacyVibrate {
  0% { transform: translateX(0); color: inherit; }
  20% { transform: translateX(-4px); color: #FF4136; }
  40% { transform: translateX(4px); color: #FF4136; }
  60% { transform: translateX(-4px); color: #FF4136; }
  80% { transform: translateX(4px); color: #FF4136; }
  100% { transform: translateX(0); color: inherit; }
}

.privacy-error-animation {
  animation: privacyVibrate 0.6s ease-in-out;
  color: #FF4136 !important;
}
.privacy-error-animation a {
  color: #FF4136 !important;
}

/* -------------------------------------------------------------------------- */
/* Footer
/* -------------------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--color-border);
  padding: 4rem 0 2rem;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4rem;
  gap: 4rem;
}

.footer-brand {
  max-width: 300px;
}

.footer-brand h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.footer-brand p {
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-links a {
  color: var(--color-text-light);
  font-weight: 500;
  font-size: 0.9rem;
}

.social-links a:hover {
  color: var(--color-text-dark);
}

.footer-links {
  display: flex;
  gap: 4rem;
}

.footer-col h4 {
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.footer-col a {
  display: block;
  color: var(--color-text-muted);
  margin-bottom: 0.8rem;
  font-size: 0.9rem;
}

.footer-col a:hover {
  color: var(--color-text-dark);
}

.footer-col p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.mini-form {
  display: flex;
  gap: 0.5rem;
}

.mini-form input {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  color: white;
  width: 200px;
}

.mini-form button {
  border-radius: 8px;
  padding: 0.5rem 1rem;
}

.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: 2rem;
  text-align: center;
}

.risk-disclaimer {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.copyright {
  font-size: 0.85rem;
  color: var(--color-text-light);
}

/* -------------------------------------------------------------------------- */
/* Cookie Banner
/* -------------------------------------------------------------------------- */
.cookie-banner {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(150%);
  width: 90%;
  max-width: 800px;
  z-index: 9999;
  padding: 1.5rem;
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  background: rgba(20, 20, 20, 0.8);
  border-radius: 16px;
}

.cookie-banner.show {
  transform: translateX(-50%) translateY(0);
}

.cookie-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.cookie-content p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-light);
}

.cookie-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-shrink: 0;
}

.cookie-link {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-decoration: underline;
}

/* -------------------------------------------------------------------------- */
/* Animations & Fade-In Elements
/* -------------------------------------------------------------------------- */
.fade-in-section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s ease-out, transform 1s ease-out;
  will-change: opacity, visibility;
}

.fade-in-section.is-visible {
  opacity: 1;
  transform: none;
}

/* -------------------------------------------------------------------------- */
/* Reduced Motion (accesibilidad)
/* -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .logos-slide {
    animation: none;
  }
  .fade-in-section {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .hero {
    transform: none !important;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* -------------------------------------------------------------------------- */
/* Responsive Design
/* -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  .bento-grid {
    grid-template-columns: 1fr 1fr;
  }
  .bento-large {
    grid-column: span 2;
    grid-row: span 1;
  }
  .bento-wide {
    grid-column: span 2;
  }
  .academy-grid {
    grid-template-columns: 1fr;
  }
  .projects-grid {
    grid-template-columns: 1fr;
  }
  .footer-top {
    flex-direction: column;
    gap: 3rem;
  }
  .footer-links {
    flex-direction: column;
    gap: 2rem;
  }
}

@media (max-width: 768px) {
  :root {
    --section-padding: 80px 0;
  }
  
  .hero-actions {
    flex-direction: column;
  }

  /* Prevent transparent header overlap on small screens */
  .hero-container {
    padding-top: 80px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }
  
  .bento-grid {
    grid-template-columns: 1fr;
  }
  .bento-large, .bento-wide {
    grid-column: span 1;
  }

  .cookie-content {
    flex-direction: column;
    text-align: center;
  }

  /* Mobile Nav */
  .mobile-controls {
    display: flex;
  }
  .desktop-config-btn {
    display: none !important;
  }
  .mobile-menu-toggle {
    display: flex;
  }

  /* Fix for horizontal overflow and descuadre */
  .glass-card, .bento-item {
    padding: 1.5rem;
  }
  .bento-large h3 {
    font-size: 1.8rem;
  }
  .bento-item h3 {
    font-size: 1.3rem;
  }

  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 2rem;
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    transition: clip-path 0.4s ease-in-out;
  }

  .nav-menu.active {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }

  .nav-menu ul {
    flex-direction: column;
    align-items: center;
    width: 100%;
  }
  
  .nav-menu .btn {
    width: 100%;
    margin-top: 1rem;
  }
}
