/* =====================================================================
   AK Community — Sistema de diseño · BASE
   Elementos HTML sin clase. Nada de colores fijos: solo roles.
   ===================================================================== */
@layer base {

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

  html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* Las anclas (#aprender, #contratar) no quedan bajo la cabecera fija */
    scroll-padding-top: calc(var(--header-h) + 12px);
    background-color: var(--bg);
  }
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
  }

  body {
    margin: 0;
    background-color: var(--bg);
    background-image: radial-gradient(var(--dot) 1px, transparent 1.2px); /* papel punteado */
    background-size: 22px 22px;
    color: var(--text);
    font-family: var(--font-text);
    font-size: var(--step-0);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  /* Cualquier bloque con data-theme propio vuelve a pintar texto y fondo
     con SUS tokens (modo oscuro por sección). */
  [data-theme]:not(html) {
    color: var(--text);
    background-color: var(--bg);
  }

  /* --- Titulares: Fraunces solo en H1/H2 --- */
  h1, h2 {
    font-family: var(--font-display);
    font-weight: var(--weight-semibold);
    font-optical-sizing: auto;
    letter-spacing: -0.015em;
    line-height: var(--leading-tight);
    color: var(--text);
    margin: 0 0 var(--space-4);
    text-wrap: balance;
  }
  h1 { font-size: var(--step-5); }
  h2 { font-size: var(--step-4); }
  h3, h4, h5, h6 {
    font-family: var(--font-text);
    font-weight: var(--weight-black);
    line-height: var(--leading-snug);
    color: var(--text);
    margin: 0 0 var(--space-3);
  }
  h3 { font-size: var(--step-1); }
  h4 { font-size: var(--step-0); }
  h5, h6 { font-size: var(--step--1); }
  h1 em, h2 em { color: var(--accent-text); font-weight: 500; }

  p, ul, ol, dl, blockquote, figure, table, pre { margin: 0 0 var(--space-4); }
  ul, ol { padding-left: 1.3em; }
  li + li { margin-top: .25em; }
  strong, b { font-weight: var(--weight-black); }
  small { font-size: var(--step--1); }

  a {
    color: var(--link);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color var(--dur-base) var(--ease-out);
  }
  a:hover { color: var(--primary-hover); }

  img, svg, video, iframe { max-width: 100%; }
  img, video { height: auto; }

  hr { border: 0; border-top: 1px solid var(--rule); margin: var(--space-6) 0; }

  blockquote {
    font-family: var(--font-display);
    font-style: italic;
    font-size: var(--step-1);
    line-height: 1.35;
    border-left: 3px solid var(--accent);
    padding-left: var(--space-5);
    color: var(--text);
  }

  code, kbd, samp, pre { font-family: var(--font-mono); font-size: .9em; }
  code { background: var(--surface-2); padding: 1px 6px; border-radius: var(--radius-xs); }
  pre { background: var(--surface-2); padding: var(--space-4); border-radius: var(--radius-sm); overflow-x: auto; }

  table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
  th, td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
  th { font-weight: var(--weight-black); color: var(--text); background: var(--surface-2); }

  /* --- Formularios (sans, tokens) --- */
  label { font-weight: var(--weight-bold); color: var(--text); }
  input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="range"]):not([type="color"]),
  select,
  textarea {
    font: inherit;
    font-size: max(16px, var(--step--1)); /* 16 px evita el zoom de iOS */
    color: var(--text);
    background-color: var(--surface);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    min-height: 46px;
    line-height: 1.4;
    max-width: 100%;
    transition: border-color var(--dur-base), box-shadow var(--dur-base);
  }
  textarea { min-height: 120px; }
  select { padding-right: 36px; }
  input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 1; }
  input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent);
  }
  input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 1.1em; height: 1.1em; }

  button, input[type="submit"], input[type="button"] { font: inherit; cursor: pointer; }

  :focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

  ::selection { background: var(--accent-soft); color: var(--text); }
}
