/* ==========================================================================
   ABA Clinical Network — Institutional Stylesheet
   WCAG 2.1 Level AA / 2.2 Compliant | High-Contrast (>= 7:1) | Zero Inline CSS
   ========================================================================== */

:root {
  --navy-950: #091a2b;
  --navy-900: #0f2942;
  --navy-800: #173a5c;
  --teal-800: #08473e;
  --teal-700: #0b5d51;
  --teal-600: #0f766e;
  --teal-100: #d9f3ee;
  --teal-50: #f0faf8;
  --mint-300: #5eead4;

  --surface-0: #ffffff;
  --surface-1: #f8fafc;
  --surface-2: #f1f5f9;

  --border-subtle: #dbe3ec;
  --border-strong: #94a3b8;

  --text-primary: #0f2942;
  --text-body: #1e293b;
  --text-muted: #334155;
  --text-on-dark: #ffffff;
  --text-on-dark-muted: #dce7f3;

  --amber-bg: #fef3c7;
  --amber-border: #b45309;
  --amber-text: #78350f;

  --error-bg: #fef2f2;
  --error-border: #b91c1c;
  --error-text: #991b1b;

  --success-bg: #ecfdf5;
  --success-border: #047857;
  --success-text: #065f46;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 41, 66, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 41, 66, 0.08);

  --container-max: 1180px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-body);
  background-color: var(--surface-0);
}

/* Skip Link (WCAG 2.4.1) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--navy-900);
  color: var(--text-on-dark);
  padding: 0.875rem 1.25rem;
  font-weight: 700;
  text-decoration: none;
  border-bottom-right-radius: var(--radius-sm);
}

.skip-link:focus,
.skip-link:focus-visible {
  left: 0;
  outline: 3px solid var(--mint-300);
  outline-offset: -3px;
}

/* Focus Visibility (WCAG 2.4.7 & 2.4.11) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--teal-700);
  outline-offset: 3px;
  border-radius: 3px;
}

.hero a:focus-visible,
.site-footer a:focus-visible,
.dark-panel a:focus-visible {
  outline-color: var(--mint-300);
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.narrow {
  max-width: 820px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Typography */
h1,
h2,
h3,
h4 {
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 3.6vw, 2.85rem);
  font-weight: 800;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.1875rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

a {
  color: var(--teal-700);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--teal-800);
}

.lead {
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--text-muted);
}

.eyebrow {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--teal-700);
  margin-bottom: 0.625rem;
}

/* Top Compliance Strip */
.top-strip {
  background-color: var(--navy-950);
  color: var(--text-on-dark-muted);
  font-size: 0.875rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.top-strip-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1.25rem;
}

.top-strip strong {
  color: var(--text-on-dark);
}

/* Header & Navigation */
.site-header {
  background-color: var(--surface-0);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--navy-900);
  min-height: 44px;
  flex-shrink: 0;
}

.brand:hover {
  color: var(--navy-900);
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: 1.0625rem;
  font-weight: 800;
  color: var(--navy-900);
}

.brand-sub {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-0);
  color: var(--navy-900);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
}

.nav-toggle:hover {
  background: var(--surface-1);
}

.primary-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.primary-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 0.7rem;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy-900);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.primary-nav a:hover {
  background-color: var(--surface-2);
  color: var(--teal-800);
}

.primary-nav a[aria-current="page"] {
  background-color: var(--teal-50);
  color: var(--teal-800);
  box-shadow: inset 0 -2px 0 var(--teal-700);
}

.primary-nav a.nav-cta {
  background-color: var(--teal-700);
  color: var(--text-on-dark);
  margin-left: 0.35rem;
  padding: 0.5rem 0.95rem;
}

.primary-nav a.nav-cta:hover {
  background-color: var(--teal-800);
  color: var(--text-on-dark);
}

/* Hero Section */
.hero {
  background: linear-gradient(155deg, var(--navy-950) 0%, var(--navy-900) 60%, var(--navy-800) 100%);
  color: var(--text-on-dark);
  padding: 4rem 0 4.25rem;
  border-bottom: 4px solid var(--teal-700);
}

.hero-compact {
  padding: 3rem 0 3.25rem;
}

