/*
 * Castleport CMA (AAMA) Eligibility Route Finder
 * Scoped to .cma-rf so it can ship inside an existing design system.
 * Last verified against AAMA sources: 2026-08-14.
 */

.cma-rf {
  --cma-rf-ink: #152235;
  --cma-rf-muted: #526174;
  --cma-rf-line: #d8dee8;
  --cma-rf-soft: #f5f7fa;
  --cma-rf-panel: #ffffff;
  --cma-rf-accent: #174a78;
  --cma-rf-accent-strong: #103553;
  --cma-rf-accent-soft: #eaf3fb;
  --cma-rf-positive: #17643a;
  --cma-rf-positive-soft: #eaf7ef;
  --cma-rf-warning: #8a4f00;
  --cma-rf-warning-soft: #fff5df;
  --cma-rf-danger: #8b2532;
  --cma-rf-danger-soft: #fff0f2;
  --cma-rf-radius: 16px;
  --cma-rf-shadow: 0 12px 36px rgba(21, 34, 53, 0.1);
  box-sizing: border-box;
  width: 100%;
  max-width: 960px;
  margin: 2rem auto;
  border: 1px solid var(--cma-rf-line);
  border-radius: var(--cma-rf-radius);
  background: var(--cma-rf-panel);
  color: var(--cma-rf-ink);
  box-shadow: var(--cma-rf-shadow);
  overflow: hidden;
  font: inherit;
  line-height: 1.55;
}

.cma-rf *,
.cma-rf *::before,
.cma-rf *::after {
  box-sizing: inherit;
}

.cma-rf [hidden] {
  display: none !important;
}

.cma-rf a {
  color: var(--cma-rf-accent);
  text-underline-offset: 0.16em;
}

.cma-rf a:hover {
  text-decoration-thickness: 2px;
}

.cma-rf__header,
.cma-rf__form,
.cma-rf__result,
.cma-rf__footer,
.cma-rf__progress-wrap,
.cma-rf__error {
  padding-left: clamp(1rem, 4vw, 2.5rem);
  padding-right: clamp(1rem, 4vw, 2.5rem);
}

.cma-rf__header {
  padding-top: clamp(1.4rem, 4vw, 2.5rem);
  padding-bottom: 1.5rem;
  background: linear-gradient(145deg, var(--cma-rf-accent-soft), var(--cma-rf-panel));
}

