/* ============================================================
   base.css
   Reset, typography defaults, and page-level texture.
   Loaded after tokens.css, before components.css.
   ============================================================ */

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

html {
  scroll-behavior: smooth;
}

html, body {
  background: var(--abyss);
  color: var(--paper);
  font-family: var(--serif);
  font-size: var(--t-body);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection {
  background: var(--waterline);
  color: var(--abyss);
}

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

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

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

/* ----------------------------------------------------------------
   PAGE TEXTURE
   Two stacked layers: a very faint horizontal grid, and a film
   grain noise overlay. Both fixed, both barely visible, both
   designed to give the dark surface a sense of being printed
   on something rather than rendered flat.
   ---------------------------------------------------------------- */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-grid);
  background-image: linear-gradient(rgba(232, 228, 214, 0.018) 1px, transparent 1px);
  background-size: 100% 8px;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-noise);
  background: 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.92' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.9  0 0 0 0 0.92  0 0 0 0 0.95  0 0 0 0.025 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.45;
}

main, header, section, footer, nav {
  position: relative;
  z-index: var(--z-content);
}

/* ----------------------------------------------------------------
   LAYOUT PRIMITIVES
   ---------------------------------------------------------------- */

.container {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ----------------------------------------------------------------
   MOTION KEYFRAMES — shared across components
   ---------------------------------------------------------------- */

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

@keyframes marquee {
  from { transform: translateX(100%); }
  to   { transform: translateX(-100%); }
}

/* ----------------------------------------------------------------
   ACCESSIBILITY — respect reduced motion
   ---------------------------------------------------------------- */

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

/* ----------------------------------------------------------------
   RESPONSIVE PADDING — applied at container level
   ---------------------------------------------------------------- */

@media (max-width: 900px) {
  .container {
    padding: 0 var(--gutter-mobile);
  }
}
