/* Additive accessibility corrections; the original desktop theme is retained. */

/* The runtime measures the sticky header. Count its height once, on the
   scrolling element; target margins provide a little additional clearance. */
html {
  scroll-padding-top: var(--sticky-header-offset, 110px);
}

:focus-visible {
  scroll-margin-block: 16px;
}

.content-section {
  scroll-margin-top: 16px;
}

[tabindex]:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 5px;
}

/* #586671: 5.37579:1 on #f6f4ef, 5.90893:1 on white. */
.updated,
.source-list h2,
.source-list li,
.source-list p,
.hero-photo figcaption {
  color: #586671;
}

/* Decorative numbering keeps the existing brass palette.
   #766348: 5.23629:1 on #f6f4ef, 5.75560:1 on white. */
.document-link .doc-icon {
  color: #766348;
}

/* Native controls must be able to shrink inside the route form's grid. */
.route-form,
.route-form .field {
  min-width: 0;
}

.route-form input,
.route-form select,
.route-form textarea,
.route-form button {
  min-width: 0;
  max-width: 100%;
  font-size: max(1rem, 16px);
}

/* The 404 footer uses h2 headings without changing their visual treatment. */
.footer h2 {
  font-size: 9px;
  font-weight: 600;
  line-height: 1.7;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: #d6bc95;
  margin: 0 0 19px;
}

/* Supplementary accessible text, including new-tab notices. */
.sr-only {
  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;
}

/* Existing mobile breakpoint. Wrapping is used instead of clipping enlarged
   text; the ordinary desktop grid and header layout remain unchanged. */
@media (max-width: 820px) {
  .shell {
    overflow-wrap: anywhere;
  }

  .header-inner {
    flex-wrap: wrap;
    row-gap: 12px;
    padding-block: 12px;
  }

  .brand {
    min-width: 0;
    max-width: 100%;
  }

  .brand-name {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .brand-symbol {
    flex-shrink: 0;
  }

  .nav-toggle {
    flex: 0 0 auto;
    max-width: 100%;
    margin-left: auto;
  }

  .hero > *,
  .service-split > *,
  .route-panel > *,
  .document-list > *,
  .step-grid > *,
  .about-split > *,
  .faq-layout > *,
  .footer-top > *,
  .page-index > *,
  .contact-grid > * {
    min-width: 0;
  }

  .button,
  .text-link,
  .document-link {
    min-width: 0;
    max-width: 100%;
  }

  .document-link > span,
  .about-panel blockquote {
    min-width: 0;
  }

  .document-link .doc-icon,
  .document-link .arrow {
    flex-shrink: 0;
  }

  .status-badge {
    max-width: 100%;
    white-space: normal;
  }

  .skip-link {
    max-width: calc(100% - 24px);
    overflow-wrap: anywhere;
  }
}

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

/* Preserve native high-contrast colour choices and visible control edges. */
@media (forced-colors: active) {
  .button,
  .button:hover,
  .button.light,
  .button.light:hover,
  .button.outline,
  .button.outline:hover,
  .nav-toggle,
  .field input,
  .field select,
  .field textarea {
    forced-color-adjust: auto;
    color: ButtonText;
    background: ButtonFace;
    border-color: ButtonText;
  }

  .check-item input {
    appearance: auto;
    accent-color: auto;
    forced-color-adjust: auto;
  }

  .brand-symbol,
  .footer .brand-symbol,
  .document-link .doc-icon {
    color: CanvasText;
    border-color: CanvasText;
  }

  .faq-item summary::after {
    color: ButtonText;
  }

  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  summary:focus-visible,
  [tabindex]:focus-visible {
    outline-color: Highlight;
    box-shadow: none;
  }
}

/* Existing spacing, moved from inline attributes for the strict CSP. */
.padding-top-small { padding-top: 10px; }
.padding-top-medium { padding-top: 15px; }
.margin-top-section { margin-top: 35px; }
