/* Account vs user adoption figures. This article-local stylesheet loads after
   resources.css; selectors remain namespaced so the figures cannot leak. */

.au-lead,
.au-matrix,
.au-spread {
  container-name: adoption-figure;
  container-type: inline-size;
  margin: 38px 0;
  padding: 36px 38px 34px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg-muted);
}

/* Figure 1 — which metric leads */

p.au-lead__question {
  margin: 0 0 20px;
  color: var(--color-text);
  font-size: 20px;
  font-weight: 600;
}

.au-lead__branch {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 34px minmax(0, 1fr) 34px minmax(0, 0.9fr);
  align-items: center;
  margin-bottom: 16px;
}

.au-lead__branch:last-of-type { margin-bottom: 0; }

.au-lead__arrow {
  color: #9aa8bd;
  font-size: 24px;
  text-align: center;
}

.au-lead__cond {
  padding: 22px 24px;
  border: 1px solid #dfe7f2;
  border-radius: 12px;
  background: #fff;
}

p.au-lead__cond-title {
  margin: 0 0 8px;
  color: var(--color-text);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}

p.au-lead__cond-eg {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 15px;
  line-height: 1.5;
  text-wrap: pretty;
}

.au-lead__primary {
  padding: 22px 24px;
  border: 1px solid #b6dfc6;
  border-radius: 12px;
  background: #f0faf4;
}

