/* ==========================================================
   TOKENS — Sistema de diseño Empathy Agency
   Tema claro elegante (ivory + blanco), manchas azul marca:
   · Azul Empathy   #0000E2 / Rojo #F40000 / Gris #A5A5A5
   · Fondo crema / Superficies blancas / Tinta #15161f
   Colores en oklch() con fallbacks en hex.
   ========================================================== */

:root {
  /* --- Superficies (fallback hex) --- */
  --bg: #f7f6f2;
  --bg-2: #efeee9;
  --panel: #ffffff;
  --panel-2: #f4f2ec;
  --ink: #15161f;
  --muted: #5b5e6b;
  --muted-2: #858998;

  /* --- Marca --- */
  --brand: #0000e2;
  --brand-bright: #3d6bff;
  --brand-soft: #3f4fb8;
  --brand-pale: #e3e7ff;
  --brand-deep: #0000b3;

  /* --- Acentos --- */
  --red: #d92b24;
  --gray: #a5a5a5;
  --white: #ffffff;

  /* --- Líneas / vidrio --- */
  --line: rgba(21, 22, 31, 0.09);
  --line-strong: rgba(21, 22, 31, 0.16);
  --glass: rgba(255, 255, 255, 0.72);

  /* --- Sombras y brillo --- */
  --glow: 0 0 0 1px rgba(61, 107, 255, 0.25), 0 16px 44px -18px rgba(61, 107, 255, 0.35);
  --shadow: 0 26px 64px -34px rgba(24, 24, 48, 0.35);

  /* --- Formas --- */
  --radius-s: 12px;
  --radius: 20px;
  --radius-l: 28px;
  --radius-full: 999px;

  /* --- Tipografía --- */
  --font-display: "Sora", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-hero: clamp(2.5rem, 5.2vw, 4.4rem);
  --fs-h1: clamp(2.2rem, 4.5vw, 3.6rem);
  --fs-h2: clamp(1.7rem, 3vw, 2.5rem);
  --fs-h3: clamp(1.25rem, 1.8vw, 1.6rem);
  --fs-lead: clamp(1.05rem, 1.4vw, 1.25rem);

  /* --- Layout --- */
  --container: 1240px;
  --gutter: clamp(1.5rem, 4.5vw, 2.5rem);
  --space-section: clamp(3rem, 6vw, 5rem);

  /* --- Scroll driven (rejilla) --- */
  --scroll-progress: 0;

  /* --- Alias (admin / legacy) --- */
  --surface: var(--panel);
  --fg: var(--ink);
  --line-transparent: rgba(21, 22, 31, 0.06);
  --brand-2: var(--brand-bright);
  --r-lg: var(--radius);
}

/* Tokens en oklch (navegadores modernos) */
@supports (color: oklch(0.6 0.2 265)) {
  :root {
    --bg: oklch(0.973 0.006 95);
    --bg-2: oklch(0.95 0.008 90);
    --panel: oklch(1 0 0);
    --panel-2: oklch(0.963 0.008 88);
    --ink: oklch(0.24 0.02 265);
    --muted: oklch(0.48 0.022 265);
    --muted-2: oklch(0.62 0.02 265);

    --brand: oklch(0.47 0.23 272);           /* fiel al logo #0000E2 */
    --brand-bright: oklch(0.59 0.19 270);
    --brand-soft: oklch(0.5 0.14 272);
    --brand-pale: oklch(0.93 0.02 272);
    --brand-deep: oklch(0.4 0.23 272);

    --red: oklch(0.55 0.2 25);
    --gray: oklch(0.73 0 0);
    --white: oklch(1 0 0);

    --line: color-mix(in oklab, var(--ink) 10%, transparent);
    --line-strong: color-mix(in oklab, var(--ink) 16%, transparent);
    --glass: color-mix(in oklab, var(--panel) 74%, transparent);
    --glow: 0 0 0 1px color-mix(in oklab, var(--brand-bright) 26%, transparent),
            0 16px 44px -18px color-mix(in oklab, var(--brand-bright) 38%, transparent);
  }
}

