/* Platform page: Features, one step at a time (the .pfx section).
   Without the script every phase and step shows as one list. The script adds
   .is-live and one of three modes:
     .is-tabs  under 1024px: phase tabs, the selected phase only
     .is-pin   1024px and up when every step fits the window: the side
               navigation and the step area pin, the current step shows
     .is-flow  1024px and up when a step would not fit: a plain list beside
               the sticky side navigation
   Cards, their art and the dialogs keep their styles from platform-v4.css. */

.pfx { --pfx-gap: 20px; }

/* ---------- Phase and step headings ---------- */
.pfx-phase + .pfx-phase { margin-top: 56px; }
.pfx-phase-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 28px;
}
.pfx-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--kit-white);
  box-shadow: 0 0 0 1px var(--kit-ivory-medium);
}
.pfx-ico .icon { width: 23px; height: 23px; }
.pfx-ico--lg { width: 52px; height: 52px; border-radius: 14px; }
.pfx-ico--lg .icon { width: 32px; height: 32px; }
.pfx-phase-name {
  margin: 0;
  font-size: var(--type-h3);
  line-height: var(--type-h3-lh);
  letter-spacing: var(--type-h3-ls);
  font-weight: var(--type-heading-weight);
  color: var(--pf-ink);
}
.pfx-phase-name:focus { outline: none; }
.pfx-phase-name:focus-visible { outline: 2px solid var(--kit-teal-medium); outline-offset: 4px; border-radius: 4px; }
.pfx-num { font-weight: 400; color: var(--kit-teal-medium); }
.pfx-phase-line { grid-column: 1 / -1; margin: 0; font-size: var(--type-body); line-height: var(--type-body-lh); color: var(--pf-muted); }

.pfx-step { display: grid; gap: 16px; padding-bottom: 40px; }
.pfx-step-head { display: grid; gap: 4px; }
.pfx-step-name {
  margin: 0;
  font-size: var(--type-h5);
  line-height: var(--type-h5-lh);
  font-weight: var(--type-heading-weight);
  color: var(--pf-ink);
}

/* ---------- Cards ---------- */
.pfx-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--pfx-gap); margin: 0; padding: 0; list-style: none; }
.pfx-cards > li { display: flex; min-width: 0; }
.pfx-cards .pf4-card { flex: 1; }
@media (min-width: 600px) { .pfx-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- The step's smaller features: chips that open their card ---------- */
.pfx-also { display: grid; gap: 10px; }
.pfx-also-label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--type-label-s);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: var(--type-label-tracking);
  text-transform: uppercase;
  color: var(--pf-muted);
}
.pfx-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pfx-chip {
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--kit-white);
  box-shadow: 0 0 0 1px var(--kit-ivory-medium);
  font: inherit;
  font-size: var(--type-small);
  line-height: 20px;
  color: var(--pf-muted);
  cursor: pointer;
  transition: box-shadow .15s ease, color .15s ease;
}
.pfx-chip:hover { color: var(--kit-teal-shade); box-shadow: 0 0 0 1.5px var(--kit-teal-medium); }
.pfx-chip:focus-visible { outline: 2px solid var(--kit-teal-medium); outline-offset: 2px; }
.pfx-chip--more { font-weight: var(--type-subhead-weight); color: var(--kit-teal-shade); }
.pfx.is-live .pfx-chips:not(.is-open) .pfx-extra { display: none; }
.pfx:not(.is-live) .pfx-more-li { display: none; }

.pfx-cue { display: none; margin: 0; font-size: var(--type-small); line-height: 20px; color: var(--pf-muted); }

/* ---------- Under 1024px: phase tabs ---------- */
.pfx-tabs {
  position: sticky;
  top: var(--fnav-top);
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 28px;
  padding-top: 8px;
  background: var(--kit-ivory-tint);
}
.pfx-tabs[hidden] { display: none; }
.pfx-tab {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0 12px;
  border: 0;
  border-bottom: 1px solid var(--kit-ivory-medium);
  background: none;
  font: inherit;
  text-align: left;
  color: var(--pf-muted);
  cursor: pointer;
}
.pfx-tab-num { font-size: 13px; line-height: 16px; color: var(--pf-muted); }
.pfx-tab-name { font-size: var(--type-body); line-height: 22px; font-weight: var(--type-heading-weight); }
.pfx-tab[aria-selected="true"] { color: var(--kit-teal-shade); border-bottom: 3px solid var(--kit-teal-medium); padding-bottom: 10px; }
.pfx-tab[aria-selected="true"] .pfx-tab-num { color: var(--kit-teal-medium); }
.pfx-tab:focus-visible { outline: 2px solid var(--kit-teal-medium); outline-offset: -2px; border-radius: 4px; }
.pfx.is-tabs .pfx-phase + .pfx-phase { margin-top: 0; }
.pfx-phase[hidden] { display: none; }
.pfx-next { display: none; }
.pfx.is-tabs .pfx-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 8px;
  padding: 16px 20px;
  border: 0;
  border-radius: 12px;
  background: var(--kit-white);
  box-shadow: 0 0 0 1px var(--kit-ivory-medium);
  font: inherit;
  font-weight: var(--type-subhead-weight);
  color: var(--kit-teal-shade);
  cursor: pointer;
}
.pfx.is-tabs .pfx-next:hover { box-shadow: 0 0 0 1.5px var(--kit-teal-medium); }
.pfx.is-tabs .pfx-next:focus-visible { outline: 2px solid var(--kit-teal-medium); outline-offset: 2px; }

