/* Shared: tokens, reset, footer, legal layout (all pages) */
:root {
  color-scheme: light;
  --sr-blue-deep: #0d47a1;
  --sr-blue: #1565c0;
  --sr-teal: #00897b;
  --sr-green: #43a047;
  --sr-hero-mint: #7bb8a4;
  --sr-gray-900: #111827;
  --sr-gray-600: #6b7280;
  --sr-link: #0d6efd;
  --sr-badge-bg: #e3f2fd;
  --sr-badge-border: rgba(21, 101, 192, 0.18);
  --sr-hero-border-hover: rgba(21, 101, 192, 0.2);
  --sr-bg-page: #f8f9fa;
  --sr-text: #212529;
  /* Footer text: ~5:1 on --sr-bg-page for WCAG 2.1 AA body contrast */
  --sr-footer-text: #495057;
  --sr-border: #dee2e6;
  --sr-sep: #adb5bd;
  --sr-surface: #fff;
  --sr-legal-muted: #495057;
  --sr-legal-body: #343a40;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--sr-bg-page);
  color: var(--sr-text);
  line-height: 1.6;
  font-size: 1rem;
  -webkit-tap-highlight-color: rgba(21, 101, 192, 0.12);
}

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

a, button {
  touch-action: manipulation;
}

/* Screen-reader-only labels (e.g. “opens in new tab”) */
.visually-hidden {
  position: absolute;
  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;
}

.skip-link {
  position: absolute;
  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;
}

.skip-link:focus,
.skip-link:focus-visible {
  position: fixed;
  top: max(0.5rem, env(safe-area-inset-top, 0px));
  left: max(0.5rem, env(safe-area-inset-left, 0px));
  z-index: 10000;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  clip-path: none;
  padding: 0.5rem 1rem;
  background: var(--sr-surface);
  color: var(--sr-text);
  border: 2px solid var(--sr-blue);
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  outline: 2px solid var(--sr-blue);
  outline-offset: 2px;
}

a:focus-visible {
  outline: 2px solid var(--sr-blue);
  outline-offset: 2px;
}

.privacy-choice:focus-visible {
  outline-offset: 4px;
  border-radius: 2px;
}

/* Footer — no extra padding; safe-area only for notched devices */
.site-footer {
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  text-align: center;
  font-size: 0.75rem;
  color: var(--sr-footer-text);
}

.site-footer a {
  color: inherit;
  text-decoration: underline;
}

.site-footer a:hover { color: var(--sr-text); }

.footer-rule {
  border: none;
  border-top: 1px solid var(--sr-border);
  margin: 0 auto;
  max-width: 56rem;
}

.footer-copy {
  max-width: 48rem;
  margin: 0 auto;
  line-height: 1.25;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 0.2rem;
  max-width: 48rem;
  margin: 0 auto;
}

/* WCAG 2.5.8 minimum 24×24px; no extra link padding */
.footer-legal a,
.footer-legal .privacy-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.5rem;
  min-width: 1.5rem;
  padding: 0;
  box-sizing: border-box;
}

.footer-legal .sep {
  user-select: none;
  color: var(--sr-sep);
}

.privacy-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.privacy-choice .privacy-icon { flex-shrink: 0; }

/* Legal / content pages */
.legal-page {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.legal-header {
  padding: 1rem max(1.25rem, env(safe-area-inset-right, 0px)) 1rem max(1.25rem, env(safe-area-inset-left, 0px));
  padding-top: max(1rem, env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--sr-border);
  background: var(--sr-surface);
}

.legal-header a {
  color: var(--sr-link);
  text-decoration: none;
  font-size: 0.9375rem;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.25rem 0;
  box-sizing: border-box;
}

.legal-header a:hover {
  text-decoration: underline;
}

.legal-header a:focus-visible {
  outline: 2px solid var(--sr-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

.legal-main {
  flex: 1;
  max-width: 44rem;
  margin: 0 auto;
  padding: 2rem max(1.25rem, env(safe-area-inset-right, 0px)) calc(3rem + env(safe-area-inset-bottom, 0px)) max(1.25rem, env(safe-area-inset-left, 0px));
  width: 100%;
}

.legal-main h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.legal-meta {
  color: var(--sr-legal-muted);
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
}

.legal-main h2 {
  font-size: 1.125rem;
  margin: 1.75rem 0 0.5rem;
}

.legal-main p,
.legal-main li {
  margin-bottom: 0.75rem;
  color: var(--sr-legal-body);
}

.legal-main ul {
  margin: 0.5rem 0 1rem 1.25rem;
}

.legal-main a {
  color: var(--sr-link);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.legal-main a:hover {
  text-decoration: underline;
}

.legal-main a:focus-visible {
  outline: 2px solid var(--sr-blue);
  outline-offset: 2px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }
}

/* Responsive */
@media (max-width: 640px) {
  body {
    font-size: 1.0625rem;
  }

  .site-footer {
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    line-height: 1.3;
    font-size: 0.8125rem;
  }
  .footer-line {
    display: block;
  }
  .footer-legal {
    gap: 0 0.15rem;
  }
  .footer-legal a,
  .footer-legal .privacy-choice {
    min-height: 1.5rem;
    min-width: 1.5rem;
    padding: 0;
  }
  .legal-header {
    padding: 0.75rem max(1rem, env(safe-area-inset-right, 0px)) 0.75rem max(1rem, env(safe-area-inset-left, 0px));
    padding-top: max(0.75rem, env(safe-area-inset-top, 0px));
  }
  .legal-header a {
    font-size: 1rem;
    min-height: 2.75rem;
    padding: 0.35rem 0;
  }
  .legal-main {
    padding: 1.5rem max(1rem, env(safe-area-inset-right, 0px)) calc(2.5rem + env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
  }
  .legal-main h1 {
    font-size: 1.5rem;
    line-height: 1.2;
  }
  .legal-main h2 {
    font-size: 1.1875rem;
    line-height: 1.3;
  }
  .legal-meta {
    font-size: 0.9375rem;
    line-height: 1.45;
  }
}

@media (max-width: 480px) {
  .footer-legal {
    flex-direction: column;
    gap: 0;
    width: 100%;
    max-width: 100%;
  }
  .footer-legal .sep {
    display: none;
  }
  .footer-legal a,
  .footer-legal .privacy-choice {
    width: 100%;
    max-width: 20rem;
    min-height: 1.5rem;
    padding: 0;
    justify-content: center;
  }
}
