/* Theory Media — reset + base. Paper-dominant: the firm's original identity,
   promoted from the Paper Cut experiment 2026-08-04.

   The organizing idea — COLOR IS VISIBILITY. Dark sections (.stage-dark) are
   fully colorless: invisibility has no color. Lit sections (.stage-lit) carry
   ink typography on paper, and the brand's one chromatic note (logo-slate)
   appears only there, attached to what is measured, live, or yours. */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--ink); }

body.tm-root {
  background: var(--ink);
  color: var(--slope);
  font-family: var(--font-display);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}
h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); font-weight: 700; }
h4 { font-size: var(--text-h4); font-weight: 700; }

p { max-width: 62ch; }

.tm-eyebrow {
  font-family: var(--font-label);
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}

/* ---- The two stages ----
   Every section declares one. Components inherit their palette from it. */

.stage-dark { background: var(--ink); color: var(--slope); }
.stage-dark h1, .stage-dark h2, .stage-dark h3, .stage-dark h4 { color: var(--paper); }
.stage-dark .tm-eyebrow { color: var(--slope); }
.stage-dark .tm-dot { color: var(--paper); }   /* no color in the dark */

.stage-lit { background: var(--paper); color: var(--body-ink); }
.stage-lit h1, .stage-lit h2, .stage-lit h3, .stage-lit h4 { color: var(--ink); }
.stage-lit .tm-eyebrow { color: var(--label-ink); }
.stage-lit .tm-dot { color: var(--logo); }     /* the note returns with the light */

/* Film grain — the print texture. One fixed overlay, both stages. */
body.tm-root::after {
  content: ""; position: fixed; inset: 0; z-index: 2000; pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- Layout ---- */

.tm-container { max-width: var(--container-max); margin-inline: auto; padding-inline: var(--container-pad); }
.tm-section { padding-block: var(--section-pad-lg); position: relative; }
.tm-section--md { padding-block: var(--section-pad-md); }

.tm-visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.tm-skip-link {
  position: absolute; top: -100px; left: var(--space-4);
  background: var(--ink); color: var(--paper);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-standard);
  z-index: 1000; font-weight: 700;
  transition: top var(--dur-fast) var(--ease-entrance);
}
.tm-skip-link:focus { top: var(--space-4); }
:focus-visible { outline: 2px solid var(--logo); outline-offset: 3px; }

/* ---- Reduced motion: everything lands in its final state ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  body.tm-root::after { display: none; }
}
