/* The guided product tour, on a dark band (Figma 11:373 tiles, 4:59 chapter
   line, 11:408 phones). Eight chapter tiles, a line naming the chapter, then
   the player: dark chrome, lime Play and progress, around the real CRM,
   which stays the light product it is. Text, rules and focus follow the
   band's variables (styles.css). */
.hero-stage { padding-block: 64px; }
.tour-guide {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 24px;
  margin-bottom: 24px; font-size: 15px; line-height: 24px; color: var(--fg-2);
}
.tour-guide > span:first-child { color: var(--fg); font-weight: 600; }

/* Chapters: one row of eight tiles, four to a row on tablets, two on
   phones. The selected tile's lime is .tour-tab-mark, which homepage.js
   adds and slides to it (420ms, the motion notes); its outline turns lime
   at once so the choice registers before the fill arrives. */
.tour-tabs { position: relative; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.tour-tabs [role="tab"] {
  position: relative; display: flex; flex-direction: column; justify-content: flex-start;
  min-height: 76px; padding: 15px 11px;
  border: 1px solid var(--line-dark); border-radius: var(--radius-control);
  background: transparent; color: var(--fg); text-align: left;
  transition: border-color var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);
}
.tour-tab-name { font-size: 14px; line-height: 22px; font-weight: 600; }
.tour-tab-purpose { display: block; margin-top: 4px; font-size: 13px; line-height: 18px; color: var(--fg-2); }
.tour-tabs [role="tab"]:hover { border-color: var(--outline-dark); }
.tour-tabs [role="tab"]:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
/* The text turns ink a beat after the outline, as the fill arrives. */
.tour-tabs [aria-selected="true"] { border-color: var(--lime); color: var(--ink); transition-delay: 0ms, 120ms; }
.tour-tabs [aria-selected="true"]:hover { border-color: var(--lime); }
.tour-tabs [aria-selected="true"] .tour-tab-purpose { color: var(--ink); }
.tour-tabs [aria-selected="true"]:focus-visible { outline-color: var(--ink); outline-offset: -6px; }
/* Before homepage.js has placed the mark, the tile fills itself. */
.tour-tabs:not(:has(.tour-tab-mark)) [aria-selected="true"] { background: var(--lime); }
.tour-tab-mark {
  position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none;
  border-radius: var(--radius-control); background: var(--lime);
  /* Only the position glides; tiles in a row share one size, so the size
     can change in place without animating layout. */
  transition: transform 420ms cubic-bezier(0.25, 0.9, 0.35, 1);
}
.tour-tab-mark.is-placing { transition: none; }
/* Tiles serve every width, so the chapter select (kept for the page
   checks) carries the hidden attribute in the partial. */

/* The tiles above already name the chapter, so its title line under them
   is for screen readers only; it still heads the tab panel. /tour/ and
   feature pages show the chapter's description and feature link here. */
.tour-overview { padding: 20px 0; }
.tour-proof { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tour-heading > * { display: inline; margin: 0; font: inherit; }
.home-tour .tour-overview { padding: 0 0 24px; }
/* /tour/ and feature pages explain the chapter; the homepage does not. */
.tour-explanation { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 40px; }
.tour-explanation p { max-width: 780px; min-height: 56px; }
.tour-explanation .arrow-link { flex: none; margin-bottom: 3px; }
#tour-panel:focus-visible { outline: 2px solid var(--focus); outline-offset: 8px; }

/* The player is the CRM running, with nothing drawn over it: no toolbar, no
   play button, no loading message (the chapter's poster stands in until the
   CRM is ready). It starts by itself once on screen; a click on the screen
   pauses and resumes it quietly (tour-player.js). */
.tour-player {
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line-dark); border-radius: var(--radius-control);
  background: var(--ink); color: var(--white);
}
/* How much of the chapter has played: one lime line along the top of the
   screen, growing step by step. No track and no step marks: the segments
   touch, so a played run reads as one line (Jon, 26 October 2026). */
