/* base.css — reset, body defaults, grano global, manchas, focus, reduced-motion */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-serif);
  background: var(--paper);
  color: var(--ink);
  font-size: 1.125rem;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

button {
  font-family: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  background: none;
  border: 0;
  outline: 0;
  color: inherit;
}

textarea { resize: none; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 1px dashed var(--accent);
  outline-offset: 4px;
}

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

a { color: inherit; text-decoration: none; }

/* El atributo `hidden` debe ganar a cualquier display propio del componente */
[hidden] { display: none !important; }

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Grano global. Ruido SVG inline en data URI; multiply para envejecer el papel. */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.18;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='5'/><feColorMatrix values='0 0 0 0 0.1  0 0 0 0 0.1  0 0 0 0 0.1  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Manchas de tinta de fondo — gradientes radiales sutiles que respiran tinta */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 15% 20%, rgba(184, 148, 63, 0.08) 0%, transparent 40%),
    radial-gradient(ellipse at 85% 75%, rgba(122, 155, 138, 0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(26, 26, 26, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 1;
}

.muted { color: var(--ink-faded); }

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

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