/* =========================================================================
   layout.css - Sections, Layouts, Header & Footer
   ========================================================================= */

/* --- Sections Base --- */
.section {
  padding: var(--space-12) 0;
  position: relative;
}

.section-header {
  margin-bottom: var(--space-8);
}

.section-title {
  font-size: 2.5rem;
  margin-bottom: var(--space-3);
}

.section-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Body Overrides for Preloader --- */
body.loading {
  overflow: hidden;
}

/* --- Preloader --- */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-darker);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.6s ease, visibility 0.6s;
}

#preloader.preloader-hidden {
  opacity: 0;
  visibility: hidden;
}

.preloader-content {
  text-align: center;
}

.neural-core-loader {
  width: 100px;
  height: 100px;
  margin: 0 auto 20px;
}

.loader-circle {
  fill: none;
  stroke: var(--accent-cyan);
  stroke-width: 2;
  stroke-dasharray: 251.2;
  stroke-dashoffset: 251.2;
  animation: drawCircle 2s infinite alternate ease-in-out;
}

.loader-inner {
  fill: var(--accent-cyan);
  fill-opacity: 0.2;
  stroke: var(--accent-cyan);
  stroke-width: 1;
  animation: pulseInner 1s infinite alternate ease-in-out;
}

.loader-text {
  font-family: var(--font-display);
  font-size: 0.875rem;
  letter-spacing: 2px;
  color: var(--text-secondary);
  text-transform: uppercase;
  animation: fadeInOut 2s infinite ease-in-out;
}

@keyframes drawCircle {
  0% { stroke-dashoffset: 251.2; transform: rotate(0deg); }
  100% { stroke-dashoffset: 0; transform: rotate(360deg); }
}

@keyframes pulseInner {
  0% { transform: scale(0.8); opacity: 0.3; }
  100% { transform: scale(1.1); opacity: 1; }
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* --- Navbar --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 80px;
  background-color: rgba(9, 14, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  z-index: 1000;
  transition: var(--theme-transition);
}

:root[data-theme="light"] .navbar {
  background-color: rgba(248, 250, 252, 0.88);
}

.navbar.scrolled {
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  background-color: rgba(9, 14, 23, 0.95);
}

:root[data-theme="light"] .navbar.scrolled {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  background-color: rgba(248,250,252,0.96);
}

.navbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

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

.logo-img {
  height: 36px;
  width: auto;
  transition: opacity var(--transition-normal), filter var(--transition-normal);
}

:root[data-theme="light"] .logo-img {
  filter: brightness(0);
}

.logo-img-footer {
  height: 28px;
  opacity: 0.7;
}

.logo-img-footer:hover {
  opacity: 1;
}

.nav-links {
  display: flex;
  gap: var(--space-5);
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
}

/* --- Navbar Controls (theme + lang toggles) --- */
.nav-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.toggle-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--theme-transition);
}

:root[data-theme="light"] .toggle-btn {
  background: rgba(0,0,0,0.04);
}

.toggle-btn:hover {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.toggle-btn svg {
  width: 18px;
  height: 18px;
}

.lang-toggle {
  width: auto;
  padding: 0 10px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--accent-gradient);
  transition: width var(--transition-normal);
}

.nav-links a:hover::after {
  width: 100%;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
}

/* --- Hero Section --- */
.hero {
  padding-top: calc(80px + var(--space-12));
  padding-bottom: var(--space-12);
  min-height: 90vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero-bg-glow {
  position: absolute;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 80vw;
  height: 80vh;
  background: radial-gradient(circle, rgba(0,242,254,0.08) 0%, rgba(9,14,23,0) 70%);
  z-index: 0;
  pointer-events: none;
}

.hero-container {
  position: relative;
  z-index: 1;
  max-width: 900px;
}

.hero-title {
  font-size: 4rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: var(--space-5);
  letter-spacing: -1px;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto var(--space-6) auto;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.hero-social-proof {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.5rem 1rem;
  border-radius: 99px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-light);
}

/* --- Impact Section --- */
.impact-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: 900px;
  margin: 0 auto;
}

.impact-row {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.impact-row:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-glow);
  border-color: rgba(0,242,254,0.3);
}

.impact-row.reverse {
  flex-direction: row-reverse;
}

.impact-number {
  font-family: var(--font-display);
  font-size: 6rem;
  font-weight: 800;
  color: transparent;
  -webkit-text-stroke: 2px rgba(0,242,254,0.2);
  line-height: 1;
  flex-shrink: 0;
  transition: -webkit-text-stroke var(--transition-normal);
}

.impact-row:hover .impact-number {
  -webkit-text-stroke-color: var(--accent-cyan);
}

.impact-content {
  flex-grow: 1;
}

.impact-title {
  font-size: 1.75rem;
  margin-top: var(--space-3);
  margin-bottom: var(--space-2);
}

.impact-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

.impact-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255,255,255,0.05);
}

