/* ============================================================
   CYNTEK — global.css
   Tipografía base, containers, secciones, utilidades,
   loader y sistema de reveal on scroll.
   ============================================================ */

/* ------------------------------------------------------------
   1. BODY — tipografía base y fondo del tema
   ------------------------------------------------------------ */
body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-relaxed);
  color: var(--text-primary);
  background-color: var(--surface-1);
  transition: var(--transition-theme);
  overflow-x: hidden;
}

body.no-scroll {
  overflow: hidden;
}

/* ------------------------------------------------------------
   2. HEADINGS
   ------------------------------------------------------------ */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--text-primary);
  text-wrap: balance;
}

h1, .h1 {
  font-size: clamp(2.5rem, 6vw, var(--fs-5xl));
  font-weight: var(--fw-black);
  letter-spacing: var(--ls-tighter);
  text-transform: uppercase;
  line-height: var(--lh-tight);
}

h2, .h2 {
  font-size: clamp(2rem, 4.5vw, var(--fs-4xl));
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-tight);
  text-transform: uppercase;
}

h3, .h3 {
  font-size: clamp(1.5rem, 3vw, var(--fs-3xl));
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-tight);
}

h4, .h4 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-tight);
}

h5, .h5 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
}

h6, .h6 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
}

/* ------------------------------------------------------------
   3. PÁRRAFOS Y TEXTO
   ------------------------------------------------------------ */
p {
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  color: var(--text-secondary);
  max-width: 72ch;
}

p.lead {
  font-size: var(--fs-lg);
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 62ch;
}

small, .text-sm {
  font-size: var(--fs-sm);
}

.text-xs { font-size: var(--fs-xs); }
.text-lg { font-size: var(--fs-lg); }

.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary   { color: var(--text-primary); }
.text-accent    { color: var(--text-accent); }

.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

.text-uppercase { text-transform: uppercase; }

/* ------------------------------------------------------------
   4. EYEBROW (etiqueta pequeña de sección)
   ------------------------------------------------------------ */
.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--cyntek-orange);
  margin-bottom: var(--sp-4);
  line-height: 1;
}

.eyebrow::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--cyntek-orange);
  vertical-align: middle;
  margin-right: var(--sp-3);
  transform: translateY(-1px);
}

.eyebrow--plain::before {
  display: none;
}

/* ------------------------------------------------------------
   5. CONTAINERS
   ------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-px);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.container--wide {
  max-width: 1520px;
}

.container--full {
  max-width: none;
}

/* ------------------------------------------------------------
   6. SECCIONES
   ------------------------------------------------------------ */
.section {
  position: relative;
  padding-block: var(--section-py);
  background-color: var(--surface-1);
  color: var(--text-primary);
  transition: var(--transition-theme);
}

.section--lg {
  padding-block: var(--section-py-lg);
}

.section--dark {
  background-color: var(--surface-0);
}

.section--alt {
  background-color: var(--surface-2);
}

.section--flush-top    { padding-top: 0; }
.section--flush-bottom { padding-bottom: 0; }

/* Grid técnico de fondo (sutil) */
.section--grid::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 90%);
  z-index: 0;
}

.section > .container {
  position: relative;
  z-index: 1;
}

/* ------------------------------------------------------------
   7. SECTION HEADER (patrón eyebrow + título + texto)
   ------------------------------------------------------------ */
.section-header {
  max-width: 780px;
  margin-bottom: var(--sp-10);
}

.section-header--center {
  margin-inline: auto;
  text-align: center;
}

.section-header--center .eyebrow::before {
  display: none;
}

.section-header h2 {
  margin-bottom: var(--sp-5);
}

.section-header p {
  margin: 0;
}

/* ------------------------------------------------------------
   8. DIVISORES TÉCNICOS
   ------------------------------------------------------------ */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border-default);
  border: none;
  margin: 0;
}

.divider--accent {
  width: 48px;
  height: 2px;
  background: var(--cyntek-orange);
}

/* ------------------------------------------------------------
   9. UTILIDADES DE LAYOUT
   ------------------------------------------------------------ */
.flex        { display: flex; }
.inline-flex { display: inline-flex; }
.grid        { display: grid; }
.block       { display: block; }
.hidden      { display: none; }

.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.items-end      { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between{ justify-content: space-between; }
.justify-end    { justify-content: flex-end; }

.flex-col  { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1    { flex: 1 1 0; }

.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }

.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }

