/* OE – Dashboard Walkthrough
 *
 * Designed for a muted section (e.g. oe-section-muted). Layout: steps |
 * dashboard. In --scroll mode on wide blocks the steps are tall and the
 * dashboard is sticky, so scrolling walks through the steps. Narrow: the
 * dashboard comes first and the steps become compact buttons in two columns.
 * State lives on the root: data-view and data-scenario (baseline | scenario).
 */

.oe-block-dashboard-walkthrough {
  --oe-dashboard-walkthrough-heading: var(--oe-color-heritage-blue);
  --oe-dashboard-walkthrough-muted: var(--oe-color-cool-grey);
  --oe-dashboard-walkthrough-panel: var(--oe-color-muted);
  --oe-dashboard-walkthrough-tint: color-mix(in srgb, var(--oe-color-sky-blue) 10%, var(--oe-color-primary-4));
  --oe-dashboard-walkthrough-base: var(--oe-color-sky-blue);
  --oe-dashboard-walkthrough-base-light: var(--oe-color-secondary-9-300);
  /* Hex exception, this block only (user-approved 2026-10-07 for the prototype's
     colours, as oe-branching-cards): scenario magenta/pink and chart grey */
  --oe-dashboard-walkthrough-magenta: #B3107A;
  --oe-dashboard-walkthrough-pink: #D268AE;
  --oe-dashboard-walkthrough-grid: #7C8891;
  --oe-dashboard-walkthrough-rule: color-mix(in srgb, var(--oe-dashboard-walkthrough-grid) 25%, transparent);
  container: oe-dashboard-walkthrough / inline-size;
}

.oe-block-dashboard-walkthrough *,
.oe-block-dashboard-walkthrough *::before,
.oe-block-dashboard-walkthrough *::after {
  box-sizing: border-box;
}

.oe-block-dashboard-walkthrough__layout {
  display: grid;
  grid-template-columns: minmax(0, .75fr) minmax(0, 1.4fr);
  gap: var(--oe-spacing-xlarge);
}

/* ---------- Steps ---------- */

.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__step {
  margin: 0 0 var(--oe-spacing-xsmall);
  padding: 0;
}

.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__step-button {
  display: block;
  position: relative;
  width: 100%;
  margin: 0;
  padding: var(--oe-spacing-medium);
  border: 0;
  border-left: var(--oe-border-width-medium) solid var(--oe-dashboard-walkthrough-rule);
  border-radius: var(--oe-border-radius-base);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color .3s, border-color .3s, box-shadow .3s, opacity .3s;
}

.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__step-button:hover {
  border-left-color: var(--oe-dashboard-walkthrough-base);
}

.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__step-button:focus-visible {
  outline: var(--oe-spacing-3xsmall) solid var(--oe-dashboard-walkthrough-base);
  outline-offset: var(--oe-spacing-3xsmall);
}

.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__step.is-on .oe-block-dashboard-walkthrough__step-button {
  border-left-color: var(--oe-dashboard-walkthrough-base);
  background: var(--oe-color-primary-4); /* + oe-box-shadow-xsmall, toggled by script.js */
}

.oe-block-dashboard-walkthrough__step-label {
  display: block;
  margin-bottom: var(--oe-spacing-2xsmall);
  font-size: var(--oe-font-size-small);
  line-height: var(--oe-line-height-medium-large);
  color: var(--oe-dashboard-walkthrough-muted);
}

/* Once the visitor has reached a step (scroll or click), the others step back so the
   active one reads as "this is what the dashboard shows". Not before: nothing fades on arrival. */
.oe-block-dashboard-walkthrough.is-engaged .oe-block-dashboard-walkthrough__steps:has(.is-on) .oe-block-dashboard-walkthrough__step:not(.is-on) .oe-block-dashboard-walkthrough__step-button {
  opacity: .65;
}

.oe-block-dashboard-walkthrough.is-engaged .oe-block-dashboard-walkthrough__steps:has(.is-on) .oe-block-dashboard-walkthrough__step:not(.is-on) .oe-block-dashboard-walkthrough__step-button:is(:hover, :focus-visible) {
  opacity: 1;
}