.tour-progress { display: flex; height: 3px; }
.tour-progress > span { position: relative; flex: 1; overflow: hidden; }
.tour-progress i { position: absolute; inset: 0; background: var(--lime); transform: scaleX(0); transform-origin: left; }

/* The CRM and everything laid over it. Overlays sit on the light product,
   so their focus ring is ink. */
.tour-viewport { --focus: var(--ink); position: relative; aspect-ratio: 1440 / 900; background: var(--surface); overflow: hidden; }
.tour-stage { position: absolute; top: 0; left: 0; width: 1440px; height: 900px; transform-origin: 0 0; }
.tour-viewport.is-focused .tour-stage { transition: transform 400ms var(--ease); }
.tour-stage iframe { display: block; width: 1440px; height: 900px; border: 0; }
.tour-viewport > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.tour-surface {
  position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; padding: 0;
  border: 0; background: transparent; cursor: pointer;
}
.tour-surface:focus-visible { outline: 2px solid var(--ink); outline-offset: -6px; }
/* Loading is announced, not drawn. */
.tour-loading { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* End of a chapter: a white card (band-light in the markup, so its buttons
   are ink) over the dimmed last screen. */
.tour-end {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: color-mix(in srgb, var(--ink) 62%, transparent);
}
.tour-end-card { width: min(520px, 100%); padding: 32px; border-radius: var(--radius-control); }
.tour-end-card h4 { margin: 0 0 24px; font-size: 24px; line-height: 32px; }
.tour-end-card h4:focus { outline: none; }
.tour-end-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.tour-end-actions .button { flex: 1 1 auto; min-width: 0; }
.tour-end-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; margin: 12px 0 0; font-size: 14px; line-height: 22px; color: var(--fg-2); }
.tour-end-links button, .tour-end-links a, .tour-countdown button {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none;
  font-size: 14px; line-height: 22px; font-weight: 600; color: var(--fg);
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 5px;
  transition: text-decoration-color var(--motion-fast);
}
.tour-end-links button:hover, .tour-end-links a:hover, .tour-countdown button:hover { text-decoration-color: currentColor; }
/* No dot before a link that is not there. */
.tour-end-links span:has(+ a[hidden]) { display: none; }
.tour-countdown { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0; font-size: 14px; line-height: 22px; color: var(--fg-2); font-variant-numeric: tabular-nums; }

.tour-caption { display: flex; align-items: center; gap: 16px; min-height: 72px; padding: 16px 20px; }
.tour-caption p { margin: 0; font-size: 18px; line-height: 28px; color: var(--white); }
.tour-stall {
  margin-left: auto; flex: none; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--outline-dark); border-radius: var(--radius-control); background: transparent;
  font-size: 14px; font-weight: 600; color: var(--white);
  transition: border-color var(--motion-fast);
}
.tour-stall:hover { border-color: var(--white); }

/* Without JavaScript the player cannot run: its controls are hidden (a
   <noscript> style in the page head) and this line says so. */
.tour-noscript { padding: 12px 0; font-size: 14px; line-height: 22px; color: var(--fg-2); }

/* Homepage: the section has its own intro and call to action, so the tour
   shows the chapters, the chapter line and the screen only. The caption is
   still announced, and shows only if a step stalls and offers to skip it.
   /tour/ has its own heading in place of the guide line. */
