/**
 * @file
 * Base layer — resets, root element styles, typography and shared helpers.
 * Depends on tokens.css.
 */

/* ==========================================================================
   Reset / normalize additions
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--space-4));
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Lock scroll when a drawer / modal is open. */
body.is-locked {
  overflow: hidden;
}

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

img {
  display: block;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-heading);
  letter-spacing: -0.015em;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.05em; }

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

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

a:hover {
  color: var(--color-primary-hover);
}

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

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: var(--space-8) 0;
}

ul, ol {
  margin: 0 0 var(--space-4);
  padding-left: 1.5rem;
}

li { margin-bottom: 0.35em; }

blockquote {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-left: 4px solid var(--color-primary);
  background: var(--color-primary-soft);
  border-radius: var(--radius-sm);
  color: var(--color-text);
}

code, kbd, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Accessibility helpers (mirror Drupal core)
   ========================================================================== */
.visually-hidden,
.visually-hidden.focusable:not(:focus):not(:focus-within) {
  position: absolute !important;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: var(--z-modal);
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: var(--color-on-primary) !important;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  transition: top var(--transition);
}

.skip-link:focus {
  top: 0;
}

.hidden { display: none !important; }

/* ==========================================================================
   Utility helpers (reusable across any future page)
   ========================================================================== */
.u-text-center { text-align: center; }
.u-text-muted  { color: var(--color-text-muted); }
.u-mt-0 { margin-top: 0; }
.u-mb-0 { margin-bottom: 0; }
.u-flow > * + * { margin-top: var(--space-4); }

/* Section rhythm helper for building new pages. */
.section {
  padding-block: var(--space-12);
}

.section__head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto var(--space-10);
}

.section__title {
  font-size: var(--text-3xl);
  font-weight: var(--weight-extra);
}

.section__subtitle {
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  margin: 0;
}
