/* ==========================================================================
   Barbería Hugo — base.css
   Fase 3 · Agente 13 (Arquitecto Frontend)
   Reset moderno + estilos de documento. Sin componentes ni secciones.
   Orden de carga: tokens → typography → BASE → layout → components → sections → motion
   ========================================================================== */

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

* { margin: 0; }

html {
  color-scheme: dark;                       /* tema global oscuro (síntesis F1 §2) */
  scroll-padding-top: calc(var(--nav-height) + var(--space-4)); /* anclas bajo la nav fija */
  hanging-punctuation: first last;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  background-color: var(--color-bg);
  color: var(--color-text);
  overflow-x: clip;                         /* sin scroll horizontal accidental */
  text-rendering: optimizeLegibility;
}

img, picture, video, canvas, svg, iframe {
  display: block;
  max-width: 100%;
}
img, video { height: auto; }                /* respeta width/height para el ratio (anti-CLS) */
img { font-style: italic; }                 /* el alt de una imagen rota se distingue del texto */

input, button, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
textarea { resize: vertical; }

p, h1, h2, h3, h4, h5, h6, li, dd, blockquote, figcaption { overflow-wrap: break-word; }

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

table { border-collapse: collapse; }

a { color: var(--color-link); text-decoration-color: var(--color-link-underline); text-underline-offset: .2em; }
a:hover { color: var(--color-link-hover); }

hr {
  border: 0;
  border-top: var(--border-hairline) solid var(--color-hairline);
}

[hidden] { display: none !important; }

/* 2. Temas por sección ------------------------------------------------------- */
/* tokens.css re-mapea los semánticos; aquí se pintan. */
[data-theme] {
  background-color: var(--color-bg);
  color: var(--color-text);
}
[data-theme="ivory"] { color-scheme: light; }
[data-theme="nero"]  { color-scheme: dark; }

/* 3. Selección --------------------------------------------------------------- */
::selection {
  background-color: var(--color-selection-bg);
  color: var(--color-selection-fg);
}

/* 4. Foco visible global ------------------------------------------------------
   Champagne en oscuro, champagne-tinta en ivory (vía --focus-ring). Nunca se
   quita el outline sin alternativa. */
:focus:not(:focus-visible) { outline: none; }
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}
:target { scroll-margin-top: calc(var(--nav-height) + var(--space-4)); }

/* 5. Skip-link (nav.skip) ----------------------------------------------------- */
.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: var(--z-skip-link);
  padding: var(--space-3) var(--space-4);
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
  background: var(--p-marfil);
  color: var(--p-nero);
  font-family: var(--font-sans);
  font-size: var(--fs-ui);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  border-radius: var(--radius-xs);
  transform: translateY(calc(-100% - var(--space-6)));
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: none;
  outline: var(--focus-ring-width) solid var(--p-champagne);
  outline-offset: var(--focus-ring-offset);
}

/* 6. Utilidades accesibles ----------------------------------------------------- */
.visually-hidden,
.sr-only {
  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;
}
/* Contenido solo-JS / solo-sin-JS (la clase .js la pone el inline del <head>) */
html:not(.js) .js-only { display: none !important; }
html.js .no-js-only { display: none !important; }

/* 7. Pendientes del cliente ----------------------------------------------------
   Los [PENDIENTE CLIENTE: …] de legal.html se ven a propósito para que el
   cliente los detecte. No usar en index.html (allí no se publican). */
mark.pendiente {
  background: rgb(var(--p-champagne-rgb) / .22);
  color: inherit;
  padding: 0 .25em;
  border-bottom: var(--border-hairline) dashed var(--color-accent);
  font-style: normal;
}

/* 8. Textura de grano estática (sin animar) ------------------------------------ */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  background-image: var(--texture-grain);
  background-size: 160px;
  opacity: var(--opacity-grain);
  mix-blend-mode: overlay;
}
@media (prefers-reduced-transparency: reduce) {
  body::after { display: none; }
}
@media print {
  body::after { display: none; }
  body { background: #fff; color: #000; }
}

/* 9. Movimiento reducido: sin smooth-scroll ni transiciones largas --------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