.mb-1 { margin-bottom: var(--sp-1); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }

/* ------------------------------------------------------------
   10. ACCESIBILIDAD — solo lectores de pantalla
   ------------------------------------------------------------ */
.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------
   11. LOADER (pantalla de carga inicial)
   ------------------------------------------------------------ */
.loader {
  position: fixed;
  inset: 0;
  z-index: var(--z-loader);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--surface-0);
  transition: opacity var(--dur-slow) var(--ease-soft),
              visibility var(--dur-slow) var(--ease-soft);
}

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

.loader__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-6);
}

/* Halo claro detrás del logo para que se vea sobre fondo oscuro */
.loader__inner::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 340px;
  height: 140px;
  transform: translate(-50%, calc(-50% - 34px));
  background: radial-gradient(
    ellipse at center,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(255, 255, 255, 0.06) 40%,
    transparent 72%
  );
  filter: blur(18px);
  pointer-events: none;
  z-index: 0;
}

.loader__logo {
  position: relative;
  z-index: 1;
  display: block;
  width: auto;
  height: 48px;
  max-height: 48px;
  object-fit: contain;
  /* Sombra clara + realce para que el logo oscuro se lea sobre negro */
  filter:
    drop-shadow(0 0 12px rgba(255, 255, 255, 0.35))
    drop-shadow(0 0 28px rgba(255, 122, 92, 0.22))
    brightness(1.25)
    contrast(1.05);
}

.loader__mark {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-black);
  letter-spacing: var(--ls-widest);
  color: var(--text-primary);
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}

/* Barra de carga 15% más ancha: 180px → 207px */
.loader__bar {
  position: relative;
  z-index: 1;
  width: 207px;
  height: 2px;
  background: var(--border-default);
  overflow: hidden;
}

.loader__bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  background: var(--cyntek-orange);
  animation: loader-slide 1.2s var(--ease-inout) infinite;
}

@keyframes loader-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

@media (max-width: 640px) {
  .loader__logo { height: 36px; }
  .loader__bar  { width: 180px; }
}

/* ------------------------------------------------------------
   12. REVEAL ON SCROLL
   Elementos con [data-reveal] se animan al entrar en pantalla.
   animations.js añade .is-visible.
   ------------------------------------------------------------ */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--dur-slower) var(--ease-out),
              transform var(--dur-slower) var(--ease-out);
  will-change: opacity, transform;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Variantes de retardo (stagger) */
[data-reveal][data-delay="1"] { transition-delay: 100ms; }
[data-reveal][data-delay="2"] { transition-delay: 200ms; }
[data-reveal][data-delay="3"] { transition-delay: 300ms; }
[data-reveal][data-delay="4"] { transition-delay: 400ms; }
[data-reveal][data-delay="5"] { transition-delay: 500ms; }
[data-reveal][data-delay="6"] { transition-delay: 600ms; }

/* ------------------------------------------------------------
   13. PREFERENCIAS DE MOVIMIENTO REDUCIDO
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .loader__bar::after {
    animation: none;
  }
}

/* ------------------------------------------------------------
   14. FONDOS TÉCNICOS REUTILIZABLES
   ------------------------------------------------------------ */
.bg-grid {
  position: relative;
}

.bg-grid::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  z-index: 0;
}

.bg-grid > * {
  position: relative;
  z-index: 1;
}

/* ------------------------------------------------------------
   15. ENLACES DE TEXTO (subrayado naranja animado)
   ------------------------------------------------------------ */
.link {
  position: relative;
  display: inline-block;
  color: var(--text-primary);
  font-weight: var(--fw-medium);
  transition: color var(--dur-base) var(--ease-soft);
}

.link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform var(--dur-base) var(--ease-out);
}

.link:hover {
  color: var(--cyntek-orange);
}

.link:hover::after {
  transform: scaleX(1);
}

.link--accent {
  color: var(--cyntek-orange);
}

/* ------------------------------------------------------------
   16. FONDOS Y OVERLAYS GENÉRICOS
   ------------------------------------------------------------ */
.overlay-dark {
  position: relative;
}

.overlay-dark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--overlay-gradient);
  pointer-events: none;
  z-index: 1;
}

.overlay-dark > * {
  position: relative;
  z-index: 2;
}