/* segments: owned by one work stream; merged into v2.css later. */

/* Personal rhythm card in #panel-return. */
.rhythm-person {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
}
.rhythm-person .state-pill {
  white-space: nowrap;
}
.rhythm-body small {
  line-height: 1.45;
}
.rhythm-scale {
  position: relative;
  height: 12px;
  max-width: 300px;
  margin-top: 18px;
}
.rhythm-scale::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 1px;
  background: linear-gradient(90deg, #ffffff10, #ffffff2e 70%, #ffffff10);
}
.rhythm-scale > i {
  position: absolute;
  top: 50%;
  left: calc(var(--x) * 100%);
}
.rhythm-visit,
.rhythm-expected,
.rhythm-today {
  display: inline-block;
  border-radius: 50%;
}
.rhythm-visit {
  width: 6px;
  height: 6px;
  background: #8fa0dd;
}
.rhythm-expected {
  width: 9px;
  height: 9px;
  border: 1.5px solid #b8c5ff;
  background: #10162d;
}
.rhythm-today {
  width: 9px;
  height: 9px;
  background: #6f8bff;
  box-shadow:
    0 0 0 3px #6f8bff33,
    0 0 12px #6f8bffaa;
}
.rhythm-scale > .rhythm-visit,
.rhythm-scale > .rhythm-expected,
.rhythm-scale > .rhythm-today {
  transform: translate(-50%, -50%);
}
.rhythm-scale > .rhythm-gap {
  width: calc(var(--w) * 100%);
  height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  background: linear-gradient(90deg, #b8c5ff66, #6f8bff);
  transform-origin: left center;
}
.js .return-preview .rhythm-gap {
  transform: scaleX(0);
  transition: transform 0.9s var(--ease);
}
.js .return-preview .rhythm-scale > .rhythm-today {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4);
  transition:
    opacity 0.5s var(--ease),
    transform 0.6s var(--ease);
}
.js .return-preview .rhythm-person .state-pill {
  opacity: 0;
  transform: translateX(6px);
  transition:
    opacity 0.5s var(--ease),
    transform 0.6s var(--ease);
}
.js .return-preview.is-live .rhythm-gap {
  transform: none;
}
.js .return-preview.is-live .rhythm-scale > .rhythm-today {
  opacity: 1;
  transform: translate(-50%, -50%);
}
.js .return-preview.is-live .rhythm-person .state-pill {
  opacity: 1;
  transform: none;
}
.js .return-preview .rhythm-person .rhythm-gap {
  transition-delay: var(--d, 0s);
}
.js .return-preview .rhythm-scale > .rhythm-today,
.js .return-preview .rhythm-person .state-pill {
  transition-delay: calc(var(--d, 0s) + 0.6s);
}
/* Touches already sent sit above the line, numbered; today's one is lit. */
.rhythm-touch {
  display: inline-grid;
  place-items: center;
  width: 12px;
  height: 12px;
  border: 1px solid #b8c5ff59;
  border-radius: 50%;
  background: #10162d;
  color: #b8c5ff;
  font: 600 7px/1 "Inter", sans-serif;
  font-style: normal;
}
.rhythm-scale > .rhythm-touch {
  top: -8px;
  transform: translate(-50%, -50%);
}
.rhythm-touch.is-now {
  border-color: #6f8bff;
  background: #6f8bff;
  color: #fff;
}
.rhythm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 4px 24px 0;
  padding-top: 14px;
  border-top: 1px solid #ffffff12;
  font-size: 10px;
  color: #98a4c2;
}
.rhythm-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Chips of the card take the AI-chip look of the cabinet's dark theme. */
.chat-stage .return-preview :is(.liquid-chip, .state-pill) {
  border-color: #3e60ff4d;
  color: #a9bcff;
  background: #3e60ff2e;
  box-shadow: none;
}

