/* ==========================================================================
   ASISJUR — main.css
   Design tokens, reset, base y layout genérico.
   Sistema visual: "El respaldo no se improvisa"
   ========================================================================== */

/* ---------- DESIGN TOKENS ---------- */
:root {
  /* Color — tinta (paleta oficial asisjur.com: navy #0f1e30 / navy-light #1a2e45) */
  --ink-900: #0f1e30;
  --ink-800: #16283f;
  --ink-700: #1c3450;
  --ink-600: #24486b;
  --ink-500: #3a638c;
  --ink-400: #6f8dab;
  --ink-300: #a9bdd2;

  /* Color — papel (fondo claro frío, alineado a --bg-light/--border oficiales) */
  --paper-100: #f5f8fc;
  --paper-200: #eef2f7;
  --paper-300: #e5eaf0;

  /* Color — acento (azul/cian oficial asisjur.com: --primary #3dadf2, --accent #59c1d9).
     --brass-600 se oscurece respecto al oficial para mantener contraste AA como texto sobre papel. */
  --brass-600: #1c6ea3;
  --brass-500: #3dadf2;
  --brass-400: #59c1d9;
  --brass-300: #9ed6e8;
  --brass-100: #e8f6fb;

  /* Color — funcional */
  --blue-signal: #2f5d9c;
  --whatsapp: #25d366;
  --error: #b3422f;

  /* Texto */
  --text-on-ink: #f4f1e9;
  --text-on-ink-soft: rgba(244, 241, 233, 0.68);
  --text-on-paper: #17222e;
  --text-on-paper-soft: #4d5b6b;
  --text-muted: #7c8a99;

  /* Tipografía */
  --font-display: "Fraunces", "Iowan Old Style", "Georgia", serif;
  --font-body: "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --fs-display-xl: clamp(2.75rem, 2rem + 3.4vw, 5.25rem);
  --fs-display-l: clamp(2.1rem, 1.6rem + 2.2vw, 3.4rem);
  --fs-display-m: clamp(1.65rem, 1.4rem + 1.1vw, 2.35rem);
  --fs-display-s: clamp(1.3rem, 1.15rem + 0.6vw, 1.65rem);
  --fs-body-l: clamp(1.05rem, 1rem + 0.2vw, 1.2rem);
  --fs-body-m: 1rem;
  --fs-body-s: 0.875rem;
  --fs-eyebrow: 0.78rem;

  --lh-tight: 1.08;
  --lh-snug: 1.28;
  --lh-body: 1.65;

  /* Espaciado (escala base 4px) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;

  --content-max: 1280px;
  --content-narrow: 760px;
  --gutter: clamp(1.25rem, 4vw, 3rem);

  /* Radios — deliberadamente contenidos (identidad legal, no burbuja SaaS) */
  --radius-s: 2px;
  --radius-m: 4px;
  --radius-l: 8px;
  --radius-pill: 999px;

  /* Elevación */
  --shadow-s: 0 1px 2px rgba(10, 26, 44, 0.08);
  --shadow-m: 0 8px 24px -8px rgba(10, 26, 44, 0.22);
  --shadow-l: 0 24px 60px -20px rgba(10, 26, 44, 0.35);
  --shadow-brass: 0 12px 32px -12px rgba(28, 110, 163, 0.45);

  /* Movimiento */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 180ms;
  --dur-base: 320ms;
  --dur-slow: 640ms;

  /* Glow — reservado a momentos de autoridad, mismo criterio que --brass-* */
  --glow-brass: 0 0 0 rgba(89, 193, 217, 0);
  --glow-brass-active: 0 0 28px -4px rgba(89, 193, 217, 0.55);

  --header-h: 84px;
}

/* ---------- RESET ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html:focus-within {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  min-height: 100svh;
  font-family: var(--font-body);
  font-size: var(--fs-body-m);
  line-height: var(--lh-body);
  color: var(--text-on-paper);
  background: var(--paper-100);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
}

/* Grano sutil sitewide — textura "impresa premium", no decorativo genérico */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img,
picture,
svg,
video {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
  padding: 0;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  line-height: var(--lh-tight);
  font-weight: 600;
  letter-spacing: -0.01em;
}

table {
  border-collapse: collapse;
}

/* Foco visible — accesibilidad WCAG AA */
:focus-visible {
  outline: 2px solid var(--brass-500);
  outline-offset: 3px;
  border-radius: var(--radius-s);
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -60px;
  background: var(--ink-900);
  color: var(--text-on-ink);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-m);
  z-index: 1000;
  transition: top var(--dur-fast) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- LAYOUT GENÉRICO ---------- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--space-9);
  position: relative;
}

.section--tight {
  padding-block: var(--space-8);
}

.section--ink {
  background: var(--ink-900);
  color: var(--text-on-ink);
}

.section--paper-alt {
  background: var(--paper-200);
}

.section-head {
  max-width: var(--content-narrow);
  margin-bottom: var(--space-8);
}

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

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-600);
  margin-bottom: var(--space-4);
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
}

.section--ink .eyebrow,
.section--ink .eyebrow::before {
  color: var(--brass-400);
}

.section-head h2 {
  font-size: var(--fs-display-l);
  color: var(--ink-900);
  margin-bottom: var(--space-4);
}

.section--ink .section-head h2 {
  color: var(--text-on-ink);
}

.section-head p {
  font-size: var(--fs-body-l);
  color: var(--text-on-paper-soft);
}

.section--ink .section-head p {
  color: var(--text-on-ink-soft);
}

/* Reveal-on-scroll (controlado por IntersectionObserver en reveal.js).
   Solo se oculta si ese script realmente llegó a ejecutarse: initReveal()
   agrega la clase .reveal-ready a <html> justo antes de activar el
   observer. Si el módulo nunca carga (file://, MIME incorrecto, error de
   red), la clase nunca se agrega y el contenido queda visible por defecto
   en vez de invisible para siempre. */
.reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  will-change: opacity, transform;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- CURSOR CUSTOM (desktop con mouse real, ver cursor.js) ---------- */
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1200;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out), width var(--dur-base) var(--ease-spring),
    height var(--dur-base) var(--ease-spring);
  mix-blend-mode: difference;
}

.cursor-dot {
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: var(--radius-pill);
  background: var(--text-on-ink);
}

.cursor-ring {
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--text-on-ink);
}

.cursor-dot.is-visible,
.cursor-ring.is-visible {
  opacity: 1;
}

.cursor-ring.is-grown {
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-color: var(--brass-400);
}

.has-custom-cursor a,
.has-custom-cursor button,
.has-custom-cursor .btn,
.has-custom-cursor input,
.has-custom-cursor textarea,
.has-custom-cursor select {
  cursor: none;
}

/* ---------- TIPOGRAFÍA KINÉTICA (hero, ver textReveal.js) ---------- */
.kinetic-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.7em) scale(0.92);
  filter: blur(6px);
  transition: opacity var(--dur-slow) var(--ease-out), filter var(--dur-slow) var(--ease-out),
    transform 720ms var(--ease-spring);
  transition-delay: calc(var(--i) * 55ms);
}

[data-kinetic-text].is-revealed .kinetic-word {
  opacity: 1;
  transform: none;
  filter: blur(0);
}

@media (prefers-reduced-motion: reduce) {
  .cursor-dot,
  .cursor-ring {
    display: none;
  }

  .kinetic-word {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@media (max-width: 720px) {
  .section {
    padding-block: var(--space-8);
  }
}
