/* FitPal base: reset, typography, layout primitives and shared components.
   Page-specific styles live in their own files (landing.css, quiz.css, ...). */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, svg, video, picture { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul[role='list'], ol[role='list'] { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
  overflow-wrap: break-word;
}
p { text-wrap: pretty; }

:focus-visible {
  outline: 2px solid var(--volt);
  outline-offset: 3px;
  border-radius: 6px;
}
::selection { background: var(--volt); color: var(--volt-ink); }

/* ---------- Layout ---------- */
.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.container-narrow { width: min(100% - 2 * var(--gutter), var(--container-narrow)); margin-inline: auto; }
.section { position: relative; padding-block: var(--section-y); }

/* ---------- Type ---------- */
.display {
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-display);
  font-weight: 750;
}
.h1 { font-size: var(--fs-3xl); line-height: 1.04; letter-spacing: var(--tracking-display); font-weight: 750; }
.h2 { font-size: var(--fs-2xl); line-height: 1.08; letter-spacing: -0.04em; font-weight: 720; }
.h3 { font-size: var(--fs-xl); line-height: 1.2; letter-spacing: -0.025em; font-weight: 650; }
.lead { font-size: var(--fs-lg); line-height: 1.5; color: var(--text-2); }
.muted { color: var(--text-3); }
.text-volt { color: var(--volt); }
.text-grad {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-font { font-family: var(--font-brand); letter-spacing: -0.02em; }
.num { font-variant-numeric: tabular-nums; }

/* Mono micro-label with a glowing dot: "● METODO" */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--text-3);
}
.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--volt);
  box-shadow: 0 0 12px var(--volt-glow);
  flex: none;
}
.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
}

/* ---------- Buttons ---------- */
.btn {
  --btn-h: 52px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: var(--btn-h);
  padding: 0 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--dur-2) var(--ease-out),
    background-color var(--dur-2) ease,
    border-color var(--dur-2) ease,
    box-shadow var(--dur-3) var(--ease-out),
    color var(--dur-2) ease;
}
.btn:active { transform: translateY(1px) scale(0.985); }
.btn[disabled], .btn[aria-disabled='true'] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn .arrow { flex: none; transition: transform var(--dur-2) var(--ease-out); }

.btn-primary {
  background: var(--volt);
  color: var(--volt-ink);
  box-shadow: 0 0 0 1px rgba(255, 106, 43, 0.5) inset, var(--shadow-volt);
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line-2);
  color: var(--text);
}

/* Hover only where a real pointer hovers: on touch screens :hover sticks after a tap. */
@media (hover: hover) {
  .btn:hover .arrow { transform: translateX(3px); }
  .btn-primary:hover {
    background: var(--volt-2);
    transform: translateY(-1px);
    box-shadow: 0 0 0 1px rgba(228, 255, 134, 0.6) inset, 0 18px 50px -12px var(--volt-glow);
  }
  .btn-ghost:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--line-3); }
  .input:hover { border-color: var(--line-3); }
}
.btn-sm { --btn-h: 40px; padding: 0 1rem; font-size: 0.9375rem; }
.btn-lg { --btn-h: 60px; padding: 0 2rem; font-size: 1.0625rem; }
.btn-block { width: 100%; }

/* ---------- Surfaces ---------- */
.card {
  position: relative;
  background: var(--grad-surface), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
/* 1px gradient border via mask; put on a positioned element */
.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: var(--grad-border);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.glass {
  background: rgba(19, 16, 17, 0.58);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--line-2);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 32px;
  padding: 0 0.875rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.03);
  font-size: var(--fs-sm);
  color: var(--text-2);
}

/* Film grain overlay: add class="grain" to a positioned container */
.grain::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  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='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Forms ---------- */
.field { display: grid; gap: 0.5rem; }
.label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); }
.input {
  width: 100%;
  min-height: 56px;
  padding: 0 1.125rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.035);
  font-size: 1.0625rem;
  color: var(--text);
  transition: border-color var(--dur-2) ease, background-color var(--dur-2) ease, box-shadow var(--dur-2) ease;
}
.input::placeholder { color: var(--text-4); }
.input:focus { outline: none; border-color: var(--volt); background: rgba(255, 106, 43, 0.04); box-shadow: 0 0 0 4px rgba(255, 106, 43, 0.12); }
.input[aria-invalid='true'] { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(255, 100, 100, 0.12); }
.field-error { font-size: var(--fs-sm); color: var(--danger); min-height: 1.25em; }

/* ---------- Accessibility ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: var(--z-toast);
  padding: 0.75rem 1rem;
  border-radius: var(--r-sm);
  background: var(--volt);
  color: var(--volt-ink);
  font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* ---------- Scroll reveal (driven by boot.js) ----------
   Add data-reveal to any element; stagger with style="--reveal-delay: 120ms".
   Variants: data-reveal="fade" | "scale" | "left" | "right" (default: rise). */
html.reveal [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition:
    opacity var(--dur-4) var(--ease-out),
    transform var(--dur-4) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
html.reveal [data-reveal='fade'] { transform: none; }
html.reveal [data-reveal='scale'] { transform: scale(0.96); }
html.reveal [data-reveal='left'] { transform: translate3d(-32px, 0, 0); }
html.reveal [data-reveal='right'] { transform: translate3d(32px, 0, 0); }
html.reveal [data-reveal].is-visible { opacity: 1; transform: none; }

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