/* Segments section */
.segments-section {
  padding-top: 110px;
}
.segments-stage {
  position: relative;
  padding: 22px 28px 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(ellipse 55% 40% at 50% 0%, #3e60ff29, transparent 72%),
    radial-gradient(ellipse 45% 40% at 100% 100%, #7d72f21a, transparent 72%),
    linear-gradient(180deg, #111630, #0b0f22);
  box-shadow: var(--shadow);
}
.seg-controls {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.js .seg-controls {
  display: flex;
}
.seg-steps,
.seg-switch {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 5px;
  list-style: none;
  background: #ffffff0a;
  border: 1px solid #96aaff26;
  border-radius: 999px;
}
.seg-steps button,
.seg-switch button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #98a4c2;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  transition:
    color 0.18s,
    background 0.18s,
    box-shadow 0.18s;
}
.seg-steps button:hover,
.seg-switch button:hover {
  color: #fff;
  background: #ffffff0f;
}
.seg-steps button[aria-current="step"],
.seg-switch button[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(#ffffff2e, #ffffff14);
  box-shadow:
    inset 0 1px 0 #ffffff40,
    0 2px 8px #00000a66;
}
.seg-steps button > span {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff14;
  color: #b6bed7;
  font-size: 10px;
  font-weight: 600;
}
.seg-steps button[aria-current="step"] > span {
  background: #3e60ff;
  color: #fff;
}
.seg-step-bar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: #8fa6ff;
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left center;
}
.seg-steps button[aria-current="step"] .seg-step-bar {
  opacity: 0.55;
}

.seg-board {
  position: relative;
  margin-top: 18px;
}
.seg-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.seg-whole {
  display: none;
}
.js .seg-whole {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  text-align: center;
  pointer-events: none;
  transition:
    opacity 0.3s ease-out,
    transform 0.4s var(--ease);
}
.seg-whole b {
  font-size: 76px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.045em;
  color: #eef1ff;
  text-shadow:
    0 0 24px #0d1228,
    0 0 48px #0d1228;
}
.js .seg-whole::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: -1;
  width: 340px;
  height: 200px;
  margin: -100px 0 0 -170px;
  border-radius: 50%;
  background: radial-gradient(closest-side, #0d1228 55%, #0d122800);
}
.seg-whole span {
  font-size: 15px;
  color: #98a4c2;
  text-shadow: 0 0 16px #0d1228;
}
.segments-stage:not([data-step="1"]) .seg-whole {
  opacity: 0;
  transform: scale(0.94);
}

.seg-lanes {
  margin: 0;
  padding: 0;
  list-style: none;
}
.seg-lane {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 384px) minmax(0, 1fr);
  align-items: center;
  gap: 32px;
  padding: 16px 4px;
}
.seg-lane::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: #96aaff1a;
}
.seg-lane:last-child::after {
  display: none;
}
.seg-lane-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  line-height: 1.35;
}
.seg-lane-head b {
  position: relative;
  padding-left: 16px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #eef1ff;
}
.seg-lane-head b::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--seg-c);
}
.seg-lane-head span {
  flex-basis: 100%;
  font-size: 14px;
  font-weight: 500;
  color: #c9d1ec;
}
.seg-lane-head small {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--muted);
}
.seg-key {
  align-self: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #3e60ff;
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 500;
  box-shadow: 0 4px 12px -4px #3e60ff99;
}
.seg-lane-head span,
.seg-lane-head small {
  order: 2;
}
.seg-dots {
  position: relative;
  height: 64px;
}
.seg-dots::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--share) / 58.5 * 100%);
  min-width: 16px;
  background: radial-gradient(circle, var(--seg-c) 2.4px, transparent 2.9px)
    0 0 / 8px 8px;
}
.js .seg-dots::before {
  display: none;
}
.seg-lane-action {
  font-size: 13.5px;
  line-height: 1.55;
  color: #a9b2cf;
}
.seg-lane-action em {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #3e60ff29;
  box-shadow: inset 0 0 0 1px #8fa6ff26;
  color: #b8c5ff;
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}
.seg-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
}

