/* Purpose: Styles for /speed-to-lead only: the hero map of 6 service lines into one calendar, the
   business name fields, and each flow's player (branching map, phone thread, calendar card).
   Canon: ../../README.md § Speed-to-Lead page (design notes named there).
   Everything reads without JavaScript; js/speed-to-lead.js adds .is-live, the moving dots and wires. */

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---- Hero ---- */
.ahero {
  padding: calc(var(--header-height) + var(--space-2xl)) 0 var(--space-3xl);
  background: var(--bg-primary);
}

.ahero__top {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.ahero__title {
  max-width: 900px;
  font-size: clamp(2.125rem, 1.4rem + 2.4vw, 3rem);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  text-wrap: balance;
}

.ahero__title em {
  font-style: normal;
  color: var(--color-primary);
}

.ahero__lede {
  max-width: 640px;
  margin-top: var(--space-md);
  font-size: var(--font-size-lg);
  line-height: 1.6;
  color: var(--text-secondary);
}

.ahero__fine {
  margin-top: var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

@media (min-width: 1024px) {
  .ahero__top {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-3xl);
  }

  .ahero__cta {
    flex-shrink: 0;
    text-align: right;
  }
}

@media (max-width: 599px) {
  .ahero__cta .btn {
    width: 100%;
  }
}

/* The map: a wide drawing on desktop, a tall one on phones */
.netmap {
  margin: var(--space-xl) 0 0;
}

.netmap__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.netmap__svg--tall {
  display: none;
  max-width: 480px;
  margin: 0 auto;
}

@media (max-width: 959px) {
  .netmap__svg--wide { display: none; }
  .netmap__svg--tall { display: block; }
}

.net-line {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}

.netmap__svg--tall .net-line {
  stroke-width: 5;
}

.net-src circle {
  fill: var(--bg-primary);
  stroke-width: 4;
}

.net-src text,
.net-review text,
.net-hub__title {
  font: 700 13px var(--font-family);
  fill: var(--text-primary);
}

.net-hub__title {
  font-size: 14px;
}

.net-stop circle {
  fill: var(--bg-primary);
  stroke: var(--text-primary);
  stroke-width: 3;
}

.net-label text {
  font: 500 13px var(--font-family);
  fill: var(--text-secondary);
  text-anchor: middle;
}

.net-hub rect:first-child {
  fill: var(--bg-secondary);
  stroke: var(--border-color);
  stroke-width: 1.5;
}

.net-day {
  font: 500 12px var(--font-family);
  fill: var(--text-muted);
  text-anchor: middle;
}

.net-slot {
  fill: #1b2a42;
  transition: fill 0.5s ease-out;
}

/* The review line's own color (speed-to-lead.html), so the line ends in its own dot */
.net-review circle {
  fill: #b78a16;
}

.net-token {
  fill: #ffffff;
  stroke-width: 4;
}

.netmap__caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-md);
  margin-top: var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* Pause / replay controls (hero and players share the look) */
.netmap__pause,
.player__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0 1rem;
  font: 600 var(--font-size-sm) var(--font-family);
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-full);
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.netmap__pause:hover,
.player__btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.netmap__pause:focus-visible,
.player__btn:focus-visible,
.auto-jump__link:focus-visible,
.tailor__field select:focus-visible,
.tailor__field input:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

/* Jump list doubles as the map legend */
.auto-jump {
  margin-top: var(--space-xl);
}

.auto-jump__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.auto-jump__link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0 1rem;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-full);
  transition: border-color var(--transition-fast);
}

.auto-jump__link::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--k);
}

.auto-jump__link:hover {
  border-color: var(--k);
  color: var(--text-primary);
}