.home-tour .tour-guide,
.home-tour .tour-explanation,
.tour-section:not(.hero-stage) .tour-guide { display: none; }
.home-tour .tour-caption:not(:has(.tour-stall:not([hidden]))) {
  position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* The whole player (screen and caption) fits under the header on a laptop:
   its width follows the window's height, centred in the column, and never
   drops below the scale at which the CRM is still readable. */
.tour-player { --player-extra: 104px; }
.home-tour .tour-player { --player-extra: 32px; }
@media (min-width: 861px) {
  .tour-player { width: min(100%, max(864px, calc((100svh - var(--header-h, 105px) - var(--player-extra)) * 1.6))); margin-inline: auto; }
}
/* Eight across only where "08 / Automations" fits its tile. */
@media (max-width: 1279px) {
  .tour-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* Below about 860px the CRM is too small to read at full width, so the
   viewport becomes a window that follows the control being used. */
@media (max-width: 860px) {
  .tour-viewport { aspect-ratio: 4 / 3; }
}
@media (max-width: 760px) {
  .hero-stage { padding-block: 40px 48px; }
  .tour-guide { flex-direction: column; gap: 2px; margin-bottom: 20px; }
  .tour-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tour-tab-name { font-size: 15px; }
  .tour-overview { padding: 16px 0; }
  .tour-explanation { flex-direction: column; align-items: flex-start; gap: 4px; }
  .tour-explanation p { min-height: 0; }
  .tour-caption { flex-direction: column; align-items: flex-start; min-height: 0; padding: 14px 16px; gap: 8px; }
  .tour-caption p { font-size: 16px; line-height: 24px; }
  .tour-stall { margin: 0; }
  /* The end card fits the phone's 4:3 window: the outcome, Next and Replay.
     The page's own call to action follows the tour. */
  .tour-end { padding: 12px; }
  .tour-end-card { padding: 16px 18px 6px; }
  .tour-end-card h4 { margin: 6px 0 12px; font-size: 18px; line-height: 24px; }
  .tour-end-actions .button { min-height: 48px; padding-block: 12px; }
  .tour-end-actions #tour-end-cta { display: none; }
  .tour-end-links { margin-top: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .tour-viewport.is-focused .tour-stage,
  .tour-tabs [role="tab"],
  .tour-tab-mark,
  .tour-stall { transition: none; }
}

/* How it works: the connected workflow canvas (partials/workflow.html).
   Scoped to the canvas so the homepage's own workflow, which shares a class
   name and also loads this file, is untouched. */
.workflow-section { padding-block: 64px; }
.workflow-canvas {
  position: relative; aspect-ratio: 1248 / 499; border-radius: var(--radius-control);
  background: var(--canvas) radial-gradient(#d3d5ce 0.7px, transparent 0.7px) 16px 16px / 24px 24px;
  border: 1px solid var(--line);
}
.workflow-canvas .workflow-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 2; }
.workflow-canvas .track { stroke: var(--line-strong); }
.workflow-canvas .pulse { stroke: var(--green); stroke-width: 1.8; stroke-dasharray: 4 96; animation: flow 18s linear infinite; }
.workflow-canvas .alternate { opacity: 0.6; }
.workflow-node {
  position: absolute; width: 23.077%; height: 28.86%; padding: 20px; isolation: isolate;
  border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--canvas); color: var(--ink);
  transition: border-color 0.2s;
}
.workflow-node:hover { border-color: var(--line-strong); }
.workflow-node h3 { margin: 0 0 8px; font-size: 20px; color: var(--ink); }
.workflow-node p { font-size: 14px; line-height: 1.5; color: var(--quiet); }
.workflow-node.lead { top: 11.22%; left: 2.56%; }
.workflow-node.quote { top: 11.22%; left: 38.46%; }
.workflow-node.booked { top: 11.22%; left: 74.36%; border-color: var(--ink); }
.workflow-node.prepare { top: 59.72%; left: 74.36%; }
.workflow-node.event { top: 59.72%; left: 38.46%; }
.workflow-node.follow-up { top: 59.72%; left: 2.56%; }
@keyframes flow { to { stroke-dashoffset: -100; } }
@media (max-width: 760px) {
  .workflow-canvas { aspect-ratio: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 24px 16px; padding: 20px; }
  .workflow-canvas .workflow-lines { display: none; }
  .workflow-canvas .workflow-node { position: relative; inset: auto; width: auto; height: auto; min-height: 160px; padding: 20px; }
  .workflow-node.prepare { order: 4; }
  .workflow-node.event { order: 5; }
  .workflow-node.follow-up { order: 6; }
  .workflow-node p { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .workflow-canvas .pulse { animation: none; }
}
