/* ==========================================================================
   "Start a Project" flow — shared shell
   Every step is one full-screen column:
     header (back · title · close)  →  scrolling body  →  pinned CTA bar
   Uses dvh so mobile browser chrome never hides the CTA, and respects the
   notch / home-indicator safe areas.
   ========================================================================== */

.flow {
  position: fixed;
  inset: 0;
  z-index: var(--z-flow);
  overflow: hidden;
  background: var(--white);
  color: var(--black);
}

.flow[data-tone="dark"] {
  background: var(--black);
  color: var(--white);
}

/* ---- Progress ------------------------------------------------------------ */

.flow__progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-progress);
  height: 3px;
  background: rgba(128, 128, 128, .18);
}

.flow__progress span {
  display: block;
  height: 100%;
  background: currentColor;
  transition: width .4s var(--ease-out);
}

/* ---- Screen ---------------------------------------------------------------- */

.flow-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ---- Header ------------------------------------------------------------------ */

.flow-head {
  position: relative;
  z-index: 2;
  flex: none;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: start;
  gap: 8px;
  padding:
    calc(clamp(18px, 5vh, 44px) + env(safe-area-inset-top))
    clamp(12px, 3vw, 34px)
    clamp(14px, 3vh, 28px);
}

.flow-head__back,
.flow-head__close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: inherit;
  transition: transform var(--dur-1) var(--ease-out), opacity var(--dur-1);
}

.flow-head__back .chev {
  width: clamp(22px, 2.4vw, 30px);
  height: clamp(22px, 2.4vw, 30px);
}

.flow-head__back:active,
.flow-head__close:active {
  transform: scale(.9);
}

.flow-head__titles {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding-top: 4px;
  text-align: center;
}

.flow-head__title {
  font-weight: var(--fw-thin);
  font-size: clamp(22px, 3.2vw, 38px);
  line-height: 1;
  letter-spacing: -.01em;
  text-transform: uppercase;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.flow-head__sub {
  font-weight: var(--fw-light);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .45;
  text-wrap: balance;
}

/* Header variant without a back button keeps the title centred */
.flow-head__spacer {
  width: 44px;
  height: 44px;
}

/* ---- Body ------------------------------------------------------------------- */

.flow-body {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ---- Pinned CTA bar -------------------------------------------------------- */

.flow-cta {
  position: relative;
  z-index: 2;
  flex: none;
  width: 100%;
  padding: clamp(20px, 4vh, 34px) 20px calc(clamp(20px, 4vh, 34px) + env(safe-area-inset-bottom));
  font-weight: var(--fw-light);
  font-size: 15px;
  text-align: center;
  text-transform: uppercase;
  transition: background .25s, color .25s, opacity .2s;
}

.flow-cta:active:not(:disabled) {
  transform: scale(.995);
}

.flow-cta--black {
  background: var(--black);
  color: var(--white);
}

.flow-cta--white {
  background: var(--white);
  color: var(--black);
}

.flow-cta--muted {
  background: #c9c9c9;
  color: var(--white);
}

.flow-cta--ghost {
  background: #242424; /* solid equivalent of 14% white on black */
  color: #8a8a8a;
  cursor: not-allowed;
}

.flow-cta--tracked {
  font-weight: var(--fw-regular);
  font-size: 14px;
  letter-spacing: .14em;
}

/* ---- Glass panels used on the dark scheduling screen ----------------------- */

.glass {
  background:
    radial-gradient(130% 100% at 50% -10%, rgba(255, 255, 255, .12), rgba(0, 0, 0, 0) 60%),
    linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
  background-color: rgba(18, 18, 20, .45);
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--radius);
  box-shadow: inset 0 0 70px rgba(255, 255, 255, .06);
}

/* Section number + label, e.g. "01  WHEN" */
.step-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 30px;
}

.step-label__num {
  font-weight: var(--fw-light);
  font-size: clamp(18px, 2vh, 26px);
  line-height: .8;
}

.step-label__text {
  font-weight: var(--fw-medium);
  font-size: var(--fs-label);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  opacity: .55;
}

/* ---- Short screens (phones in landscape, small phones) --------------------
   A pinned header + pinned footer would leave too little room to read, so
   the whole step scrolls and only the CTA stays pinned (sticky). */
@media (max-height: 700px) {
  .flow-screen:not(.identity):not(.confirm) {
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .flow-screen:not(.identity):not(.confirm) .flow-body {
    flex: none;
    overflow: visible;
  }

  .flow-screen .flow-cta {
    position: sticky;
    bottom: 0;
    margin-top: auto;
  }

  .flow-head {
    padding-top: calc(16px + env(safe-area-inset-top));
    padding-bottom: 12px;
  }
}
