/* Module-specific styles */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.info-card {
  background: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-soft);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-medium);
}

.info-card h3 {
  margin-top: 0;
  border: none;
}

.chart-wrapper {
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  margin: 2rem 0;
}

.chart-container {
  position: relative;
  margin: 0 auto;
  height: clamp(360px, 52vw, 520px);
  max-width: clamp(640px, 92vw, 900px);
}

.interactive-demo {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  margin: 2rem 0;
}

@media (min-width: 800px) {
  .interactive-demo {
    grid-template-columns: 1.5fr 1fr;
  }
}

.interactive-demo .steps {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.interactive-demo .steps li {
  border-left: 4px solid var(--border-color);
  padding: 0.75rem 0.75rem 0.75rem 1rem;
  margin: 0.25rem 0;
  background: var(--bg-primary);
  border-radius: 0.5rem;
}

.interactive-demo .steps strong {
  display: block;
  margin-bottom: 0.25rem;
}

/* Scoped to this table */
#methods-table {
  width: clamp(100%, 62rem, 88vw);
  margin-left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-soft);
  padding: 0.75rem;
  overflow: auto;
  margin-top: 1rem;
  margin-bottom: 2rem;
}

#methods-table > table {
  width: 100%;
  min-width: 960px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-primary);
  border-radius: 0.5rem;
}

#methods-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-primary);
  color: var(--text-primary);
  text-align: left;
  font-weight: 700;
  padding: 0.9rem 0.9rem;
  border-bottom: 2px solid var(--border-color);
}

#methods-table tbody td {
  padding: 0.8rem 0.9rem;
  vertical-align: top;
  border-bottom: 1px solid var(--border-color);
}

#methods-table th,
#methods-table td {
  border-right: 1px solid var(--border-color);
}

#methods-table th:last-child,
#methods-table td:last-child {
  border-right: none;
}

#methods-table tbody tr:nth-child(odd) td {
  background: rgba(255, 255, 255, 0.035);
}

:root[data-theme="light"] #methods-table tbody tr:nth-child(odd) td {
  background: rgba(0, 0, 0, 0.03);
}

#methods-table tbody tr:hover td {
  background: rgba(13, 148, 136, 0.1);
}

#methods-table td:first-child,
#methods-table th:first-child {
  position: sticky;
  left: 0;
  background: inherit;
  font-weight: 600;
}

#methods-table thead th:first-child {
  border-top-left-radius: 0.5rem;
}

#methods-table thead th:last-child {
  border-top-right-radius: 0.5rem;
}

#methods-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 0.5rem;
}

#methods-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 0.5rem;
}

.node {
  fill: none;
  stroke: var(--text-primary);
  stroke-width: 2.5;
}

.label {
  fill: var(--text-primary);
  font:
    600 15px/1 system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Inter,
    Arial,
    sans-serif;
}

.link {
  stroke: currentColor;
  stroke-width: 3;
  fill: none;
  marker-end: url(#arrow);
  stroke-linecap: round;
}

.node {
  fill: none;
  stroke: var(--text-primary);
  stroke-width: 2.2;
}

.label {
  fill: var(--text-primary);
  font:
    600 12px/1 system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Inter,
    Arial,
    sans-serif;
}

.link {
  stroke: currentColor;
  stroke-width: 2.4;
  fill: none;
  marker-end: url(#obArrow);
  stroke-linecap: round;
}

.cdc-vendors {
  margin: 1.25rem 0;
}

.cdc-vendors h2 {
  margin: 0.25rem 0 1rem;
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
}

.cdc-vendors .disclosure {
  font-size: 0.9rem;
  opacity: 0.85;
  margin: 0.25rem 0 1rem;
}

.cdc-filter {
  display: grid;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}

.cdc-filter .row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.cdc-chip {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.01em;
  cursor: pointer;
  user-select: none;
}

:root[data-theme="light"] .cdc-chip {
  border-color: rgba(0, 0, 0, 0.18);
  background: rgba(0, 0, 0, 0.04);
}

.cdc-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

:root[data-theme="light"] .cdc-chip:hover {
  background: rgba(0, 0, 0, 0.07);
  border-color: rgba(0, 0, 0, 0.3);
}

.cdc-chip[aria-pressed="true"] {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08) inset;
}

.cdc-chip:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

#cdc-chips {
  gap: 0.6rem;
}