/* Pointer from the active step towards the dashboard (wide layout only) */
.oe-block-dashboard-walkthrough__step.is-on .oe-block-dashboard-walkthrough__step-button::after {
  content: "";
  position: absolute;
  top: 50%;
  right: calc(-1 * var(--oe-spacing-xsmall));
  width: var(--oe-spacing-base);
  height: var(--oe-spacing-base);
  background: var(--oe-color-primary-4);
  transform: translateY(-50%) rotate(45deg);
}

.is-on .oe-block-dashboard-walkthrough__step-label {
  color: var(--oe-dashboard-walkthrough-base);
}

.oe-block-dashboard-walkthrough__step-title {
  display: block;
  font-size: var(--oe-font-size-medium);
  line-height: var(--oe-line-height-medium-large);
  color: var(--oe-dashboard-walkthrough-heading);
}

.oe-block-dashboard-walkthrough__step-text {
  display: block;
  margin-top: var(--oe-spacing-2xsmall);
  font-size: var(--oe-font-size-base);
  line-height: var(--oe-line-height-large);
  color: var(--oe-dashboard-walkthrough-muted);
}

/* Scroll mode: tall steps, sticky dashboard (prototype spacing) */
.oe-block-dashboard-walkthrough--scroll .oe-block-dashboard-walkthrough__step {
  display: flex;
  align-items: center;
  min-height: 44vh; /* was 62vh in the prototype: shorter scroll between steps */
  margin: 0;
}

.oe-block-dashboard-walkthrough--scroll .oe-block-dashboard-walkthrough__step:first-child {
  min-height: 40vh; /* tall enough that step 1 stays active while it is read */
  align-items: flex-start;
  padding-top: var(--oe-spacing-xlarge);
}

.oe-block-dashboard-walkthrough--scroll .oe-block-dashboard-walkthrough__step:last-child {
  min-height: 40vh;
}

.oe-block-dashboard-walkthrough--scroll .oe-block-dashboard-walkthrough__pin {
  position: sticky;
  top: var(--oe-spacing-4xlarge);
  align-self: start;
}

/* ---------- Dashboard mock-up ---------- */

.oe-block-dashboard-walkthrough__mock {
  overflow: hidden;
  border: var(--oe-spacing-5xsmall) solid var(--oe-dashboard-walkthrough-rule);
  border-radius: var(--oe-border-radius-base);
  background: var(--oe-color-primary-4);
  color: var(--oe-dashboard-walkthrough-muted);
}

.oe-block-dashboard-walkthrough__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--oe-spacing-xsmall) var(--oe-spacing-base);
  padding: var(--oe-spacing-small) var(--oe-spacing-medium);
  background: var(--oe-color-heritage-blue);
  color: var(--oe-color-primary-4);
}

.oe-block-dashboard-walkthrough__name {
  font-size: var(--oe-font-size-base);
}

/* Which step the dashboard is showing (set by script.js) */
.oe-block-dashboard-walkthrough__now {
  padding: var(--oe-spacing-3xsmall) var(--oe-spacing-xsmall);
  border-radius: var(--oe-border-radius-badge);
  background: var(--oe-color-sky-blue);
  color: var(--oe-color-primary-4);
  font-size: var(--oe-font-size-xsmall);
  line-height: var(--oe-line-height-medium-large);
}

.oe-block-dashboard-walkthrough__now:empty {
  display: none;
}

.oe-block-dashboard-walkthrough__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--oe-spacing-2xsmall);
  margin-left: auto;
}

.oe-block-dashboard-walkthrough__chip {
  padding: var(--oe-spacing-3xsmall) var(--oe-spacing-xsmall);
  border-radius: var(--oe-border-radius-small);
  background: var(--oe-color-trans-light-10);
  font-size: var(--oe-font-size-xsmall);
}