.metric {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.metric strong {
  font-size: 1.5rem;
  font-family: var(--font-display);
  margin-bottom: 0.25rem;
}

/* --- Workflow / Proceso --- */
.workflow-steps {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

.workflow-steps::before {
  content: '';
  position: absolute;
  left: 28px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-light);
  z-index: 0;
}

.step-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
  position: relative;
  z-index: 1;
}

.step-number {
  width: 58px;
  height: 58px;
  background: var(--bg-dark);
  border: 2px solid var(--accent-cyan);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--accent-cyan);
  flex-shrink: 0;
  box-shadow: 0 0 15px rgba(0,242,254,0.2);
}

.step-title {
  margin-bottom: var(--space-2);
  margin-top: var(--space-2);
}

.step-desc {
  color: var(--text-secondary);
}

/* --- Technologies Grid --- */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  margin-top: var(--space-8);
}

.tech-item {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.01);
  border: 1px solid transparent;
  transition: all var(--transition-normal);
}

.tech-item:hover {
  background: rgba(255,255,255,0.03);
  border-color: var(--border-light);
  transform: translateY(-2px);
}

/* --- About Section --- */
.about-section {
  position: relative;
}

.about-visual {
  position: relative;
  height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.neural-network-svg {
  width: 350px;
  height: 350px;
  filter: drop-shadow(0 0 20px rgba(0,242,254,0.3));
}

.neural-core {
  fill: var(--accent-cyan);
  fill-opacity: 0.1;
  stroke: var(--accent-cyan);
  stroke-width: 2;
  animation: corePulse 4s infinite alternate ease-in-out;
}

.neural-node {
  fill: var(--accent-cyan);
  fill-opacity: 0.2;
  stroke: var(--accent-blue);
  stroke-width: 1;
}

.neural-line {
  stroke: var(--accent-cyan);
  stroke-width: 1;
  stroke-opacity: 0.2;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
}

/* Animations per node for organic feel */
.node-1 { animation: floatNode 5s infinite alternate ease-in-out; }
.node-2 { animation: floatNode 6s infinite alternate-reverse ease-in-out; }
.node-3 { animation: floatNode 7s infinite alternate ease-in-out; }
.node-4 { animation: floatNode 5.5s infinite alternate-reverse ease-in-out; }
.node-5 { animation: floatNode 4.5s infinite alternate ease-in-out; }
.node-6 { animation: floatNode 6.5s infinite alternate-reverse ease-in-out; }

/* Line flow animation */
.line-1, .line-2, .line-3, .line-4, .line-5, .line-6 {
  animation: lineFlow 4s infinite ease-in-out;
}

@keyframes corePulse {
  0% { r: 35; fill-opacity: 0.1; stroke-opacity: 0.5; }
  100% { r: 45; fill-opacity: 0.3; stroke-opacity: 1; }
}

@keyframes floatNode {
  0% { transform: translate(0, 0); }
  100% { transform: translate(10px, -15px); }
}

@keyframes lineFlow {
  0% { stroke-dashoffset: 200; stroke-opacity: 0.1; }
  50% { stroke-opacity: 0.5; }
  100% { stroke-dashoffset: 0; stroke-opacity: 0.1; }
}

/* --- FAQ Accordion --- */
.faq-accordion {
  border-top: 1px solid var(--border-light);
}

.faq-item {
  border-bottom: 1px solid var(--border-light);
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.125rem;
  font-family: var(--font-sans);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.faq-icon {
  color: var(--text-muted);
  transition: transform var(--transition-normal);
}

.faq-question.active .faq-icon {
  transform: rotate(180deg);
  color: var(--accent-cyan);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0, 1, 0, 1);
}

.faq-answer.active {
  max-height: 500px;
  transition: max-height 0.5s ease-in-out;
}

.faq-answer-inner {
  padding-bottom: var(--space-4);
  color: var(--text-secondary);
  font-weight: 300;
  line-height: 1.7;
}

/* --- Contact Section --- */
.hero-cta-section {
  padding: var(--space-16) 0;
}

.glow-bg-bottom {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 50vh;
  background: radial-gradient(ellipse at bottom, rgba(0,242,254,0.1) 0%, rgba(9,14,23,0) 70%);
  z-index: 0;
}

.contact-card {
  position: relative;
  z-index: 1;
  background: var(--bg-darker);
  border: 1px solid rgba(0,242,254,0.2);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  padding: var(--space-8);
}

/* --- Footer --- */
.footer {
  background-color: #030508;
  border-top: 1px solid var(--border-light);
  padding-top: var(--space-8);
  padding-bottom: var(--space-4);
}

.footer-container {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-8);
  margin-bottom: var(--space-6);
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.footer-col h5 {
  color: #fff; /* Default for dark theme */
  transition: var(--theme-transition);
}

.footer-col a {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.footer-col a:hover {
  color: var(--accent-cyan);
}

.footer-bottom {
  border-top: 1px solid var(--border-light);
  padding-top: var(--space-4);
}

/* --- Logo Carousel --- */
.logo-carousel-section {
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-darker);
  overflow: hidden;
}

.text-uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }

