/* ==========================================================================
   Quantuk Perú — base.css
   Design tokens, reset and typography.
   Source of truth for every color, size and motion value in the site.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand — sampled from the corporate logo.
     Change --brand-red here and the whole site follows. */
  --brand-red: #ed1c24;
  --brand-red-dark: #c7141b;
  --brand-red-darker: #a10f15;
  --brand-red-soft: #fff1f1;
  --brand-graphite: #3d3d3d;

  /* Neutrals */
  --ink-900: #0e0e10;
  --ink-800: #17171a;
  --ink-700: #202024;
  --ink-600: #2c2c32;
  --slate-700: #414852;
  --slate-600: #5a616b;
  --slate-500: #737b85;
  --slate-400: #9aa1a9;
  --line: #e3e6ea;
  --line-strong: #ccd2d9;
  --surface: #f6f7f9;
  --surface-2: #eef0f3;
  --white: #ffffff;

  /* Semantic roles */
  --bg: var(--white);
  --bg-alt: var(--surface);
  --bg-dark: var(--ink-900);
  --text: var(--ink-800);
  --text-muted: var(--slate-600);
  --text-on-dark: rgba(255, 255, 255, 0.82);
  --primary: var(--brand-red);
  --on-primary: var(--white);
  --border: var(--line);
  --focus-ring: var(--brand-red);
  --danger: #d92d20;
  --success: #12805c;

  /* Typography */
  --font-heading: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Fluid type scale — 1.25 minor third, clamped for mobile safety */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: clamp(1.0625rem, 1.03rem + 0.17vw, 1.125rem);
  --text-lg: clamp(1.1875rem, 1.13rem + 0.3vw, 1.375rem);
  --text-xl: clamp(1.5rem, 1.38rem + 0.6vw, 1.875rem);
  --text-2xl: clamp(1.875rem, 1.65rem + 1.1vw, 2.625rem);
  --text-3xl: clamp(2.25rem, 1.85rem + 2vw, 3.75rem);
  --text-4xl: clamp(2.625rem, 1.9rem + 3.2vw, 4.5rem);

  /* Spacing — 4/8 rhythm */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  --space-3xl: 5.5rem;
  --space-4xl: 7.5rem;

  /* Section rhythm */
  --section-y: clamp(3.5rem, 2rem + 6vw, 7rem);

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --radius-pill: 999px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(14, 14, 16, 0.06), 0 1px 3px rgba(14, 14, 16, 0.08);
  --shadow-md: 0 8px 24px rgba(14, 14, 16, 0.1);
  --shadow-lg: 0 24px 60px rgba(14, 14, 16, 0.16);
  --shadow-red: 0 12px 30px rgba(237, 28, 36, 0.28);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 180ms;
  --dur-base: 280ms;
  --dur-slow: 420ms;
  --dur-reveal: 700ms;

  /* Layout */
  --container: 1240px;
  --container-narrow: 880px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --topbar-h: 76px;
  --navbar-h: 62px;

  /* Layering scale — never invent z-index outside this list */
  --z-base: 1;
  --z-raised: 10;
  --z-sticky: 50;
  --z-header: 100;
  --z-drawer: 200;
  --z-modal: 300;
  --z-toast: 400;
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Offset for anchor targets so the fixed header never covers a heading */
  scroll-padding-top: calc(var(--navbar-h) + var(--space-lg));
}

body {
  min-height: 100dvh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.is-locked {
  overflow: hidden;
}

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

img {
  height: auto;
}

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

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

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

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

table {
  border-collapse: collapse;
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: var(--ink-900);
}

h1 {
  font-size: var(--text-3xl);
}

h2 {
  font-size: var(--text-2xl);
}

h3 {
  font-size: var(--text-xl);
}

h4 {
  font-size: var(--text-lg);
  line-height: 1.3;
}

p {
  text-wrap: pretty;
  max-width: 68ch;
}

strong {
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   4. Accessibility helpers
   -------------------------------------------------------------------------- */
:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* Evita que una referencia legal se parta al final de la línea:
   "Ley N." en un renglón y "° 29571" en el siguiente se lee mal. */
.nowrap {
  white-space: nowrap;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Keyboard-only shortcut to jump past the header into the content */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-sm);
  z-index: var(--z-toast);
  padding: var(--space-xs) var(--space-md);
  background-color: var(--brand-red);
  color: var(--white);
  font-family: var(--font-heading);
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: top var(--dur-fast) var(--ease-out);
}

.skip-link:focus {
  top: 0;
}

/* --------------------------------------------------------------------------
   5. Reduced motion
   Honour the OS setting: keep meaning, drop the movement.
   -------------------------------------------------------------------------- */
@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;
  }
}

/* --------------------------------------------------------------------------
   6. Print
   -------------------------------------------------------------------------- */
@media print {
  .site-header,
  .site-footer,
  .hero__controls,
  .quote-modal,
  .scroll-progress {
    display: none !important;
  }

  body {
    color: #000;
  }
}
