/* ==========================================================================
   Better Tomorrow Trust — Base: reset, fonts, elements, layout primitives, a11y
   ========================================================================== */

/* ---- Self-hosted fonts (drop files into /assets/fonts/) ----
   Riffic Bold = brand display face. Inter = body.
   Falls back gracefully to system stack until the files are added. */
@font-face {
  font-family: "Riffic Bold";
  src: url("../fonts/RifficFree-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-variable.woff2") format("woff2-variations");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

/* ---- Modern reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, picture, svg, video { display: block; max-width: 100%; height: auto; }
img { font-style: italic; background-repeat: no-repeat; background-size: cover; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

/* ---- Typography ---- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-tight);
  color: var(--blue-900);
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); line-height: 1.25; }

p { text-wrap: pretty; }
p + p { margin-top: var(--space-4); }

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

strong { font-weight: var(--fw-semibold); }
small { font-size: var(--fs-small); }

::selection { background: var(--blue-200); color: var(--blue-900); }

/* ---- Layout primitives ---- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: var(--container-narrow); }
.container--wide { max-width: var(--container-wide); }

.section { padding-block: var(--section-y); }
.section--tint { background: var(--surface-3); }
.section--wash { background: var(--grad-wash); }
.section--dark { background: var(--grad-hero); color: #dfe3f5; }
.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 { color: #fff; }

.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }

.grid { display: grid; gap: var(--space-6); }
.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: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---- Section header ---- */
.section-head { max-width: 720px; margin-bottom: var(--space-7); }
.section-head--center { margin-inline: auto; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--fs-eyebrow); font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-eyebrow); text-transform: uppercase;
  color: var(--color-primary);
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--color-accent); border-radius: 2px; }
.section-head--center .eyebrow::before { display: none; }
/* Light eyebrow for dark/navy sections — defined here so it works on every page */
.eyebrow--light { color: var(--green-400); }
.lead { font-size: var(--fs-lead); color: var(--color-text-muted); line-height: 1.55; }

/* ---- Accessibility helpers ---- */
.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;
}
.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: var(--z-toast);
  background: var(--blue-700); color: #fff; padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm); transition: top var(--dur) var(--ease-out);
}
.skip-link:focus { top: var(--space-4); color: #fff; }

:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Reveal-on-scroll (progressive enhancement; JS adds .is-visible) ---- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity var(--reveal-dur) var(--ease-out), transform var(--reveal-dur) var(--ease-out); }
.reveal.is-visible { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 80ms; }
.reveal[data-delay="2"] { transition-delay: 160ms; }
.reveal[data-delay="3"] { transition-delay: 240ms; }
.reveal[data-delay="4"] { transition-delay: 320ms; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}
