/* ezracenter.org — modern accessible redesign
   Native light/dark mode via prefers-color-scheme (no JS, no toggle).
   Layout uses flex/grid only: no floats, no fixed heights, no absolute
   positioning (except the skip link), no negative margins.
   The :root token block below is the single source of truth. */

:root {
  color-scheme: light dark;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1d2b3a;
  --text-muted: #47586b;
  --accent: #0f5a94;
  --accent-contrast: #ffffff;
  --hero-1: #123f63;
  --hero-2: #1b5a8a;
  --border: #d9dfe6;
  --focus: #0f5a94;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --surface: #1a222c;
    --text: #e6ecf2;
    --text-muted: #9fb0c0;
    --accent: #7db8e8;
    --accent-contrast: #0f141a;
    --hero-1: #14283e;
    --hero-2: #1d3a58;
    --border: #2a3644;
    --focus: #7db8e8;
  }
}

/* Atkinson Hyperlegible — Braille Institute typeface for low vision.
   Self-hosted; falls back to the system UI stack. */
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-regular.woff2") format("woff2");
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-bold.woff2") format("woff2");
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-italic.woff2") format("woff2");
}

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

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
ul,
figure {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI",
    Roboto, sans-serif;
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.125rem);
  line-height: 1.6;
  overflow-wrap: break-word;
}

main {
  flex: 1;
}

/* Headings */
h1,
h2,
h3 {
  line-height: 1.25;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.55rem + 2vw, 2.75rem);
}

h2 {
  font-size: clamp(1.45rem, 1.25rem + 1vw, 1.85rem);
  margin-top: 2em;
}

h3 {
  font-size: clamp(1.2rem, 1.1rem + 0.5vw, 1.35rem);
  margin-top: 2em;
}

p,
ul {
  margin-block: 0 1.25rem;
}

/* Layout primitives — overlap-proof by construction */
.container {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

/* Skip link — hidden until keyboard-focused */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  /* -2px offsets the border-box seam: fractional line-height rounding can
     leave the bottom border visible when translating by exactly -100%. */
  transform: translateY(calc(-100% - 2px));
  z-index: 1000;
  padding: 0.75rem 1rem;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  border: 2px solid var(--focus);
}

.skip-link:focus {
  transform: translateY(0);
}

/* Programmatic focus target only */
#main-content:focus {
  outline: none;
}

/* Header / nav */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.75rem;
}

.site-title {
  font-size: 1.35rem;
}

.site-title a {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.site-title img {
  display: block;
  height: 2.75rem;
  width: auto;
}

.site-header nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  list-style: none;
  padding: 0;
}

.site-header nav a {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a:focus-visible {
  text-decoration: underline;
}

.site-header nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--hero-1), var(--hero-2));
  color: #ffffff;
  padding-block: clamp(2rem, 5vw, 3.5rem);
}

.hero h1 {
  color: #ffffff;
}

/* Content */
.content {
  padding-block: clamp(1.5rem, 4vw, 3rem);
}

.content p {
  max-inline-size: 75ch;
}

.content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.content a:hover {
  color: color-mix(in srgb, var(--accent) 80%, var(--text));
}

address {
  font-style: normal;
}

/* Download lists → responsive card grid */
ul.download-list {
  list-style: none;
  padding: 0;
  margin-block: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 1rem;
}

.download-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  color: var(--text-muted);
}

.download-list a {
  font-weight: 700;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* Procedural step lists keep normal list styling */
.content ul:not(.download-list) {
  padding-left: 1.5rem;
  margin-block: 0 1.5rem;
}

.content ul:not(.download-list) li + li {
  margin-top: 0.5rem;
}

/* Footer — pinned to the bottom on short pages via body flex column */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  padding-block: 1.5rem;
  margin-top: auto;
}

.site-footer .legal-notice {
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* Focus */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Motion */
@media (prefers-reduced-motion: no-preference) {
  a {
    transition: color 120ms ease;
  }

  .skip-link {
    transition: transform 120ms ease;
  }
}

/* Forced colors (Windows High Contrast) keeps affordances visible */
@media (forced-colors: active) {
  .skip-link,
  :focus-visible {
    outline-color: Highlight;
  }

  .download-list li {
    border-color: CanvasText;
  }
}
