/* Base del sistema: tipografías, reset y tipografía editorial.
   Orden de carga: dist/tokens.css → dist/materials.css → css/base.css → css/components.css */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");

/* PP Neue Montreal: licencia web pendiente. Los archivos viven en assets/fonts/pp-neue-montreal/
   y están fuera de git (.gitignore). Sin ellos, todo cae a Inter. */
@font-face { font-family: "PP Neue Montreal"; src: url("../assets/fonts/pp-neue-montreal/PPNeueMontreal-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "PP Neue Montreal"; src: url("../assets/fonts/pp-neue-montreal/PPNeueMontreal-Medium.woff2") format("woff2"); font-weight: 500 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--q-font-sans);
  font-size: var(--q-type-body-size);
  line-height: var(--q-type-body-line);
  color: var(--q-texto);
  background: var(--q-fondo);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01" 1, "tnum" 0;
}
[data-tema] { color: var(--q-texto); color-scheme: light; }
[data-tema="oscuro"] { color-scheme: dark; }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
b, strong { font-weight: 500; } /* peso máximo de la marca */
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--q-borde-activo); outline-offset: 2px; border-radius: var(--q-radius-xs); }
[hidden] { display: none !important; } /* hidden siempre oculta, aunque la pieza defina su display */
::selection { background: color-mix(in srgb, var(--q-apagado) 70%, transparent); }

/* Tipografía editorial */
.q-display, .q-title, .q-h1, .q-h2, .q-h3 { margin: 0; font-weight: 500; }
.q-display { font-size: var(--q-type-display-size); line-height: var(--q-type-display-line); letter-spacing: var(--q-type-display-tracking); }
.q-title   { font-size: var(--q-type-title-size);   line-height: var(--q-type-title-line);   letter-spacing: var(--q-type-title-tracking); }
.q-h1      { font-size: var(--q-type-h1-size);      line-height: var(--q-type-h1-line);      letter-spacing: var(--q-type-h1-tracking); }
.q-h2      { font-size: var(--q-type-h2-size);      line-height: var(--q-type-h2-line);      letter-spacing: var(--q-type-h2-tracking); }
.q-h3      { font-size: var(--q-type-h3-size);      line-height: var(--q-type-h3-line);      letter-spacing: var(--q-type-h3-tracking); }
.q-subtitle{ font-size: var(--q-type-subtitle-size); line-height: var(--q-type-subtitle-line); letter-spacing: var(--q-type-subtitle-tracking); color: var(--q-texto-medio); margin: 0; }
.q-body    { font-size: var(--q-type-body-size);  line-height: var(--q-type-body-line); color: var(--q-texto-medio); margin: 0; }
.q-small   { font-size: var(--q-type-small-size); line-height: var(--q-type-small-line); color: var(--q-texto-suave); margin: 0; }
.q-gris    { color: var(--q-texto-titulo); }               /* segunda línea de los títulos */
.q-label, .q-mono {
  font-family: var(--q-font-mono);
  font-size: var(--q-type-label-size);
  line-height: var(--q-type-label-line);
  letter-spacing: var(--q-type-label-tracking);
  color: var(--q-texto-label);
  font-weight: 400;
}
.q-label { text-transform: uppercase; }
.q-micro { font-family: var(--q-font-mono); font-size: var(--q-type-micro-size); letter-spacing: var(--q-type-micro-tracking); text-transform: uppercase; color: var(--q-texto-label); }
.q-section { margin: 0; font-size: var(--q-type-section-size); line-height: var(--q-type-section-line); letter-spacing: var(--q-type-section-tracking); font-weight: 500; text-wrap: balance; }
.q-section span, .q-title span, .q-display span { color: var(--q-texto-titulo); }
.q-num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.q-metric { white-space: nowrap; font-size: var(--q-type-metric-size); line-height: var(--q-type-metric-line); letter-spacing: var(--q-type-metric-tracking); font-weight: 500; font-variant-numeric: tabular-nums; }

/* Superficie noche */
.q-noche { background: var(--q-noche); color: var(--q-arena); }
.q-noche .q-body, .q-noche .q-subtitle { color: var(--q-texto-noche); }
.q-noche .q-label, .q-noche .q-mono, .q-noche .q-micro { color: var(--q-label-noche); }

/* Grano del material (mismo que el manual) */
.q-grano { position: relative; isolation: isolate; }
.q-grano::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: .22; mix-blend-mode: overlay;
}

.q-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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