/*
 * base.css — reset + @font-face + body/headings defaults
 *
 * Todo va dentro de @layer reset o @layer theme. Asi gana al Kit Elementor
 * (que vive en la capa implicita anonima, mas baja por especificacion CSS).
 */

/* ─── @font-face SELF-HOSTED ───────────────────────────────────────────── */

/* Merriweather — headings (serif). Variable woff2, self-hosted (OFL 1.1). */
@font-face {
  font-family: 'Merriweather';
  src: url('../fonts/Merriweather-VariableFont.woff2') format('woff2-variations'),
       url('../fonts/Merriweather-VariableFont.woff2') format('woff2');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Merriweather';
  src: url('../fonts/Merriweather-VariableFont-latin-ext.woff2') format('woff2-variations'),
       url('../fonts/Merriweather-VariableFont-latin-ext.woff2') format('woff2');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Merriweather';
  src: url('../fonts/Merriweather-Italic-VariableFont.woff2') format('woff2-variations'),
       url('../fonts/Merriweather-Italic-VariableFont.woff2') format('woff2');
  font-weight: 300 900;
  font-style: italic;
  font-display: swap;
}

/* Overpass — body (sans). Variable woff2, self-hosted (OFL 1.1). */
@font-face {
  font-family: 'Overpass';
  src: url('../fonts/Overpass-VariableFont.woff2') format('woff2-variations'),
       url('../fonts/Overpass-VariableFont.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Overpass';
  src: url('../fonts/Overpass-VariableFont-latin-ext.woff2') format('woff2-variations'),
       url('../fonts/Overpass-VariableFont-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Overpass';
  src: url('../fonts/Overpass-Italic-VariableFont.woff2') format('woff2-variations'),
       url('../fonts/Overpass-Italic-VariableFont.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* ─── @layer reset ──────────────────────────────────────────────────────── */

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

  html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    font-weight: var(--fw-regular);
    line-height: var(--lh-normal);
    color: var(--color-dark);
    background-color: var(--color-cream);
  }

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

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

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

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

/* ─── @layer theme ──────────────────────────────────────────────────────── */

@layer theme {
  body {
    font-family: var(--font-sans);
    color: var(--color-dark);
    background-color: var(--color-cream);
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    font-weight: var(--fw-regular);
    line-height: var(--lh-tight);
    letter-spacing: var(--ls-tight);
    color: var(--color-dark);
    margin: 0 0 var(--space-4);
  }

  h1 { font-size: var(--fs-6xl); }
  h2 { font-size: var(--fs-5xl); }
  h3 { font-size: var(--fs-4xl); }
  h4 { font-size: var(--fs-3xl); }
  h5 { font-size: var(--fs-2xl); }
  h6 { font-size: var(--fs-xl); }

  p {
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: var(--lh-relaxed);
    color: var(--color-body);
    margin: 0 0 var(--space-4);
  }

  a {
    color: var(--color-gold-ink); /* a11y: #a87410 = 4.61:1 on cream — WCAG AA. --color-gold (#D99E39) = 2.36:1 (FAIL). */
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease-out-soft);
  }

  a:hover,
  a:focus-visible {
    color: var(--color-gold-dark);
  }

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

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
}

/* ─── UNLAYERED foundations (body + headings) ──────────────────────────────
 *
 * ROOT-CAUSE FIX (Fase 2 foundations — AC-R1.*, AC-R2.*):
 * The body/heading defaults above live inside @layer reset/theme. Cascade
 * layers ALWAYS lose against unlayered rules of equal specificity, so on
 * Elementor/GeneratePress pages the body font-family fell back to the system
 * stack (GP's unlayered `body { font-family: ... }` won).
 *
 * The theme already resolves this for components with the `body.scc-fase0`
 * pattern (specificity 0,2,0, UNLAYERED). We apply the SAME pattern to the
 * body/heading foundations so they win site-wide WITHOUT raising enqueue
 * priority or using aggressive !important. Elementor keeps winning wherever
 * it sets its OWN element styles (higher specificity), as intended.
 */
body.scc-fase0 {
  font-family: var(--font-body);
  /* Body copy uses the readable ink token (#2b2b2b), NOT --color-dark (#000
   * pure black, reserved for hero/proto parity). Headings keep --color-dark. */
  color: var(--color-ink);
  background-color: var(--color-cream);
}

/* ─── Content link color (Fase 2 foundations — AC-R5) ──────────────────────
 *
 * Default <a> elements without their own component class inherit the browser
 * UA blue (rgb(30,115,190)), which is outside the palette. Reset inline
 * content links to the WCAG-AA gold-ink token (#a87410 on cream = 4.6:1).
 * Low specificity (0,2,0) so component links (buttons, nav, cards) that carry
 * their own class keep their styles. Scoped under body.scc-fase0 to match the
 * unlayered foundations pattern and only affect reworked pages. */
body.scc-fase0 a {
  color: var(--color-gold-ink);
}

body.scc-fase0 a:hover,
body.scc-fase0 a:focus-visible {
  color: var(--color-gold-dark);
}

body.scc-fase0 h1,
body.scc-fase0 h2,
body.scc-fase0 h3,
body.scc-fase0 h4,
body.scc-fase0 h5,
body.scc-fase0 h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-regular);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  color: var(--color-dark);
}

body.scc-fase0 h1 { font-size: var(--fs-6xl); }
body.scc-fase0 h2 { font-size: var(--fs-5xl); }
body.scc-fase0 h3 { font-size: var(--fs-4xl); }
body.scc-fase0 h4 { font-size: var(--fs-3xl); }
body.scc-fase0 h5 { font-size: var(--fs-2xl); }
body.scc-fase0 h6 { font-size: var(--fs-xl); font-family: var(--font-body); }