.cdc-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 820px) {
  .cdc-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.cdc-card {
  border: 1px solid var(--border-color, #2a3441);
  border-radius: 0.75rem;
  padding: 1rem;
  background: var(--surface, #0b121d);
  transition: transform 0.2s ease;
}

:root[data-theme="light"] .cdc-card {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

@media (prefers-reduced-motion: reduce) {
  .cdc-card {
    transition: none;
  }
}

.cdc-card h3 {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.05rem;
}

.cdc-card p {
  margin: 0 0 0.45rem;
}

.cdc-card .meta {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 0.35rem;
}

.cdc-pill {
  display: inline-block;
  font-size: 0.8rem;
  border: 1px solid var(--border-color, #2a3441);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  margin: 0.15rem 0.25rem 0 0;
  opacity: 0.9;
}

.cdc-hide {
  display: none !important;
}

/* Show-all expand button — renders only the first 6 vendor cards
   on initial paint; the remaining 9 live in a <template> and get
   cloned in when this button (or any filter interaction) fires. */
.cdc-show-all-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0 0.5rem;
}

.cdc-show-all {
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border-color, #2a3441);
  background: var(--surface, #0b121d);
  color: var(--text-primary, #f8fafc);
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.15s;
  min-height: 44px;
  min-width: 44px;
}

:root[data-theme="light"] .cdc-show-all {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #0f172a;
}

.cdc-show-all:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.28);
}

:root[data-theme="light"] .cdc-show-all:hover {
  background: #e2e8f0;
  border-color: rgba(0, 0, 0, 0.24);
}

.cdc-show-all:focus-visible {
  outline: 2px solid var(--accent-primary, #3b82f6);
  outline-offset: 2px;
}

.cdc-noscript {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.85;
}

/* Intro enhancements */
.sticky-subnav {
  position: sticky;
  top: calc(var(--header-height, 4.5rem) + 1rem);
  z-index: 5;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  margin: 0 0 1.5rem;
  box-shadow: var(--shadow-soft);
}

.sticky-subnav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.sticky-subnav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--text-secondary);
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border 0.2s ease;
}

.sticky-subnav a:hover {
  border-color: var(--border-color);
  color: var(--text-primary);
}

.sticky-subnav a.is-active {
  background: rgba(20, 184, 166, 0.15);
  border-color: rgba(45, 212, 191, 0.4);
  color: var(--text-primary);
}

#intro-outcome,
#cdc-methods,
#core-components,
#transactional-outbox,
#operational-gotchas,
#cdc-vendors-title,
#choose-next {
  scroll-margin-top: calc(var(--header-height, 4.5rem) + 2rem);
}

.intro-lede {
  display: grid;
  gap: 1.2rem;
  margin-bottom: 2rem;
  text-align: center;
}

.intro-lede .lead {
  font-size: 1.1rem;
  font-weight: 600;
}

.intro-callouts {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 840px) {
  .intro-callouts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.intro-callout {
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1rem;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-soft);
  text-align: left;
}

/* Callout heading: match whichever heading level the markup uses
   (h3 originally; bumped to h2 for the heading-order axe rule).
   Without :is() the broader `.prose h2 { margin-top: var(--space-2xl) }`
   rule would apply, blowing the layout inside the small callout. */
.intro-callout :is(h2, h3) {
  margin-top: 0;
  font-size: var(--type-lg);
  line-height: 1.3;
}

.intro-callout ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.intro-deep-dive {
  margin: 0.5rem 0 0;
}

.intro-diagram {
  display: block;
  width: 100%;
  height: auto;
  max-width: 440px;
  margin: 0.5rem auto 0;
  color: var(--accent-primary);
}

.intro-next,
.series-roadmap {
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  margin: 1.5rem 0;
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.intro-next ul {
  list-style: disc;
  padding-left: 1.2rem;
  margin: 0.75rem 0 0.25rem;
}

.series-roadmap ol {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
}

.series-roadmap a,
.intro-next a {
  font-weight: 600;
}

.cdc-methods-grid {
  display: grid;
  gap: 1.25rem;
  margin: 1.5rem 0 2rem;
}

@media (min-width: 960px) {
  .cdc-methods-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.method-card {
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: 0.9rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  transition:
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.method-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.method-icon {
  font-size: 1.5rem;
}

.method-highlights {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.method-highlights li {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.95rem;
}

.method-highlights li::before {
  content: "•";
  color: var(--accent-primary);
  font-weight: 700;
  transform: translateY(-1px);
}

.method-link {
  margin: 0;
  font-weight: 600;
}

.method-details summary {
  font-weight: 600;
  cursor: pointer;
}

.method-details[open] {
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

.method-card.is-highlighted {
  border-color: rgba(20, 184, 166, 0.9);
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2);
}

.table-intro {
  margin-top: 0.75rem;
  font-style: italic;
}

.comparison-table .cell-indicator {
  display: inline-block;
  margin-right: 0.35rem;
}

.comparison-table td {
  vertical-align: top;
}

.comparison-table .recommended-row td {
  background: rgba(20, 184, 166, 0.12);
  font-weight: 600;
}

.priority-chooser {
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.25rem;
  background: var(--bg-secondary);
  margin: 2rem 0;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 1rem;
}

.priority-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.priority-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

.priority-btn.is-active,
.priority-btn:focus-visible {
  border-color: rgba(20, 184, 166, 0.6);
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.18);
}

.priority-result {
  border: 1px dashed var(--border-color);
  border-radius: 0.75rem;
  padding: 1rem;
  background: var(--bg-primary);
}

.priority-result h4 {
  margin-top: 0;
}

.code-toggle {
  margin: 1rem 0 0;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
}

.code-toggle summary {
  font-weight: 600;
  cursor: pointer;
}

.code-columns {
  display: grid;
  gap: 1rem;
  margin-top: 0.75rem;
}

@media (min-width: 880px) {
  .code-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.code-columns pre {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.6rem;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  font-size: 0.9rem;
}

.operational-checklist {
  list-style: none;
  margin: 1rem 0 2rem;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.operational-checklist li {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: auto 1fr;
  align-items: start;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
}

.operational-checklist .severity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  width: fit-content;
}

.severity-must {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.severity-should {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
}

.severity-nice {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
}

.operational-checklist .checklist-link {
  grid-column: 2;
  font-weight: 600;
}

.next-steps {
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin: 2.5rem 0 1rem;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-soft);
}

.next-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 840px) {
  .next-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.next-card {
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1rem;
  background: var(--bg-primary);
  display: grid;
  gap: 0.5rem;
}

.next-card h3 {
  margin: 0;
}

.next-card a {
  text-decoration: none;
  font-weight: 600;
}

.next-card p {
  margin: 0;
}

.priority-note,
.next-note {
  margin: 0;
  color: var(--text-secondary);
}

.method-details ul {
  margin-top: 0.5rem;
  padding-left: 1.1rem;
}

.intro-muted {
  margin-top: 0.75rem;
  color: var(--text-secondary);
}

.core-components-links {
  margin: 1rem 0 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow-soft);
}

.figure-caption {
  font-size: 0.9rem;
  text-align: center;
  margin-top: 0.75rem;
  color: var(--text-secondary);
}

.method-card details {
  background: var(--bg-primary);
  border-radius: 0.65rem;
  padding: 0.75rem 0.9rem;
}
