/* Six-act demonstration: inspectable explanations stay with the actual map. */
.fm-demo {
  --demo-story-blue: #90c5ee;
  --demo-story-gold: #dfbf7e;
  --demo-story-ink: #f1f2e9;
  --demo-story-muted: #bdcbd3;
  --demo-story-line: #40586b;
  --demo-story-panel: rgba(14, 29, 39, .96);
  scroll-padding-top: 78px;
}
.fm-demo-top { position: sticky; top: 0; z-index: 20; }
.fm-demo-top > div { min-width: 0; }
.fm-demo-top-actions { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.fm-demo .maplibregl-ctrl-top-right { right:310px; }
.fm-demo .maplibregl-ctrl-bottom-right { right:310px; max-width:calc(100% - 330px); }
.fm-demo-wordmark, .fm-demo-period { overflow-wrap: anywhere; }
.fm-demo-stage { scroll-margin-top: 78px; }
.fm-demo h2 { max-width: 26ch; }
.fm-demo[data-act="3"] .fm-demo-number { font-size:clamp(35px,4.5vw,55px); }
.fm-demo-map-status, .fm-demo-map-legend { max-width: calc(100% - 330px); }
.fm-demo-story { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.fm-demo-info,
.fm-demo-transfer-card,
.fm-demo-validation {
  position: absolute;
  right: 18px;
  top: 64px;
  width: 280px;
  max-width: calc(100% - 36px);
  padding: 17px 18px 15px;
  background: var(--demo-story-panel);
  border: 1px solid var(--demo-story-line);
  border-radius: 6px;
  color: var(--demo-story-ink);
  box-shadow: 0 5px 22px rgba(0, 0, 0, .18);
  pointer-events: none;
  overflow-wrap: break-word;
  z-index: 4;
}
.demo-info-eyebrow { color: var(--demo-story-gold); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; line-height: 1.4; margin-bottom: 8px; }
.fm-demo-info h3,
.fm-demo-transfer-card h3,
.fm-demo-validation h3 { margin: 0; font-size: 17px; font-weight: 500; line-height: 1.22; letter-spacing: -.02em; color: var(--demo-story-ink); }
.demo-info-visual { display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 0; min-height: 60px; margin: 13px 0 12px; color: var(--demo-story-blue); font-variant-numeric: tabular-nums; }
.demo-info-visual svg { display: block; width: 100%; max-width: 100%; height: auto; max-height: 85px; overflow: visible; }
.demo-info-visual svg text { font-family: inherit; }
.demo-info-visual > strong { font-size: 25px; line-height: 1.1; letter-spacing: -.03em; font-weight: 500; }
.demo-info-visual > span { font-size: 17px; }
.demo-info-caption { font-size: 12px; line-height: 1.6; color: var(--demo-story-muted); margin: 0; }
.demo-info-caption strong { font-weight: 500; color: var(--demo-story-ink); }
.demo-info-scope { font-size: 11px; line-height: 1.5; color: #a7b6c1; margin: 11px 0 0; padding-top: 10px; border-top: 1px solid var(--demo-story-line); }
.demo-info-equation { display: flex; flex-wrap: wrap; gap: 7px; align-items: baseline; justify-content: center; text-align: center; font-variant-numeric: tabular-nums; }
.demo-info-equation strong { font-size: 24px; font-weight: 500; letter-spacing: -.03em; }
.demo-info-equation small { display: block; color: var(--demo-story-muted); font-size: 10px; line-height: 1.4; margin-top: 4px; }
.demo-info-bars { width: 100%; display: grid; gap: 10px; }
.demo-info-bar { display: grid; grid-template-columns: 65px minmax(0, 1fr) 45px; align-items: center; gap: 8px; font-size: 10px; color: var(--demo-story-muted); }
.demo-info-bar i { display: block; height: 12px; background: var(--demo-story-blue); }
.demo-info-bar[data-observed] i { background: var(--demo-story-gold); }
.demo-info-bar strong { font-size: 11px; color: var(--demo-story-ink); text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.fm-demo-transfer-route { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 17px 0; }
.fm-demo-route-node { min-width: 0; flex: 1; display: grid; gap: 6px; font-size: 12px; line-height: 1.4; }
.fm-demo-route-node:last-child { text-align: right; }
.fm-demo-route-node::before { content: ""; display: block; width: 9px; height: 9px; border-radius: 50%; background: var(--demo-story-blue); }
.fm-demo-route-node:last-child::before { margin-left: auto; background: var(--demo-story-gold); }
.fm-demo-route-node small { font-size: 10px; color: var(--demo-story-muted); }
.fm-demo-route-line { height: 1px; background: var(--demo-story-line); flex: 1; min-width: 30px; }
.fm-demo-validation-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 17px 0; }
.fm-demo-validation-metrics > div { display: grid; gap: 5px; min-width: 0; }
.fm-demo-validation-metrics strong { font-size: 20px; font-weight: 500; color: var(--demo-story-blue); font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -.025em; }
.fm-demo-validation-metrics > div:last-child strong { color: var(--demo-story-gold); }
.fm-demo-validation-metrics span { font-size: 10px; line-height: 1.4; color: var(--demo-story-muted); }
.fm-demo-scope { display: block; color: #aebdc6; font-size: 11px; line-height: 1.5; margin: 10px 0 0; max-width: 58ch; }
.fm-demo-steps { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 11px; }
.fm-demo-step { min-width: 0; line-height: 1.3; overflow-wrap: break-word; }
.fm-demo-step[aria-current="step"] { border-color: var(--demo-story-gold); }
.fm-demo-step small { font-size: 10px; margin-bottom: 3px; }
.fm-demo-progress-label { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 11px; color: var(--demo-story-muted); margin: 0 0 4px; }
.fm-demo-progress-label strong, .fm-demo-progress-label output { font-weight: 500; color: var(--demo-story-ink); font-variant-numeric: tabular-nums; }
#fm-demo-stage-progress { display: block; width: 100%; height: 16px; margin: 0 0 11px; padding: 0; accent-color: var(--demo-story-gold); cursor: pointer; }
#fm-demo-stage-progress:disabled { opacity: .45; cursor: wait; }
.fm-demo-transport { row-gap: 10px; }
.fm-demo-transport > div { min-width: 0; }
@media (min-width: 701px) and (max-height: 850px) {
  .fm-demo-top { padding: 10px 30px; }
  .fm-demo-stage { padding: 14px 32px 10px; grid-template-columns: minmax(0, 1fr) minmax(210px, .46fr); gap: 24px; }
  .fm-demo h2 { font-size: clamp(28px, 3.2vw, 42px); }
  .fm-demo-act { margin-bottom: 6px; }
  .fm-demo-explainer { font-size: 12px; margin-top: 8px; line-height: 1.5; }
  .fm-demo-number { font-size: 55px; }
  .fm-demo-unit { margin-top: 6px; }
  .fm-demo-scope { font-size: 10px; margin-top: 5px; }
  #fm-demo-map { height: 35dvh; min-height: 280px; }
  .fm-demo-info, .fm-demo-transfer-card, .fm-demo-validation { top: 14px; padding: 12px 15px; }
  .demo-info-visual { min-height: 46px; margin: 8px 0; }
  .demo-info-visual svg { max-height: 58px; }
  .demo-info-eyebrow { margin-bottom: 5px; }
  .fm-demo-info h3 { font-size: 16px; }
  .demo-info-caption { font-size: 11px; line-height: 1.5; }
  .demo-info-scope { margin-top: 8px; padding-top: 7px; font-size: 10px; }
  .fm-demo-controlbar { padding-top: 10px; padding-bottom: 10px; }
  .fm-demo-steps { margin-bottom: 9px; }
  .fm-demo-step { padding-top: 6px; }
  .fm-demo-step small { margin-bottom: 1px; }
  #fm-demo-stage-progress { margin-bottom: 8px; height: 14px; }
  .fm-demo-control, .fm-demo-primary { padding-top: 7px; padding-bottom: 7px; min-height: 34px; }
  .fm-demo-foot { font-size: 10px; line-height: 1.5; margin-top: 7px; }
}
@media (max-width: 1000px) and (min-width: 701px) {
  .fm-demo-stage { grid-template-columns: minmax(0, 1fr) minmax(180px, .5fr); }
  .fm-demo-info, .fm-demo-transfer-card, .fm-demo-validation { width: 255px; right: 14px; }
  .fm-demo-steps { gap: 9px; }
  .fm-demo-step { font-size: 11px !important; }
}
@media (max-width: 700px) {
  .fm-demo { scroll-padding-top: 85px; }
  .fm-demo-top { padding: 11px 16px; gap: 12px; flex-wrap: nowrap; align-items: center; }
  .fm-demo-top > div { flex: 1; }
  .fm-demo-top > .fm-demo-top-actions { flex:0 0 auto; }
  .fm-demo-wordmark { font-size: 11px; letter-spacing: .04em; line-height: 1.4; }
  .fm-demo-period { font-size: 10px; line-height: 1.4; margin-top: 3px; }
  .fm-demo-close { flex: none; padding: 7px 10px; font-size: 12px !important; min-height: 40px; }
  .fm-demo-stage { padding: 18px 16px 13px; gap: 12px; scroll-margin-top: 85px; }
  .fm-demo-act { font-size: 10px; letter-spacing: .11em; margin-bottom: 7px; }
  .fm-demo h2 { font-size: clamp(27px, 5.8vw, 37px); max-width: none; line-height: 1.08; }
  .fm-demo-explainer { font-size: 12px; line-height: 1.6; margin-top: 10px; }
  .fm-demo-number-block { flex-wrap: wrap; gap: 5px 12px; }
  .fm-demo-number { font-size: 43px; }
  .fm-demo-unit { font-size: 11px; max-width: 29ch; margin: 0; }
  .fm-demo-scope { flex-basis: 100%; max-width: none; font-size: 11px; margin-top: 3px; }
  .fm-demo-mapwrap { margin: 0 16px; }
  .fm-demo .maplibregl-ctrl-top-right { right:0; }
  .fm-demo .maplibregl-ctrl-bottom-right { right:0; max-width:100%; }
  #fm-demo-map { height: 36dvh; min-height: 230px; }
  .fm-demo-story { position: static; inset: auto; }
  .fm-demo-info, .fm-demo-transfer-card, .fm-demo-validation { position: relative; top: auto; right: auto; width: auto; max-width: none; border: 0; border-top: 1px solid var(--demo-story-line); border-radius: 0; padding: 18px; background: #14232e; box-shadow: none; }
  .fm-demo-map-status { top: 11px; left: 11px; max-width: calc(100% - 90px); font-size: 10px; }
  .fm-demo-map-legend { position: relative; bottom: auto; left: auto; margin: 0; max-width: none; border-radius: 0; padding: 10px 12px; background: #14232e; font-size: 10px; gap: 8px 12px; }
  .demo-info-eyebrow { font-size: 10px; }
  .fm-demo-info h3 { font-size: 18px; }
  .demo-info-visual { min-height: 58px; margin: 13px 0; }
  .demo-info-visual svg { max-width: 320px; max-height: 85px; }
  .demo-info-caption { font-size: 13px; line-height: 1.6; }
  .demo-info-scope { font-size: 11px; }
  .demo-info-bars { max-width: 340px; }
  .fm-demo-controlbar { padding: 16px; }
  .fm-demo-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 13px; margin-bottom: 15px; }
  .fm-demo-step { font-size: 12px !important; padding-top: 8px; }
  .fm-demo-step small { display: inline; margin-right: 5px; font-size: 10px; }
  .fm-demo-progress-label { font-size: 11px; gap: 10px; }
  #fm-demo-stage-progress { height: 24px; margin-bottom: 14px; }
  .fm-demo-transport { align-items: stretch; }
  .fm-demo-transport > div { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .fm-demo-transport > .fm-demo-control { width: 100%; }
  .fm-demo-control, .fm-demo-primary { font-size: 12px !important; padding: 9px 10px; min-height: 42px; text-align: center; }
  .fm-demo-foot { font-size: 11px; line-height: 1.6; margin-top: 12px; }
}
@media (max-width: 380px) {
  .fm-demo-top { padding: 10px 12px; gap: 8px; }
  .fm-demo-close { padding: 7px 8px; }
  .fm-demo-stage { padding-left: 13px; padding-right: 13px; }
  .fm-demo-mapwrap { margin-left: 13px; margin-right: 13px; }
  .fm-demo h2 { font-size: 28px; }
  .fm-demo-number { font-size: 39px; }
  .fm-demo-info { padding: 16px; }
  .fm-demo-controlbar { padding-left: 13px; padding-right: 13px; }
  .fm-demo-steps { gap: 9px; }
  .fm-demo-step { font-size: 11px !important; }
  .fm-demo-step small { font-size: 9px; }
}
@media (pointer: coarse) {
  .fm-demo-close, .fm-demo-step, .fm-demo-control, .fm-demo-primary { min-height: 44px; }
  #fm-demo-stage-progress { min-height: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .fm-demo { scroll-behavior: auto; }
  .fm-demo *, .fm-demo *::before, .fm-demo *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
