/* =========================================================================
   CISOSE 2027 — Base styles: reset, typography, layout primitives, a11y.
   Requires tokens.css.
   ========================================================================= */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--sp-4));
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  /* No overflow-x clipping here on purpose: horizontal overflow must be fixed at its source,
     and tests/congress-home.test.mjs fails on any element wider than the viewport. */
}

img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2, h3, h4 {
  margin: 0;
  color: var(--color-heading);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  text-wrap: balance;
}
h1 { font-size: var(--fs-display); line-height: var(--lh-tight); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-3xl); line-height: var(--lh-tight); letter-spacing: -0.015em; }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { margin: 0; max-width: var(--measure); text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
dl, dd { margin: 0; }

a {
  color: var(--color-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--color-link-hover); }

/* ---- Focus: always visible, never colour-only ---- */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- Layout primitives ---- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide { max-width: calc(var(--container-wide) + var(--gutter) * 2); }

.section { padding-block: var(--section-y); }
.section--soft { background: var(--color-bg-soft); }
.section--tint { background: var(--color-bg-tint); }
.section--inverse { background: var(--color-bg-inverse); color: var(--color-text-inverse); }
/* :where() keeps specificity at (0,1,0) so light surfaces nested in an inverse
   section (e.g. a white card) can restore dark headings with a single class. */
.section--inverse :where(h2, h3, h4) { color: var(--c-white); }

.stack > * + * { margin-top: var(--stack-gap, var(--sp-4)); }

/* ---- Text helpers ---- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-accent);
}
.lead { font-size: var(--fs-lg); line-height: 1.55; color: var(--color-text); }
.muted { color: var(--color-text-muted); }
.mono { font-family: var(--font-mono); }

/* ---- 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(--sp-4);
  top: var(--sp-3);
  z-index: var(--z-skip);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-sm);
  background: var(--c-navy-900);
  color: var(--c-white);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; color: var(--c-white); }

/* ---- Reduced motion: switch off all non-essential animation ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
