/* =============================================================================
   ZWF Base
   Modern reset + element defaults + accessibility primitives.
   Depends on tokens.css.
   ============================================================================= */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  tab-size: 4;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  font-family: var(--zwf-font-sans);
  font-size: var(--zwf-text-base);
  line-height: var(--zwf-leading-normal);
  color: var(--zwf-color-ink);
  background-color: var(--zwf-color-paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background-color: var(--zwf-color-selection);
  color: var(--zwf-color-ink);
}

/* Media --------------------------------------------------------------------- */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}
img, video { object-fit: cover; }

/* Forms ------------------------------------------------------------------------ */
input, button, textarea, select {
  font: inherit;
  color: inherit;
}
button { cursor: pointer; background: none; border: 0; }

/* Typography ----------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--zwf-font-heading);
  font-weight: var(--zwf-weight-bold);
  line-height: var(--zwf-leading-tight);
  letter-spacing: var(--zwf-tracking-tight);
  text-wrap: balance;
  color: var(--zwf-color-ink);
}

h1 { font-size: var(--zwf-text-4xl); }
h2 { font-size: var(--zwf-text-3xl); }
h3 { font-size: var(--zwf-text-2xl); }
h4 { font-size: var(--zwf-text-xl); }
h5 { font-size: var(--zwf-text-lg); }
h6 { font-size: var(--zwf-text-base); text-transform: uppercase; letter-spacing: var(--zwf-tracking-wide); }

p, li, blockquote, dd { text-wrap: pretty; }

a {
  color: var(--zwf-color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color var(--zwf-transition-fast) var(--zwf-ease-standard);
}
a:hover { color: var(--zwf-color-primary-hover); }

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

small { font-size: var(--zwf-text-sm); }

code, kbd, samp, pre { font-family: var(--zwf-font-mono); font-size: 0.9em; }

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

ul, ol { padding-left: 1.25em; }

blockquote {
  border-left: 3px solid var(--zwf-color-primary);
  padding-left: var(--zwf-space-md);
  color: var(--zwf-color-ink-muted);
  font-size: var(--zwf-text-lg);
}

address { font-style: normal; }

:target { scroll-margin-top: 6rem; }

/* Accessibility ------------------------------------------------------------- */

/* Visible keyboard focus everywhere; never remove without a replacement. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--zwf-color-focus);
  outline-offset: 2px;
  border-radius: var(--zwf-radius-sm);
}

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

.zwf-skip-link {
  position: fixed;
  top: var(--zwf-space-2xs);
  left: var(--zwf-space-2xs);
  z-index: var(--zwf-z-toast);
  padding: var(--zwf-space-2xs) var(--zwf-space-sm);
  background: var(--zwf-color-ink);
  color: var(--zwf-color-ink-inverse);
  border-radius: var(--zwf-radius-sm);
  transform: translateY(-150%);
  transition: transform var(--zwf-transition-base) var(--zwf-ease-standard);
}
.zwf-skip-link:focus { transform: translateY(0); }

/* Respect reduced-motion: kill transitions/animations and smooth scroll. */
@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;
  }
}

/* Honour forced-colors / Windows high-contrast mode for interactive UI. */
@media (forced-colors: active) {
  .zwf-btn { border: 1px solid currentColor; }
}
