/* ==========================================================================
   Web de Javier Cestino · base
   Fuentes, tokens de color y tema, reset, tipografía y piezas comunes.
   ========================================================================== */

/* ---------- Fuentes de Migas (autoalojadas, solo se usan en su apartado) ---------- */
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-var.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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../fonts/plus-jakarta-sans-latin-var.woff2") format("woff2");
  font-weight: 200 800;
  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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens: tema claro (por defecto) ---------- */
:root {
  color-scheme: light;

  --paper: #ffffff;
  --mist: #f5f5f7;
  --ink: #1d1d1f;
  --graphite: #6e6e73;
  --hairline: #d2d2d7;
  --clay: #d97757;          /* terracota de marca: solo grafismo */
  --clay-text: #a84e2e;     /* terracota para texto y foco (≥ 5:1) */

  --nav-bg: rgba(255, 255, 255, 0.72);
  --nav-solid: #ffffff;
  --nav-line: rgba(0, 0, 0, 0.08);
  --btn-bg: #1d1d1f;
  --btn-fg: #ffffff;
  --btn-hover: #3a3a3c;

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable Text", "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --font-migas: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --gutter: clamp(1.25rem, 0.6rem + 3.2vw, 2.75rem);
  --max: 70rem;
  --nav-h: 3rem;
  --section-space: clamp(5rem, 3.5rem + 7vw, 9.5rem);

  --radius-s: 12px;
  --radius-m: 18px;
  --radius-l: 22px;
  --radius-xl: 32px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (min-width: 48em) {
  :root { --nav-h: 3.25rem; }
}

/* ---------- Tokens: tema oscuro (sistema) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #000000;
    --mist: #161617;
    --ink: #f5f5f7;
    --graphite: #a1a1a6;
    --hairline: #38383a;
    --clay-text: #e08a6c;
    --nav-bg: rgba(22, 22, 23, 0.72);
    --nav-solid: #161617;
    --nav-line: rgba(255, 255, 255, 0.1);
    --btn-bg: #f5f5f7;
    --btn-fg: #000000;
    --btn-hover: #d2d2d7;
  }
}

/* ---------- Tokens: tema oscuro (elegido a mano) ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #000000;
  --mist: #161617;
  --ink: #f5f5f7;
  --graphite: #a1a1a6;
  --hairline: #38383a;
  --clay-text: #e08a6c;
  --nav-bg: rgba(22, 22, 23, 0.72);
  --nav-solid: #161617;
  --nav-line: rgba(255, 255, 255, 0.1);
  --btn-bg: #f5f5f7;
  --btn-fg: #000000;
  --btn-hover: #d2d2d7;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 1rem);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  line-height: 1.5;
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, p, ul, ol, dl, dd, figure {
  margin: 0;
}

h1, h2, h3, h4, h5 {
  font-weight: 600;
  text-wrap: balance;
}

p { text-wrap: pretty; }

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

a { color: inherit; }

button { font: inherit; color: inherit; }

[role="list"] { list-style: none; padding: 0; }

main:focus { outline: none; }

/* ---------- Foco visible ---------- */
:focus-visible {
  outline: 2px solid var(--clay-text);
  outline-offset: 3px;
}

/* ---------- Utilidades ---------- */
.visually-hidden {
  position: absolute !important;
  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;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 0.75rem;
  z-index: 100;
  padding: 0.75rem 1.125rem;
  border-radius: 980px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus { transform: none; }

.container {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.625rem 1.375rem;
  border: 0;
  border-radius: 980px;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s var(--ease);
}

.btn:active { transform: scale(0.98); }

.btn--primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
}

.btn--primary:hover { background: var(--btn-hover); }

.btn--secondary {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.btn--secondary:hover {
  background: var(--mist);
  box-shadow: inset 0 0 0 1px var(--graphite);
}

/* ---------- Revelado al hacer scroll (solo si hay JS y se permite movimiento) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .can-reveal [data-reveal] {
    transition: opacity 0.8s var(--ease), translate 0.8s var(--ease);
  }

  .can-reveal [data-reveal]:not(.is-in) {
    opacity: 0;
    translate: 0 1.25rem;
  }
}