/* ---------- 1024px and up: side navigation beside the steps ---------- */
.pfx-rail { display: none; }
@media (min-width: 1024px) {
  .pfx-flow { display: grid; grid-template-columns: 260px minmax(0, 1fr); column-gap: 48px; align-items: start; }
  .pfx-rail { display: block; position: sticky; top: calc(var(--fnav-top) + 32px); }
  .pfx-rail ol { margin: 0; padding: 0; list-style: none; }
  .pfx-rail a { text-decoration: none; }
  .pfx-rail-phase + .pfx-rail-phase { margin-top: 28px; }
  .pfx-rail-ph { display: flex; align-items: center; gap: 14px; color: var(--pf-ink); }
  .pfx-rail-name {
    display: flex;
    align-items: baseline;
    gap: .3em;
    font-size: var(--type-h4);
    line-height: var(--type-h4-lh);
    letter-spacing: var(--type-h4-ls);
    font-weight: var(--type-heading-weight);
  }
  .pfx-rail-ph .pfx-num { color: var(--pf-muted); }
  .pfx-rail-ph[aria-current] { color: var(--kit-teal-shade); }
  .pfx-rail-ph[aria-current] .pfx-num { color: var(--kit-teal-medium); }
  .pfx-rail-ph[aria-current] .pfx-ico { box-shadow: 0 0 0 2px var(--kit-teal-medium); }
  .pfx-rail-ph:hover { color: var(--kit-teal-shade); }
  .pfx-rail-ph:focus-visible, .pfx-rail-steps a:focus-visible { outline: 2px solid var(--kit-teal-medium); outline-offset: 2px; border-radius: 4px; }
  .pfx-rail-more { padding-left: 50px; }
  .pfx.is-live .pfx-rail-phase:not(.is-open) .pfx-rail-more { display: none; }
  .pfx-rail-lead { margin: 2px 0 6px; font-size: var(--type-caption); line-height: 18px; color: var(--pf-muted); }
  /* each step's dot sits on the phase icon's centre line */
  .pfx-rail-steps a {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    column-gap: 14px;
    margin-left: -50px;
    padding: 6px 0;
    font-size: var(--type-small);
    line-height: 20px;
    color: var(--pf-muted);
  }
  .pfx-dot { justify-self: center; width: 8px; height: 8px; border-radius: 50%; background: var(--kit-ivory-medium); }
  .pfx-rail-steps a:hover { color: var(--kit-teal-shade); }
  .pfx-rail-steps a.is-done { color: var(--kit-text-subtle); }
  .pfx-rail-steps a.is-done .pfx-dot { background: var(--kit-teal-medium); }
  .pfx-rail-steps a[aria-current] { color: var(--kit-teal-shade); font-weight: var(--type-subhead-weight); }
  .pfx-rail-steps a[aria-current] .pfx-dot { background: var(--kit-citron-highlight); box-shadow: 0 0 0 2px var(--kit-teal-medium); }

  /* the side navigation names the phases, so their in-flow heads are for
     screen readers only */
  .pfx-phase-head {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .pfx-phase + .pfx-phase { margin-top: 0; }
  .pfx-step-name { font-size: var(--type-h4); line-height: var(--type-h4-lh); letter-spacing: var(--type-h4-ls); }
  .pfx-step { padding-bottom: 64px; scroll-margin-top: calc(var(--fnav-top) + 32px); }

  /* ---- pinned: one step at a time ---- */
  .pfx.is-pin .pfx-body { position: relative; height: calc(var(--n) * var(--slot) + var(--stage-h)); }
  .pfx.is-pin .pfx-stage { position: sticky; top: calc(var(--fnav-top) + 32px); height: var(--stage-h); }
  .pfx.is-pin .pfx-step {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
  }
  .pfx.is-pin .pfx-step.is-current { opacity: 1; pointer-events: auto; }
  /* the art takes what the window leaves (the script sets --art-h per
     step), so a step always fits */
  .pfx.is-pin .pfx-step .pf-fcard-art { height: var(--art-h, 88px); margin: 0; }
  .pfx.is-pin .pfx-step .pf-fcard-art .fa { width: 100%; height: 100%; }
  .pfx.is-pin .pfx-cue { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .pfx-chip, .pfx.is-pin .pfx-step { transition: none; }
}