.logo-slider {
  width: 100%;
  overflow: hidden;
  position: relative;
}

.logo-slider::before,
.logo-slider::after {
  content: "";
  position: absolute;
  top: 0;
  width: 150px;
  height: 100%;
  z-index: 2;
}

.logo-slider::before {
  left: 0;
  background: linear-gradient(to right, var(--bg-darker) 0%, rgba(9,14,23,0) 100%);
}

.logo-slider::after {
  right: 0;
  background: linear-gradient(to left, var(--bg-darker) 0%, rgba(9,14,23,0) 100%);
}

.logo-track {
  display: flex;
  width: max-content;
  animation: scroll 60s linear infinite;
}

.logo-slide {
  width: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity var(--transition-normal);
}

.logo-slide:hover {
  opacity: 1;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: -0.5px;
}

@media (max-width: 768px) {
  .logo-slide {
    width: 150px;
  }
}

@keyframes scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* --- Legal Pages --- */
.navbar--static {
  position: relative;
}

.legal-section {
  padding-top: var(--space-8);
  padding-bottom: var(--space-12);
}

.legal-back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.9rem;
  color: var(--accent-cyan);
  margin-bottom: var(--space-6);
  transition: opacity var(--transition-normal);
}

.legal-back-link:hover {
  opacity: 0.75;
}

.legal-page-title {
  font-size: 2.75rem;
  font-weight: 800;
  margin-bottom: var(--space-2);
  line-height: 1.15;
}

.legal-updated {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-light);
}

.legal-content h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  color: var(--text-primary);
}

.legal-content p {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.legal-content ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: var(--space-4);
}

.legal-content ul li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.6rem;
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 0.95rem;
}

.legal-content ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  opacity: 0.6;
}

.legal-content a {
  color: var(--accent-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-content a:hover {
  opacity: 0.8;
}

/* --- Light Mode Overrides for Hardcoded Colors --- */
:root[data-theme="light"] .hero-bg-glow {
  background: radial-gradient(circle, rgba(8,145,178,0.06) 0%, rgba(248,250,252,0) 70%);
}

:root[data-theme="light"] .hero-social-proof {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.08);
}

:root[data-theme="light"] .input-wrap input,
:root[data-theme="light"] .input-wrap textarea {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.1);
}

:root[data-theme="light"] .input-wrap input:focus,
:root[data-theme="light"] .input-wrap textarea:focus {
  background: rgba(0,0,0,0.04);
}

:root[data-theme="light"] .contact-card {
  background: #fff;
  border-color: rgba(8,145,178,0.15);
  box-shadow: 0 20px 50px rgba(0,0,0,0.06);
}

:root[data-theme="light"] .glow-bg-bottom {
  background: radial-gradient(ellipse at bottom, rgba(8,145,178,0.06) 0%, rgba(248,250,252,0) 70%);
}

:root[data-theme="light"] .footer {
  background-color: #e8ecf1;
}

:root[data-theme="light"] .footer-col h5 {
  color: var(--text-primary);
}

:root[data-theme="light"] .logo-carousel-section {
  background: var(--bg-darker);
}

:root[data-theme="light"] .logo-slider::before {
  background: linear-gradient(to right, var(--bg-darker) 0%, rgba(238,242,247,0) 100%);
}

:root[data-theme="light"] .logo-slider::after {
  background: linear-gradient(to left, var(--bg-darker) 0%, rgba(238,242,247,0) 100%);
}

:root[data-theme="light"] .impact-number {
  -webkit-text-stroke-color: rgba(8,145,178,0.15);
}

:root[data-theme="light"] .impact-row:hover .impact-number {
  -webkit-text-stroke-color: var(--accent-cyan);
}

:root[data-theme="light"] .abstract-shape {
  background: linear-gradient(135deg, rgba(8,145,178,0.08) 0%, rgba(22,163,74,0.08) 100%);
  border-color: rgba(8,145,178,0.2);
}

:root[data-theme="light"] .step-number {
  background: var(--bg-dark);
}

:root[data-theme="light"] .workflow-steps::before {
  background: rgba(0,0,0,0.08);
}

:root[data-theme="light"] body {
  transition: var(--theme-transition);
}

/* --- Responsive Layout (Media Queries) --- */
@media (max-width: 992px) {
  .hero-title { font-size: 3rem; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .tech-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-container { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: block; }
  .nav-controls .btn { display: none; } /* Hide CTA on mobile */
  
  .hero-title { font-size: 2.5rem; }
  .hero-actions { flex-direction: column; width: 100%; }
  .hero-actions .btn { width: 100%; }
  
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .tech-grid { grid-template-columns: 1fr; }
  
  .section { padding: var(--space-8) 0; }
  .contact-card { padding: var(--space-5); }
  
  .impact-row, .impact-row.reverse {
    flex-direction: column;
    text-align: center;
  }
  .impact-metrics {
    justify-content: center;
  }
  
  /* Mobile menu active state */
  .nav-links.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 80px;
    left: 0;
    width: 100%;
    background: var(--bg-darker);
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-light);
  }
}
