/* ============================================================
   ITBOOST v3 — Base reset, typography rhythm, container, sections.
   Brutalist Paper: box-sizing:border-box EVERYWHERE (thick borders
   must never cause overflow), exposed grid motif, sharp corners,
   oversized condensed type. Mobile-first. Breakpoints: 768px / 1024px.
   ============================================================ */

/* CRITICAL: box-sizing:border-box on every element + pseudo.
   Without this, the 2–3px black borders on every card/button/input
   would blow past container width and trigger horizontal scroll. */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Reduced-motion: kill smooth scroll, animations, transitions.
   Marquees and hover-invert still work (they're visual-only, not motion). */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: var(--lh-normal);
  letter-spacing: var(--tracking-normal);
  min-height: 100vh;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

/* Paper grain — subtle dotted noise via radial-gradient, fixed, GPU-light.
   Gives the warm paper a tactile feel without an image asset. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  background-image: radial-gradient(var(--ink) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
  background-position: 0 0;
  mix-blend-mode: multiply;
}

img, picture, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

svg { fill: currentColor; }

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

button, input, textarea, select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

button {
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

/* --- Headings: oversized condensed, Archivo Black by default ------ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 900;            /* Archivo 900 — condensed feel */
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tighter);
  text-wrap: balance;
  text-transform: uppercase;   /* brutalist: all-caps headlines */
}

h1 {
  font-size: var(--fs-h1);
  font-weight: 900;
  letter-spacing: var(--tracking-tighter);
}
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 {
  font-size: var(--fs-lead);
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

p { text-wrap: pretty; }

strong, b { font-weight: 700; }
em, i { font-style: italic; }

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

/* --- Focus ring — VISIBLE over black borders (spec §4 risk) -------
   Thick black borders on every card/button mean a 2px black outline
   would be swallowed. Use accent orange with a paper-colored offset
   halo so the ring reads clearly on both paper bg and ink hover states.
   outline-offset + box-shadow together guarantee a visible ring on
   ink-filled (inverted) buttons too. */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 0;
  box-shadow: 0 0 0 6px var(--bg); /* halo separates ring from black border */
}

/* Buttons and links that sit on ink-filled backgrounds need a different
   halo color when they themselves are inverted on hover/focus. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--accent-2); /* electric blue — interactive */
  outline-offset: 3px;
  box-shadow: 0 0 0 5px var(--bg);
}

:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* --- Skip link ------------------------------------------------ */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: var(--z-modal);
  padding: var(--space-3) var(--space-5);
  background: var(--accent);
  color: var(--accent-on);
  border: var(--border-thick);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  transition: top var(--t-fast);
}
.skip-link:focus {
  top: 1rem;
}

/* ============================================================
   Container + utilities
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
  position: relative;
  z-index: var(--z-base);
}

.container--narrow { max-width: var(--container-narrow); }
.container--wide   { max-width: var(--container-wide); }

/* Hairline / hard divider — exposed grid motif */
.hairline {
  border: 0;
  height: var(--border-thick);
  background: var(--ink);
  margin: 0;
}
.hairline--thin {
  height: 1px;
  background: var(--ink);
}

.text-dim    { color: var(--text-dim); }
.text-faint  { color: var(--text-faint); }
.text-accent { color: var(--accent); }
.text-blue   { color: var(--accent-2); }

/* Eyebrow / mono label — bx.studio signature.
   Monospace, all-caps, with arrow `→` or `//` prefix conventions
   attached by the component, not here. */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border: var(--border-thin);
  background: var(--bg);
}
.eyebrow::before {
  content: '→';
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 400;
}

/* ============================================================
   Section rhythm — exposed grid / border motif
   Brutalist sections announce themselves with THICK top borders,
   not subtle hairlines. Optional sunken paper tint.
   ============================================================ */
.section {
  padding-block: var(--section-pad-y);
  position: relative;
}
.section + .section,
.section--bordered {
  border-top: var(--border-thick);
}
.section--tight { padding-block: var(--space-8); }
.section--accent-tint {
  background: var(--accent-soft);
}
.section--sunken {
  background: var(--surface-2);
}

/* Section header — mono index numerals, bx.studio signature.
   .section-num renders the `01/` `02/` `03/` markers. */
.section-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-bottom: clamp(2.5rem, 1rem + 4vw, 4.5rem);
  max-width: 60rem;
}
@media (min-width: 768px) {
  .section-head {
    grid-template-columns: auto 1fr;
    gap: var(--space-6);
    align-items: start;
  }
}

/* Big mono index numeral. Solid ink fill (not outlined) — passes
   AA-large 3:1 cleanly on paper bg. */
.section-num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--fs-numeral);
  line-height: 0.85;
  color: var(--ink);
  letter-spacing: var(--tracking-tighter);
  user-select: none;
  display: block;
  /* bx.studio touch: trailing slash reads as "01/" */
}
.section-num[data-num]::after {
  content: '/';
  color: var(--accent);
}

.section-title {
  font-size: var(--fs-h2);
  font-weight: 900;
  line-height: var(--lh-tight);
  max-width: 18ch;
}

.section-intro {
  color: var(--text-dim);
  font-size: var(--fs-lead);
  line-height: var(--lh-normal);
  max-width: 52ch;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-top: var(--space-4);
}

.section-kicker {
  margin-top: var(--space-2);
}

/* ============================================================
   Responsive helpers
   ============================================================ */
.grid {
  display: grid;
  gap: var(--space-5);
}
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }

@media (min-width: 768px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--2-even { grid-template-columns: 1fr 1fr; gap: var(--space-8); }
}

.flow > * + * { margin-top: var(--space-5); }
.flow--lg > * + * { margin-top: var(--space-7); }

.prose p + p { margin-top: var(--space-4); }

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