/* =========================================================================
   AssocBridge design system — base.css
   Typography, links, focus, skip link, Razor validation helpers, utilities,
   print and reduced motion. Depends on tokens.css.
   ========================================================================= */

/* ---------- Document ---------- */
html {
  scroll-behavior: smooth;
  /* WCAG 2.2 SC 2.4.11 Focus Not Obscured: keep keyboard focus and #anchors clear of the sticky header / bottom save bar */
  scroll-padding-top: 7rem; scroll-padding-bottom: 5rem;
}
body {
  font-family: var(--font-sans);
  font-feature-settings: 'cv11', 'ss03';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-width: 320px;
  overflow-wrap: break-word;
}
[hidden] { display: none !important; }
::selection { background: var(--gold-100); color: var(--navy-950); }

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -.01em;
}
h1, h2, .h1, .h2, .font-serif, .serif, .hero-title, .page-title, .auth-title, .app-title, .section-title, .cta-title { font-family: var(--font-serif); }
h3, h4, h5, h6, .h3, .h4, .h5, .h6 { font-family: var(--font-sans); letter-spacing: -.005em; }
p { text-wrap: pretty; }
a { text-underline-offset: .18em; text-decoration-thickness: 1px; }
.text-muted, .text-secondary { color: var(--muted) !important; }
.tnum, table, .stat-num, .regid, .datebadge, .kpi-num, .stage-count, .counter { font-variant-numeric: tabular-nums lining-nums; }
.mw-prose { max-width: var(--measure); }
.mw-feed { max-width: var(--measure-wide); }
.prose > * + * { margin-top: 1em; }
.prose h2 { font-size: var(--fs-xl); margin-top: 1.75em; }
.prose h3 { font-size: var(--fs-md); margin-top: 1.5em; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li + li { margin-top: .35em; }

/* eyebrow: small brass label with a lead rule. The colour is token-driven so the SAFE value is automatic:
   brass-700 on light (7:1), gold-400 on any dark surface (see the dark-surface list below). Page authors never pick a colour. */
.eyebrow {
  font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--eyebrow-color, var(--gold-700)); display: inline-flex; align-items: center; gap: .6rem; margin: 0 0 .6rem;
}
.eyebrow::before { content: ''; width: 1.5rem; height: 2px; background: var(--eyebrow-rule, var(--gold-500)); flex: none; }
/* deprecated: kept so old markup still works; plain .eyebrow already does the right thing everywhere */
.eyebrow-gold { --eyebrow-color: var(--gold-400); --eyebrow-rule: var(--gold-400); }

/* ---------- Membership / application numbers ---------- */
.regid {
  display: inline-block; font-size: .84em; font-weight: 550; letter-spacing: .05em;
  font-feature-settings: 'tnum', 'zero', 'cv11';
  padding: .12em .5em; border-radius: var(--r-xs); background: var(--navy-50);
  border: 1px solid var(--navy-200); color: var(--navy-900); user-select: all; cursor: text;
  max-width: 100%; overflow-wrap: anywhere; word-break: break-all; line-height: 1.5; hyphens: none;
}
.regid-plain { background: none; border: 0; padding: 0; }
.regid b { font-weight: 700; color: var(--navy-700); }
/* single-line truncating variant: always pair with a title="full number" attribute */
.regid-trunc { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: normal; overflow-wrap: normal; vertical-align: bottom; }

/* ---------- Focus (solid, >= 3:1 on every surface) ---------- */
:focus-visible {
  outline: var(--focus-w) solid var(--focus-color);
  outline-offset: 2px;
}
/* Surface-aware tokens. Light panels FIRST, dark surfaces AFTER: an element that carries both (e.g. .panel.on-dark) is dark,
   and a light card nested inside a dark band (.section-dark > .cat-tile) resets to the light values because its own declaration wins. */
