/* ============================================================
   Incode website — base layer
   Reset, typography, shared design-system classes, keyframes,
   and the data-attribute behavior states used by /js/site.js.
   Breakpoints (match Tailwind, used across all stylesheets):
     sm 640px · md 768px · lg 1024px · xl 1280px
   ============================================================ */

/* ---------- Reset (lite) ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
img, video, svg { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
ul[class], ol[class] { list-style: none; padding: 0; }
/* the [hidden] + .is-open contract every siteModal root (and every
   JS hidden-toggle) assumes: the attribute always wins, even against
   author display rules like a modal root's display:flex — without this
   a "closed" lightbox stays a full-viewport, opacity-0, z-200 overlay
   swallowing every click (ghost-overlay bug, GovFaceMatch hero video,
   2026-08-05). The per-component `X[hidden]` band-aids scattered in
   page CSS are now redundant but harmless. */
[hidden] { display: none !important; }

/* ---------- Document ---------- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 4rem;
}

body {
  background: var(--color-background);
  color: var(--color-foreground);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--leading-snug);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

::selection {
  background: var(--color-blue);
  color: var(--color-grey-50);
}

/* ---------- Typography ---------- */
.font-display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: var(--track-tighter);
}

.font-display-regular {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: var(--track-tighter);
}

.text-balance { text-wrap: balance; }
.tabular-nums { font-variant-numeric: tabular-nums; }

/* No widow words anywhere: running text reflows so the last line never
   carries a single word; multi-line headings stay balanced. */
p, li, dt, dd, blockquote, figcaption { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; }

/* Page heading */
.page-heading {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: var(--track-tighter);
  font-size: 36px;
  line-height: 1.05;
  text-wrap: balance;
  color: var(--color-black);
}
.page-heading--dark { color: var(--color-white); }
@media (min-width: 640px) { .page-heading { font-size: 48px; } }
@media (min-width: 768px) { .page-heading { font-size: 56px; } }

/* ---------- Layout: section + container ---------- */
.section {
  position: relative;
  width: 100%;
  background: var(--color-background);
  color: var(--color-foreground);
}
.section--dark,
.section--rich {
  background: var(--color-black);
  color: var(--color-white);
}
.section__inner {
  margin-inline: auto;
  max-width: var(--container-large);
  padding: 48px 20px;
}
@media (min-width: 640px) { .section__inner { padding-block: var(--space-section-sm); } }
@media (min-width: 768px) { .section__inner { padding-block: var(--space-section-md); } }
@media (min-width: 1024px) { .section__inner { padding-inline: 24px; } }

.container {
  margin-inline: auto;
  max-width: var(--container-large);
  padding-inline: 20px;
}
@media (min-width: 1024px) { .container { padding-inline: 24px; } }

/* ---------- Eyebrow (de-pilled 2026-08-17: pills are retired site-wide,
   kickers are plain text; still consumed by the legacy /lp/ mirrors) ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-kicker);
  font-weight: 500;
  color: var(--color-blue);
}
.eyebrow--dark {
  color: var(--color-blue-200);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  /* a button label never wraps to a second line (Sofia, 2026-07-24) —
     inherits into nested label spans too */
  white-space: nowrap;
  border-radius: var(--radius-md);
  font-weight: 500;
  padding: 10px 20px;
  font-size: var(--fs-body);
  transition: color .2s, background-color .2s, border-color .2s;
}
.btn--sm { padding: 8px 12px; font-size: var(--fs-xs); }
/* primary: solid blue at rest; hovering slides a blue → ink gradient
   through the plate (background-position only, one buttery eased move —
   the window shows pure blue at 0% and the full blend at 100%) */
.btn--primary {
  /* flat fallback under the gradient image: static contrast checkers can't
     resolve background-image (a11y, 2026-07-29) */
  background-color: var(--color-blue);
  background-image: linear-gradient(115deg, var(--color-blue) 0%, var(--color-blue) 48%, var(--color-black) 100%);
  background-size: 230% 100%;
  background-position: 0% 0;
  color: var(--color-white);
  transition: color .2s, border-color .2s, background-position .5s var(--ease-out-expo);
}
.btn--primary:hover { background-position: 100% 0; }
.btn--secondary {
  background: var(--color-background);
  color: var(--color-foreground);
  border: 1px solid var(--color-border-light);
}
.btn--secondary:hover { border-color: rgba(0, 106, 255, 0.4); color: var(--color-blue); }
.btn--ghost { color: var(--color-foreground); }
.btn--ghost:hover { color: var(--color-blue); }
.btn--outline-white {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: var(--color-white);
}
.btn--outline-white:hover { background: rgba(255, 255, 255, 0.10); border-color: rgba(255, 255, 255, 0.55); }
/* white + ghost-dark: the canonical buttons on dark grounds (2026-07-25
   system pass) — replaces every per-page *-btn-white / *-btn-ghost copy
   (pr-, uc-, cap-, tech-, ph-, pp-…). Use <Button variant="white"> /
   <Button variant="ghost-dark">. */
