/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
p { margin: 0; }
::selection { background: rgba(178, 44, 56, .45); color: #fff; }
:focus-visible { outline: 2px solid var(--red-tx); outline-offset: 2px; border-radius: 6px; }
.mono { font-family: var(--mono); font-feature-settings: "zero" 1; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--tx-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--s4) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--s4); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* Grão de filme sobre tudo (sutil) */
.grain {
  position: fixed; inset: -50%; z-index: 9000; pointer-events: none; opacity: .045;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

/* Luzes ambientes */
.ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.ambient i {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5;
  background: radial-gradient(circle, rgba(178, 44, 56, .55), rgba(178, 44, 56, 0) 70%);
  animation: drift 22s var(--ease-io) infinite alternate;
}
.ambient i:nth-child(1) { width: 620px; height: 620px; top: -260px; right: -120px; }
.ambient i:nth-child(2) { width: 520px; height: 520px; bottom: -300px; left: 10%; opacity: .28; animation-duration: 28s; animation-delay: -6s; }
.ambient i:nth-child(3) { width: 380px; height: 380px; top: 40%; right: 30%; opacity: .12; animation-duration: 34s; animation-delay: -12s; background: radial-gradient(circle, rgba(255, 255, 255, .35), transparent 70%); }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-60px, 40px) scale(1.08); }
  100% { transform: translate(40px, -30px) scale(.95); }
}

/* Linha de pesponto (costura) — assinatura visual */
.stitch {
  height: 2px; border: 0; margin: 0;
  background-image: linear-gradient(90deg, var(--red-line) 0 8px, transparent 8px 14px);
  background-size: 14px 2px;
}
.stitch.soft { background-image: linear-gradient(90deg, var(--line-3) 0 6px, transparent 6px 12px); background-size: 12px 1px; height: 1px; }
.stitch.run { animation: stitch-run 1.2s linear infinite; }
@keyframes stitch-run { to { background-position: 14px 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .grain { display: none; }
}