/* ---------------------- Tema oscuro (data-theme="dark") ---------------------- */
html[data-theme="dark"] {
  --bg: #131419;
  --bg-2: #191b22;
  --panel: #1d2028;
  --panel-2: #232733;
  --ink: #eceef4;
  --muted: #a7acbd;
  --muted-2: #7c8396;

  --brand: #5b6cff;
  --brand-bright: #8ea0ff;
  --brand-soft: #aab8ff;
  --brand-pale: #28305c;
  --brand-deep: #3b4cf5;
  --red: #ff5a52;

  --line: rgba(236, 238, 244, 0.1);
  --line-strong: rgba(236, 238, 244, 0.18);
  --glass: rgba(29, 32, 40, 0.72);

  --glow: 0 0 0 1px rgba(142, 160, 255, 0.3), 0 16px 44px -18px rgba(142, 160, 255, 0.32);
  --shadow: 0 26px 64px -34px rgba(0, 0, 0, 0.7);
}

@supports (color: oklch(0.6 0.2 265)) {
  html[data-theme="dark"] {
    --bg: oklch(0.18 0.012 265);
    --bg-2: oklch(0.22 0.014 265);
    --panel: oklch(0.24 0.016 265);
    --panel-2: oklch(0.28 0.018 265);
    --ink: oklch(0.93 0.008 265);
    --muted: oklch(0.72 0.014 265);
    --muted-2: oklch(0.58 0.014 265);

    --brand: oklch(0.66 0.17 272);
    --brand-bright: oklch(0.74 0.14 270);
    --brand-soft: oklch(0.8 0.08 272);
    --brand-pale: oklch(0.32 0.05 272);
    --brand-deep: oklch(0.58 0.17 272);
    --red: oklch(0.7 0.18 25);

    --line: color-mix(in oklab, var(--ink) 12%, transparent);
    --line-strong: color-mix(in oklab, var(--ink) 19%, transparent);
    --glass: color-mix(in oklab, var(--panel) 74%, transparent);
    --glow: 0 0 0 1px color-mix(in oklab, var(--brand-bright) 30%, transparent),
            0 16px 44px -18px color-mix(in oklab, var(--brand-bright) 32%, transparent);
  }
}

/* ------------------------------ Reset ------------------------------ */
@layer base {
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

html[data-scroll="locked"] {
  scroll-behavior: auto;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  min-height: 100dvh;
}

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

img {
  height: auto;
}

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

button {
  font: inherit;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

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

::selection {
  background: var(--brand-bright);
  color: var(--white);
}

:focus-visible {
  outline: 2px solid var(--brand-bright);
  outline-offset: 3px;
  border-radius: 4px;
}

::-webkit-scrollbar {
  width: 11px;
}
::-webkit-scrollbar-track {
  background: var(--bg-2);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--brand), var(--brand-deep));
  border-radius: 8px;
  border: 2px solid var(--bg-2);
}

/* --------------------------- Tipografía --------------------------- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.display {
  font-size: var(--fs-hero);
  line-height: 1.03;
}
.h1 { font-size: var(--fs-h1); }
.h2 { font-size: var(--fs-h2); }
.h3 { font-size: var(--fs-h3); }

.lead {
  font-size: var(--fs-lead);
  color: var(--muted);
  line-height: 1.7;
}

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.text-gradient {
  background: linear-gradient(100deg, var(--brand-soft) 5%, var(--brand-bright) 50%, var(--brand) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-soft);
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand-bright), transparent);
}

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

.section {
  position: relative;
}

.section-head {
  max-width: 780px;
  margin-bottom: clamp(1.8rem, 3.5vw, 2.8rem);
}
.section-head.center {
  margin-inline: auto;
  text-align: center;
}
.section-head.center .eyebrow {
  justify-content: center;
}
.section-head.center .eyebrow::before {
  display: none;
}
.section-head h2 { margin-top: 1.1rem; }
.section-head .lead {
  margin-top: 1.2rem;
}

.grid {
  display: grid;
  gap: clamp(1.1rem, 2.2vw, 1.8rem);
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .display { line-height: 1.08; }
}

/* ----------------------------- Botones ----------------------------- */
.btn {
  --y: 0px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s, color 0.25s, border-color 0.25s;
  position: relative;
  transform: translateY(var(--y));
  will-change: transform;
}

:root { --ease: cubic-bezier(0.22, 1, 0.36, 1); }

.btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s var(--ease);
}

.btn:hover {
  --y: -2px;
}