.cma-rf__eyebrow {
  margin: 0 0 0.35rem;
  color: var(--cma-rf-accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.cma-rf__header h2 {
  margin: 0;
  max-width: 19ch;
  font-size: clamp(1.65rem, 5vw, 2.6rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.cma-rf__header > p:not(.cma-rf__eyebrow) {
  max-width: 72ch;
  margin: 0.8rem 0 0;
}

.cma-rf__privacy {
  padding: 0.7rem 0.9rem;
  border-left: 4px solid var(--cma-rf-positive);
  border-radius: 8px;
  background: var(--cma-rf-positive-soft);
  color: var(--cma-rf-ink);
  font-size: 0.93rem;
}

.cma-rf__progress-wrap {
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-top: 1px solid var(--cma-rf-line);
  border-bottom: 1px solid var(--cma-rf-line);
  background: var(--cma-rf-soft);
}

.cma-rf__progress-label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.45rem;
  color: var(--cma-rf-muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.cma-rf__progress {
  display: block;
  width: 100%;
  height: 0.65rem;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  accent-color: var(--cma-rf-accent);
}

.cma-rf__progress::-webkit-progress-bar {
  background: #e1e7ee;
  border-radius: 999px;
}

.cma-rf__progress::-webkit-progress-value {
  background: var(--cma-rf-accent);
  border-radius: 999px;
}

.cma-rf__progress::-moz-progress-bar {
  background: var(--cma-rf-accent);
  border-radius: 999px;
}

.cma-rf__error {
  margin: 1rem clamp(1rem, 4vw, 2.5rem) 0;
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
  border: 1px solid #e9aeb6;
  border-radius: 10px;
  background: var(--cma-rf-danger-soft);
  color: var(--cma-rf-danger);
  font-weight: 750;
}

.cma-rf__form {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.cma-rf__step-number {
  margin: 0 0 0.25rem;
  color: var(--cma-rf-accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cma-rf__step h3,
.cma-rf__result h3 {
  margin: 0 0 1rem;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.cma-rf__step h3:focus,
.cma-rf__result h3:focus {
  outline: none;
}

.cma-rf__question {
  min-inline-size: 0;
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
}

.cma-rf__question legend {
  margin-bottom: 0.65rem;
  padding: 0;
  font-weight: 800;
}

.cma-rf__hint,
.cma-rf__field small {
  display: block;
  margin: -0.25rem 0 0.65rem;
  color: var(--cma-rf-muted);
  font-size: 0.88rem;
  font-weight: 450;
}

.cma-rf__choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.cma-rf__choices--inline {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}

.cma-rf__choice {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-height: 54px;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--cma-rf-line);
  border-radius: 12px;
  background: var(--cma-rf-panel);
  cursor: pointer;
  transition: border-color 130ms ease, background 130ms ease, transform 130ms ease;
}

.cma-rf__choice:hover {
  border-color: var(--cma-rf-accent);
  background: var(--cma-rf-accent-soft);
}

.cma-rf__choice:has(input:checked) {
  border-color: var(--cma-rf-accent);
  background: var(--cma-rf-accent-soft);
  box-shadow: inset 0 0 0 1px var(--cma-rf-accent);
}

.cma-rf__choice:focus-within {
  outline: 3px solid color-mix(in srgb, var(--cma-rf-accent) 30%, transparent);
  outline-offset: 2px;
}

.cma-rf__choice input {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0.18rem 0 0;
  accent-color: var(--cma-rf-accent);
}

.cma-rf__choice span,
.cma-rf__choice strong,
.cma-rf__choice small {
  display: block;
}

.cma-rf__choice small {
  margin-top: 0.18rem;
  color: var(--cma-rf-muted);
  font-size: 0.85rem;
  font-weight: 450;
}

.cma-rf__field {
  display: grid;
  gap: 0.35rem;
  margin: 0 0 1rem;
  font-weight: 800;
}

.cma-rf__field input,
.cma-rf__field select,
.cma-rf__field textarea {
  width: min(100%, 32rem);
  min-height: 48px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--cma-rf-line);
  border-radius: 10px;
  background: var(--cma-rf-panel);
  color: var(--cma-rf-ink);
  font: inherit;
  font-weight: 500;
}

.cma-rf__field input:focus,
.cma-rf__field select:focus,
.cma-rf__field textarea:focus {
  border-color: var(--cma-rf-accent);
  outline: 3px solid color-mix(in srgb, var(--cma-rf-accent) 25%, transparent);
  outline-offset: 1px;
}

.cma-rf__notice {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--cma-rf-line);
  border-radius: 10px;
  background: var(--cma-rf-soft);
}

.cma-rf__notice p:last-child {
  margin-bottom: 0;
}

.cma-rf__review {
  padding: 0.25rem 0 1rem;
}

.cma-rf__review dl {
  display: grid;
  gap: 0;
  margin: 0;
  border: 1px solid var(--cma-rf-line);
  border-radius: 12px;
  overflow: hidden;
}

.cma-rf__review dl > div {
  display: grid;
  grid-template-columns: minmax(130px, 0.35fr) 1fr;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--cma-rf-line);
}

.cma-rf__review dl > div:last-child {
  border-bottom: 0;
}

.cma-rf__review dt {
  color: var(--cma-rf-muted);
  font-weight: 800;
}

.cma-rf__review dd {
  margin: 0;
}

.cma-rf__confirm {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.9rem;
  border: 1px solid var(--cma-rf-line);
  border-radius: 10px;
  background: var(--cma-rf-soft);
  font-weight: 700;
}

.cma-rf__confirm input {
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.15rem;
  accent-color: var(--cma-rf-accent);
}

.cma-rf__nav,
.cma-rf__result-actions,
.cma-rf__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.4rem;
}

.cma-rf__button {
  appearance: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 46px;
  padding: 0.68rem 1rem;
  border: 1px solid var(--cma-rf-accent);
  border-radius: 10px;
  background: var(--cma-rf-accent);
  color: #fff !important;
  font: inherit;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.cma-rf__button:hover {
  border-color: var(--cma-rf-accent-strong);
  background: var(--cma-rf-accent-strong);
  text-decoration: none;
}

.cma-rf__button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--cma-rf-accent) 35%, transparent);
  outline-offset: 3px;
}

.cma-rf__button--secondary {
  background: var(--cma-rf-panel);
  color: var(--cma-rf-accent) !important;
}

.cma-rf__button--secondary:hover {
  background: var(--cma-rf-accent-soft);
  color: var(--cma-rf-accent-strong) !important;
}

.cma-rf__result {
  padding-top: 1.8rem;
  padding-bottom: 2rem;
}

.cma-rf__status {
  display: inline-block;
  margin: 0 0 0.7rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cma-rf__status--matched {
  background: var(--cma-rf-positive-soft);
  color: var(--cma-rf-positive);
}

.cma-rf__status--boundary {
  background: var(--cma-rf-warning-soft);
  color: var(--cma-rf-warning);
}

.cma-rf__status--no-clear {
  background: var(--cma-rf-danger-soft);
  color: var(--cma-rf-danger);
}

.cma-rf__result-lead {
  max-width: 72ch;
  margin: -0.25rem 0 1.25rem;
  font-size: 1.05rem;
}

.cma-rf__metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0 1.75rem;
}

.cma-rf__metric {
  display: grid;
  align-content: start;
  gap: 0.25rem;
  padding: 1rem;
  border: 1px solid var(--cma-rf-line);
  border-radius: 12px;
  background: var(--cma-rf-soft);
}

.cma-rf__metric > span {
  color: var(--cma-rf-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cma-rf__metric > strong {
  font-size: clamp(1.15rem, 3vw, 1.45rem);
  line-height: 1.2;
}

.cma-rf__metric > small {
  color: var(--cma-rf-muted);
  font-size: 0.84rem;
}

.cma-rf__result section {
  margin: 1.5rem 0;
}

.cma-rf__result h4 {
  margin: 0 0 0.6rem;
  font-size: 1.13rem;
}

.cma-rf__result h5 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.cma-rf__result ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.cma-rf__result li + li {
  margin-top: 0.45rem;
}

.cma-rf__checklist {
  list-style: none;
  padding-left: 0 !important;
}

.cma-rf__checklist li {
  position: relative;
  padding-left: 1.75rem;
}

.cma-rf__checklist li::before {
  content: "□";
  position: absolute;
  left: 0;
  top: -0.05rem;
  font-size: 1.25rem;
  font-weight: 800;
}

.cma-rf__warnings {
  padding: 1rem;
  border: 1px solid #e7c077;
  border-radius: 12px;
  background: var(--cma-rf-warning-soft);
}

.cma-rf__packet {
  padding: 1rem;
  border: 1px solid var(--cma-rf-line);
  border-radius: 12px;
  background: var(--cma-rf-soft);
}

.cma-rf__signer {
  margin-top: 0.75rem;
  padding: 0.9rem;
  border: 1px solid var(--cma-rf-line);
  border-radius: 10px;
  background: var(--cma-rf-panel);
}

.cma-rf__signer p {
  margin: 0.3rem 0 0.75rem;
}

.cma-rf__signature-lines {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 0.75rem 1rem;
  color: var(--cma-rf-muted);
  font-size: 0.9rem;
}

.cma-rf__official-next {
  padding: 1rem;
  border-left: 4px solid var(--cma-rf-accent);
  border-radius: 10px;
  background: var(--cma-rf-accent-soft);
}

.cma-rf__sources {
  margin-top: 1.4rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--cma-rf-line);
  border-radius: 10px;
}

.cma-rf__sources summary {
  font-weight: 800;
  cursor: pointer;
}

.cma-rf__fine-print,
.cma-rf__footer {
  color: var(--cma-rf-muted);
  font-size: 0.82rem;
}

.cma-rf__footer {
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-top: 1px solid var(--cma-rf-line);
  background: var(--cma-rf-soft);
}

.cma-rf__footer p {
  margin: 0;
}

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

@media (max-width: 640px) {
  .cma-rf {
    margin: 1rem auto;
    border-radius: 12px;
  }

  .cma-rf__progress-label,
  .cma-rf__review dl > div,
  .cma-rf__signature-lines {
    grid-template-columns: 1fr;
  }

  .cma-rf__progress-label {
    display: grid;
    gap: 0.1rem;
  }

  .cma-rf__choices--inline {
    grid-template-columns: 1fr;
  }

  .cma-rf__button,
  .cma-rf__nav .cma-rf__button,
  .cma-rf__result-actions .cma-rf__button,
  .cma-rf__links .cma-rf__button {
    width: 100%;
  }
}

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

@media print {
  body * {
    visibility: hidden !important;
  }

  .cma-rf,
  .cma-rf .cma-rf__result,
  .cma-rf .cma-rf__result * {
    visibility: visible !important;
  }

  .cma-rf {
    position: absolute;
    inset: 0 auto auto 0;
    max-width: none;
    margin: 0;
    border: 0;
    box-shadow: none;
  }

  .cma-rf__header,
  .cma-rf__progress-wrap,
  .cma-rf__form,
  .cma-rf__footer,
  .cma-rf__result-actions,
  .cma-rf__links {
    display: none !important;
  }

  .cma-rf__result {
    padding: 0;
  }

  .cma-rf__metric,
  .cma-rf__signer,
  .cma-rf__warnings,
  .cma-rf__official-next,
  .cma-rf__sources {
    break-inside: avoid;
    background: #fff !important;
  }

  .cma-rf a {
    color: #000 !important;
    text-decoration: none;
  }

  .cma-rf__sources[open] {
    display: block;
  }
}
