/* ============================================================
   NAAS HOLDING — accessibility layer
   WCAG 2.2 Level AA / EN 301 549 support:

     1. shared utilities (skip link, visually-hidden text)
     2. a visible focus indicator that is never removed
     3. the accessibility options panel
     4. the preference modes the panel switches on, held as
        data-* attributes on <html> so they survive a reload
        and apply before first paint

   Everything here is additive. Removing this file leaves the
   site exactly as it was.
   ============================================================ */

/* ------------------------------------------------------------
   1. Utilities
   ------------------------------------------------------------ */

.sr-only {
  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;
}

/* Skip link — the first thing in the tab order on every page.
   Off-screen until focused, then it lands in the top corner. */
.skip-link {
  position: fixed;
  z-index: 1200;
  inset-block-start: 0.5rem;
  inset-inline-start: 0.5rem;
  transform: translateY(-160%);
  background: var(--paper);
  color: #00231B;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  border: 2px solid #00231B;
  border-radius: 2px;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.9);
  transition: transform 0.18s ease;
}
.skip-link:focus { transform: translateY(0); }

/* `main` takes focus when the skip link is used, without being
   a tab stop of its own. */
main:focus { outline: none; }
main:focus-visible { outline: 3px solid var(--accent-live); outline-offset: -3px; }

/* Hero legibility over the map (WCAG 1.4.3). The hero text sits on a
   canvas whose brightness changes — a city lighting up behind a line of
   type can lift the local background well above the dark field the
   colours were chosen against. Automated checkers report this as
   "undetermined" rather than a failure, so it passes an audit while
   still being hard to read. Two defences: lift the dimmer text, and
   give every hero line a dark halo so it keeps its own contrast
   wherever the map happens to be bright behind it. */
body[data-page="home"] .hero .hero-sub { color: rgba(237, 235, 226, 0.82); }
body[data-page="home"] .hero .hero-meta,
body[data-page="home"] .hero .scroll-cue { color: var(--ivory-dim); }
body[data-page="home"] .hero h1,
body[data-page="home"] .hero .hero-sub,
body[data-page="home"] .hero .kicker {
  text-shadow: 0 1px 0 rgba(0, 35, 27, 0.85), 0 0 18px rgba(0, 35, 27, 0.72);
}

/* Contrast repair (WCAG 1.4.3). The sage kicker on the mid-green
   section measured 4.11:1 against #074432 — one notch under the 4.5:1
   that text this size needs. Lifted until it measures 5.4:1. */
