/* From the profile to the remedy (Training and Development page).
   Tokens come from styles.css with fallbacks. No inline styles: bar widths
   are SVG attributes and the connecting wires are an SVG overlay whose
   geometry is set from script through attributes. */

.rf {
  --rf-ink: var(--ink, #141414);
  --rf-ink-2: var(--ink-2, #33312d);
  --rf-paper: var(--paper, #ffffff);
  --rf-paper-2: var(--paper-2, #f6f4ef);
  --rf-paper-3: var(--paper-3, #ece9e2);
  --rf-rule: var(--rule, #dcd8cf);
  --rf-muted: var(--muted, #5c5a55);
  --rf-accent: var(--accent, #c5271e);
  --rf-mono: var(--font-mono, "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace);
  --rf-serif: var(--font-serif, "Source Serif 4", Georgia, serif);
  --rf-dur: var(--dur, 180ms);
  --rf-ease: var(--ease, cubic-bezier(0.2, 0.7, 0.2, 1));
  border: 1px solid var(--rf-rule);
  background: var(--rf-paper);
  padding: clamp(16px, 2.6vw, 32px);
}

.rf-cap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 0 20px;
  font-family: var(--rf-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rf-muted);
}

.rf-cap b {
  color: var(--rf-ink);
  font-weight: 500;
}

.rf-root {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: 24px clamp(48px, 9vw, 140px);
  align-items: stretch;
}

.rf-teams {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  gap: 12px;
  align-content: start;
}

.rf-team {
  appearance: none;
  display: grid;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 14px 16px;
  border: 1px solid var(--rf-rule);
  border-left: 3px solid var(--rf-rule);
  background: var(--rf-paper);
  color: var(--rf-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--rf-dur) var(--rf-ease), background-color var(--rf-dur) var(--rf-ease);
}

.rf-team:hover {
  border-color: var(--rf-ink);
}

.rf-team:focus-visible {
  outline: 2px solid var(--rf-ink);
  outline-offset: 2px;
}

.rf-team[aria-pressed="true"] {
  border-color: var(--rf-ink);
  border-left-color: var(--rf-accent);
  background: var(--rf-paper-2);
}

.rf-team-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.rf-team-name {
  font-family: var(--rf-serif);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.rf-team-n {
  font-family: var(--rf-mono);
  font-size: 0.72rem;
  color: var(--rf-muted);
  font-variant-numeric: tabular-nums;
}

.rf-bars {
  /* One grid for all four rows: the label column is as wide as the longest
     label, so the bars start on one line and no label is truncated. */
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) 3em;
  gap: 5px 12px;
  align-items: center;
  font-size: 0.78rem;
  color: var(--rf-muted);
}

.rf-bar-row {
  display: contents;
}

.rf-bar-label {
  white-space: nowrap;
}

.rf-bar-row.is-binding .rf-bar-label,
.rf-bar-row.is-binding .rf-bar-value {
  color: var(--rf-ink);
}

.rf-bar {
  display: block;
  width: 100%;
  height: 8px;
}

.rf-bar-track {
  fill: var(--rf-paper-3);
}

.rf-bar-fill {
  fill: var(--rf-ink-2);
}

.rf-bar-row.is-binding .rf-bar-fill {
  fill: var(--rf-accent);
}

.rf-bar-value {
  font-family: var(--rf-mono);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.rf-team-binding {
  font-family: var(--rf-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rf-accent);
}

/* Wires between a team and its remedy, drawn over the grid gap. */
.rf-wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.rf-wire {
  stroke: var(--rf-rule);
  stroke-width: 1.25;
  transition: stroke var(--rf-dur) var(--rf-ease), stroke-width var(--rf-dur) var(--rf-ease);
}

.rf-wire.is-on {
  stroke: var(--rf-accent);
  stroke-width: 2;
}

.rf-package {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--rf-ink);
  background: var(--rf-paper);
  box-shadow: inset 3px 0 0 var(--rf-accent);
}

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

.rf-package-head img {
  width: 96px;
  height: 64px;
  object-fit: contain;
}

.rf-package-copy {
  display: grid;
  gap: 4px;
}

.rf-remedy-kicker {
  font-family: var(--rf-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rf-muted);
}

.rf-package-title {
  font-family: var(--rf-serif);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.rf-remedy-line {
  font-size: 0.85rem;
  color: var(--rf-muted);
  line-height: 1.45;
}

.rf-modules {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  border-top: 1px solid var(--rf-rule);
}

.rf-module {
  border-bottom: 1px solid var(--rf-rule);
  transition: background-color var(--rf-dur) var(--rf-ease);
}

.rf-module-link {
  display: grid;
  gap: 2px;
  min-height: 44px;
  padding: 9px 10px;
  color: var(--rf-ink);
  text-decoration: none;
}

.rf-module-facet {
  font-family: var(--rf-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rf-muted);
}

.rf-module-title {
  font-size: 0.95rem;
  line-height: 1.3;
}

.rf-module-why {
  font-family: var(--rf-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rf-accent);
  margin-top: 2px;
}

.rf-module.is-off .rf-module-title {
  color: var(--rf-muted);
}

.rf-module.is-on {
  background: var(--rf-paper-2);
  box-shadow: inset 3px 0 0 var(--rf-accent);
}

.rf-module.is-on .rf-module-title {
  font-weight: 600;
}

.rf-module-link:hover .rf-module-title,
.rf-module-link:focus-visible .rf-module-title {
  color: var(--rf-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rf-module-link:focus-visible,
.rf-remedy-more:focus-visible {
  outline: 2px solid var(--rf-ink);
  outline-offset: 2px;
}

.rf-remedy-more {
  justify-self: start;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: 0.85rem;
  color: var(--rf-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* The sub-condition rows of the binding condition, shown for the selected team.
   The sub-conditions span the parent grid and form their own three-column grid, so
   their bars start on one line beneath the condition bars. */
.rf-facets {
  grid-column: 1 / -1;
  display: none;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) 3em;
  gap: 5px 12px;
  align-items: center;
  margin: 6px 0 2px;
  padding: 8px 0 4px 12px;
  border-left: 2px solid var(--rf-accent);
}

.rf-team[aria-pressed="true"] .rf-facets {
  display: grid;
}

.rf-facets-label {
  grid-column: 1 / -1;
  font-family: var(--rf-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rf-muted);
  margin-bottom: 2px;
}

.rf-bar-row--facet {
  font-size: 0.74rem;
}

.rf-bar-row--facet .rf-bar-label {
  white-space: normal;
  line-height: 1.25;
}

.rf-bar-row--facet .rf-bar {
  height: 6px;
}

.rf-bar-row--facet .rf-bar-fill {
  fill: var(--rf-muted);
}

.rf-bar-row--facet.is-low {
  color: var(--rf-ink);
}

.rf-bar-row--facet.is-low .rf-bar-fill {
  fill: var(--rf-accent);
}

.rf-status {
  grid-column: 1 / -1;
  grid-row: 2;
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--rf-rule);
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--rf-ink-2);
  min-height: 1.5em;
}

.rf-status b {
  font-weight: 600;
  color: var(--rf-ink);
}

/* Static fallback shown before the script runs or without JavaScript. */
.rf-static {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.rf-static li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--rf-rule);
}

.rf-static b {
  color: var(--rf-accent);
  font-weight: 500;
}

@media (max-width: 760px) {
  .rf-root {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .rf-teams,
  .rf-package,
  .rf-status {
    grid-column: auto;
    grid-row: auto;
  }

  /* On a phone the status line is the bridge between the tapped team and
     its remedy below, in place of the wires. */
  .rf-status {
    padding: 14px;
    border-top: 0;
    border-left: 3px solid var(--rf-accent);
    background: var(--rf-paper-2);
  }

  .rf-team {
    padding: 12px 14px;
    gap: 8px;
  }

  .rf-bars {
    grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr) 3em;
  }

  .rf-bar-label {
    white-space: normal;
    line-height: 1.25;
  }

  .rf-team-head {
    flex-wrap: wrap;
  }

  .rf-package-head {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .rf-package-head img {
    width: 72px;
    height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rf-team,
  .rf-module,
  .rf-wire {
    transition: none;
  }
}

/* The stepped-wedge diagram on the same page. */
.wedge {
  margin: clamp(24px, 4vw, 48px) 0 0;
  padding: clamp(16px, 2.6vw, 28px);
  border: 1px solid var(--rule, #dcd8cf);
  background: var(--paper, #fff);
}

.wedge svg {
  display: block;
  width: 100%;
  height: auto;
  color: var(--ink, #141414);
}

/* Two drawings of the same wedge: the wide one scales its 11px labels down
   to about 5px on a phone, so a narrow drawing with its own type replaces it. */
.wedge .wedge-narrow {
  display: none;
}

@media (max-width: 640px) {
  .wedge .wedge-wide {
    display: none;
  }

  .wedge .wedge-narrow {
    display: block;
    max-width: 420px;
  }
}

.wedge figcaption {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--rule, #dcd8cf);
  max-width: 72ch;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted, #5c5a55);
}

/* What it costs: the heading on the left, the terms and the actions on the
   right, so the actions sit under the words they answer. */
.cost-terms {
  display: grid;
  gap: 28px;
  align-content: start;
  max-width: 60ch;
}

.cost-terms p {
  margin: 0;
}

.stepper--five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .stepper--five {
    grid-template-columns: 1fr;
  }
}

/* When the modules are delivered: four phases across a programme. */
.phases {
  margin: clamp(24px, 4vw, 48px) 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.phase {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--rule, #dcd8cf);
  border-top: 3px solid var(--ink, #141414);
  background: var(--paper, #fff);
}

.phase-num {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted, #5c5a55);
}

.phase h3 {
  margin: 0;
  font-family: var(--font-serif, Georgia, serif);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.phase-who {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted, #5c5a55);
}

.phase ul {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.phase li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  font-size: 0.88rem;
  line-height: 1.35;
}

.phase li img {
  width: 20px;
  height: 20px;
  color: var(--ink, #141414);
}

.phase-bar {
  height: 6px;
  background: var(--paper-3, #ece9e2);
  position: relative;
  margin-top: 4px;
}

.phase-bar span {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--ink, #141414);
}

.phase-bar--1 span { left: 0; width: 20%; }
.phase-bar--2 span { left: 10%; width: 30%; }
.phase-bar--3 span { left: 25%; width: 45%; }
.phase-bar--4 span { left: 40%; width: 60%; }

.phases-axis {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  margin: 0;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--muted, #5c5a55);
}

.coming {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px clamp(20px, 3vw, 40px);
  align-items: start;
  margin: clamp(24px, 4vw, 40px) 0 0;
  padding: clamp(18px, 2.4vw, 28px);
  border: 1px dashed var(--ink, #141414);
  background: var(--paper, #fff);
}

.coming-badge {
  margin: 0;
  padding: 5px 10px;
  border: 1px solid var(--ink, #141414);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.coming-body h3 {
  margin: 0 0 8px;
  font-family: var(--font-serif, Georgia, serif);
  font-weight: 500;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.coming-body p {
  margin: 0;
  max-width: 70ch;
  color: var(--ink-2, #33312d);
}

@media (max-width: 900px) {
  .phases {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .phases {
    grid-template-columns: 1fr;
  }

  .coming {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.modules-table td:last-child {
  white-space: nowrap;
}