.seg-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 20px;
  margin-top: 22px;
}
.seg-rules,
.seg-result {
  padding: 26px 28px;
  border-radius: 20px;
}
.seg-rules {
  border: 1px solid #96aaff1f;
  background:
    radial-gradient(ellipse 70% 60% at 0% 0%, #3e60ff1a, transparent 70%),
    linear-gradient(180deg, #111630, #0b0f22);
  box-shadow: var(--shadow);
}
.seg-rules h3,
.seg-result h3 {
  font-size: 19px;
}
.seg-rules ul {
  display: grid;
  gap: 10px;
  margin: 16px 0 18px;
  padding: 0;
  list-style: none;
}
.seg-rules li {
  position: relative;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #a9b2cf;
}
.seg-rules li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6f8bff;
  box-shadow: 0 0 8px #6f8bff99;
}
.seg-rules li b {
  color: #eef1ff;
  font-weight: 600;
}
.seg-cascade {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.seg-cascade span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid #96aaff26;
  border-radius: 999px;
  background: #ffffff0a;
  font-size: 12px;
  color: #dfe4f7;
}
.seg-cascade img {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
}
.seg-cascade i {
  font-style: normal;
  color: #6c7698;
  font-size: 12px;
}
.seg-small {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}
.seg-result {
  color: #f4f6ff;
  background:
    radial-gradient(ellipse 80% 60% at 100% 0%, #8ea2ff55, transparent 70%),
    linear-gradient(160deg, #3e60ff, #2340d8 45%, #141f78);
  box-shadow:
    inset 0 1px 0 #ffffff40,
    0 0 0 1px #8fa6ff33,
    0 24px 60px -20px #3e60ff80;
}
.seg-result-label {
  font-size: 12px;
  color: #c9d3ff;
}
.seg-result h3 {
  margin-top: 6px;
}
.seg-funnel {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.seg-funnel li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  font-size: 13px;
  color: #dfe5ff;
}
.seg-funnel b {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}
.seg-funnel b small {
  margin-left: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #c9d3ff;
}
.seg-funnel i {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 6px;
  background: #ffffff26;
  overflow: hidden;
  position: relative;
}
.seg-funnel i::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #fff, #dfe6ff);
  transform: scaleX(var(--v));
  transform-origin: left center;
}
.seg-revenue {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #ffffff2a;
  font-size: 13px;
  color: #dfe5ff;
}
.seg-revenue b {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #fff;
}
.seg-result .seg-small {
  color: #c9d3ff;
}

/* Story steps: only with JS; without it everything is visible. */
.js .segments-stage .seg-lane-head,
.js .segments-stage .seg-lane-action,
.js .segments-stage .seg-lane::after,
.js .segments-stage .seg-rules,
.js .segments-stage .seg-result,
.js .segments-stage .seg-note {
  transition:
    opacity 0.7s var(--ease),
    transform 0.8s var(--ease);
}
.js .segments-stage .seg-lane:nth-child(2) > * {
  transition-delay: 80ms;
}
.js .segments-stage .seg-lane:nth-child(3) > * {
  transition-delay: 160ms;
}
.js .segments-stage .seg-lane:nth-child(4) > * {
  transition-delay: 240ms;
}
.js .segments-stage .seg-lane:nth-child(5) > * {
  transition-delay: 320ms;
}
/* Labels appear only once the dots have landed in their lanes. */
.js .segments-stage:not(.is-landed) .seg-lane-head,
.js .segments-stage:not(.is-landed) .seg-lane::after,
.js .segments-stage:not(.is-landed) .seg-note {
  opacity: 0;
  transform: translateY(8px);
}
.js .segments-stage:not(.is-landed) .seg-lane::after {
  transform: none;
}
.js .segments-stage:not(.is-landed) .seg-lane-action,
.js .segments-stage:not(.is-landed) .seg-rules,
.js .segments-stage:is([data-step="1"], [data-step="2"]) .seg-lane-action {
  opacity: 0;
  transform: translateY(10px);
}
/* Steps 1–2 take only the height they show; later blocks unfold below. */
.js .segments-stage:is([data-step="1"], [data-step="2"]) .seg-bottom {
  display: none;
}
@starting-style {
  .js .segments-stage .seg-rules,
  .js .segments-stage .seg-result,
  .js .segments-stage .seg-lane-action {
    opacity: 0;
    transform: translateY(10px);
  }
}
.js .segments-stage:not([data-step="4"]) .seg-result {
  opacity: 0;
  transform: translateY(14px);
}
.js .segments-stage .seg-funnel i::after {
  transition: transform 1.1s var(--ease);
}
.js .segments-stage .seg-funnel li:nth-child(2) i::after {
  transition-delay: 0.2s;
}
.js .segments-stage .seg-funnel li:nth-child(3) i::after {
  transition-delay: 0.4s;
}
.js .segments-stage:not([data-step="4"]) .seg-funnel i::after {
  transform: scaleX(0);
}

@media (max-width: 1100px) {
  .js .segments-stage:is([data-step="1"], [data-step="2"]) .seg-lane-action {
    display: none;
  }
  .seg-lane {
    grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
    gap: 10px 24px;
  }
  .seg-lane-action {
    grid-column: 2;
  }
}
@media (max-width: 767px) {
  .rhythm-person {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px 10px;
    padding: 14px 0;
  }
  .rhythm-person .state-pill {
    grid-column: 2;
    justify-self: start;
    margin: 6px 0 0;
  }
  .rhythm-scale {
    margin-top: 16px;
  }
  .rhythm-legend {
    margin-inline: 16px;
    font-size: 8px;
  }

  .segments-section {
    padding-top: 72px;
  }
  .segments-stage {
    padding: 12px 14px 16px;
    border-radius: 20px;
  }
  .seg-controls {
    gap: 8px;
  }
  .seg-steps,
  .seg-switch {
    width: 100%;
    padding: 4px;
  }
  .seg-steps {
    gap: 2px;
  }
  .seg-steps li {
    flex: auto;
  }
  .seg-steps button,
  .seg-switch button {
    justify-content: center;
    width: 100%;
    min-height: 36px;
    padding: 7px 5px;
    font-size: 12px;
  }
  .seg-switch button {
    flex: 1;
  }
  .seg-steps button > span {
    display: none;
  }
  .seg-step-bar {
    left: 10px;
    right: 10px;
    bottom: 3px;
  }
  .seg-whole b {
    font-size: 54px;
  }
  .js .seg-whole::before {
    width: 260px;
    height: 150px;
    margin: -75px 0 0 -130px;
  }
  .seg-whole span {
    font-size: 13px;
  }
  .seg-lane {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 14px 0;
  }
  .seg-lane-action {
    grid-column: auto;
    font-size: 12.5px;
  }
  .seg-lane-head b {
    font-size: 22px;
  }
  .seg-lane-head span {
    order: 0;
    flex-basis: auto;
    font-size: 13px;
  }
  .seg-lane-head small {
    font-size: 12px;
  }
  .seg-key {
    font-size: 12px;
    padding: 3px 8px;
  }
  .seg-dots {
    height: 52px;
  }
  .seg-dots::before {
    background-size: 6.5px 6.5px;
    background-image: radial-gradient(
      circle,
      var(--seg-c) 2px,
      transparent 2.4px
    );
  }
  .seg-note {
    font-size: 12px;
  }
  .js .segments-stage:not([data-step="4"]) .seg-result {
    display: none;
  }
  .seg-bottom {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin-top: 16px;
  }
  .seg-rules,
  .seg-result {
    padding: 20px 18px;
    border-radius: 18px;
  }
  .seg-rules h3,
  .seg-result h3 {
    font-size: 17px;
  }
  .seg-rules li {
    font-size: 12.5px;
  }
  .seg-cascade span {
    padding: 5px 9px;
    font-size: 12px;
  }
  .seg-revenue b {
    font-size: 26px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .js .return-preview .rhythm-gap,
  .js .return-preview .rhythm-person .state-pill {
    opacity: 1;
    transform: none;
  }
  .js .return-preview .rhythm-scale > .rhythm-today {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}
