/* ══════════════════════════════════
   TEXTURE SYSTEM
   Global grain overlays, per-element
   grain, worn rules, stains
══════════════════════════════════ */

/* Layer A — fine paper grain, always on top */
body::before {
  content: '';
  position: fixed; inset: 0;
  z-index: 9001; pointer-events: none;
  opacity: 0.6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.88' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23g)' opacity='1'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  mix-blend-mode: overlay;
}

/* Layer B — topography contour lines */
body::after {
  content: '';
  position: fixed; inset: 0;
  z-index: 9000; pointer-events: none;
  opacity: 0.04;
  background-image: url("../assets/pattern/topography.svg");
  background-size: 600px 600px;
  mix-blend-mode: overlay;
}

/* Per-element texture mixin — apply .ptex class */
.ptex { position: relative; }
.ptex::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none; z-index: 1;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.78' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: overlay;
}

/* Worn divider rule */
.worn-rule {
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,140,0,0.45) 12%,
    rgba(255,140,0,0.12) 38%,
    rgba(255,140,0,0.38) 62%,
    rgba(255,140,0,0.07) 80%,
    transparent 100%);
  filter: url(#grunge-line);
  position: relative;
}