/* Brief sky-blue glow round the dashboard when the active step changes */
.oe-block-dashboard-walkthrough__mock.is-changed {
  animation: oe-dashboard-walkthrough-flash 1s ease-out;
}

.oe-block-dashboard-walkthrough__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--oe-spacing-xsmall);
  padding: var(--oe-spacing-xsmall) var(--oe-spacing-medium);
  border-bottom: var(--oe-spacing-5xsmall) solid var(--oe-dashboard-walkthrough-rule);
}

.oe-block-dashboard-walkthrough__tabs,
.oe-block-dashboard-walkthrough__switch {
  display: flex;
  flex-wrap: wrap;
  gap: var(--oe-spacing-2xsmall);
}

.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__tab,
.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__scn {
  min-height: var(--oe-sizing-large);
  margin: 0;
  padding: 0 var(--oe-spacing-small);
  border: 0;
  border-radius: var(--oe-border-radius-small);
  background: transparent;
  color: var(--oe-dashboard-walkthrough-muted);
  font-family: inherit;
  font-size: var(--oe-font-size-small);
  cursor: pointer;
  transition: background-color .2s, color .2s;
}

.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__tab:focus-visible,
.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__scn:focus-visible {
  outline: var(--oe-spacing-3xsmall) solid var(--oe-dashboard-walkthrough-base);
  outline-offset: var(--oe-spacing-3xsmall);
}

.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__tab[aria-selected="true"] {
  background: var(--oe-dashboard-walkthrough-tint);
  color: var(--oe-dashboard-walkthrough-heading);
}

.oe-block-dashboard-walkthrough__switch {
  padding: var(--oe-spacing-3xsmall);
  border-radius: var(--oe-border-radius-small);
  background: var(--oe-dashboard-walkthrough-panel);
}

.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__scn[aria-pressed="true"] {
  background: var(--oe-color-primary-4);
  color: var(--oe-dashboard-walkthrough-heading); /* + oe-box-shadow-xsmall */
}

.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__scn[data-scenario="scenario"][aria-pressed="true"] {
  color: var(--oe-dashboard-walkthrough-magenta);
}

.oe-block-dashboard-walkthrough__body {
  min-height: calc(var(--oe-spacing-5xlarge) * 2);
  padding: var(--oe-spacing-medium);
}

.oe-block-dashboard-walkthrough__view[hidden] {
  display: none;
}

.oe-block-dashboard-walkthrough__view {
  animation: oe-dashboard-walkthrough-in .45s ease;
}

/* Outlook: KPIs */
.oe-block-dashboard-walkthrough__kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--oe-spacing-xsmall);
}

.oe-block-dashboard-walkthrough__kpi {
  padding: var(--oe-spacing-small);
  border-radius: var(--oe-border-radius-small);
  background: var(--oe-dashboard-walkthrough-panel);
}

.oe-block-dashboard-walkthrough__kpi-label {
  display: block;
  font-size: var(--oe-font-size-xsmall);
  line-height: var(--oe-line-height-medium-large);
}

.oe-block-dashboard-walkthrough__kpi-value {
  display: block;
  margin-top: var(--oe-spacing-2xsmall);
  font-size: var(--oe-font-size-large);
  line-height: var(--oe-line-height-medium);
  color: var(--oe-dashboard-walkthrough-heading);
  transition: color .4s;
}

[data-scenario="scenario"] .oe-block-dashboard-walkthrough__kpi-value,
[data-scenario="scenario"] .oe-block-dashboard-walkthrough__bar-value {
  color: var(--oe-dashboard-walkthrough-magenta);
}

/* Outlook: line chart */
.oe-block-dashboard-walkthrough__chart {
  margin-top: var(--oe-spacing-base);
}

.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__chart-title {
  margin: 0 0 var(--oe-spacing-xsmall);
  font-size: var(--oe-font-size-small);
  line-height: var(--oe-line-height-medium-large);
  color: var(--oe-dashboard-walkthrough-heading);
}

.oe-block-dashboard-walkthrough__line-chart {
  display: block;
  width: 100%;
  height: auto;
}