.hero h1 {
  color: var(--text-on-dark);
  max-width: 24ch;
}

.hero .lead {
  color: var(--text-on-dark-muted);
  max-width: 66ch;
  margin-bottom: 1.75rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  border: 1px solid rgba(94, 234, 212, 0.45);
  background: rgba(11, 93, 81, 0.38);
  color: var(--mint-300);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 1.15rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.95fr);
  gap: 2.25rem;
  align-items: start;
}

.hero-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.hero-card h2 {
  color: var(--text-on-dark);
  font-size: 1.125rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.metric-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.875rem;
}

.metric-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.metric-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--mint-300);
}

.metric-label {
  font-size: 0.875rem;
  color: var(--text-on-dark-muted);
}

/* Buttons */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.7rem 1.35rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.975rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
  background-color: var(--teal-700);
  color: var(--text-on-dark);
  border-color: var(--teal-700);
}

.btn-primary:hover {
  background-color: var(--teal-800);
  border-color: var(--teal-800);
  color: var(--text-on-dark);
}

.btn-hero-primary {
  background-color: var(--mint-300);
  color: var(--navy-950);
  border-color: var(--mint-300);
}

.btn-hero-primary:hover {
  background-color: #99f6e4;
  border-color: #99f6e4;
  color: var(--navy-950);
}

.btn-hero-secondary {
  background-color: transparent;
  color: var(--text-on-dark);
  border-color: rgba(255, 255, 255, 0.6);
}

.btn-hero-secondary:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: var(--text-on-dark);
}

.btn-secondary {
  background-color: var(--surface-0);
  color: var(--navy-900);
  border-color: var(--navy-900);
}

.btn-secondary:hover {
  background-color: var(--surface-2);
  color: var(--navy-950);
}

/* Sections */
.section {
  padding: 3.75rem 0;
}

.section-alt {
  background-color: var(--surface-1);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.section-header {
  max-width: 740px;
  margin-bottom: 2.25rem;
}

/* Cards & Grids */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
}

.card {
  background-color: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.card-accent {
  border-top: 4px solid var(--teal-700);
}

.card-navy {
  border-top: 4px solid var(--navy-900);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.pillar-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background-color: var(--teal-100);
  color: var(--teal-800);
  font-size: 0.8125rem;
  font-weight: 700;
}

.status-pill {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
}

.status-active {
  background-color: var(--teal-100);
  color: var(--teal-800);
  border: 1px solid #86d3c6;
}

.status-upcoming {
  background-color: var(--surface-2);
  color: var(--navy-900);
  border: 1px solid var(--border-strong);
}

.check-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.check-list li {
  position: relative;
  padding-left: 1.65rem;
}

.check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 800;
  color: var(--teal-700);
}

.card-footer-action {
  margin-top: auto;
  padding-top: 1rem;
}