/* ---- See it with your business name ---- */
.tailor {
  padding: var(--space-3xl) 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.tailor[hidden] {
  display: none;
}

.tailor__inner {
  display: grid;
  gap: var(--space-xl);
}

.tailor__title {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tailor__text {
  margin-top: var(--space-sm);
  color: var(--text-secondary);
  max-width: 520px;
}

.tailor__fields {
  display: grid;
  gap: var(--space-md);
}

.tailor__field {
  display: grid;
  gap: 0.4rem;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.tailor__field select,
.tailor__field input {
  min-height: 48px;
  padding: 0 0.9rem;
  font: 500 16px var(--font-family);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid #2a4066;
  border-radius: var(--border-radius-md);
}

.tailor__field input::placeholder {
  color: var(--text-muted);
}

@media (min-width: 720px) {
  .tailor__fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .tailor__inner {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    align-items: end;
  }

  .legend {
    grid-column: 1 / -1;
  }
}

/* Node kinds: a shape and a color, so color is never the only cue */
.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.legend__item,
.node {
  --mk: #94a3b8;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.legend__item::before,
.node__title::before {
  content: '';
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  background: var(--mk);
}

.legend__item--trigger::before,
.node--trigger .node__title::before { border-radius: 50%; }
.legend__item--message::before,
.node--message .node__title::before { border-radius: 2px 6px 6px 6px; }
.legend__item--check::before,
.node--check .node__title::before,
.node--ai .node__title::before { transform: rotate(45deg) scale(0.85); }
.legend__item--owner::before,
.node--owner .node__title::before { border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 2.5px var(--mk); }
.legend__item--goal::before,
.node--goal .node__title::before { border-radius: 3px; }

.legend__item--trigger,
.node--trigger { --mk: #e8edf4; }
.legend__item--message,
.node--message { --mk: #60a5fa; }
.legend__item--check,
.node--check,
.node--ai { --mk: #fbbf24; }
.legend__item--owner,
.node--owner { --mk: #f0abfc; }
.legend__item--goal,
.node--goal { --mk: #34d399; }

/* ---- Flow sections ---- */
.flow {
  --flow: var(--color-primary);
  padding: var(--space-4xl) 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
}

.flow__head {
  display: grid;
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.flow__starts {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: var(--space-sm);
  font-size: var(--font-size-sm);
  font-weight: 700;
  /* Text stays in text ink; the dot carries the flow color (2 flow colors sit under 4.5:1) */
  color: var(--text-primary);
}

.flow__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--flow);
}

.flow__title {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.flow__lead {
  margin-top: var(--space-sm);
  max-width: 640px;
  font-size: var(--font-size-lg);
  line-height: 1.6;
  color: var(--text-secondary);
}

.flow__facts {
  list-style: none;
  display: grid;
  gap: var(--space-sm);
  align-content: end;
  font-size: var(--font-size-sm);
  line-height: 1.55;
  color: var(--text-secondary);
}

.flow__facts strong {
  display: block;
  color: var(--text-primary);
}

.flow__aside {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (min-width: 1024px) {
  .flow__head {
    grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
    gap: var(--space-3xl);
  }
}

/* ---- Player: map + phone + calendar ---- */
.player {
  display: grid;
  gap: var(--space-xl);
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
}

/* Desktop: the calendar sits under the map, the phone runs down the right */
@media (min-width: 1024px) {
  .player {
    grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
      "map device"
      "cal device"
      "bar bar";
    gap: var(--space-lg) var(--space-2xl);
    padding: var(--space-xl);
  }

  .player__map { grid-area: map; }
  .player > .player__side { display: contents; }
  .device { grid-area: device; align-self: start; }
  .cal { grid-area: cal; align-self: start; max-width: 420px; }
  .player__bar { grid-area: bar; }
}

@media (max-width: 599px) {
  .player {
    padding: var(--space-md) 0.75rem;
  }
}

.player__map {
  position: relative;
  min-width: 0;
}

.graph {
  position: relative;
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: repeat(var(--rows, 6), auto);
  gap: 1.75rem 1.5rem;
}

.graph__wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.wire {
  fill: none;
  stroke: #2f4468;
  stroke-width: 2;
  transition: stroke 0.3s ease-out, stroke-width 0.3s ease-out;
}

.wire.is-path {
  stroke: color-mix(in srgb, var(--flow) 45%, #2f4468);
}

.wire.is-lit {
  stroke: var(--flow);
  stroke-width: 3;
}

.wire-label {
  font: 600 11px var(--font-family);
  fill: var(--text-secondary);
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--bg-secondary);
  stroke-width: 5px;
  stroke-linejoin: round;
}

.graph__token {
  fill: #ffffff;
  stroke: var(--flow);
  stroke-width: 3;
}

.node {
  position: relative;
  z-index: 1;
  align-self: start;
  padding: 0.6rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  transition: border-color 0.3s ease-out, box-shadow 0.3s ease-out, opacity 0.3s ease-out;
}

.node__meta {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.node__title {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

.node__title::before {
  position: relative;
  top: 1px;
}

.node__say {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.player.is-live .node__say {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.player.is-live .node {
  opacity: 0.6;
}

.player.is-live .node.is-done,
.player.is-live .node.is-on {
  opacity: 1;
}

.node.is-on {
  border-color: var(--flow);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--flow) 30%, transparent);
}

.node--goal.is-done,
.node--goal.is-on {
  border-color: #34d399;
}

.player__now {
  min-height: 3em;
  margin-top: var(--space-lg);
  font-size: var(--font-size-sm);
  line-height: 1.5;
  color: var(--text-secondary);
}

.player__now strong {
  color: var(--text-primary);
}

.player:not(.is-live) .player__now {
  display: none;
}

@media (max-width: 599px) {
  .graph {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.25rem 0.6rem;
  }

  .node {
    padding: 0.45rem 0.5rem;
  }

  .node__title {
    font-size: 0.75rem;
    gap: 0.3rem;
  }

  .node__title::before {
    width: 8px;
    height: 8px;
  }

  .node__meta {
    font-size: 0.6875rem;
  }

  .wire-label {
    font-size: 10px;
  }
}

/* Phone thread */
.player__side {
  display: grid;
  gap: var(--space-md);
  align-content: start;
  min-width: 0;
}

.device {
  padding: var(--space-md);
  background: #06111f;
  border: 6px solid #1b2a42;
  border-radius: 28px;
}

.device__head {
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-sm);
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.device__head strong {
  display: block;
  color: var(--text-primary);
}

.thread {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.msg {
  max-width: 88%;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-primary);
  border-radius: 16px;
  transition: opacity 0.35s ease-out, transform 0.35s ease-out;
}

.msg__meta {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #a9b9cf;
}

.msg--out {
  align-self: flex-end;
  background: #0d3a4a;
  border-bottom-right-radius: 5px;
}

.msg--in {
  align-self: flex-start;
  background: #24324a;
  border-bottom-left-radius: 5px;
}

.msg--event {
  align-self: center;
  max-width: 100%;
  padding: 0.3rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-align: center;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-full);
}

.msg--booked {
  font-weight: 700;
  color: #bdf5dc;
  border-color: #34d399;
}

.msg--you {
  align-self: stretch;
  max-width: 100%;
  font-size: 0.8125rem;
  background: #1a1830;
  border: 1px dashed #6b5ca8;
  border-radius: var(--border-radius-md);
}

.msg--you .msg__meta {
  color: #d8c8ff;
}

.player.is-live .msg {
  opacity: 0;
  transform: translateY(6px);
}

.player.is-live .msg.is-in {
  opacity: 1;
  transform: none;
}

.fill {
  padding: 0 0.15em;
  color: #9fe7f7;
  background: rgba(4, 186, 222, 0.12);
  border-radius: 4px;
}

.fill.is-set {
  padding: 0;
  color: inherit;
  background: none;
}

.msg__link {
  color: #7fdcf2;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Calendar card */
.cal {
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  transition: border-color 0.4s ease-out;
}

.cal__head {
  margin-bottom: var(--space-sm);
  font-size: var(--font-size-sm);
  font-weight: 700;
}

.cal__week {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
}

.cal__week span {
  padding: 0.35rem 0;
  background: #1b2a42;
  border-radius: 6px;
  transition: background 0.4s ease-out, color 0.4s ease-out;
}

.cal .cal__day--hit {
  font-weight: 700;
  color: #06111f;
  background: #34d399;
}

.cal__slot {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #bdf5dc;
  background: rgba(52, 211, 153, 0.12);
  border-left: 3px solid #34d399;
  border-radius: 6px;
  transition: opacity 0.4s ease-out;
}

.cal--review .cal__slot {
  color: #fde68a;
  background: rgba(250, 204, 21, 0.1);
  border-left-color: #facc15;
}

.cal--review .cal__slot svg {
  color: #facc15;
}

.player.is-live .cal:not(.is-in) .cal__day--hit {
  color: var(--text-secondary);
  background: #1b2a42;
}

.player.is-live .cal:not(.is-in) .cal__slot {
  opacity: 0;
}

.player.is-live .cal.is-in {
  border-color: #34d399;
}

.player.is-live .cal--review.is-in {
  border-color: #facc15;
}

.player__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-md);
}

.player__note {
  flex: 1 1 240px;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* ---- Mid-page call to action ---- */
.auto-strip {
  padding: var(--space-3xl) 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.auto-strip__inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xl);
}

.auto-strip__title {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: var(--space-sm);
}

.auto-strip__text {
  max-width: 620px;
  color: var(--text-secondary);
}

.auto-strip__who {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  max-width: 620px;
  margin-top: var(--space-lg);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.auto-strip__who strong {
  color: var(--text-primary);
}

.auto-strip__who a {
  color: var(--color-primary-light);
  font-weight: 600;
  white-space: nowrap;
}

.auto-strip__photo {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  object-fit: cover;
}

@media (max-width: 599px) {
  .auto-strip__inner .btn {
    width: 100%;
  }
}

@media (min-width: 1024px) {
  .auto-strip__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .auto-strip__inner .btn {
    flex-shrink: 0;
  }
}

/* ---- You stay in control: a ruled list ---- */
.auto-control {
  padding: var(--space-4xl) 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
}

.auto-control__heading {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auto-control__sub {
  margin-top: var(--space-sm);
  color: var(--text-secondary);
}

.auto-control__list {
  list-style: none;
  display: grid;
  margin-top: var(--space-2xl);
  border-top: 1px solid var(--border-color);
}

.auto-control__list li {
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--border-color);
}

.auto-control__title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.auto-control__text {
  font-size: var(--font-size-sm);
  line-height: 1.6;
  color: var(--text-secondary);
}

@media (min-width: 1024px) {
  .auto-control__list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-bottom: 1px solid var(--border-color);
  }

  .auto-control__list li {
    padding: var(--space-xl) var(--space-xl) var(--space-xl) 0;
    border-bottom: 0;
  }

  .auto-control__list li + li {
    padding-left: var(--space-xl);
    border-left: 1px solid var(--border-color);
  }
}

@media (prefers-reduced-motion: reduce) {
  .net-slot,
  .wire,
  .node,
  .msg,
  .cal,
  .cal__slot,
  .cal__week span {
    transition: none;
  }
}
