/* connect.css
 * Circumference Connect overrides on top of main.css (the shared ARC and Full
 * Circle template). Brand tokens mirror docs/BRAND.md; a brand change is a
 * value swap here and in backend/app/domain/statements.py.
 */

:root {
  --cx-primary: #0c2d46;
  --cx-accent: #0076d4;
  --cx-heading: #273d4e;
  --cx-body: #243947;
  --cx-muted: #5a636e; /* 5.7:1 on --cx-panel, 6.1:1 on white (WCAG AA) */
  --cx-secondary: #eaeaea; /* brand secondary (docs/BRAND.md) */
  --cx-tertiary: #c8c8c8; /* brand tertiary */
  --cx-success: #2f8f5e;
  --cx-warning: #c98a16;
  --cx-danger: #b6362e;
  --cx-panel: #f4f7fb;
  --cx-rule: #e3e8ef;
  --cx-accent-soft: #e8f2fb;
  --cx-header-height: 96px; /* main.js sets the measured height; these are fallbacks */
  --cx-blade-width: 240px;
  --cx-radius: 10px;
}

@media (max-width: 991.98px) {
  :root { --cx-header-height: 84px; }
}
@media (max-width: 575.98px) {
  :root { --cx-header-height: 120px; }
}

html { scroll-padding-top: var(--cx-header-height); }

body.cx-page { display: flex; flex-direction: column; min-height: 100vh; color: var(--cx-body); }
body.cx-page > main.main { flex: 1 0 auto; display: flex; flex-direction: column; }
body.cx-page > footer { flex-shrink: 0; }
body.cx-page > main.main > .page-title { padding-top: var(--cx-header-height); }

