/* =====================================================================
   Fonts
   ===================================================================== */

/* Self-hosted Rubik, shipped as a variable font: one file covers weights
   300-900 (kept in sync with the sibling SoCraTes site). */
@font-face {
  font-family: "Rubik";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("../fonts/rubik-variable.woff2") format("woff2");
}

@font-face {
  font-family: "Rubik";
  font-style: italic;
  font-weight: 300 900;
  font-display: swap;
  src: url("../fonts/rubik-italic-variable.woff2") format("woff2");
}

/* Metric-matched Arial fallback: overrides derived from the actual Rubik
   metrics (UPM 1000, ascent 935, descent 250) so the swap causes no layout
   shift while the WOFF2 loads. */
@font-face {
  font-family: "Rubik Fallback";
  src: local("Arial");
  size-adjust: 104.34%;
  ascent-override: 89.61%;
  descent-override: 23.96%;
  line-gap-override: 0%;
}

/* =====================================================================
   Reset
   ===================================================================== */

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

body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd,
ol,
ul {
  margin: 0;
}

/* The consent-gated iframes carry `hidden` in the markup; the display rules
   below would otherwise override the UA's [hidden] handling. */
[hidden] {
  display: none !important;
}

/* =====================================================================
   Element defaults
   ===================================================================== */

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--navbar-height);
}

body {
  min-height: 100vh;
  margin: 0;
  /* Keeps the fixed consent banner from covering page content. */
  padding-bottom: var(--consent-height, 0);
  background-color: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-base);
  overflow-wrap: break-word;
}

/* Headings share the display scale; sizes come from layout/component rules. */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-title);
}

p {
  margin-bottom: var(--space-sm);
}

p:last-child {
  margin-bottom: 0;
}

ul,
ol,
blockquote {
  margin-bottom: 2.3125rem;
}

b,
strong {
  font-weight: var(--font-weight-bold);
}

blockquote {
  padding: 10px 0 10px 20px;
  border-left: 3px solid var(--color-primary);
  color: var(--color-text-muted);
  font-size: var(--font-size-quote);
  font-style: italic;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  color: var(--color-primary-darker);
}

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

img {
  height: auto;
}

button {
  font: inherit;
  color: inherit;
}

hr {
  height: 0;
  margin: var(--space-sm) 0;
  border: 0;
  border-top: 1px solid currentcolor;
}

/* Focus: always visible, never removed. */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* =====================================================================
   Utilities
   ===================================================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: calc(var(--z-navbar) + 10);
  padding: var(--space-2xs) var(--space-sm);
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  transform: translateY(-150%);
  transition: transform var(--duration-fast) var(--easing);
}

.skip-link:focus {
  color: var(--color-text-inverse);
  transform: translateY(0);
}

/* Error pages (404.html / 50x.html) — class instead of inline styles because
   the CSP has no style-src 'unsafe-inline'. */
.error-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-xl);
  text-align: center;
}

/* =====================================================================
   Reduced motion
   ===================================================================== */

@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;
    scroll-behavior: auto !important;
  }
}

/* =====================================================================
   Forced colors (Windows High Contrast)
   ===================================================================== */

@media (forced-colors: active) {
  /* Backgrounds are dropped, so button-styled links need a visible edge. */
  .btn {
    border-color: currentcolor;
  }

  /* No poster/video behind the hero copy — text sits on plain Canvas. */
  .hero__backdrop {
    display: none;
  }
}