.btn--white {
  height: 44px;
  padding-inline: 24px;
  border-radius: var(--radius-lg);
  background: var(--color-white);
  color: var(--color-black);
}
.btn--white:hover { background: rgba(255, 255, 255, 0.9); }
.btn--ghost-dark {
  height: 44px;
  padding-inline: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: var(--color-white);
}
.btn--ghost-dark:hover { border-color: rgba(255, 255, 255, 0.5); }

/* ---------- Stat number fills (Sofia, 2026-07-26 · white-on-dark 2026-07-27) ----------
   Big display numbers: Incode Blue → black gradient on bright grounds;
   on ink they are ALWAYS solid white — never blue, never a gradient.
   The page class keeps size, weight and tracking; these own only the fill. */
.stat-grad {
  background-image: linear-gradient(105deg, var(--color-blue) 12%, var(--color-black) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-on-dark {
  color: var(--color-white);
}

/* ---------- System primitives (2026-07-25 consistent-system pass) ----------
   The shared vocabulary every page template consumes instead of
   re-declaring its own. See docs/CONVENTIONS.md § Consistent system.
   Per-page copies (pr-label, cap-kicker, tech-title, uc-inner, …) are
   being migrated onto these; new pages use these directly. */

/* kicker: the tracked line above section titles. Plain text, never a
   pill, sentence case (Sofia). */
.kicker {
  font-family: var(--font-sans);
  font-size: var(--fs-kicker);
  letter-spacing: 0;
  color: var(--color-kicker-on-white);
}
.kicker--on-dark { color: rgba(255, 255, 255, 0.5); }

/* section title: the shared 26/32/36 display ramp. */
.section-title {
  margin-top: 16px;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  font-size: 26px;
  line-height: 1.05;
  color: var(--color-black);
}
@media (min-width: 640px) { .section-title { font-size: 32px; } }
@media (min-width: 768px) { .section-title { font-size: 36px; } }
.section-title--on-dark { color: var(--color-white); }

/* section shell: one container, one gutter. 24px desktop inline padding is
   THE site gutter (matches the nav/container decision from the tight-margins
   pass) — pages still on 32px migrate here. */
.section-inner {
  margin-inline: auto;
  width: 100%;
  max-width: var(--container-large);
  padding: 64px 20px;
}
@media (min-width: 768px) { .section-inner { padding-block: 96px; } }
@media (min-width: 1024px) { .section-inner { padding-inline: 24px; } }

/* ---------- DS icon ----------
   Usage: <span class="ds-icon" style="--icon:url(/icons/lock.svg)"></span>
   Color comes from background-color (set via a class or inline). */
.ds-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask-image: var(--icon);
  mask-image: var(--icon);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* ---------- Decorative backgrounds (globals.css) ---------- */
.glow-blue {
  background: radial-gradient(closest-side, rgba(0, 106, 255, 0.45), rgba(0, 106, 255, 0));
}
.bg-hero-glow {
  background-image:
    radial-gradient(1200px 600px at 50% -10%, rgba(0, 106, 255, 0.22), transparent 60%),
    radial-gradient(800px 400px at 50% 110%, rgba(0, 106, 255, 0.18), transparent 60%);
}
.bg-age-hero {
  background-color: var(--color-black);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(80, 120, 200, 0.18) 1px, transparent 0),
    radial-gradient(ellipse 65% 65% at -8% 95%, rgba(0, 60, 230, 0.65) 0%, transparent 60%),
    radial-gradient(ellipse 45% 50% at 108% 5%, rgba(0, 40, 180, 0.35) 0%, transparent 55%);
  background-size: 26px 26px, 100% 100%, 100% 100%;
}
.bg-problem-glow {
  background-image:
    radial-gradient(900px 500px at 0% 50%, rgba(0, 106, 255, 0.18), transparent 65%),
    radial-gradient(900px 500px at 100% 50%, rgba(0, 106, 255, 0.18), transparent 65%);
}

.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.no-scrollbar::-webkit-scrollbar { display: none; width: 0; height: 0; }

.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;
}