.oe-block-dashboard-walkthrough__grid {
  stroke: var(--oe-dashboard-walkthrough-grid);
  stroke-opacity: .25;
}

.oe-block-dashboard-walkthrough__split {
  stroke: var(--oe-dashboard-walkthrough-grid);
  stroke-opacity: .6;
  stroke-dasharray: 3 3;
}

.oe-block-dashboard-walkthrough__axis {
  font-family: inherit;
  font-size: var(--oe-font-size-xsmall);
  fill: var(--oe-dashboard-walkthrough-muted);
}

.oe-block-dashboard-walkthrough__line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.oe-block-dashboard-walkthrough__line--history { stroke: var(--oe-dashboard-walkthrough-grid); }
.oe-block-dashboard-walkthrough__line--base { stroke: var(--oe-dashboard-walkthrough-base); }

.oe-block-dashboard-walkthrough__line--alt {
  stroke: var(--oe-dashboard-walkthrough-magenta);
  opacity: .15;
  transition: opacity .5s;
}

[data-scenario="scenario"] .oe-block-dashboard-walkthrough__line--alt {
  opacity: 1;
}

/* Forecast lines draw in (script.js re-adds .is-drawing to restart it) */
.oe-block-dashboard-walkthrough__line--base,
.oe-block-dashboard-walkthrough__line--alt {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

/* With JS, hide the forecast lines until their first draw */
.is-js .oe-block-dashboard-walkthrough__line-chart:not(.is-drawing) .oe-block-dashboard-walkthrough__line--base,
.is-js .oe-block-dashboard-walkthrough__line-chart:not(.is-drawing) .oe-block-dashboard-walkthrough__line--alt {
  stroke-dashoffset: 1;
}

.is-drawing .oe-block-dashboard-walkthrough__line--base,
.is-drawing .oe-block-dashboard-walkthrough__line--alt {
  animation: oe-dashboard-walkthrough-draw 1.3s cubic-bezier(.4, 0, .2, 1) both;
}

.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--oe-spacing-base);
  margin: var(--oe-spacing-2xsmall) 0 0;
  font-size: var(--oe-font-size-xsmall);
}

.oe-block-dashboard-walkthrough__key::before {
  content: "";
  display: inline-block;
  width: var(--oe-spacing-small);
  height: var(--oe-spacing-3xsmall);
  margin-right: var(--oe-spacing-xsmall);
  border-radius: var(--oe-border-radius-xsmall);
  vertical-align: middle;
  background: var(--oe-dashboard-walkthrough-base);
}

.oe-block-dashboard-walkthrough__key--alt::before { background: var(--oe-dashboard-walkthrough-magenta); }
.oe-block-dashboard-walkthrough__key--history::before { background: var(--oe-dashboard-walkthrough-grid); }

/* Bar views */
.oe-block-dashboard-walkthrough__bars {
  display: grid;
  gap: var(--oe-spacing-xsmall);
}

.oe-block-dashboard-walkthrough__bar-row {
  display: grid;
  grid-template-columns: var(--oe-width-fixed-3xsmall) minmax(0, 1fr) var(--oe-spacing-xlarge);
  align-items: center;
  gap: var(--oe-spacing-xsmall);
  font-size: var(--oe-font-size-small);
}

.oe-block-dashboard-walkthrough__track {
  position: relative;
  height: var(--oe-spacing-base);
  border-radius: var(--oe-border-radius-small);
  background: var(--oe-dashboard-walkthrough-panel);
}

/* Zero line */
.oe-block-dashboard-walkthrough__track::before {
  content: "";
  position: absolute;
  top: calc(-1 * var(--oe-spacing-2xsmall));
  bottom: calc(-1 * var(--oe-spacing-2xsmall));
  left: 50%;
  width: var(--oe-spacing-5xsmall);
  background: var(--oe-dashboard-walkthrough-grid);
  opacity: .6;
}

