/**
 * base.css — reset, base typography, layout primitives
 * All values reference tokens.css. No ad-hoc colours or sizes.
 */

/* ================================================================
   RESET (modern minimal)
   ================================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%; /* 16px base */
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text-primary);
  background-color: var(--color-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

/* Keep intrinsic aspect ratio: width/height attrs set the box, CSS lets height
   follow the scaled width so images never squash/stretch vertically. */
img, video {
  height: auto;
}

picture {
  display: block;
}

a {
  color: var(--color-text-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--duration-base) var(--easing-default);
}

a:hover {
  color: var(--color-accent-teal);
}

/* Visible focus rings for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--color-state-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Remove default button/input UA styling */
button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* UA button defaults reset — critical: prevents white background on nav buttons */
button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.2;
  color: inherit;
}

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

/* ================================================================
   TYPOGRAPHY UTILITIES
   ================================================================ */
.label-uppercase {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.text-primary   { color: var(--color-text-primary) !important; }
.text-secondary { color: var(--color-text-secondary) !important; }
.text-inverse   { color: var(--color-text-inverse) !important; }
.text-accent    { color: var(--color-text-accent) !important; }
.text-teal      { color: var(--color-accent-teal) !important; }

/* ================================================================
   LAYOUT — CONTAINER
   ================================================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad-xs);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--container-pad-md);
  }
}

@media (min-width: 1280px) {
  .container {
    padding-inline: var(--container-pad-xl);
  }
}

/* ================================================================
   SECTION PATTERNS
   ================================================================ */

/* Section base */
.section {
  padding-top: var(--section-py-mobile);
  padding-bottom: var(--section-py-mobile);
}

@media (min-width: 768px) {
  .section {
    padding-top: var(--section-py-tablet);
    padding-bottom: var(--section-py-tablet);
  }
}

@media (min-width: 1024px) {
  .section {
    padding-top: var(--section-py-desktop);
    padding-bottom: var(--section-py-desktop);
  }
}

/* Dark sections */
.section--dark {
  background-color: var(--color-navy-950);
  color: var(--color-text-inverse);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4 {
  color: var(--color-text-inverse);
}

.section--dark p,
.section--dark li {
  color: var(--color-text-inverse-secondary);
}

/* Dark-medium (navy-900) — header bg, card bg inside dark section */
.section--dark-mid {
  background-color: var(--color-navy-900);
  color: var(--color-text-inverse);
}

.section--dark-mid h2, .section--dark-mid h3, .section--dark-mid h4 {
  color: var(--color-text-inverse);
}

/* Surface (off-white) sections */
.section--surface {
  background-color: var(--color-surface);
  color: var(--color-text-primary);
}

/* White sections */
.section--white {
  background-color: var(--color-white);
  color: var(--color-text-primary);
}

/* Section header block (pre-label + H2) */
.section-header {
  text-align: center;
  max-width: 720px;
  margin-inline: auto;
  margin-bottom: var(--space-12);
}

.section-header__prelabel {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent-teal);
  margin-bottom: var(--space-3);
}

.section--white .section-header__prelabel,
.section--surface .section-header__prelabel {
  color: var(--color-text-accent);
}

.section-header__h2 {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

@media (min-width: 1024px) {
  .section-header__h2 {
    font-size: var(--text-3xl);
  }
}

.section-header__lead {
  font-size: var(--text-md);
  color: var(--color-text-secondary);
  margin-top: var(--space-4);
  line-height: 1.65;
}

.section--dark .section-header__lead,
.section--dark-mid .section-header__lead {
  color: var(--color-text-inverse-secondary);
}

/* ================================================================
   GRID HELPERS (NO inline grid-template-columns anywhere)
   ================================================================ */

/* Generic 2-column grid */
.grid-2 {
  display: grid;
  gap: var(--space-8);
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* Generic 3-column grid */
.grid-3 {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Generic 4-column grid */
.grid-4 {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .grid-4 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* 2-col asymmetric: 60/40 */
.grid-60-40 {
  display: grid;
  gap: var(--space-12);
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .grid-60-40 {
    grid-template-columns: 60fr 40fr;
    align-items: center;
  }
}

/* 2-col asymmetric: 40/60 (image left, text right variant) */
.grid-40-60 {
  display: grid;
  gap: var(--space-12);
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .grid-40-60 {
    grid-template-columns: 40fr 60fr;
    align-items: center;
  }
}

/* Flex row, wrap, center */
.flex-row-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* ================================================================
   SCROLL REVEAL (reduced-motion: visibility fallback)
   ================================================================ */

/* JS-enabled: start hidden, animate to visible when .is-visible is added */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
}

/* When JS adds .is-visible */
.js .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: no-preference) {
  .js .reveal.is-visible {
    transition: opacity var(--duration-enter) var(--easing-enter),
                transform var(--duration-enter) var(--easing-enter);
  }
}

/* No-JS fallback: reveal elements are always visible (no opacity:0 applied) */
/* The .js class is added by the inline script in scripts.php; without it, rules above don't apply. */

/* Without JS / reduced-motion: immediately visible */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ================================================================
   BREADCRUMB BASE
   ================================================================ */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
}

.breadcrumb a {
  color: var(--color-text-secondary);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--color-text-accent);
  text-decoration: underline;
}

.breadcrumb__sep {
  color: var(--color-text-tertiary);
}

.breadcrumb__current {
  color: var(--color-text-primary);
  font-weight: 500;
}

/* Dark section breadcrumb */
.section--dark .breadcrumb,
.section--dark .breadcrumb a,
.section--dark .breadcrumb__sep {
  color: var(--color-text-inverse-secondary);
}

.section--dark .breadcrumb__current {
  color: var(--color-text-inverse);
}

/* ================================================================
   SKIP LINK (accessibility)
   ================================================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-accent-blue);
  color: var(--color-white);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  z-index: 9999;
}

.skip-link:focus {
  top: var(--space-4);
}

/* ================================================================
   VISUALLY HIDDEN (screen reader only)
   ================================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ================================================================
   DIVIDER ACCENT (gradient rule)
   ================================================================ */
.divider-accent {
  height: 3px;
  background: var(--color-accent-gradient);
  border: none;
  margin: 0;
}