.btn-primary {
  background: linear-gradient(120deg, var(--brand-bright), var(--brand) 70%);
  color: var(--white);
  box-shadow: 0 12px 34px -12px rgba(61, 107, 255, 0.7);
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
}
.btn-primary:hover::after { transform: translateX(120%); }
.btn-primary:hover { box-shadow: 0 16px 46px -12px rgba(61, 107, 255, 0.85); }

.btn-ghost {
  border-color: var(--line-strong);
  background: var(--glass);
  color: var(--ink);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover {
  border-color: var(--brand-bright);
  box-shadow: var(--glow);
}

.btn-light {
  background: var(--white);
  color: var(--brand-deep);
}
.btn-light:hover { box-shadow: 0 14px 40px -12px rgba(0, 0, 0, 0.55); }

.btn-block { width: 100%; }

.btn-danger {
  background: linear-gradient(120deg, oklch(0.58 0.2 25), oklch(0.48 0.22 25) 70%);
  color: #fff;
  box-shadow: 0 12px 30px -14px oklch(0.5 0.2 25 / 0.8);
}
.btn-danger:hover { box-shadow: 0 14px 38px -12px oklch(0.5 0.2 25 / 0.9); }

.btn[data-size="sm"] {
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
}

.btn[data-size="lg"] {
  padding: 1.05rem 2.1rem;
  font-size: 1.02rem;
}

/* --------- Páginas interiores (header de página) --------- */
.hero-page {
  position: relative;
  padding: clamp(7rem, 14vh, 9.5rem) var(--gutter) 4rem;
  text-align: center;
  overflow: hidden;
}
.hero-page::before {
  content: "";
  position: absolute;
  inset: var(--gutter);
  inset-block-end: 0;
  background:
    radial-gradient(720px 300px at 50% -30%, color-mix(in oklab, var(--brand-bright) 22%, transparent), transparent 70%),
    linear-gradient(180deg, transparent, var(--bg) 92%);
  pointer-events: none;
}
.hero-page .container { position: relative; }
.hero-page .eyebrow { justify-content: center; }
.hero-page .display {
  max-width: 20ch;
  margin-inline: auto;
  font-size: clamp(2.1rem, 5.6vw, 3.9rem);
}
.hero-page .lead {
  max-width: 56ch;
  margin: 1.1rem auto 0;
  color: var(--muted);
}
.hero-page--sm { padding-block-end: 2.2rem; }

/* ------------------------------ Chips ------------------------------ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  background: var(--glass);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  backdrop-filter: blur(6px);
}
.chip b { color: var(--ink); }

/* ---------------------------- Formularios --------------------------- */
.field {
  position: relative;
  margin-bottom: 1.1rem;
}

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.45rem;
  letter-spacing: 0.01em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.85rem 1.05rem;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field textarea { min-height: 130px; resize: vertical; }
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237f96ff' stroke-width='2.4'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.6rem;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand-bright);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--brand-bright) 22%, transparent);
  background: var(--panel-2);
}

.field input::placeholder,
.field textarea::placeholder { color: var(--muted-2); }

/* Errores de validación */
.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--red);
}
.field .f-error {
  display: none;
  font-size: 0.78rem;
  color: oklch(0.72 0.18 25);
  margin-top: 0.4rem;
}
.field.has-error .f-error { display: block; }

/* Honeypot oculto a humanos */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
  height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none;
}

/* Checkbox de consentimiento */
.checkline {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 1.3rem;
}
.checkline input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-bright);
  margin-top: 2px;
  flex: none;
}
.checkline a { color: var(--brand-soft); text-decoration: underline; }

/* --------------------------- Alerts (flash) -------------------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius-s);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  font-size: 0.92rem;
  margin-bottom: 1.4rem;
}
.alert-ok {
  border-color: color-mix(in oklab, #22c55e 45%, transparent);
  background: color-mix(in oklab, #22c55e 12%, var(--panel));
}
.alert-error {
  border-color: color-mix(in oklab, var(--red) 45%, transparent);
  background: color-mix(in oklab, var(--red) 12%, var(--panel));
  color: oklch(0.82 0.14 25);
}
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert ul { margin: 0.3rem 0 0 1.1rem; list-style: disc; }

/* ------------------------- Accesibilidad ---------------------------- */
@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;
  }
}