/* =====================================================================
   Concrete Inspection Specialist — Base / reset / typography / layout
   V2 "FIELD DOSSIER"
   ===================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}

/* Grain overlay — feTurbulence fractalNoise tile, pointer-events none */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23grain)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

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

a { color: var(--accent-600); text-decoration: none; }
a:hover { color: var(--accent-700); }

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

ul, ol { padding: 0; list-style: none; }

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

/* ---- Headings ---- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); letter-spacing: -0.01em; }

p { text-wrap: pretty; }

/* ---- Focus ---- */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
:focus:not(:focus-visible) { outline: none; }

/* ---- Layout primitives ---- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2.5rem);
}
.wrap--narrow { max-width: var(--wrap-narrow); }

.section { padding-block: clamp(3.5rem, 7vw, 6.5rem); }
.section--tight { padding-block: clamp(2.5rem, 5vw, 4rem); }
.section--sunk { background: var(--paper-2); }
.section--dark {
  background:
    radial-gradient(120% 140% at 85% -10%, rgba(11,108,176,0.22), transparent 55%),
    var(--steel-950);
  color: var(--steel-300);
}
.section--dark h1, .section--dark h2, .section--dark h3 { color: #fff; }
.section--accent {
  background:
    linear-gradient(180deg, var(--accent-700), var(--accent-600));
  color: #eaf3fb;
}
.section--accent h1, .section--accent h2 { color: #fff; }

/* ---- Utilities ---- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-600);
}
.section--dark .eyebrow, .section--accent .eyebrow { color: var(--accent-bright); }
.eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  background: currentColor;
  opacity: 0.7;
}
.eyebrow--plain::before { display: none; }

.lead { font-size: var(--fs-lead); color: var(--steel-600); line-height: 1.55; }
.section--dark .lead { color: var(--steel-300); }
.section--accent .lead { color: #dcebf8; }

.muted { color: var(--steel-500); }
.measure { max-width: 60ch; }
.center { text-align: center; }
.mx-auto { margin-inline: auto; }

.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;
}

/* ---- Section heading block (rule-head applied via restyle) ---- */
.s-head {
  position: relative;
  max-width: 64ch;
  margin-bottom: clamp(2rem, 4vw, 3rem);
  padding-top: 3rem;
}
.s-head::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--steel-300);
}
.s-head.center { margin-inline: auto; }
.s-head__title { font-size: var(--fs-h2); margin-top: 0.6rem; }
.s-head__lead { margin-top: 1rem; }

/* Grids */
.grid { display: grid; gap: clamp(1rem, 2.5vw, 1.75rem); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) {
  .cols-3, .cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
}

.stack > * + * { margin-top: var(--space-4); }
.divider { height: 1px; background: var(--border); border: 0; }

/* Reveal-on-scroll (progressive enhancement — cis.js fallback) */
.reveal { opacity: 0; transform: translateY(18px); }
.reveal.is-in { opacity: 1; transform: none; transition: opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out); }
/* Failsafe: if scripting is unavailable, never hide content */
@media (scripting: none) {
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* SVG draw — only active with JS class on html */
html.js path[pathLength],
html.js line[pathLength],
html.js circle[pathLength],
html.js rect[pathLength] {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

@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;
  }
  .reveal { opacity: 1; transform: none; }
  /* Pause all CSS animations: marquee, badge-rotate, etc. */
  .marquee__track { animation-play-state: paused !important; }
  .badge-rotate__svg { animation-play-state: paused !important; }
}