p.au-lead__label {
  margin: 0 0 6px;
  color: #17693f;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

p.au-lead__metric {
  margin: 0 0 6px;
  color: var(--color-text);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.25;
}

p.au-lead__formula {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 15px;
  line-height: 1.5;
}

.au-lead__diag {
  padding: 20px 22px;
  border: 1px dashed #c6d2e2;
  border-radius: 12px;
}

p.au-lead__diag-label {
  margin: 0 0 6px;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

p.au-lead__diag-text {
  margin: 0;
  color: #243650;
  font-size: 16px;
  line-height: 1.5;
  text-wrap: pretty;
}

.au-lead__banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 24px;
  padding: 20px 24px;
  border-radius: 12px;
  background: var(--color-primary);
}

p.au-lead__banner-title {
  margin: 0;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
}

p.au-lead__banner-text {
  margin: 0;
  color: #cfe0f5;
  font-size: 16px;
  line-height: 1.5;
  text-wrap: pretty;
}

/* Figure 2 — the four patterns */

.au-matrix__grid {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

p.au-matrix__axis {
  margin: 0 0 6px;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.au-matrix__row-label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px 0 18px 4px;
  border-right: 3px solid #9fb3cc;
}

.au-matrix__row-label--high { border-right-color: #b6dfc6; }

p.au-matrix__row-name {
  margin: 0;
  color: var(--color-text);
  font-size: 20px;
  font-weight: 600;
}

p.au-matrix__row-def {
  margin: 6px 0 0;
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.45;
}

.au-matrix__cell {
  padding: 22px 24px;
  border: 1px solid #dfe7f2;
  border-radius: 12px;
  background: #fff;
}

.au-matrix__cell--warn { border-color: #e8c48a; background: #fff8e9; }
.au-matrix__cell--good { border-color: #b6dfc6; background: #f0faf4; }

p.au-matrix__use {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-transform: uppercase;
}

.au-matrix__glyph {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.au-acct {
  display: flex;
  gap: 3px;
  padding: 6px;
  border: 1px solid #cfdcec;
  border-radius: 6px;
  background: #fff;
}

.au-acct--off {
  border: 1px dashed #c6d2e2;
  background: transparent;
}

.au-acct i {
  width: 7px;
  height: 14px;
  border-radius: 2px;
  background: #dde5ef;
}

.au-acct--off i { background: #e7ecf3; }

.au-matrix__cell .au-acct i.is-on { background: #5a9fe0; }
.au-matrix__cell--warn .au-acct i.is-on { background: #e2a33a; }
.au-matrix__cell--good .au-acct i.is-on { background: var(--color-accent-green); }

p.au-matrix__pattern {
  margin: 0 0 8px;
  color: var(--color-text);
  font-size: 18px;
  font-weight: 700;
}

p.au-matrix__reading {
  margin: 0 0 12px;
  color: #243650;
  font-size: 16px;
  line-height: 1.5;
  text-wrap: pretty;
}

p.au-matrix__inspect {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 15px;
  line-height: 1.5;
  text-wrap: pretty;
}

.au-matrix__inspect b { color: #3c6ea8; }
.au-matrix__inspect--warn b { color: #6b4e08; }
.au-matrix__inspect--good b { color: #17693f; }

ul.au-matrix__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin: 22px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid #e0e7f1;
  list-style: none;
}

.au-matrix__legend li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--color-text-muted);
  font-size: 14px;
}

.au-key {
  width: 7px;
  height: 14px;
  border-radius: 2px;
  background: #dde5ef;
}

.au-key--on { background: var(--color-accent-green); }

.au-key--off {
  width: 14px;
  border: 1px dashed #c6d2e2;
  border-radius: 3px;
  background: transparent;
}

/* Figure 3 — same user total, different account spread */

.au-spread__totals {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 32px;
  padding: 18px 24px;
  border: 1px solid #dfe7f2;
  border-radius: 12px;
  background: #fff;
}

p.au-spread__totals-label {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

p.au-spread__total {
  margin: 0;
  color: var(--color-text);
  font-size: 17px;
}

.au-spread__total b { font-weight: 700; }

.au-spread__pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 24px;
}

.au-spread__card {
  padding: 24px 26px 26px;
  border: 1px solid #dfe7f2;
  border-radius: 12px;
  background: #fff;
}

.au-spread__card--good { border-color: #b6dfc6; }
.au-spread__card--warn { border-color: #e8c48a; }

p.au-spread__name {
  margin: 0 0 4px;
  color: var(--color-text);
  font-size: 21px;
  font-weight: 600;
}

p.au-spread__sub {
  margin: 0 0 18px;
  color: var(--color-text-muted);
  font-size: 15px;
}

.au-spread__rows {
  display: grid;
  gap: 10px;
}

.au-spread__row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 62px;
  align-items: center;
  gap: 14px;
}

.au-spread__acct {
  color: var(--color-text-muted);
  font-size: 15px;
}

.au-spread__acct--lead { color: var(--color-text); font-weight: 700; }

.au-spread__track {
  height: 14px;
  border-radius: 999px;
  background: #eef3fa;
}

.au-spread__track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--color-accent-green);
}

.au-spread__fill--10 { width: 10%; }
.au-spread__fill--60 { width: 60%; }

.au-spread__track--warn { background: #f6e6c8; }
.au-spread__track--warn span { background: #e2a33a; }

.au-spread__track--empty {
  border: 1px dashed #c3cfdd;
  background: transparent;
}

.au-spread__row b {
  color: var(--color-text);
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}

.au-spread__row b.is-muted { color: var(--color-text-muted); font-weight: 400; }

.au-spread__result {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 20px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #e5ebf4;
}

p.au-spread__result-label {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

p.au-spread__result-label--warn { color: #6b4e08; }

p.au-spread__result-value {
  margin: 0;
  color: var(--color-text);
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
}

p.au-spread__result-note {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 15px;
}

p.au-spread__note {
  margin: 24px 0 0;
  color: #243650;
  font-size: 17px;
  line-height: 1.6;
  text-wrap: pretty;
}

@container adoption-figure (max-width: 900px) {
  .au-lead__branch {
    grid-template-columns: minmax(0, 1fr);
  }

  .au-lead__arrow {
    transform: rotate(90deg);
    padding: 8px 0;
  }

  .au-matrix__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .au-matrix__grid > div:first-child,
  p.au-matrix__axis {
    display: none;
  }

  p.au-matrix__use {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    margin: 0 0 10px;
    padding: 0 0 10px;
    border-bottom: 1px solid #e5ebf4;
    clip: auto;
    clip-path: none;
    white-space: normal;
  }

  .au-matrix__row-label {
    grid-column: 1 / -1;
    padding: 4px 0 4px 14px;
    border-right: 0;
    border-left: 3px solid #9fb3cc;
  }

  .au-matrix__row-label--high { border-left-color: #b6dfc6; }

  .au-spread__pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

@container adoption-figure (max-width: 620px) {
  .au-matrix__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .au-spread__row {
    grid-template-columns: 84px minmax(0, 1fr) 56px;
    gap: 10px;
  }
}

@container adoption-figure (max-width: 380px) {
  .au-matrix__cell {
    padding: 20px 16px;
  }

  .au-matrix__glyph {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    gap: 8px;
  }

  .au-spread__totals,
  .au-spread__card {
    padding-right: 16px;
    padding-left: 16px;
  }

  .au-spread__row {
    grid-template-columns: 70px minmax(0, 1fr) 48px;
    gap: 8px;
  }

  .au-spread__acct { font-size: 14px; }
  .au-spread__row b { font-size: 13px; }
}

@media (max-width: 700px) {
  .au-lead,
  .au-matrix,
  .au-spread {
    padding: 24px 20px;
  }
}