.oe-block-dashboard-walkthrough__fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: var(--oe-border-radius-small);
  background: var(--oe-dashboard-walkthrough-base);
  transition: width .6s cubic-bezier(.4, 0, .2, 1), left .6s cubic-bezier(.4, 0, .2, 1), background-color .6s;
}

.oe-block-dashboard-walkthrough__fill.is-neg { background: var(--oe-dashboard-walkthrough-base-light); }
[data-scenario="scenario"] .oe-block-dashboard-walkthrough__fill { background: var(--oe-dashboard-walkthrough-pink); }
[data-scenario="scenario"] .oe-block-dashboard-walkthrough__fill.is-neg { background: var(--oe-dashboard-walkthrough-magenta); }

.oe-block-dashboard-walkthrough__bar-value {
  text-align: right;
  color: var(--oe-dashboard-walkthrough-heading);
}

.oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__note {
  margin: var(--oe-spacing-base) 0 0;
  padding: var(--oe-spacing-small) var(--oe-spacing-base);
  border-radius: var(--oe-border-radius-small);
  background: var(--oe-dashboard-walkthrough-tint);
  font-size: var(--oe-font-size-small);
  line-height: var(--oe-line-height-large);
  color: var(--oe-dashboard-walkthrough-heading);
}

.oe-block-dashboard-walkthrough__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--oe-spacing-small);
  padding: var(--oe-spacing-xsmall) var(--oe-spacing-medium);
  border-top: var(--oe-spacing-5xsmall) solid var(--oe-dashboard-walkthrough-rule);
  font-size: var(--oe-font-size-xsmall);
}

/* ---------- Narrow: dashboard first, compact step buttons ---------- */

@container oe-dashboard-walkthrough (max-width: 60rem) {
  .oe-block-dashboard-walkthrough__layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--oe-spacing-medium);
  }

  .oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__pin {
    position: static;
    order: -1;
  }

  .oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--oe-spacing-xsmall);
  }

  .oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__step,
  .oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__step:first-child,
  .oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__step:last-child {
    display: block;
    min-height: 0;
    margin: 0;
    padding: 0;
  }

  .oe-block-dashboard-walkthrough .oe-block-dashboard-walkthrough__step-button {
    height: 100%;
    padding: var(--oe-spacing-small) var(--oe-spacing-base);
  }

  .oe-block-dashboard-walkthrough__step-title {
    font-size: var(--oe-font-size-base);
  }

  .oe-block-dashboard-walkthrough__step-text {
    display: none;
  }

  .oe-block-dashboard-walkthrough__step.is-on .oe-block-dashboard-walkthrough__step-button::after {
    display: none;
  }
}

@container oe-dashboard-walkthrough (max-width: 35rem) {
  .oe-block-dashboard-walkthrough__kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .oe-block-dashboard-walkthrough__bar-row {
    grid-template-columns: var(--oe-width-fixed-4xsmall) minmax(0, 1fr) var(--oe-spacing-xlarge);
  }

  .oe-block-dashboard-walkthrough__chips {
    margin-left: 0;
  }
}

/* ---------- Animation ---------- */

@keyframes oe-dashboard-walkthrough-in {
  from { opacity: 0; transform: translateY(var(--oe-spacing-2xsmall)); }
  to { opacity: 1; transform: none; }
}

@keyframes oe-dashboard-walkthrough-flash {
  from { outline: var(--oe-spacing-3xsmall) solid var(--oe-color-sky-blue); }
  to { outline: var(--oe-spacing-3xsmall) solid transparent; }
}

@keyframes oe-dashboard-walkthrough-draw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

.oe-block-dashboard-walkthrough--static .oe-block-dashboard-walkthrough__view,
.oe-block-dashboard-walkthrough--static .is-drawing .oe-block-dashboard-walkthrough__line--base,
.oe-block-dashboard-walkthrough--static .is-drawing .oe-block-dashboard-walkthrough__line--alt {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .oe-block-dashboard-walkthrough *,
  .oe-block-dashboard-walkthrough *::before,
  .oe-block-dashboard-walkthrough *::after {
    animation: none !important;
    transition-duration: 0s !important;
  }
}