.s-dark .kicker { color: #9FC0B6; }
.s-dark .kicker::before { background: #9FC0B6; }
/* Same pairing, same shortfall: the roman numerals on the governance rows
   and the Arabic jump link in the legal page headers. */
.s-dark .row-idx { color: #9FC0B6; }
.page-hero .legal-jump { color: #9FC0B6; }

/* The ivory sections used to carry a texture on a pseudo-element, kept
   off the section's own background so contrast checkers could still
   measure a flat ivory. The texture is gone altogether now, so both the
   pseudo-element and the stacking rules that lifted content above it
   have gone with it — the background is flat because it is flat. */

/* Reflow (WCAG 1.4.10) and resize (1.4.4). At 320 CSS pixels with text
   enlarged, the contact column was held open past the viewport by the
   unbreakable email address, and the top-bar link was being cut off with
   an ellipsis — both are content loss. Grid children may now shrink,
   long addresses may break, and the top-bar link wraps instead of
   truncating. */
.wrap.split > *,
.wrap.contact-grid > *,
.split-side { min-width: 0; }
.contact-email a,
.footer-email,
a[href^="mailto:"] { overflow-wrap: anywhere; }

/* Form controls carry an intrinsic minimum width of roughly twenty
   characters. With the text enlarged that minimum was wider than a
   320-pixel screen and pushed the whole column off-canvas. */
.contact-form { min-width: 0; }
.form-row input,
.form-row select,
.form-row textarea { min-width: 0; width: 100%; }

/* The oversized decorative word in the footer grows with the text size
   and was the one thing still forcing a horizontal scrollbar at 320px. */
.site-footer { overflow: hidden; }
.footer-ghost { max-width: 100%; }

@media (max-width: 720px) {
  /* A long button label wraps rather than being cut off, and the
     generous desktop padding gives way so the label has room. */
  .btn { white-space: normal; text-align: center; padding-inline: 1.5rem; }
  .btn > span { min-width: 0; }
  .topbar-right a {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.35;
    padding-block: 0.6rem;
  }
}

/* Legal and statement pages: h2 now carries what h3 used to, so the
   heading levels run 1 → 2 with nothing skipped. Same size as before. */
.legal h2 { font-size: 1.22rem; color: var(--ink-strong); margin: 2.4rem 0 0.7rem; }
.legal h2:first-of-type { margin-top: 1.6rem; }

/* ------------------------------------------------------------
   2. Focus indicator (WCAG 2.4.7, 2.4.11, 1.4.11)
   Two-tone ring so it is visible on both the ivory sections and
   the deep green ones, at well over 3:1 against either.
   ------------------------------------------------------------ */

:focus-visible {
  outline: 3px solid #7EA59B;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(0, 35, 27, 0.55);
  border-radius: 2px;
}
.s-light :focus-visible,
.site-header :focus-visible,
.topbar :focus-visible {
  outline-color: #074432;
  box-shadow: 0 0 0 6px rgba(237, 235, 226, 0.75);
}

/* The site keeps the brand palette throughout — sage, the two greens
   and ivory. The one high-visibility yellow left in this file belongs
   to the accessibility modes below, which a visitor has to switch on
   deliberately; it never appears on the site as delivered. */

/* ------------------------------------------------------------
   3. The accessibility options panel
   ------------------------------------------------------------ */

.a11y-fab {
  position: fixed;
  z-index: 1100;
  inset-block-end: clamp(1rem, 3vw, 1.75rem);
  inset-inline-end: clamp(1rem, 3vw, 1.75rem);
  width: 52px; height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(237, 235, 226, 0.32);
  background: #074432;
  color: #EDEBE2;
  cursor: pointer;
  box-shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.95);
  transition: background 0.3s var(--ease), transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.a11y-fab:hover,
.a11y-fab[aria-expanded="true"] {
  background: #0d5940;
  border-color: rgba(174, 212, 199, 0.65);
  transform: translateY(-2px);
}
.a11y-fab svg { width: 26px; height: 26px; display: block; }

.a11y-panel {
  position: fixed;
  z-index: 1101;
  inset-block-end: calc(clamp(1rem, 3vw, 1.75rem) + 64px);
  inset-inline-end: clamp(1rem, 3vw, 1.75rem);
  width: min(21rem, calc(100vw - 2rem));
  max-height: min(78vh, 42rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #00231B;
  color: #EDEBE2;
  border: 1px solid rgba(237, 235, 226, 0.2);
  border-radius: 4px;
  box-shadow: 0 40px 90px -36px rgba(0, 0, 0, 0.95);
  padding: 1.35rem 1.35rem 1.1rem;
  font-family: var(--sans);
}
.a11y-panel[hidden] { display: none; }

.a11y-panel h2 {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  margin-block-end: 0.2rem;
  color: #EDEBE2;
}
.a11y-intro {
  font-size: 0.8rem;
  line-height: 1.55;
  color: rgba(237, 235, 226, 0.66);
  margin-block-end: 1.1rem;
}

.a11y-group { margin-block-end: 1.15rem; }
.a11y-group > .a11y-legend {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(237, 235, 226, 0.52);
  margin-block-end: 0.5rem;
}

.a11y-sizes { display: flex; gap: 0.4rem; }
.a11y-size {
  flex: 1 1 0;
  min-height: 44px;
  padding: 0.5rem 0.2rem;
  background: transparent;
  color: #EDEBE2;
  border: 1px solid rgba(237, 235, 226, 0.26);
  border-radius: 2px;
  font-family: var(--sans);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.a11y-size:hover { border-color: rgba(174, 212, 199, 0.7); }
.a11y-size[aria-pressed="true"] {
  background: #EDEBE2;
  border-color: #EDEBE2;
  color: #00231B;
}
/* The labels now carry their percentage, so the buttons hold a steady
   size and the ladder is read rather than inferred from the glyph. */
.a11y-size { font-size: 0.78rem; letter-spacing: 0.02em; white-space: nowrap; }

.a11y-switch {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0;
  background: none;
  border: 0;
  border-block-end: 1px solid rgba(237, 235, 226, 0.12);
  color: #EDEBE2;
  font-family: var(--sans);
  font-size: 0.88rem;
  text-align: start;
  cursor: pointer;
}
.a11y-switch:last-of-type { border-block-end: 0; }
.a11y-switch > span:first-child { flex: 1 1 auto; }

/* The track is decorative; the state is carried by aria-checked. */
.a11y-track {
  flex: 0 0 auto;
  width: 40px; height: 22px;
  border-radius: 11px;
  border: 1px solid rgba(237, 235, 226, 0.4);
  background: rgba(237, 235, 226, 0.08);
  position: relative;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
}
.a11y-track::after {
  content: "";
  position: absolute;
  inset-block-start: 3px;
  inset-inline-start: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #EDEBE2;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease);
}
.a11y-switch[aria-checked="true"] .a11y-track {
  background: #7EA59B;
  border-color: #AED4C7;
}
.a11y-switch[aria-checked="true"] .a11y-track::after {
  transform: translateX(18px);
  background: #00231B;
}
[dir="rtl"] .a11y-switch[aria-checked="true"] .a11y-track::after { transform: translateX(-18px); }

.a11y-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin-block-start: 1.1rem;
  padding-block-start: 0.9rem;
  border-block-start: 1px solid rgba(237, 235, 226, 0.14);
}
.a11y-reset {
  min-height: 44px;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid rgba(237, 235, 226, 0.3);
  border-radius: 2px;
  color: #EDEBE2;
  font-family: var(--sans);
  font-size: 0.82rem;
  cursor: pointer;
}
.a11y-reset:hover { border-color: rgba(174, 212, 199, 0.7); }
.a11y-foot a {
  color: #AED4C7;
  font-size: 0.82rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Below the fold of a small screen the panel becomes a sheet. */
@media (max-width: 480px) {
  .a11y-panel {
    inset-inline: 0.5rem;
    inset-block-end: calc(clamp(1rem, 3vw, 1.75rem) + 64px);
    width: auto;
  }
}

@media print {
  .a11y-fab, .a11y-panel, .skip-link { display: none !important; }
}

/* ------------------------------------------------------------
   4. Preference modes
   ------------------------------------------------------------ */

/* 4a. Text size — rem-based type scales with the root. */
html[data-a11y-text="115"] { font-size: 115%; }
html[data-a11y-text="130"] { font-size: 130%; }
html[data-a11y-text="150"] { font-size: 150%; }

/* 4b. Reduced motion, chosen in the panel rather than in the OS.
   Mirrors the @media (prefers-reduced-motion) rules in styles.css. */
html[data-a11y-motion="reduce"] { scroll-behavior: auto; }
html[data-a11y-motion="reduce"] .rv,
html[data-a11y-motion="reduce"] .rv-wipe {
  opacity: 1; transform: none; clip-path: none; transition: none;
}
html[data-a11y-motion="reduce"] *,
html[data-a11y-motion="reduce"] *::before,
html[data-a11y-motion="reduce"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}
html[data-a11y-motion="reduce"] .grain,
html[data-a11y-motion="reduce"] .cursor-dot,
html[data-a11y-motion="reduce"] .cursor-ring,
html[data-a11y-motion="reduce"] .marquee,
html[data-a11y-motion="reduce"] #hero3d,
html[data-a11y-motion="reduce"] #lattice,
html[data-a11y-motion="reduce"] .hero-whisper,
html[data-a11y-motion="reduce"] .s-light::after { display: none !important; }
/* The hero keeps its gradient so the headline still sits on a field. */
html[data-a11y-motion="reduce"] .hero-mesh { opacity: 0.5; animation: none !important; }

/* 4c. Underline every link (WCAG 1.4.1 — never colour alone) */
html[data-a11y-links="underline"] main a,
html[data-a11y-links="underline"] .site-footer a,
html[data-a11y-links="underline"] .main-nav a,
html[data-a11y-links="underline"] .topbar a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

/* 4d. Readable typeface — one humanist sans everywhere, looser
   line height and no decorative letter-spacing. */
html[data-a11y-font="readable"] {
  --serif: "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
}
html[data-a11y-font="readable"] body { line-height: 1.85; }
html[data-a11y-font="readable"] h1,
html[data-a11y-font="readable"] h2,
html[data-a11y-font="readable"] h3,
html[data-a11y-font="readable"] h4,
html[data-a11y-font="readable"] .kicker,
html[data-a11y-font="readable"] .btn {
  letter-spacing: 0.01em;
  font-style: normal;
}
html[data-a11y-font="readable"] p,
html[data-a11y-font="readable"] li { max-width: 68ch; }

/* 4e. Enhanced focus ring */
html[data-a11y-focus="strong"] :focus-visible {
  outline: 4px solid #FFD400 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 8px rgba(0, 0, 0, 0.9) !important;
}

/* 4f. High contrast.
   Brand colour gives way to contrast: ivory text on near-black,
   a single high-visibility accent, solid borders, no decorative
   wash. Every pair here is at or above 7:1. */
html[data-a11y-contrast="high"] {
  --void: #000000;
  --ink: #000000;
  --ink-2: #000000;
  --panel: #0a0a0a;
  --paper: #ffffff;
  --paper-2: #ffffff;
  --white: #ffffff;
  --ivory: #ffffff;
  --ivory-dim: #ffffff;
  --ivory-faint: #e6e6e6;
  --text: #000000;
  --text-dim: #1a1a1a;
  --ink-strong: #000000;
  --accent: #000000;
  --accent-live: #FFD400;
  --accent-glow: rgba(255, 212, 0, 0.5);
  --line-light: #000000;
  --line-dark: #ffffff;
}
html[data-a11y-contrast="high"] body { background: #000; color: #fff; }
html[data-a11y-contrast="high"] .s-light,
html[data-a11y-contrast="high"] .s-light * { color: #000; }
html[data-a11y-contrast="high"] .s-light { background: #fff; }
html[data-a11y-contrast="high"] a { text-decoration: underline; text-underline-offset: 3px; }
html[data-a11y-contrast="high"] .s-light a { color: #000; }
html[data-a11y-contrast="high"] main a:not(.btn) { color: #FFD400; }
html[data-a11y-contrast="high"] .s-light a:not(.btn) { color: #0b3d2c; }
html[data-a11y-contrast="high"] .btn-primary {
  background: #FFD400; color: #000; border: 2px solid #000;
}
html[data-a11y-contrast="high"] .btn-ghost {
  background: #000; color: #fff; border: 2px solid #fff;
}
html[data-a11y-contrast="high"] .s-light .btn-ghost {
  background: #fff; color: #000; border: 2px solid #000;
}
html[data-a11y-contrast="high"] .site-header,
html[data-a11y-contrast="high"] .topbar { background: #fff; color: #000; border-block-end: 2px solid #000; }
html[data-a11y-contrast="high"] .topbar a,
html[data-a11y-contrast="high"] .main-nav a,
html[data-a11y-contrast="high"] .nav-toggle { color: #000; }
html[data-a11y-contrast="high"] .site-footer { background: #000; color: #fff; border-block-start: 2px solid #fff; }
html[data-a11y-contrast="high"] .site-footer a { color: #FFD400; }
html[data-a11y-contrast="high"] input,
html[data-a11y-contrast="high"] select,
html[data-a11y-contrast="high"] textarea {
  background: #fff; color: #000; border: 2px solid #000;
}
/* Decoration that only reads as texture is dropped — it cannot
   carry meaning and it lowers the contrast of what sits on it. */
html[data-a11y-contrast="high"] #hero3d,
html[data-a11y-contrast="high"] #lattice,
html[data-a11y-contrast="high"] .hero-mesh,
html[data-a11y-contrast="high"] .grain,
html[data-a11y-contrast="high"] .hero-whisper,
html[data-a11y-contrast="high"] .footer-ghost,
html[data-a11y-contrast="high"] .whisper,
html[data-a11y-contrast="high"] .sadu,
html[data-a11y-contrast="high"] .cursor-dot,
html[data-a11y-contrast="high"] .cursor-ring { display: none !important; }
html[data-a11y-contrast="high"] .sector,
html[data-a11y-contrast="high"] .pillar,
html[data-a11y-contrast="high"] .row,
html[data-a11y-contrast="high"] .card,
html[data-a11y-contrast="high"] .def-row {
  background: #000; border: 2px solid #fff; box-shadow: none !important;
}
html[data-a11y-contrast="high"] .s-light .sector,
html[data-a11y-contrast="high"] .s-light .pillar,
html[data-a11y-contrast="high"] .s-light .row,
html[data-a11y-contrast="high"] .s-light .card,
html[data-a11y-contrast="high"] .s-light .def-row {
  background: #fff; border: 2px solid #000;
}
html[data-a11y-contrast="high"] .a11y-panel { border-color: #fff; }

/* Windows / macOS forced-colours mode: hand everything to the OS. */
@media (forced-colors: active) {
  .a11y-fab, .a11y-panel { border: 1px solid CanvasText; }
  .a11y-track { border: 1px solid CanvasText; }
  .a11y-switch[aria-checked="true"] .a11y-track { background: Highlight; }
  :focus-visible { outline: 3px solid CanvasText; }
  .skip-link { border: 2px solid CanvasText; }
}

/* The hidden skip link's shadow leaked into the top corner of every
   page. The shadow now exists only while the link is on screen. */
.skip-link { box-shadow: none; }
.skip-link:focus, .skip-link:focus-visible { box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.9); }

/* The panel headings without spaced capitals, like the rest of the site. */
.a11y-group > .a11y-legend { text-transform: none; letter-spacing: 0.005em; }