/* Dark Institutional Panel */
.dark-panel {
  background-color: var(--navy-900);
  color: var(--text-on-dark);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.dark-panel h2,
.dark-panel h3 {
  color: var(--text-on-dark);
}

.dark-panel p,
.dark-panel li {
  color: var(--text-on-dark-muted);
}

.dark-panel a {
  color: var(--mint-300);
}

/* Callout / Legal Notice Banners */
.callout {
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  border-left: 4px solid var(--teal-700);
  background-color: var(--teal-50);
  color: var(--text-body);
  margin: 1.5rem 0;
}

.callout-amber {
  border-left-color: var(--amber-border);
  background-color: var(--amber-bg);
  color: var(--amber-text);
}

.callout-amber strong {
  color: var(--amber-text);
}

.callout-title {
  display: block;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

/* Tables (Accessible Responsive Wrapper) */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  margin: 1.25rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

caption {
  text-align: left;
  font-weight: 700;
  color: var(--navy-900);
  padding: 0.875rem 1rem;
  background-color: var(--surface-2);
  border-bottom: 1px solid var(--border-subtle);
}

th,
td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

thead th {
  background-color: var(--surface-1);
  color: var(--navy-900);
  font-weight: 700;
}

tbody tr:last-child td,
tbody tr:last-child th {
  border-bottom: none;
}

/* County Tag Grid */
.county-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.875rem;
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
}

.county-item {
  background: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
}

.county-name {
  display: block;
  font-weight: 800;
  color: var(--navy-900);
}

.county-meta {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* FAQ Accordion (Native Accessible HTML5 Details) */
.faq-list {
  display: grid;
  gap: 0.875rem;
}

.faq-item {
  background: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.25rem 1.25rem;
}

.faq-item summary {
  cursor: pointer;
  padding: 1rem 0;
  font-weight: 700;
  color: var(--navy-900);
  font-size: 1.05rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 44px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--teal-700);
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-body {
  padding-bottom: 1rem;
  color: var(--text-body);
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.875rem;
}

/* Accessible Inquiry Form */
.form-card {
  background: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-full {
  grid-column: 1 / -1;
}

.field label {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--navy-900);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  color: var(--text-body);
  background-color: var(--surface-0);
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.field-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  background-color: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.checkbox-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-top: 0.1rem;
  flex-shrink: 0;
  accent-color: var(--teal-700);
}

.checkbox-row label {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-body);
  cursor: pointer;
}

.form-feedback {
  margin-top: 1.15rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.form-feedback[hidden] {
  display: none;
}

.form-feedback.is-error {
  background-color: var(--error-bg);
  border: 1.5px solid var(--error-border);
  color: var(--error-text);
}

.form-feedback.is-success {
  background-color: var(--success-bg);
  border: 1.5px solid var(--success-border);
  color: var(--success-text);
}

.draft-preview {
  margin-top: 1rem;
  padding: 1.15rem;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.draft-preview[hidden] {
  display: none;
}

.draft-pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875rem;
  background: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  color: var(--text-body);
  margin: 0.75rem 0 1rem;
}

/* Breadcrumb */
.breadcrumb {
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.breadcrumb ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  color: var(--text-on-dark-muted);
}

.breadcrumb a {
  color: var(--mint-300);
}

/* Legal Document Prose */
.prose h2 {
  margin-top: 2.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.prose ul,
.prose ol {
  padding-left: 1.35rem;
  margin-bottom: 1.25rem;
}

.prose li {
  margin-bottom: 0.5rem;
}

/* Footer */
.site-footer {
  background-color: var(--navy-950);
  color: var(--text-on-dark-muted);
  padding: 3.25rem 0 2.25rem;
  margin-top: 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.site-footer h2 {
  color: var(--text-on-dark);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.85rem;
}

.site-footer a {
  color: var(--mint-300);
}

.site-footer a:hover {
  color: #99f6e4;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.footer-links a {
  color: var(--text-on-dark-muted);
  text-decoration: none;
  display: inline-block;
  padding: 0.2rem 0;
}

.footer-links a:hover {
  color: var(--mint-300);
  text-decoration: underline;
}

.footer-bottom {
  padding-top: 1.5rem;
  font-size: 0.875rem;
  display: grid;
  gap: 0.65rem;
}

.footer-bottom p {
  margin: 0;
}

/* Responsive Breakpoints */
@media (max-width: 960px) {
  .hero-grid,
  .grid-4,
  .grid-3,
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .primary-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--surface-0);
    border-bottom: 2px solid var(--navy-900);
    box-shadow: var(--shadow-md);
    padding: 0.75rem 1.25rem 1.25rem;
  }

  .primary-nav.is-open {
    display: block;
  }

  .primary-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }

  .primary-nav a.nav-cta {
    margin-left: 0;
    margin-top: 0.4rem;
    justify-content: center;
  }
}

@media (max-width: 760px) {
  .hero-grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .county-grid,
  .form-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 2.75rem 0 3rem;
  }

  .section {
    padding: 2.75rem 0;
  }
}

/* Reduced Motion (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print Stylesheet */
@media print {
  .top-strip,
  .nav-toggle,
  .primary-nav,
  .btn-group,
  .form-card {
    display: none;
  }

  body {
    color: #000000;
    background: #ffffff;
  }

  .hero,
  .dark-panel,
  .site-footer {
    background: #ffffff;
    color: #000000;
    border: 1px solid #000000;
  }

  .hero h1,
  .hero .lead,
  .dark-panel h2,
  .dark-panel p {
    color: #000000;
  }
}
