/* The service detail page (service.html?s=<slug>). Linked after site.css.
   js/service-page.js fills the text; js/flow3d.js draws the workflow on .flow-stage. */

.sp {
  --stage: #E2E0DB; /* PALETTE.ground: the town's ground, so the white tiles stand out */
  --header: 72px;
  display: block; max-width: 1600px; min-height: calc(100svh - 80px);
  padding: 0 var(--gutter);
}
.sp [hidden] { display: none !important; }
.sp-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ------------------------------------------------------------------ hero */
.sp-hero { padding-top: calc(var(--header) + clamp(28px, 6vh, 64px)); }
.sp-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin: 0 0 clamp(22px, 4vh, 40px); padding: 0; list-style: none; font-size: var(--t-small); }
.sp-crumbs li { display: flex; align-items: center; gap: 8px; }
.sp-crumbs li + li::before { content: "/"; content: "/" / ""; color: color-mix(in srgb, var(--ink-2) 55%, transparent); }
.sp-crumbs a { display: inline-block; padding: 4px 0; color: var(--ink-2); text-decoration: none; transition: color 160ms ease; }
.sp-crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

.sp-hero h1 { font-size: var(--t-h1); line-height: 0.98; max-width: 16ch; overflow-wrap: break-word; }
.sp-short { margin-top: clamp(16px, 2.4vh, 24px); max-width: 38ch; font-size: clamp(1.1rem, 1rem + 0.5vw, 1.4rem); line-height: 1.45; color: var(--ink-2); }
.sp-kind { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 22px; font-size: var(--t-small); line-height: 1.45; color: var(--ink-2); }
.sp-pill {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 500; line-height: 1; white-space: nowrap;
  color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line);
}
.sp-pill[data-kind="core"] { color: var(--ink); background: rgba(28, 30, 35, 0.06); box-shadow: none; }
.sp-pill[data-kind="pilot"] { color: var(--brand); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 40%, transparent); }

/* ------------------------------------------------------------------ the 3D workflow */
.sp-flow { margin-top: clamp(32px, 6vh, 64px); }
.flow-stage {
  position: relative; overflow: hidden; border-radius: 24px; background: var(--stage);
  height: clamp(340px, 22vw + 190px, 520px);
}
.flow-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* labels are HTML, placed under (desktop) or beside (phones) each projected tile */
.flow-labels { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; pointer-events: none; }
.flow-label {
  position: absolute; left: 0; top: 0; pointer-events: auto; cursor: default;
  padding: 4px 6px; border-radius: 8px;
  font-size: 0.9rem; font-weight: 500; line-height: 1.3; letter-spacing: -0.005em; color: var(--ink-2);
  text-wrap: balance; transition: color 180ms ease, opacity 180ms ease;
}
.flow-stage[data-mode="h"] .flow-label { translate: -50% 0; text-align: center; }
.flow-stage[data-mode="v"] .flow-label { translate: 0 -50%; text-align: left; font-size: 0.95rem; }
.flow-stage:not(.is-3d):not(.is-flat) .flow-label { opacity: 0; } /* until three.js has arrived */
.flow-t { padding-bottom: 2px; background: linear-gradient(var(--brand), var(--brand)) no-repeat 0 100% / 0 2px; transition: background-size 220ms ease; }
.flow-label.is-live { color: var(--ink); }
.flow-label.is-active { color: var(--ink); }
.flow-label.is-active .flow-t { background-size: 100% 2px; }
.flow-stage.has-active .flow-label:not(.is-active) { opacity: 0.5; }
.flow-label:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.flow-ico { display: none; }

/* under the stage: what blue means (left) and, for what we host, the trust line (right) */
.flow-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 32px; margin-top: 16px; }
.flow-key { display: flex; align-items: center; gap: 10px; font-size: var(--t-small); color: var(--ink-2); }
.flow-key-swatch { width: 12px; height: 12px; border-radius: 4px; background: var(--brand); }
.sp-trust { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0; padding: 0; list-style: none; font-size: 0.95rem; font-weight: 500; letter-spacing: -0.005em; }
.sp-trust li { display: flex; align-items: center; gap: 9px; }
.trust-ico { display: inline-grid; place-items: center; width: 20px; height: 20px; color: var(--brand); }