/* ---------- Keyframes (globals.css @theme) ---------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes hero-gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@keyframes pulse-glow {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.08); }
}
@keyframes hero-drift {
  0%, 100% { transform: scale(1.06) translate(0%, 0%); }
  33% { transform: scale(1.09) translate(-1.2%, 0.6%); }
  66% { transform: scale(1.07) translate(1%, -0.6%); }
}
@keyframes aurora-1 {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  33% { transform: translate(-56%, -44%) scale(1.12); }
  66% { transform: translate(-46%, -54%) scale(1.06); }
}
@keyframes aurora-2 {
  0%, 100% { transform: translate(0%, 0%) scale(1); }
  50% { transform: translate(8%, -8%) scale(1.15); }
}
@keyframes aurora-3 {
  0%, 100% { transform: translate(0%, 0%) scale(0.95); }
  50% { transform: translate(-10%, 6%) scale(1.1); }
}
@keyframes aurora-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes aurora-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.85; }
}
@keyframes loading-dot {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

.animate-marquee { animation: marquee 40s linear infinite; }
.animate-pulse-glow { animation: pulse-glow 3s ease-in-out infinite; }
.animate-hero-drift { animation: hero-drift 24s ease-in-out infinite; }
.animate-hero-gradient { animation: hero-gradient 14s ease-in-out infinite; }

/* ---------- Behavior states (contracts with /js/site.js) ---------- */

/* Scroll reveal: add data-reveal to any element.
   Optional: data-reveal-delay="0.15" (seconds), data-reveal-y="24" (px via --reveal-y). */
[data-reveal] {
  opacity: 0;
  transform: translateY(var(--reveal-y, 16px));
  transition:
    opacity var(--reveal-duration) var(--ease-out-expo),
    transform var(--reveal-duration) var(--ease-out-expo);
  transition-delay: var(--reveal-delay, 0s);
}
[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* Tabs: [data-tabs] > buttons[data-tab=key] + [data-tab-panel=key] */
[data-tab-panel] { display: none; }
[data-tab-panel].is-active { display: block; animation: fadeIn .3s var(--ease-out-expo); }

/* Reduced motion: show everything, stop decoration */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .animate-marquee, .animate-pulse-glow, .animate-hero-drift, .animate-hero-gradient {
    animation: none;
  }
}

/* The page never pans sideways (Sofia, 2026-08-07: horizontal drift on
   phones read wonky) — anything overflowing the viewport is clipped.
   clip, not hidden: it doesn't create a scroll container, so sticky
   chrome keeps working. */
html,
body {
  overflow-x: clip;
}

/* ---------- Cross-document page transitions (Sofia, 2026-08-06) ----------
   A plain fade between pages instead of the hard swap. The persistent
   chrome — highlights ticker, header, footer, and the platform sidebar
   (capability.css names .cap-rail) — carries its own named group, so it
   holds still while the content crossfades: no more nav jump. Progressive:
   browsers without cross-document view transitions keep the instant swap
   and the .page-enter rise (suppressed below where transitions run, per
   "just a fade out fade in"). */
@view-transition {
  navigation: auto;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.25s;
  animation-timing-function: ease;
}
.x3-ticker { view-transition-name: site-ticker; }
.c-header { view-transition-name: site-header; }
.c-footer { view-transition-name: site-footer; }
@supports (view-transition-name: none) {
  /* main. — outranks site-loader.css's .page-enter, which loads later */
  main.page-enter { animation: none; }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* counters never jitter in width while settling (Sofia, 2026-08-13) */
[data-counter] { font-variant-numeric: tabular-nums; }

/* ---- mobile pairing for section-walk step decks (global) ----
   On narrow viewports section-walk.js can't scroll-walk a how-it-works deck,
   so it clones each step's screen into a .sw-shot under that step's text and
   marks the section .is-paired — the section then reads text -> visual ->
   text -> visual, and the shared crossfade stage hides. Lives in base (global)
   because the affected sections are page-specific (.iv-how / .ri-console /
   .frx-* / .ocr-how), so the hooks can't be scoped under one .p-{slug}.
   (Nacim, 2026-08-18: "texto imagen texto imagen ... en todas las páginas") */
@media (max-width: 1023px) {
  /* !important: some pages scope a higher-specificity display on their stage
     (e.g. .p-keytech-face-recognition .frx-ss .sol-how__stage) that would
     otherwise keep the now-cloned shared stage visible below the steps */
  .is-paired .sol-how__stage { display: none !important; }
  /* open every step's description — no accordion when each has its own visual */
  .is-paired .sol-how__reveal {
    height: auto !important;
    grid-template-rows: 1fr !important;
  }
  .is-paired .sol-how__line { opacity: 1 !important; }
  .is-paired .sw-shot { padding: 8px 0 28px; }
  .is-paired .sw-shot > * { margin-inline: auto; }
}
/* safety: a clone built while narrow must never show once back on desktop */
@media (min-width: 1024px) {
  .sw-shot { display: none; }
}
