:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fb;
  --bg-elevated: #ffffff;
  --fg: #0f172a;
  --fg-muted: #64748b;
  --fg-soft: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --brand: #6366f1;
  --brand-strong: #4338ca;
  --brand-deep: #312e81;
  --brand-glow: rgba(99, 102, 241, 0.18);
  --gradient-hero: linear-gradient(135deg, #312e81 0%, #4f46e5 50%, #818cf8 100%);
  --gradient-text: linear-gradient(135deg, #1e1b4b 0%, #4338ca 35%, #6366f1 70%, #a5b4fc 100%);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.06);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --max-width: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0b0f;
    --bg-soft: #13151c;
    --bg-elevated: #181a23;
    --fg: #f1f5f9;
    --fg-muted: #94a3b8;
    --fg-soft: #64748b;
    --border: #252834;
    --border-strong: #353a4a;
    --brand: #818cf8;
    --brand-strong: #a5b4fc;
    --brand-deep: #6366f1;
    --brand-glow: rgba(129, 140, 248, 0.22);
    --gradient-hero: linear-gradient(135deg, #4338ca 0%, #6366f1 50%, #a5b4fc 100%);
    --gradient-text: linear-gradient(135deg, #6366f1 0%, #818cf8 50%, #c7d2fe 100%);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  }
}

@font-face {
  font-family: 'InterVar';
  src: url('https://rsms.me/inter/font-files/InterVariable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'InterVar', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  font-size: 16px;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ───── Header ─────────────────────────────────────── */

header.site {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
}

header.site .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  line-height: 0;
  border-radius: 22%;
  overflow: hidden;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.06),
    0 1px 3px rgba(15, 23, 42, 0.12),
    0 4px 12px var(--brand-glow);
}

.brand-mark img {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: cover;
}

.brand-mark::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, transparent 45%, rgba(0, 0, 0, 0.06) 100%);
  pointer-events: none;
}

header.site nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.9rem;
}

header.site nav a {
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

header.site nav a:hover {
  color: var(--fg);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  padding-left: 14px;
  margin-left: 4px;
  border-left: 1px solid var(--border);
}

.lang-switch a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ───── Main ───────────────────────────────────────── */

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 24px 96px;
}

main h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 12px;
}

main .updated {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-muted);
  font-size: 0.82rem;
  margin: 0 0 40px;
}

main h2 {
  margin-top: 48px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

main h3 {
  margin-top: 28px;
  margin-bottom: 8px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fg);
}

main p {
  margin: 12px 0;
}

main p,
main li {
  color: var(--fg);
}

main a {
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

main a:hover {
  color: var(--brand-strong);
  border-bottom-color: var(--brand);
}

main ul,
main ol {
  padding-left: 24px;
  margin: 12px 0;
}

main li {
  margin: 6px 0;
}

main strong {
  font-weight: 600;
  color: var(--fg);
}

/* ───── Tables ─────────────────────────────────────── */

main table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 20px 0;
  font-size: 0.92rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

main table th,
main table td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

main table tr:last-child th,
main table tr:last-child td {
  border-bottom: none;
}

main table th {
  background: var(--bg-soft);
  font-weight: 600;
  color: var(--fg);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}

main table td + td,
main table th + th {
  border-left: 1px solid var(--border);
}

/* ───── TOC ────────────────────────────────────────── */

.toc {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 40px;
}

.toc strong {
  display: block;
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.toc ol {
  margin: 0;
  padding-left: 20px;
  columns: 2;
  column-gap: 32px;
  font-size: 0.92rem;
}

.toc ol li {
  break-inside: avoid;
  margin: 4px 0;
}

.toc a {
  color: var(--fg);
  text-decoration: none;
  border: none;
}

.toc a:hover {
  color: var(--brand);
  border: none;
}

@media (max-width: 600px) {
  .toc ol {
    columns: 1;
  }
}

/* ───── Footer ─────────────────────────────────────── */

footer.site {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.85rem;
}

footer.site .inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

footer.site a {
  color: var(--fg-muted);
  margin: 0 8px;
  text-decoration: none;
  transition: color 0.15s ease;
}

footer.site a:hover {
  color: var(--fg);
}

/* ───── Landing hero ───────────────────────────────── */

.hero {
  text-align: center;
  padding: 96px 24px 64px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, var(--brand-glow) 0%, transparent 60%);
  pointer-events: none;
  z-index: -1;
}

.hero-mark {
  position: relative;
  display: inline-block;
  width: 112px;
  height: 112px;
  margin-bottom: 28px;
  border-radius: 22%;
  overflow: hidden;
  background: #fff;
  /* Multi-layer shadow para simular volumen estilo app icon iOS/Android:
       - Borde fino sutil que separa del fondo.
       - Sombra cercana negra para anclar al "suelo".
       - Glow ancho indigo para que respire la marca.
       - Sombra lejana muy difusa para profundidad. */
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.08),
    0 2px 4px rgba(15, 23, 42, 0.08),
    0 8px 24px rgba(15, 23, 42, 0.12),
    0 16px 48px var(--brand-glow),
    0 32px 64px rgba(67, 56, 202, 0.15);
  transform: translateZ(0);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.3s ease;
}

.hero-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-mark::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 35%, rgba(0, 0, 0, 0.04) 70%, rgba(0, 0, 0, 0.1) 100%);
  pointer-events: none;
}

.hero-mark:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.08),
    0 4px 8px rgba(15, 23, 42, 0.1),
    0 16px 32px rgba(15, 23, 42, 0.15),
    0 24px 64px var(--brand-glow),
    0 48px 80px rgba(67, 56, 202, 0.2);
}

.hero h1 {
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin: 0 0 16px;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 12px var(--brand-glow));
}

.hero .tagline {
  color: var(--fg-muted);
  font-size: 1.15rem;
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.5;
}

.hero .meta {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--fg-soft);
}

.hero .links {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 40px;
}

.hero .links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--fg);
  background: var(--bg-elevated);
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.hero .links a:hover {
  border-color: var(--brand);
  color: var(--brand);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.hero .links a .arrow {
  display: inline-block;
  transition: transform 0.15s ease;
}

.hero .links a:hover .arrow {
  transform: translateX(2px);
}

@media (max-width: 600px) {
  .hero h1 {
    font-size: 2.4rem;
  }

  .hero .tagline {
    font-size: 1.05rem;
  }

  main h1 {
    font-size: 1.85rem;
  }

  main h2 {
    font-size: 1.2rem;
  }
}

::selection {
  background: var(--brand-glow);
  color: var(--brand-strong);
}
