/* ─────────────────────────────────────────
   Tuinbit · Base & Reset
   ───────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Sin rebote elástico en los extremos. Al llegar al final en el móvil, el
   navegador seguía tirando de la página y bajo el pie oscuro asomaba el
   crema del body: parecía que la web continuaba vacía. */
html, body { overscroll-behavior-y: none; }

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: auto; /* Lenis handles smooth scroll */
}

/* El cursor propio solo se esconde donde de verdad hay uno dibujado (la home
   monta #cursor desde main.js). Las páginas internas y la landing no cargan
   ese script, así que se quedaban sin ningún cursor visible. */
html:has(#cursor) { cursor: none; }

@media (pointer: coarse) {
  html { cursor: auto; }
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--paper);
  /* clip, not hidden: overflow-x:hidden here would turn body into a scroll
     container and silently break position:sticky for every descendant (e.g.
     the "Así se hace" pinned product tour). clip avoids that side effect. */
  overflow-x: clip;
}

/* The journey through the universe: every element that reads a design token
   eases into its new color as the page's --ink/--paper/--veil shift with scroll. */
body, .section, p, h1, h2, h3, h4, a, span, li, svg, .btn,
.saas-window, .servicio__item, .disciplinas__item, .problema__card {
  transition: color 0.5s ease, background-color 0.5s ease, border-color 0.5s ease, fill 0.4s ease, stroke 0.4s ease;
}

/* Skip link */
.skip-link {
  position: fixed;
  top: -100%;
  left: var(--gutter);
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: top var(--dur-xs) var(--ease-out);
}
.skip-link:focus {
  top: var(--s-2);
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: var(--lh-headline);
  letter-spacing: var(--ls-tight);
}

p { max-width: var(--measure); }

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

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

button, input, textarea {
  font-family: inherit;
  font-size: inherit;
}

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

ul, ol { list-style: none; }

/* Section label (Space Mono) */
.section-label {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: var(--ls-wide);
  color: var(--ink-40);
  text-transform: none;
  display: block;
  margin-bottom: var(--s-2);
}

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

/* Section base */
.section {
  position: relative;
  z-index: var(--z-content);
  padding-block: var(--s-6);
  background: var(--veil);
}

/* El fondo del hero lo fija system.css: es una zona persona, opaca, y tapa
   el campo de estrellas. Antes iba transparente porque el lienzo pintaba
   crema a esa altura del scroll; ahora el lienzo es siempre espacio
   profundo y dejarlo pasar volvería el hero ilegible. */

/* §10 sin riesgo: by the time scroll reaches here the journey's darkness is already
   at its peak (canvas ≈ black), so we let the animated --veil show through instead of
   a flat static color — that's what makes the galaxy actually visible at the climax. */
#sin-riesgo {
  background: var(--veil);
}

/* Button styles */
.btn {
  display: inline-block;
  padding: 0.875rem 2rem;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  background: var(--paper);
  position: relative;
  overflow: hidden;
  transition: color var(--dur-xs) var(--ease-out);
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform-origin: bottom left;
  transform: scaleX(0);
  transition: transform var(--dur-sm) var(--ease-out);
}

.btn:hover::before,
.btn:focus-visible::before {
  transform: scaleX(1);
}

.btn:hover,
.btn:focus-visible {
  color: var(--paper);
}

.btn span { position: relative; z-index: 1; }

.btn--primary {
  background: var(--ink);
  color: var(--paper);
}
.btn--primary::before {
  background: var(--paper);
}
.btn--primary:hover,
.btn--primary:focus-visible {
  color: var(--ink);
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* Visually hidden (accessible) */
.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;
}

/* Noise overlay */
.noise-overlay {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  opacity: 0.12;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  animation: noise-drift 0.4s steps(2) infinite;
  /* El grano salta moviendo la capa, no el fondo: animar background-position
     repinta la pantalla entera en el hilo principal veinte veces por segundo;
     transform lo hace el compositor. La capa sobra una tesela (160px) por
     cada lado, así que el dibujo cae exactamente donde caía y al
     desplazarla no asoma ningún borde. */
  inset: -160px;
}

@keyframes noise-drift {
  0%   { transform: translate3d(0, 0, 0); }
  25%  { transform: translate3d(90px, 45px, 0); }
  50%  { transform: translate3d(45px, 90px, 0); }
  75%  { transform: translate3d(135px, 60px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .noise-overlay { animation: none; }
}

/* Reduced motion overrides */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
