/* /templates: the workflow template catalogue.
   The same type, surfaces and rhythm as the home page's visual system (.v2-home
   in home-v2.css), scoped to this page. The state tones match the sign-up
   wizard's starter preview (webApp FTSOnboarding.vue), so a template looks the
   same here as it does when someone picks it.

   The /for/ use-case pages load this file too, for the embedded template
   (partials/template-embed) and the interactive view (template-flow-viewer),
   so those carry their own copy of the tokens. */
.tpl-page, .tpl-embed, .tpl-dialog, .tpl-flow-defs, .tpl-scope {
  --tpl-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --tpl-ink: #1d2429;
  --tpl-muted: #626c73;
  --tpl-accent: #1e6f8b;
  --tpl-surface: #f5f6f7;
  --tpl-card-line: #e9edef;
}
.tpl-page {
  --font-family: var(--tpl-font);
  font-family: var(--font-family);
  color: var(--tpl-ink);
}
.tpl { overflow-wrap: break-word; }
.tpl-wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.tpl-page main :focus-visible { outline: 3px solid #278ca6; outline-offset: 4px; }

/* Hero */
.tpl-hero {
  padding: 96px 0 72px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 0, #edf6f8, #fff 62%);
}
.tpl-eyebrow {
  margin: 0 0 20px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.6;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--tpl-accent);
}
.tpl-hero h1 {
  max-width: 880px;
  margin: 0 auto 24px;
  font-size: clamp(38px, 4.6vw, 62px);
  font-weight: 650;
  line-height: 1.06;
  letter-spacing: -.05em;
  text-wrap: balance;
}
.tpl-hero h1 span { color: #237f9c; }
.tpl-lead {
  max-width: 700px;
  margin: 0 auto 32px;
  font-size: 18px;
  line-height: 1.75;
  letter-spacing: -.01em;
  color: var(--tpl-muted);
  text-wrap: pretty;
}
.tpl-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.tpl-page .tpl-actions .btn, .tpl-dialog .tpl-actions .btn {
  min-height: 48px;
  padding: 13px 24px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  transition: background-color .2s ease, box-shadow .2s ease;
}
.tpl-page .tpl-actions .btn-primary, .tpl-dialog .tpl-actions .btn-primary { background: #227f9d; border: 1px solid #227f9d; color: #fff; }
.tpl-page .tpl-actions .btn-primary:hover, .tpl-dialog .tpl-actions .btn-primary:hover { background: #1b6881; border-color: #1b6881; color: #fff; box-shadow: 0 6px 20px #1e6f8b20; }
.tpl-page .tpl-actions .btn-outline { background: transparent; border: 1px solid #cddbe0; color: var(--tpl-accent); }
.tpl-page .tpl-actions .btn-outline:hover { background: #e9f1f4; border-color: #cddbe0; color: var(--tpl-accent); }
.tpl-fine { margin: 16px 0 0; font-size: 12px; line-height: 1.7; color: var(--tpl-muted); }

/* The catalogue */
.tpl-list { padding: 88px 0 104px; background: var(--tpl-surface); }
.tpl-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
  margin-bottom: 32px;
}
.tpl-list-head h2 {
  margin: 0 0 8px;
  font-size: clamp(30px, 3.2vw, 42px);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -.04em;
}
.tpl-count { margin: 0; font-size: 14px; line-height: 1.6; color: var(--tpl-muted); }
.tpl-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.tpl-filter[hidden] { display: none; }
.tpl-filter button {
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid #d9e2e6;
  border-radius: 100px;
  background: #fff;
  color: #33424a;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.tpl-filter button:hover { border-color: #9cc3d0; }
.tpl-filter button[aria-pressed="true"] { background: var(--tpl-ink); border-color: var(--tpl-ink); color: #fff; }

.tpl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.tpl-card {
  display: flex;
  flex-direction: column;
  padding: 28px;
  border: 1px solid var(--tpl-card-line);
  border-radius: 24px;
  background: #fff;
  scroll-margin-top: 96px;
  transition: border-color .25s ease, box-shadow .25s ease;
}
.tpl-card[hidden] { display: none; }
/* Arriving from a link to one template (an old /solution/ address, a wedge page). */
.tpl-card:target { border-color: #80b7c9; box-shadow: 0 0 0 4px #e5f5fa; }
@media (hover: hover) {
  .tpl-card:hover { border-color: #bfd9e2; box-shadow: 0 14px 36px #203d4c09; }
}
.tpl-card-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.tpl-emoji {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #edf5f7;
  font-size: 24px;
  line-height: 1;
}
.tpl-card h3 { margin: 2px 0 6px; font-size: 20px; font-weight: 650; line-height: 1.25; letter-spacing: -.02em; }
.tpl-card-head p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--tpl-muted); }
.tpl-label {
  margin: 18px 0 8px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.5;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--tpl-muted);
}
.tpl-card-head + .tpl-label { margin-top: 0; }
.tpl-states, .tpl-chips { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.tpl-states { gap: 6px 0; }
.tpl-states li { display: inline-flex; align-items: center; }
.tpl-state { padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 500; line-height: 1.5; white-space: nowrap; }
.tpl-state-start { background: #eeeeee; color: #595959; }
.tpl-state-progress { background: #fff3d6; color: #8a5a00; }
.tpl-state-done { background: #e3f4ea; color: #1e6f43; }
.tpl-state-stopped { background: #fbe3e3; color: #a12e2e; }
.tpl-join { padding: 0 6px; font-size: 12px; color: #8b979d; }
.tpl-chips { gap: 6px; }
.tpl-chips li { padding: 4px 10px; border-radius: 100px; background: #f3f5f6; font-size: 12.5px; line-height: 1.5; color: #58666e; }
.tpl-chips-steps li { padding: 3px 10px; border: 1px solid #d5e5eb; background: #fff; color: var(--tpl-accent); }
.tpl-card > ul:last-of-type { margin-bottom: 22px; }

/* The flow diagram: states in the strip's tones, each step a labelled arrow.
   The panel reaches into the card's padding so even the widest flow draws at
   full size in a phone-width card. */
.tpl-flow {
  margin: 0 -12px 4px;
  padding: 14px 8px;
  border-radius: 16px;
  background: #f8fafb;
}
.tpl-flow svg { display: block; max-width: 100%; height: auto; margin: 0 auto; overflow: visible; font-family: var(--tpl-font); }
.tpl-flow-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.tpl-flow-line { fill: none; stroke: #a9b4ba; stroke-width: 1.4; }
.tpl-flow-arrow-head { fill: #a9b4ba; }
/* On the elements, not the figure: the interactive view draws a copy outside it. */
.tpl-flow-state text, .tpl-flow-step text { text-anchor: middle; }
.tpl-flow-step rect { fill: #fff; stroke: #d5e5eb; stroke-width: 1; }
.tpl-flow-step text { font-size: 10px; fill: var(--tpl-accent); }
.tpl-flow-state rect { stroke-width: 1; }
.tpl-flow-state text { font-size: 11px; font-weight: 500; }
.tpl-flow-start rect { fill: #eeeeee; stroke: #dcdcdc; }
.tpl-flow-start text { fill: #595959; }
.tpl-flow-progress rect { fill: #fff3d6; stroke: #f1dc9f; }
.tpl-flow-progress text { fill: #8a5a00; }
.tpl-flow-done rect { fill: #e3f4ea; stroke: #bfe3cc; }
.tpl-flow-done text { fill: #1e6f43; }
.tpl-flow-stopped rect { fill: #fbe3e3; stroke: #f0c4c4; }
.tpl-flow-stopped text { fill: #a12e2e; }

/* Expand: the label row carries the button, and the diagram opens on a click. */
.tpl-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 8px; }
.tpl-card-head + .tpl-label-row { margin-top: 0; }
.tpl-label-row .tpl-label { margin: 0; }
.tpl-flow-expand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 11px;
  border: 1px solid #d9e2e6;
  border-radius: 100px;
  background: #fff;
  color: #33424a;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}
.tpl-flow-expand[hidden] { display: none; }
.tpl-flow-expand:hover { border-color: #9cc3d0; color: var(--tpl-accent); }
.tpl-flow-expand i { font-size: 11px; }
.tpl-flow.is-expandable { cursor: zoom-in; transition: box-shadow .2s ease; }
.tpl-flow.is-expandable:hover { box-shadow: inset 0 0 0 1px #d5e5eb; }

/* A use-case page's template (partials/template-embed): the copy beside the
   flow, in a white card like the page's own demo card above it. */
.tpl-embed {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 28px;
  max-width: 920px;
  margin: 28px auto 0;
  padding: 28px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.06);
  color: var(--tpl-ink);
  font-family: var(--tpl-font);
  text-align: left;
  scroll-margin-top: 96px;
}
/* Written as .tpl-embed .x so a host page's own resets (.pa p, say) do not win. */
.tpl-embed .tpl-embed-eyebrow {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.6;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--tpl-accent);
}
.tpl-embed-title { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tpl-embed-title .tpl-emoji { width: 40px; height: 40px; border-radius: 12px; font-size: 20px; }
.tpl-embed .tpl-embed-title h3 { margin: 0; font-size: 22px; font-weight: 650; line-height: 1.25; letter-spacing: -.02em; color: var(--tpl-ink); }
.tpl-embed .tpl-embed-lead { margin: 0 0 18px; font-size: 15px; line-height: 1.65; color: var(--tpl-muted); }
.tpl-embed .tpl-label { margin: 0 0 8px; }
.tpl-embed .tpl-chips { margin: 0 0 20px; }
.tpl-embed-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.tpl-embed-link { font-size: 14px; font-weight: 600; color: var(--tpl-accent); text-decoration: none; }
.tpl-embed-link:hover { text-decoration: underline; }
.tpl-embed .tpl-flow { margin: 0; padding: 18px 10px; }

/* Highlighting: what a choice touches stays lit and the rest dims. Scripts set
   these classes, in the interactive view and in the home page's worked example. */
.tpl-flow-arrow-head-on { fill: var(--tpl-accent); }
.tpl-flow-state, .tpl-flow-step, .tpl-flow-line { transition: opacity .2s ease; }
svg.is-selecting .tpl-flow-state:not(.is-on),
svg.is-selecting .tpl-flow-step:not(.is-on),
svg.is-selecting .tpl-flow-line:not(.is-on) { opacity: .2; }
svg.is-selecting .tpl-flow-line.is-on { stroke: var(--tpl-accent); stroke-width: 1.8; }
svg.is-selecting .tpl-flow-step.is-on rect { fill: #eaf5f8; stroke: var(--tpl-accent); }
svg.is-selecting .tpl-flow-step.is-on text { font-weight: 600; }
svg.is-selecting .tpl-flow-state.is-picked rect { stroke: var(--tpl-ink); stroke-width: 1.6; }
/* Only the interactive view picks from the diagram itself. */
.tpl-dialog svg [data-state],
.tpl-dialog svg [data-step] { cursor: pointer; }
.tpl-dialog svg [data-state]:hover rect { stroke-width: 1.6; }
.tpl-dialog svg .tpl-flow-step:hover rect { stroke: #9cc3d0; }

/* The dialog */
html.tpl-dialog-open { overflow: hidden; }
.tpl-dialog {
  width: min(1080px, calc(100vw - 48px));
  max-width: none;
  max-height: calc(100vh - 48px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: #fff;
  color: var(--tpl-ink);
  font-family: var(--tpl-font);
  box-shadow: 0 30px 80px #0f1d2833;
  overflow: hidden;
}
.tpl-dialog::backdrop { background: rgba(15, 29, 40, .48); }
.tpl-dialog-panel { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.tpl-dialog-head { display: flex; align-items: flex-start; gap: 16px; padding: 22px 24px 18px 28px; border-bottom: 1px solid #eef1f3; }
.tpl-dialog-heading { min-width: 0; }
.tpl-dialog-head h2 { margin: 2px 0 4px; font-size: 22px; font-weight: 650; line-height: 1.25; letter-spacing: -.02em; }
.tpl-dialog-head p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--tpl-muted); }
.tpl-dialog-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-left: auto;
  border: 1px solid #dbe5e9;
  border-radius: 100px;
  background: #fff;
  color: #33424a;
  font-size: 16px;
  cursor: pointer;
}
.tpl-dialog-close:hover { border-color: #9cc3d0; color: var(--tpl-accent); }
.tpl-dialog-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 0; overflow: auto; }
.tpl-dialog-flow { padding: 28px 24px; background: #f8fafb; }
/* The diagram stays in view while the lists beside it scroll. */
.tpl-dialog-flow-inner { position: sticky; top: 0; display: flex; flex-direction: column; gap: 14px; }
.tpl-dialog-canvas svg { display: block; width: 100%; height: auto; margin: 0 auto; overflow: visible; font-family: var(--tpl-font); }
.tpl-dialog-status {
  margin: 0;
  padding: 12px 16px;
  border: 1px solid #e3ebee;
  border-radius: 14px;
  background: #fff;
  font-size: 14px;
  line-height: 1.6;
  color: #33424a;
}
.tpl-dialog-hint { margin: 0; font-size: 12px; line-height: 1.6; color: var(--tpl-muted); text-align: center; }
.tpl-dialog-detail { padding: 24px 28px 28px; }
.tpl-dialog-detail .tpl-label:first-child { margin-top: 0; }
.tpl-dialog-states { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-dialog-states .tpl-state { border: 1px solid transparent; font: inherit; font-size: 12px; font-weight: 500; line-height: 1.5; cursor: pointer; }
.tpl-dialog-states .tpl-state.is-related { border-color: currentColor; }
.tpl-dialog-states .tpl-state[aria-pressed="true"] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--tpl-ink); }
.tpl-dialog-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tpl-pick {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e6ecef;
  border-radius: 14px;
  background: #fff;
  color: var(--tpl-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
}
.tpl-pick:hover { border-color: #bfd9e2; }
.tpl-pick.is-related { border-color: #cfe3ea; background: #f4f9fa; }
.tpl-pick[aria-pressed="true"] { border-color: var(--tpl-accent); background: #eef6f8; box-shadow: inset 0 0 0 1px var(--tpl-accent); }
.tpl-pick-name { display: block; font-size: 14px; font-weight: 600; line-height: 1.4; }
.tpl-pick-icon { width: 16px; margin-right: 8px; font-size: 12px; color: #7a878e; text-align: center; }
.tpl-pick-meta { display: block; margin-top: 2px; font-size: 13px; line-height: 1.5; color: var(--tpl-muted); }
.tpl-pick-note { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; line-height: 1.5; color: var(--tpl-accent); }
.tpl-dialog-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 16px 24px 16px 28px;
  border-top: 1px solid #eef1f3;
}
.tpl-dialog-foot p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--tpl-muted); }
.tpl-dialog-foot .tpl-actions { justify-content: flex-end; }

@media (max-width: 860px) {
  .tpl-dialog { width: 100vw; height: 100%; max-height: none; border-radius: 0; }
  .tpl-dialog-panel { height: 100%; max-height: none; }
  .tpl-dialog-body { grid-template-columns: minmax(0, 1fr); }
  .tpl-dialog-head { padding: 16px 16px 14px 20px; }
  .tpl-dialog-head h2 { font-size: 19px; }
  /* Stacked, the diagram pins to the top at a third of the screen, so a choice
     further down the lists still shows what it lights up. */
  .tpl-dialog-flow {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 12px 16px;
    box-shadow: 0 10px 18px -14px #0f1d2866;
  }
  .tpl-dialog-flow-inner { position: static; gap: 10px; }
  .tpl-dialog-canvas svg { max-height: 34vh; }
  .tpl-dialog-status { padding: 10px 12px; font-size: 13px; }
  .tpl-dialog-hint { display: none; }
  .tpl-dialog-detail { padding: 20px 20px 24px; }
  .tpl-dialog-foot { flex-wrap: nowrap; padding: 12px 16px 12px 20px; }
  .tpl-dialog-foot p { font-size: 12px; line-height: 1.5; }
  .tpl-dialog-foot .tpl-actions { flex: none; }
}
.tpl-card-foot { margin: auto 0 0; padding-top: 16px; border-top: 1px solid #eef1f3; font-size: 13px; line-height: 1.6; color: var(--tpl-muted); }
.tpl-empty { margin: 0; padding: 32px; border-radius: 24px; background: #fff; font-size: 16px; line-height: 1.7; color: var(--tpl-muted); text-align: center; }

/* How a template becomes the team's workflow */
.tpl-how { padding: 96px 0; background: #fff; text-align: center; }
.tpl-how h2 {
  max-width: 760px;
  margin: 0 auto 48px;
  font-size: clamp(30px, 3.6vw, 48px);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -.045em;
  text-wrap: balance;
}
.tpl-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  text-align: left;
}
.tpl-steps li { padding: 28px; border-radius: 24px; background: var(--tpl-surface); }
.tpl-step-number {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 18px;
  border: 1px solid #d5e5eb;
  border-radius: 50%;
  background: #fff;
  font-size: 14px;
  font-weight: 650;
  color: var(--tpl-accent);
}
.tpl-steps h3 { margin: 0 0 8px; font-size: 18px; font-weight: 650; line-height: 1.3; letter-spacing: -.02em; }
.tpl-steps p { margin: 0; font-size: 15px; line-height: 1.7; color: var(--tpl-muted); }

/* Closing call to action, in the home page's soft panel */
.tpl-cta { padding: 0 24px 72px; background: #fff; }
.tpl-cta .tpl-wrap {
  max-width: 1400px;
  padding: 88px 24px;
  border-radius: 40px;
  background: radial-gradient(ellipse at 50% 100%, #e0eff2, #f4f7f8 75%);
  text-align: center;
}
.tpl-cta h2 {
  margin: 0 auto 16px;
  font-size: clamp(32px, 4vw, 54px);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -.045em;
  text-wrap: balance;
}
.tpl-cta p { max-width: 600px; margin: 0 auto 30px; font-size: 18px; line-height: 1.75; color: var(--tpl-muted); text-wrap: pretty; }

@media (max-width: 1080px) {
  .tpl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .tpl-embed { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 20px; }
  .tpl-embed .tpl-flow { margin: 0 -8px; }
  .tpl-wrap { padding: 0 20px; }
  .tpl-hero { padding: 64px 0 48px; }
  .tpl-lead { font-size: 16px; line-height: 1.7; }
  .tpl-list { padding: 56px 0 72px; }
  .tpl-list-head { margin-bottom: 24px; }
  .tpl-grid, .tpl-steps { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .tpl-card { padding: 22px; border-radius: 20px; }
  .tpl-how { padding: 64px 0; }
  .tpl-how h2 { margin-bottom: 32px; }
  .tpl-steps li { padding: 24px; border-radius: 20px; }
  .tpl-cta { padding: 0 12px 48px; }
  .tpl-cta .tpl-wrap { padding: 56px 20px; border-radius: 28px; }
  .tpl-cta p { font-size: 16px; line-height: 1.7; }
}
@media (prefers-reduced-motion: reduce) {
  .tpl-card, .tpl-filter button, .tpl-page .tpl-actions .btn, .tpl-flow, .tpl-flow-expand, .tpl-pick,
  .tpl-flow-state, .tpl-flow-step, .tpl-flow-line { transition: none; }
}