/* Accessibility: a visible focus ring on every interactive element. */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, .nav-link:focus-visible, [tabindex="-1"]:focus-visible {
  outline: 3px solid var(--cx-accent);
  outline-offset: 2px;
}
.cx-skip { position: absolute; left: -9999px; top: 0; z-index: 2000; background: #fff; padding: 0.5rem 1rem; }
.cx-skip:focus { left: 1rem; top: 1rem; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Logos */
.cx-hero-logo { display: block; width: clamp(220px, 40vw, 420px); height: auto; margin: 0 auto 1.5rem; }
.cx-mark { width: 56px; height: auto; }
.cx-tagline { color: var(--cx-muted); font-size: 1.15rem; max-width: 48rem; margin: 0 auto; }

/* Landing */
.cx-hero { background: linear-gradient(180deg, #f1f4fa 0%, #ffffff 100%); padding: 3.5rem 0 3rem; text-align: center; }
.cx-hero h1 { color: var(--cx-heading); font-weight: 800; font-size: clamp(1.8rem, 3.5vw, 2.6rem); margin-bottom: 1rem; }
.cx-cta { display: inline-block; background: var(--cx-accent); color: #fff; border-radius: 4px; padding: 0.7rem 1.8rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.cx-cta:hover, .cx-cta:focus { color: #fff; background: #005fab; }
.cx-cta-secondary { display: inline-block; color: var(--cx-accent); padding: 0.7rem 1.2rem; font-weight: 500; }
.cx-step { background: #fff; border: 1px solid var(--cx-rule); border-radius: var(--cx-radius); padding: 1.5rem; height: 100%; }
.cx-step-number { display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--cx-accent); color: #fff; font-weight: 700; margin-bottom: 0.75rem; }
.cx-price { font-family: var(--heading-font); font-size: 1.8rem; font-weight: 700; color: var(--cx-heading); }
.cx-note { color: var(--cx-muted); font-size: 0.9rem; }

/* Portal shell: blade plus main pane (ARC account-management pattern). */
.cx-shell { display: grid; grid-template-columns: 1fr; gap: 1.25rem; min-height: 60vh; }
@media (min-width: 992px) { .cx-shell { grid-template-columns: var(--cx-blade-width) 1fr; } }
.cx-blade { background: #fff; border: 1px solid var(--cx-rule); border-radius: var(--cx-radius); padding: 1rem; align-self: start; }
@media (min-width: 992px) { .cx-blade { position: sticky; top: calc(var(--cx-header-height) + 1rem); } }
.cx-blade-brand { display: flex; align-items: center; gap: 0.6rem; border-bottom: 1px solid var(--cx-rule); padding-bottom: 0.75rem; margin-bottom: 0.75rem; }
.cx-blade-brand strong { font-family: var(--heading-font); color: var(--cx-primary); }
.cx-blade .nav-link { color: var(--cx-heading); border-radius: 6px; padding: 0.55rem 0.75rem; margin-bottom: 0.15rem; display: flex; gap: 0.6rem; align-items: center; }
.cx-blade .nav-link:hover { background: #eef4fb; color: var(--cx-accent); }
.cx-blade .nav-link.active { background: var(--cx-accent); color: #fff; }
.cx-main { min-width: 0; }
.cx-card { background: #fff; border: 1px solid var(--cx-rule); border-radius: var(--cx-radius); padding: 1.5rem; margin-bottom: 1.25rem; }
.cx-card h2, .cx-card h3 { color: var(--cx-heading); }
.cx-card h2 { font-size: 1.35rem; font-weight: 700; margin-bottom: 0.75rem; }
.cx-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.5rem; }
.cx-panel { max-width: 560px; margin: 0 auto; }
.cx-why { background: var(--cx-panel); border-left: 4px solid var(--cx-accent); padding: 0.75rem 1rem; border-radius: 4px; color: var(--cx-body); font-size: 0.95rem; }
.cx-kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.25rem; margin: 0; }
.cx-kv dt { color: var(--cx-muted); font-weight: 500; }
.cx-kv dd { margin: 0; overflow-wrap: anywhere; }

/* State is always words; color only reinforces it. */
.cx-pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.cx-state { display: inline-block; border-radius: 999px; padding: 0.15rem 0.7rem; font-weight: 600; font-size: 0.85rem; border: 1px solid transparent; }
.cx-state.good { background: #e6f4ec; color: #1f6b45; border-color: #b9dfc9; }
.cx-state.busy { background: var(--cx-accent-soft); color: #00508f; border-color: #bcd9f2; }
.cx-state.warn { background: #fbf2dd; color: #7a5208; border-color: #efd8a4; }
.cx-state.bad { background: #fbe6e1; color: #8f2a23; border-color: #f0c2b9; }
.cx-state.idle { background: #eef1f5; color: #3f4a55; border-color: #d9dfe6; }

.cx-meter { height: 12px; background: #dde3eb; border-radius: 999px; overflow: hidden; }
.cx-meter > span { display: block; height: 100%; background: var(--cx-accent); }
.cx-meter.warn > span { background: var(--cx-warning); }
.cx-meter.bad > span { background: var(--cx-danger); }

.cx-config { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--cx-panel); border: 1px solid var(--cx-rule); border-radius: 6px; padding: 0.75rem; white-space: pre-wrap; word-break: break-all; font-size: 0.85rem; max-height: 260px; overflow: auto; }
.cx-qr { display: flex; justify-content: center; }
.cx-qr img { width: min(280px, 100%); height: auto; border: 1px solid var(--cx-rule); border-radius: 6px; background: #fff; padding: 6px; }
.cx-once { border: 2px solid var(--cx-warning); background: #fffaf0; border-radius: 6px; padding: 0.75rem 1rem; }
.cx-banner { border-radius: 6px; padding: 0.75rem 1rem; margin-bottom: 1rem; }
.cx-banner.warn { background: #fbf2dd; color: #5f4106; border: 1px solid #efd8a4; }
.cx-banner.info { background: var(--cx-accent-soft); color: #00406f; border: 1px solid #bcd9f2; }
.cx-banner.bad { background: #fbe6e1; color: #74221c; border: 1px solid #f0c2b9; }
.cx-table th { color: var(--cx-heading); font-weight: 600; white-space: nowrap; }
.cx-table td { vertical-align: middle; }
.cx-toast { position: fixed; bottom: 4.5rem; right: 1rem; background: var(--cx-heading); color: #fff; padding: 0.65rem 1rem; border-radius: 6px; z-index: 1090; max-width: 360px; }
/* Over a dialog the toast moves to the top, so it never covers the dialog's buttons. */
body.modal-open .cx-toast { top: 1rem; bottom: auto; }
.cx-checklist { list-style: none; padding: 0; margin: 0; }
.cx-checklist li { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.35rem 0; }
.cx-checklist .done { color: #1f6b45; font-weight: 600; }
.cx-checklist .todo { color: var(--cx-muted); font-weight: 600; }
.cx-loading { color: var(--cx-muted); padding: 2rem 0; text-align: center; }

/* Contrast: the template mutes section headings to about 2.6:1; Connect keeps 4.5:1 or more. */
.cx-page .section-title h2 { color: var(--cx-muted); }
.cx-page .text-muted, .cx-page .form-text, .cx-page .cx-note { color: var(--cx-muted) !important; }

/* Buttons in the brand accent (Bootstrap reads these variables). */
.cx-page .btn-primary {
  --bs-btn-bg: var(--cx-accent); --bs-btn-border-color: var(--cx-accent);
  --bs-btn-hover-bg: #0063b1; --bs-btn-hover-border-color: #0063b1;
  --bs-btn-active-bg: #005596; --bs-btn-active-border-color: #005596;
  --bs-btn-disabled-bg: var(--cx-accent); --bs-btn-disabled-border-color: var(--cx-accent);
}
.cx-page .btn-outline-primary {
  --bs-btn-color: var(--cx-accent); --bs-btn-border-color: var(--cx-accent);
  --bs-btn-hover-bg: var(--cx-accent); --bs-btn-hover-border-color: var(--cx-accent);
  --bs-btn-active-bg: #005596;
}
.cx-page .btn-link { --bs-btn-color: #005596; }

/* Small phones: the header keeps the logo and menu; the call to action lives on the page. */
@media (max-width: 575.98px) { .header .cta-btn { display: none; } }

/* Portal navigation collapses to a menu button below the large breakpoint. */
.cx-blade-toggle { display: none; }
@media (max-width: 991.98px) {
  .cx-blade-toggle { display: inline-flex; }
  .cx-blade.collapsed .nav, .cx-blade.collapsed .cx-blade-foot { display: none; }
}

/* Progress steps while a gateway is created. */
.cx-progress { list-style: none; padding: 0; margin: 0 0 1rem; }
.cx-progress li { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.3rem 0; color: var(--cx-muted); }
.cx-progress li.now { color: var(--cx-heading); font-weight: 600; }
/* The wizard moves focus to the current step name; show where it went. */
.cx-progress li:focus { outline: 3px solid var(--cx-accent); outline-offset: 2px; }
.cx-progress li.done { color: #1f6b45; }
.cx-reply { border-left: 3px solid var(--cx-accent); padding-left: 0.75rem; margin: 0.5rem 0; }
