*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  letter-spacing: var(--tr-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle film grain overlay - makes the dark canvas feel like 35mm */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
  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 values='0 0 0 0 0.73   0 0 0 0 0.90   0 0 0 0 1   0 0 0 0.4 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 300px 300px;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
img { font-style: italic; shape-margin: 0.6rem; }

a { color: inherit; text-decoration: none; transition: color var(--dur-1) var(--ease-out); }
a:hover { color: var(--accent); }

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
  margin: 0;
  font-variation-settings: "opsz" 144, "SOFT" 100;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { margin: 0 0 1em; max-width: var(--max-w-read); }

strong { font-weight: 600; }
em { font-style: italic; }

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

/* --- Focus - keyboard-only amber ring --- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}
.chapter:focus-visible,
.essay__frame:focus-visible,
.hero .btn:focus-visible,
.chapter-spread__cover > span:focus-visible {
  outline-offset: 4px;
  box-shadow: 0 0 0 1px var(--bg), 0 0 0 3px var(--accent);
}

/* Utility - section marks (Anton, small caps feel) */
.mark {
  font-family: var(--font-mark);
  text-transform: uppercase;
  letter-spacing: var(--tr-caps);
  font-weight: 400;
  line-height: 1;
}

.meta {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--tr-meta);
  color: var(--ink-50);
}

/* Layout primitives */
.rail { padding-inline: var(--rail); }
.wrap { max-width: var(--max-w); margin-inline: auto; padding-inline: var(--rail); }
.stack > * + * { margin-top: var(--space-5); }

/* Hidden but accessible */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* WordPress overrides for default content */
.wp-block-button__link { border-radius: 0 !important; }
.alignwide, .alignfull { max-width: none !important; }

/* Block the jarring default Kadence header/footer when we're customizing */
body.nate-mono header.site-header,
body.nate-mono footer.site-footer {
  display: none;
}
