/* ==========================================================================
   RIEL — Reset, typography, layout primitives, utilities
   ========================================================================== */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--s-4);
  font-family: var(--font-head);
  font-weight: var(--fw-sub);
  line-height: var(--lh-head);
  color: var(--text-strong);
  letter-spacing: -.015em;
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
  font-weight: var(--fw-display);
  line-height: var(--lh-tight);
  letter-spacing: -.02em;
}
h2 { font-size: var(--fs-h2); font-weight: var(--fw-head); letter-spacing: -.02em; }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

p { margin: 0 0 var(--s-4); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

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

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

ul, ol { margin: 0 0 var(--s-4); padding-left: 1.25em; }
li { margin-bottom: var(--s-2); }

strong, b { font-weight: 700; color: var(--text-strong); }

hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-7) 0; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }

:focus-visible {
  outline: 3px solid var(--c-orange);
  outline-offset: 3px;
  border-radius: 4px;
}

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

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

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide { max-width: var(--container-wide); }
.container--narrow { max-width: 820px; }

/* The header is fixed. Pages that do not open with a dark hero reserve space
   for it; pages that do (body.header-overlay) let the hero run underneath and
   add the offset to the hero's own top padding instead. */
main { padding-top: var(--header-h); }
body.header-overlay main { padding-top: 0; }

.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: clamp(48px, 5vw, 80px); }
.section--flush-top { padding-top: 0; }
.section--flush-bottom { padding-bottom: 0; }
.section--alt { background: var(--bg-alt); }
.section--dark { background: var(--bg-dark); color: var(--text-on-dark); }
.section--dark h1, .section--dark h2, .section--dark h3,
.section--dark h4, .section--dark h5 { color: #fff; }

.grid { display: grid; gap: var(--s-6); }
/* Grid and flex children default to min-width:auto, which stops them shrinking
   below their content. Without this a wide element (a spec table with a
   min-width, a long unbroken string) forces the whole column wider than the
   viewport on mobile. */
.grid > *, .split > *, .with-rail > *, .stats > *, .divisions > * { min-width: 0; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1023px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 639px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------- Section headers */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin: 0 0 var(--s-4);
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--c-orange);
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: currentColor;
  flex: none;
}
.section--dark .eyebrow { color: var(--c-orange); }
.eyebrow--solar { color: var(--c-solar-ink); }
.section--dark .eyebrow--solar { color: var(--c-solar); }
.eyebrow--steel { color: var(--c-steel); }
.section--dark .eyebrow--steel { color: #A9B4C4; }

.section-head { max-width: 720px; margin-bottom: clamp(40px, 5vw, 64px); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center .eyebrow { justify-content: center; }
.section-head p { font-size: var(--fs-lead); color: var(--text-muted); }
.section--dark .section-head p { color: var(--text-on-dark); }

.section-head--split {
  max-width: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-7);
}
.section-head--split > div:first-child { max-width: 720px; }
@media (max-width: 767px) {
  .section-head--split { flex-direction: column; align-items: flex-start; gap: var(--s-5); }
}

.lead { font-size: var(--fs-lead); color: var(--text-muted); }

/* --------------------------------------------------------- Utilities */

.u-center { text-align: center; }
.u-mt-0 { margin-top: 0; }
.u-mb-0 { margin-bottom: 0; }
.u-mb-4 { margin-bottom: var(--s-4); }
.u-mb-6 { margin-bottom: var(--s-6); }
.u-mb-7 { margin-bottom: var(--s-7); }
.u-hide { display: none !important; }

/* The hidden attribute is only `display:none` in the UA sheet, so any class
   that sets display (.btn is inline-flex) silently defeats it. This keeps
   hidden meaning hidden — it is what the download gate relies on to not offer
   a link to a file that does not exist yet. */
[hidden] { display: none !important; }

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

.skip-link {
  position: absolute;
  top: -100px; left: var(--s-4);
  z-index: 9999;
  padding: var(--s-3) var(--s-5);
  background: var(--c-dark);
  color: #fff;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  transition: top var(--t-fast);
}
.skip-link:focus { top: 0; }

/* Ratio boxes */
.ratio { position: relative; overflow: hidden; border-radius: var(--r-md); background: var(--c-grey-200); }
.ratio > img, .ratio > video, .ratio > iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.ratio--16x9 { aspect-ratio: 16 / 9; }
.ratio--4x3  { aspect-ratio: 4 / 3; }
.ratio--3x2  { aspect-ratio: 3 / 2; }
.ratio--1x1  { aspect-ratio: 1 / 1; }
.ratio--3x4  { aspect-ratio: 3 / 4; }

/* Placeholder for content the client has not supplied yet (see report.md) */
[data-tbd] { color: var(--text-muted); }
.tbd-tile {
  display: grid;
  place-items: center;
  background: var(--c-grey-100);
  border: 1px dashed var(--c-grey-300);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  border-radius: var(--r-md);
  min-height: 180px;
  text-align: center;
  padding: var(--s-5);
}

/* --------------------------------------------------------- Motion base */

[data-anim] { will-change: transform, opacity; }

/* Pre-hide animated elements only once JS has confirmed motion is on, so the
   page is fully readable if JS or GSAP fails to load. Set by an inline script
   in <head>; removed again by animations.js if GSAP is unavailable. */
html.anim-on [data-anim="reveal"] { opacity: 0; transform: translateY(40px); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  [data-anim] { opacity: 1 !important; transform: none !important; }
}
