/* NEXX audit completion layer — additive, URL/SEO/funnel safe. */
:root {
  /* Compact 4px rhythm. The previous audit layer accidentally doubled the
     shared shell scale and made every card, FAQ row and CTA oversized. */
  --nx-space-1: .25rem;
  --nx-space-2: .5rem;
  --nx-space-3: .75rem;
  --nx-space-4: 1rem;
  --nx-space-5: 1.25rem;
  --nx-space-6: 1.5rem;
  --nx-space-8: 2rem;
  --nx-touch: 3rem;
  --nx-wa: #117f3a;
  --nx-link-visited: #c4b5fd;
  --nx-feedback-fast: 120ms;
  --nx-feedback-ease: ease-out;
}

/* Shared interaction contract, 2026-10: WCAG 2.2 + GOV.UK link conventions.
   Keep the established NEXX palette and compact 4px spacing scale. */
html { scroll-padding-block: 5.5rem 1.5rem; }
/* Inline links must be distinguishable without relying on cyan alone. Navigation,
   product cards and payment actions retain their independent affordances. */
html body :is(.nx-prose, .nx-guide-article, .nx-guide-body article, .nx-document-section, .nx-community, .nx-bios, .nx-bios-modal, .landing-app, .nx-company)
  :is(p, li, dd) a:not(:is([role="button"], .nx-page-btn, .nx-btn, .nx-bios-cta, .nx-bios-method, .nx-guide-card)) {
  text-decoration-line: underline;
  text-decoration-thickness: .075em;
  text-underline-offset: .2em;
  text-decoration-skip-ink: auto;
  overflow-wrap: anywhere;
}
html body :is(.nx-prose, .nx-guide-article, .nx-guide-body article, .nx-document-section)
  :is(p, li, dd) a:visited:not(:is([role="button"], .nx-page-btn, .nx-btn, .nx-bios-cta, .nx-guide-card)) {
  color: var(--nx-link-visited);
}
html body :is(.nx-prose, .nx-guide-article, .nx-guide-body article, .nx-document-section, .nx-community, .nx-bios, .nx-bios-modal, .landing-app)
  :is(p, li, dd) a:hover:not(:is([role="button"], .nx-page-btn, .nx-btn, .nx-bios-cta, .nx-bios-method, .nx-guide-card)) {
  text-decoration-thickness: .14em;
}
/* Feedback changes paint, not geometry; no growing or moving button on press. */
html body :is(.nx-btn, .nx-page-btn, .nx-bios-cta, .nx-bios-method, .nx-store-change, .nx-community button, .nx-service-auth-submit) {
  touch-action: manipulation;
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: var(--nx-feedback-fast);
  transition-timing-function: var(--nx-feedback-ease);
}
html body :is(.nx-btn, .nx-page-btn, .nx-bios-cta, .nx-bios-method, .nx-store-change, .nx-community button, .nx-service-auth-submit):active:not(:disabled):not([aria-disabled="true"]) {
  box-shadow: inset 0 0 0 2px currentColor;
  transform: none;
  scale: none;
}
html body :is(.nx-btn, .nx-page-btn, .nx-bios-cta, .nx-bios-method) { white-space: normal; text-align: center; }
html body :is(button, input, select, textarea)[aria-busy="true"] { cursor: progress; }
html body :is(.nx-bios-price, .nx-bios-check-result__price, .nx-bios-product__price) { font-variant-numeric: tabular-nums; }
html body :is(input, select, textarea)::placeholder { color: var(--nx-muted, #94a3b8); opacity: 1; }

/* Do not impose text/control sizes on diagrams, full-screen tests or provider iframes. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  html body :is(.nx-btn, .nx-page-btn, .nx-bios-cta, .nx-bios-method, .nx-store-change, .nx-community button, .nx-service-auth-submit, .nx-guide-card, .nx-shared-dialog) { transition: none !important; animation: none !important; }
}

/* The audit found local pages that explicitly zeroed the keyboard ring. */
html body :is(a, button, input, select, textarea, summary, [role="button"], [tabindex]):focus-visible {
  outline: 3px solid var(--nx-accent-soft, #67e8f9) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 2px var(--nx-ink, #060a12) !important;
}

.nx-skip-link {
  position: fixed;
  z-index: 100000;
  top: max(.5rem, env(safe-area-inset-top, 0px));
  left: max(.5rem, env(safe-area-inset-left, 0px));
  min-height: var(--nx-touch);
  display: inline-flex;
  align-items: center;
  padding: .75rem 1rem;
  border-radius: .75rem;
  background: var(--nx-text, #f8fafc);
  color: var(--nx-ink, #060a12);
  font: 700 .875rem/1.2 var(--nx-font-body, system-ui, sans-serif);
  text-decoration: none;
  transform: translateY(calc(-100% - 1.5rem));
  transition: transform .16s ease;
}
.nx-skip-link:focus-visible { transform: translateY(0); }

.nx-audit-breadcrumbs {
  position: relative;
  z-index: 2;
  width: min(72rem, calc(100% - 2rem));
  margin: 0 auto;
  padding-top: calc(5rem + env(safe-area-inset-top, 0px));
  color: var(--nx-muted, #94a3b8);
  font: 600 .8125rem/1.5 var(--nx-font-body, system-ui, sans-serif);
}
.nx-audit-breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nx-audit-breadcrumbs li { display: inline-flex; align-items: center; gap: .5rem; }
.nx-audit-breadcrumbs li + li::before { content: "/"; color: var(--nx-faint, #64748b); }
.nx-audit-breadcrumbs a {
  min-height: var(--nx-touch);
  display: inline-flex;
  align-items: center;
  color: var(--nx-accent-soft, #67e8f9);
  text-underline-offset: .2em;
}
.nx-audit-breadcrumbs [aria-current="page"] { color: var(--nx-text, #f1f5f9); }

/* The breadcrumb supplies the fixed-header offset; avoid a second large empty band. */
.nx-has-audit-breadcrumbs :is(.nx-page-hero, .nx-guide-hero, .nx-b2b-hero) { padding-top: var(--nx-space-4); }
.nx-has-audit-breadcrumbs #app > main > :first-child { scroll-margin-top: 7rem; }
.nx-has-audit-breadcrumbs :is(.nx-page-hero, .nx-guide-hero, .nx-b2b-hero) > .nx-shell {
  padding-top: var(--nx-space-4) !important;
}
.nx-has-audit-breadcrumbs #app > article.nx-prose,
.nx-has-audit-breadcrumbs #app > article.nx-bios {
  padding-top: var(--nx-space-4) !important;
}

/* One reading system for guides and legal/service prose. */
.nx-prose :is(p, li),
.nx-guide-article :is(p, li),
.nx-guide-body article :is(p, li) { line-height: 1.6; }
.nx-prose,
.nx-prose article,
.nx-guide-article,
.nx-guide-body article { max-width: 65ch; }
.nx-prose :is(h2, h3),
.nx-guide-article :is(h2, h3) { scroll-margin-top: 7rem; }

/* Consistent 48px targets across desktop and touch layouts. */
html body .nx-guide-link { min-height: var(--nx-touch); display: inline-flex; align-items: center; }
html body header :is(a, button),
html body footer :is(.nx-foot-link, .nx-foot-contact a, .nx-foot-location, a[aria-label], a[href="/directions"]) {
  min-height: var(--nx-touch) !important;
}
html body footer :is(.nx-foot-link, .nx-foot-contact a, a[href="/directions"]) {
  display: flex;
  align-items: center;
}
html body :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { min-height: var(--nx-touch); }

/* WhatsApp green meets AA with white type; other CTAs stay visibly secondary. */
html body :is(.nx-page-btn--wa, .nx-btn--wa, .nx-sticky-mobile-cta a[href*="wa.me"], a[href*="api.whatsapp.com"]) {
  background: #117f3a !important;
  border-color: #0d6c31 !important;
  color: #fff !important;
}
#b2b-form p.text-slate-500 { color: var(--nx-muted, #94a3b8) !important; }
#b2b-form .nx-b2b-channels a[href*="wa.me"] { color: #4ade80 !important; }
.nx-guide-cta-row .nx-page-btn--primary:not([href*="wa.me"]),
.nx-page-cta .nx-page-btn--primary:not([href*="wa.me"]) {
  background: transparent;
  border-color: color-mix(in srgb, var(--nx-brand, #1d4ed8) 72%, var(--nx-border, #334155));
  color: var(--nx-text, #f1f5f9);
}
.nx-guide-cta-row .nx-page-btn--primary:not([href*="wa.me"]):hover,
.nx-page-cta .nx-page-btn--primary:not([href*="wa.me"]):hover {
  background: color-mix(in srgb, var(--nx-brand, #1d4ed8) 16%, transparent);
}
.nx-sticky-mobile-cta .nx-sticky-mobile-cta__secondary {
  background: transparent !important;
  border: 1px solid color-mix(in srgb, var(--nx-brand, #1d4ed8) 72%, var(--nx-border, #334155)) !important;
  color: var(--nx-text, #f1f5f9) !important;
}

/* Form help, inline errors, progress and result states. */
.nx-field-help,
.nx-field-error {
  display: block;
  margin-top: .5rem;
  font: 600 .8125rem/1.45 var(--nx-font-body, system-ui, sans-serif);
}
.nx-field-help { color: var(--nx-muted, #94a3b8); }
.nx-field-error { color: #fca5a5; }
html body [aria-invalid="true"] {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 1px #ef4444 !important;
}
html body form[aria-busy="true"] { cursor: progress; }
html body form[aria-busy="true"] :is(input, select, textarea, button) { opacity: .72; }

/* Preserve a usable page when JavaScript is unavailable or still loading. */
.nx-prerender-fallback {
  width: min(72rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: var(--nx-space-4) 0 var(--nx-space-8);
  color: var(--nx-text, #f1f5f9);
  font-family: var(--nx-font-body, system-ui, sans-serif);
}
.nx-prerender-fallback h1 { margin: 0 0 var(--nx-space-2); font-size: clamp(2rem, 7vw, 3.5rem); line-height: 1.08; }
.nx-prerender-fallback h2 { margin: var(--nx-space-4) 0 var(--nx-space-2); font-size: clamp(1.25rem, 4vw, 1.75rem); }
.nx-prerender-fallback p,
.nx-prerender-fallback li { max-width: 65ch; line-height: 1.6; color: var(--nx-muted, #cbd5e1); }
.nx-prerender-fallback a { color: var(--nx-accent-soft, #67e8f9); }
.nx-prerender-fallback__links { display: grid; gap: var(--nx-space-1); padding-left: 1.2rem; }

/* Complete the 8pt cadence without changing content order or page identity. */
.nx-b2b-section,
.nx-guide-body { padding-block: clamp(var(--nx-space-4), 6vw, var(--nx-space-8)); }
.nx-b2b-form-card { gap: var(--nx-space-2); }
.nx-tile-grid,
.nx-guide-list,
.nx-flow { gap: var(--nx-space-2); }

@media (max-width: 767px) {
  body:has(.nx-sticky-mobile-cta) { padding-bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px)); }
  .nx-audit-breadcrumbs {
    width: min(100% - 1rem, 72rem);
    padding-top: calc(4.25rem + env(safe-area-inset-top, 0px));
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nx-audit-breadcrumbs ol { flex-wrap: wrap; width: 100%; max-width: 100%; }
  .nx-audit-breadcrumbs li:last-child { min-width: 0; max-width: 100%; }
  .nx-audit-breadcrumbs li:last-child span {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .nx-guide-cta-row,
  .nx-b2b-cta-row { align-items: stretch; }
  .nx-guide-cta-row .nx-page-btn,
  .nx-b2b-cta-row .nx-page-btn { flex: 1 1 100%; }
}

@media (min-width: 768px) {
  .nx-audit-breadcrumbs { padding-top: calc(4.5rem + env(safe-area-inset-top, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  .nx-skip-link { transition: none; }
}

/* Light palette completion: keep the dark theme untouched and translate
   legacy dark-page utilities into one accessible daylight scale. */

/* SEO service, contact and diagnostic articles still carry dark Tailwind
   utility names in their generated markup. Scope the translation to the
   article so header, footer and branded buttons remain intentional. */

/* FAQ and About used deliberately dark section utilities before a light theme
   existed. These semantic wrappers let the whole page follow the chosen theme. */

/* A light document may still contain intentionally dark chrome. Reset its
   local tokens so inherited light typography never becomes dark-on-dark. */

/* One contrast-safe treatment for remaining light-theme links and states. */

/* The mobile conversion rail is a single light surface. Legacy dark utility
   classes otherwise leave its secondary CTA dark-on-dark in the light theme. */

/* Keep the map legible: the generic overlay uses --nx-ink, which is a near-white
   canvas in the light theme and previously washed the whole map out. */

/* Final full-sitemap pass: a few legacy standalone pages still wrap their
   content in Tailwind's dark canvas utilities. Keep their hero intentionally
   dark, but let the reading surface follow the selected light theme. */

/* Muted utility colors were created for larger desktop copy. Raise them to a
   single AA-safe dark-theme tone for captions, bylines and footer legal text. */

/* Backgrounded WhatsApp CTAs use one accessible green in both themes. Inline
   WhatsApp links keep the normal link palette. */
html body.nx-page a[href*="wa.me"][class*="bg-"],
html body.nx-page a[href*="api.whatsapp.com"][class*="bg-"] {
  background: #0b7a3d !important;
  border-color: #086532 !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}
html body.nx-page a[href*="wa.me"][class*="bg-"]:hover,
html body.nx-page a[href*="api.whatsapp.com"][class*="bg-"]:hover {
  background: #086532 !important;
  color: #fff !important;
}

/* Colour-first daylight theme (2026-08-30).
   The dark theme remains the default. In light mode, white is reserved for
   form controls; page bands and cards carry a restrained NEXX colour tint. */

/* BIOS layout and type live in nx-page-shell.css; this late layer only
   handles the shared breadcrumb rail and must not restore tiny form copy. */
@media (max-width: 480px) {
  body.nx-page:has(.nx-bios-hero) .nx-audit-breadcrumbs {
    display: none;
  }
  body.nx-page.nx-has-audit-breadcrumbs #app > article.nx-bios:has(.nx-bios-hero) {
    padding-top: calc(4.5rem + env(safe-area-inset-top, 0px)) !important;
  }
}

@media (max-width: 767px) {
  html body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]), select, textarea) { font-size: max(16px, 1em); }
}
@media (forced-colors: active) {
  html body :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline-color: Highlight !important; box-shadow: none !important; }
  html body :is(button, input, select, textarea) { border-color: ButtonText; }
  html body :is(input[type="checkbox"], input[type="radio"]) { accent-color: auto; }
}

/* Approved NEXX Obsidian / cobalt. Paint only: no layout, media, motion,
   typography, payment brands, diagnostic patterns or behavior changes.
   Repeated root specificity keeps late-loaded page bundles from reverting tokens. */
@media screen {
  :root:root {
    --nx-ink: #090c10;
    --nx-surface: #121820;
    --nx-surface-2: #121820;
    --nx-elevated: #1b2430;
    --nx-text: #f4f6fa;
    --nx-muted: #aab6c7;
    --nx-faint: var(--nx-muted);
    --nx-border: #2c3745;
    --nx-border-strong: #465365;
    --nx-border-control: #758398;
    --nx-brand: #2563eb;
    --nx-brand-hover: #1d4ed8;
    --nx-brand-deep: #1e3a8a;
    --nx-accent: #2563eb;
    --nx-accent-strong: #1d4ed8;
    --nx-accent-soft: #82b6ff;
    --nx-on-accent: #ffffff;
    --nx-trust-text: #65d6a0;
    --nx-info-text: #bfdbfe;
    --nx-success-text: #65d6a0;
    --nx-warning-text: #f4c46b;
    --nx-error-text: #ff9198;
    /* Labs and admin chrome use these existing aliases. Test stages keep their
       literal calibration colors, chart series and stop/record button colors. */
    --bg: var(--nx-ink);
    --panel: var(--nx-surface);
    --raised: var(--nx-elevated);
    --text: var(--nx-text);
    --muted: var(--nx-muted);
    --line: var(--nx-border);
    --control-line: var(--nx-border-control);
    --cyan: var(--nx-accent-soft);
    --brand: var(--nx-brand);
    --brand-hover: var(--nx-brand-hover);
    --on-brand: var(--nx-on-accent);
    --accent: var(--nx-accent-soft);
    --blue: var(--nx-brand);
    --light: var(--nx-accent-soft);
    --edge: var(--nx-border);
    --labs-bg: var(--nx-ink);
    --labs-surface: var(--nx-surface);
    --labs-elevated: var(--nx-elevated);
    --labs-text: var(--nx-text);
    --labs-muted: var(--nx-muted);
    --labs-cyan: var(--nx-accent-soft);
    --labs-blue: var(--nx-brand);
    --labs-border: var(--nx-border);
    --labs-border-strong: var(--nx-border-control);
    --labs-danger: var(--nx-error-text);
    --labs-success: var(--nx-success-text);
  }
  html body { background-color: var(--nx-ink); color: var(--nx-text); }
  html body ::selection { background: #2563eb; color: #ffffff; }
  html body :is(input, textarea) { caret-color: var(--nx-accent-soft); }
  html body.labs-body {
    background-image: radial-gradient(circle at 76% 4%, rgba(37, 99, 235, .16), transparent 28rem),
      radial-gradient(circle at 12% 24%, rgba(130, 182, 255, .07), transparent 24rem);
  }
  html .labs-tool-tile-ready .labs-tile-icon,
  html .labs-wifi-export .labs-button { background: rgba(130, 182, 255, .07); }
  html .labs-signal-ring { border-color: rgba(130, 182, 255, .18); }
  /* Keep measured-series colors paired with the unchanged chart renderers. */
  html .labs-chart-panel, html .labs-chart-legend { --labs-cyan: #70b8ff; }
}