.verify, .entry, .modal, .dropdown-menu, .on-light, .offcanvas .on-light,
.cat-tile, .panel, .leader, .feed, .register-wrap, .auth-form, .check-card, .card {
  --focus-color: var(--focus);
  --eyebrow-color: var(--gold-700); --eyebrow-rule: var(--gold-500);
}
/* dark surfaces flip the focus ring and the eyebrow to gold */
.on-dark, .site-util, .site-banner, .site-footer, .rail, .hero, .page-hero, .cta-band, .auth-aside,
.offcanvas, .decision-head, .register-bar, .help-card, .section-dark {
  --focus-color: var(--focus-on-dark);
  --eyebrow-color: var(--gold-400); --eyebrow-rule: var(--gold-400);
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: var(--sp-4); top: -4rem; z-index: var(--z-skip);
  background: var(--gold-400); color: var(--navy-950); font-weight: 600;
  padding: .75rem 1rem; border-radius: var(--r-sm); text-decoration: none; transition: top var(--motion);
}
.skip-link:focus { top: var(--sp-2); color: var(--navy-950); }
/* the ring must read on navy, white and gold alike: white outline sandwiched between navy rings (>= 3:1 against every neighbour) */
.skip-link:focus-visible { outline: var(--focus-w) solid #fff; outline-offset: 2px; box-shadow: 0 0 0 calc(2px + var(--focus-w) + 1px) var(--navy-950); }
/* the skip-link target is focused by script only; the page-wide ring would frame the whole content area */
main[tabindex="-1"]:focus, main[tabindex="-1"]:focus-visible { outline: none; }

/* ---------- Razor / ASP.NET validation helpers (CSP blocks the inline display:none) ---------- */
.validation-summary-valid, .field-validation-valid { display: none; }
.validation-summary-errors {
  background: var(--danger-bg); border: 1px solid var(--danger-line); border-left: 3px solid var(--danger);
  border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); color: var(--ink); font-size: var(--fs-sm); margin-bottom: var(--sp-4);
}
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.validation-summary-errors li + li { margin-top: .2rem; }
.field-validation-error { display: block; color: var(--danger); font-size: var(--fs-xs); font-weight: 500; margin-top: .35rem; }
.input-validation-error, .form-control.input-validation-error, .form-select.input-validation-error { border-color: var(--danger) !important; }
.input-validation-error:focus { box-shadow: 0 0 0 3px rgba(164, 42, 42, .18) !important; }
.validation-summary-errors:focus-visible { outline-offset: 2px; }

/* ---------- Utilities ---------- */
.nowrap { white-space: nowrap; }
.min-w-0 { min-width: 0; }
.break-anywhere { overflow-wrap: anywhere; }
.no-hyphens { hyphens: none; word-break: normal; }
.emblem { display: block; }
.sticky-offset { top: calc(var(--topbar-h) + 1rem); }
.is-clickable { cursor: pointer; }

/* 5%-step width helpers for meters and segmented bars: class="bar-w-{pct/5*5}" */
.bar-w-0 { width: 0; }
.bar-w-5 { width: 5%; }   .bar-w-10 { width: 10%; }  .bar-w-15 { width: 15%; }  .bar-w-20 { width: 20%; }
.bar-w-25 { width: 25%; } .bar-w-30 { width: 30%; }  .bar-w-35 { width: 35%; }  .bar-w-40 { width: 40%; }
.bar-w-45 { width: 45%; } .bar-w-50 { width: 50%; }  .bar-w-55 { width: 55%; }  .bar-w-60 { width: 60%; }
.bar-w-65 { width: 65%; } .bar-w-70 { width: 70%; }  .bar-w-75 { width: 75%; }  .bar-w-80 { width: 80%; }
.bar-w-85 { width: 85%; } .bar-w-90 { width: 90%; }  .bar-w-95 { width: 95%; }  .bar-w-100 { width: 100%; }

/* progressive-enhancement gates (app.js adds .js to <html>) */
html:not(.js) [data-password-toggle], html:not(.js) .js-only { display: none !important; }

/* mobile collapse helpers (home page keeps 4 rows / 3 feed items / 3 leaders below 768) */
@media (max-width: 767.98px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 768px) {
  .only-mobile { display: none !important; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important; transition: none !important; scroll-behavior: auto !important;
  }
}

/* ---------- Windows High Contrast / forced colours: fills vanish, so give meters, segments and stepper dots a real border ---------- */
@media (forced-colors: active) {
  .meter, .segbar { border: 1px solid CanvasText; }
  .meter > span, .segbar > .seg { forced-color-adjust: none; background: Highlight; }
  .segbar > .seg + .seg { border-left: 1px solid Canvas; }
  .step-dot { border: 2px solid CanvasText; }
}

/* ---------- Print ---------- */
@media print {
  .skip-link, .site-util, .site-banner, .rail-col, .topbar, .site-footer .footer-links, .cta-band, .page-actions,
  .offcanvas, .btn, .pagination, .auth-aside .auth-art, .decision { display: none !important; }
  body, body.admin { background: #fff !important; color: #000 !important; font-size: 11pt; }
  .admin-shell { display: block; }
  .hero, .page-hero, .section-tint, .section-soft, .section-navy { background: #fff !important; color: #000 !important; }
  .hero h1, .page-hero h1, .hero .lead { color: #000 !important; }
  .panel, .register-wrap, .feed, .leader, .cat-tile { box-shadow: none !important; break-inside: avoid; }
  a[href^="http"]:not(.btn)::after { content: " (" attr(href) ")"; font-size: .85em; word-break: break-all; }
  .regid { border: 0; background: none; }
}