/* no WebGL (or three.js didn't load): the same steps as a flat strip */
.flow-stage.is-flat { height: auto; padding: clamp(24px, 4vw, 40px); }
.is-flat .flow-canvas { display: none; }
.is-flat .flow-labels { position: static; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 16px; }
.is-flat .flow-label { position: static; translate: none; display: grid; justify-items: center; align-content: start; gap: 12px; text-align: center; color: var(--ink); }
.is-flat .flow-ico { display: grid; place-items: center; width: 68px; height: 54px; border-radius: 14px; background: #fff; color: var(--brand); }
.is-flat .flow-label[data-ai] .flow-ico { background: var(--brand); color: #fff; }

/* ------------------------------------------------------------------ lower sections */
.sp-section { margin-top: clamp(72px, 11vh, 128px); padding-top: 28px; border-top: 1px solid var(--line); }
.sp-h2 { font-size: clamp(1.6rem, 1.2rem + 1.3vw, 2.4rem); line-height: 1.08; }

/* how we set it up: a numbered sequence joined by a light line */
.setup {
  --gap: 28px;
  display: grid; grid-template-columns: repeat(var(--count, 4), minmax(0, 1fr)); gap: var(--gap);
  margin: clamp(28px, 4vh, 44px) 0 0; padding: 0; list-style: none;
}
.setup li { position: relative; }
.setup li:not(:last-child)::after {
  content: ""; position: absolute; top: 18px; left: 48px; right: calc(12px - var(--gap)); height: 1px; background: var(--line);
}
.setup-n {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--plaster); box-shadow: inset 0 0 0 1px var(--line);
  font-size: 0.95rem; font-weight: 500; color: var(--brand); font-variant-numeric: tabular-nums;
}
.setup p { margin-top: 18px; max-width: 24ch; font-size: 1.05rem; line-height: 1.45; }

/* label on the left, content on the right */
.sp-split { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 24px 40px; }

.needs { margin: 0; padding: 0; list-style: none; }
.needs li { padding: 14px 0; border-bottom: 1px solid var(--line); font-size: clamp(1.1rem, 1rem + 0.4vw, 1.35rem); line-height: 1.35; letter-spacing: -0.01em; }
.needs li:first-child { padding-top: 4px; }

.sibs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; margin: 0; padding: 0; list-style: none; }
.sib {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 0;
  border-bottom: 1px solid var(--line); text-decoration: none; font-size: 1.05rem; line-height: 1.3;
}
.sib-icon {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--plaster); color: var(--brand); box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.sib:hover .sib-icon { background: var(--brand); color: #fff; box-shadow: none; }
.sib:hover .sib-name { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.sp-all { display: inline-block; margin-top: 22px; padding: 6px 0; font-weight: 500; text-underline-offset: 5px; text-decoration-thickness: 1px; transition: color 160ms ease; }
.sp-all:hover { color: var(--brand); }

.sp-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 28px 40px;
  margin-top: clamp(72px, 11vh, 128px); padding: clamp(36px, 6vh, 64px) 0 clamp(64px, 10vh, 112px);
  border-top: 1px solid var(--line);
}
.sp-cta h2 { font-size: var(--t-h2); line-height: 1.02; max-width: 15ch; }
.sp-for { margin-top: 16px; max-width: 46ch; font-size: var(--t-body); line-height: 1.55; color: var(--ink-2); }

/* ------------------------------------------------------------------ not found */
.sp-missing { max-width: 40rem; padding: calc(var(--header) + clamp(56px, 14vh, 160px)) 0 clamp(80px, 14vh, 160px); }
.sp-missing h1 { font-size: var(--t-h2); line-height: 1.04; }
.sp-missing p { margin: 18px 0 30px; max-width: 40ch; font-size: var(--t-body); line-height: 1.6; color: var(--ink-2); }

/* ------------------------------------------------------------------ phones */
@media (max-width: 760px) {
  .sp { --header: 64px; }
  /* the lane runs down the stage; its height follows the number of steps */
  .flow-stage {
    border-radius: 18px;
    height: min(calc(var(--n, 4) * 0.31 * (100vw - 2 * var(--gutter)) + 40px), calc(var(--n, 4) * 124px + 60px));
  }
  .is-flat .flow-labels { grid-auto-flow: row; }
  .is-flat .flow-label { grid-template-columns: 56px 1fr; justify-items: start; align-items: center; text-align: left; }
  .is-flat .flow-ico { width: 56px; height: 46px; }

  .setup { --gap: 0px; grid-template-columns: minmax(0, 1fr); }
  .setup li { display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 16px; align-items: start; padding-bottom: 26px; }
  .setup li:last-child { padding-bottom: 0; }
  .setup li:not(:last-child)::after { top: 46px; bottom: 10px; left: 18px; right: auto; width: 1px; height: auto; }
  .setup p { margin-top: 7px; max-width: 34ch; }

  .sp-split { grid-template-columns: minmax(0, 1fr); }
  .sibs { grid-template-columns: minmax(0, 1fr); }
  .sp-cta { flex-direction: column; align-items: flex-start; }
  .sp-trust { flex-direction: column; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .flow-label, .flow-t, .sib-icon, .sp-all, .sp-crumbs a { transition: none; }
}
