/* The order sheet's three steps: Gas, Address, Review, with the rail above and the step bar
   below. Nothing here applies without the os-prototype class, which js/order-steps-prototype.js
   puts on the sheet before it opens. */

/* The sheet has the customer's attention. Keep the tour bubble and the cookie bar from
   sitting over it or reading through the scrim underneath it. */
body.os-prototype-open .tour-launch,
body.os-prototype-open .cookie-banner {
  visibility: hidden;
}

.os-prototype .order-form__submit {
  display: none !important;
}

.os-prototype .os-step[hidden] {
  display: none !important;
}

.os-prototype .os-step {
  outline: none;
}

/* Two rows and no gap: the views scroll, the footer ends the sheet. The sheet no longer
   scrolls itself, so the footer cannot drift away from the bottom edge while it opens.
   The keyboard never changes this height. It covers the sheet's lower edge the way it
   covers any mobile form; the views below get extra scroll room so the focused field can
   be brought above it. */
.os-prototype .order-modal__dialog {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  max-height: 90vh;
  max-height: 90dvh;
  scrollbar-gutter: auto;
}

.os-prototype .os-views {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  padding: 36px 32px calc(24px + var(--os-kb, 0px));
}

/* The step itself is the thing that changes. A short lift in from the direction of
   travel makes the sheet feel like one surface moving, not three screens swapping. */
.os-step--in[data-os-direction="forward"] {
  animation: os-step-forward 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.os-step--in[data-os-direction="back"] {
  animation: os-step-back 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes os-step-forward {
  from {
    opacity: 0;
    transform: translate3d(14px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes os-step-back {
  from {
    opacity: 0;
    transform: translate3d(-14px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.os-prototype .order-modal__title {
  font-size: 1.55rem;
  margin-bottom: 5px;
}

.os-prototype .order-modal__subtitle {
  font-size: 0.88rem;
  line-height: 1.45;
  margin-bottom: 18px;
}

.os-prototype .order-form__field {
  margin-bottom: 14px;
}

.os-prototype .order-form__label {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  color: #5b6661;
  margin-bottom: 7px;
}

.os-prototype .order-form__field input,
.os-prototype .order-form__field select,
.os-prototype .order-form__field textarea {
  min-height: 48px;
  padding: 13px 14px;
  border: 1px solid #e0e7e3;
  border-radius: 13px;
  background: #fbfcfb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.os-prototype .order-form__field input:hover,
.os-prototype .order-form__field select:hover {
  border-color: #cbd5cf;
}

.os-prototype .order-form__field input:focus,
.os-prototype .order-form__field select:focus,
.os-prototype .order-form__field textarea:focus {
  border-color: var(--color-green);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 160, 72, 0.14);
}

.os-prototype .order-form__field input::placeholder,
.os-prototype .order-form__field textarea::placeholder {
  color: #9aa5a0;
}

.os-prototype .order-form__loc {
  background: #f6faf7;
  border-color: #dcebe2;
  border-radius: 13px;
}

.os-prototype .order-form__addresses {
  margin-bottom: 14px;
}

/* Each step has its own short title, so the customer always knows what this screen is
   asking for even after the progress rail has scrolled away. */
.os-step__title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-ink);
  outline: none;
}

.os-step__hint {
  margin: 0 0 15px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #6b7280;
}

/* The progress rail. A single line with three nodes, not three boxes: it reads at a
   glance and leaves the screen to the fields. */
.os-progress {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin: 0 0 20px;
  padding: 0 2px;
}

.os-progress__step {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-body);
  color: #8a958f;
  cursor: pointer;
}

.os-progress__step:disabled {
  cursor: default;
}

.os-progress__step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 12px;
  left: calc(50% + 16px);
  width: calc(100% - 32px);
  height: 2px;
  border-radius: 999px;
  background: #e6ebe8;
  transition: background-color 0.24s ease;
}

.os-progress__step.is-done:not(:last-child)::after {
  background: var(--color-green);
}

.os-progress__dot {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1.5px solid #dfe5e1;
  background: #ffffff;
  color: #7b8781;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  transition: background-color 0.24s ease, border-color 0.24s ease, color 0.24s ease, box-shadow 0.24s ease;
}

.os-progress__step.is-done .os-progress__dot {
  border-color: var(--color-green);
  background: var(--color-green);
  color: #ffffff;
}

.os-progress__step.is-active .os-progress__dot {
  border-color: var(--color-green);
  background: var(--color-green);
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(0, 160, 72, 0.12);
}

.os-progress__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: #7b8781;
}

.os-progress__step.is-active .os-progress__label {
  color: var(--color-green-ink);
}

.os-progress__step.is-done .os-progress__label {
  color: #4b5563;
}

.os-progress__step:focus-visible {
  outline: none;
}

.os-progress__step:focus-visible .os-progress__dot {
  outline: 2px solid var(--color-orange);
  outline-offset: 2px;
}

/* A compact review card. It gives step 3 something solid to check before the quote
   opens, without turning the step into a second checkout. */
.os-review {
  border: 1px solid #e5eae7;
  border-radius: 16px;
  background: #ffffff;
  padding: 15px 15px 13px;
  margin: 2px 0 14px;
  box-shadow: 0 8px 20px rgba(31, 47, 45, 0.04);
}

.os-review__title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 4px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #6b7280;
}

.os-review__tick {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e9f8ef;
  color: var(--color-green-ink);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
}

.os-review__rows {
  margin-top: 7px;
}

.os-review__row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid #f0f3f1;
  font-size: 12.5px;
  line-height: 1.45;
}

.os-review__row[hidden] {
  display: none !important;
}

.os-review__row:first-child {
  border-top: 0;
}

.os-review__label {
  color: #7b8781;
  font-weight: 500;
}

.os-review__value {
  color: var(--color-ink);
  font-weight: 700;
  text-align: left;
  overflow-wrap: anywhere;
}

.os-review__note {
  margin: 9px 0 0;
  padding-top: 10px;
  border-top: 1px solid #f0f3f1;
  font-size: 11px;
  line-height: 1.5;
  color: #7b8781;
}

/* The action bar is the sheet's own last row, not a floating widget. It is part of the
   dialog, so it enters with it, and the views above it scroll. There is no gap and nothing
   below it: the footer is where the form ends. */
.os-bar {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px calc(13px + env(safe-area-inset-bottom, 0px));
  /* The sheet behind the bar is already white, so the blur was paying for a GPU pass on
     every scroll frame to show the same colour. A solid footer is both cleaner and the
     difference between a smooth step change on a phone and a visible stutter. */
  background: #ffffff;
  border-top: 1px solid rgba(226, 232, 228, 0.9);
  border-radius: 0 0 20px 20px;
  box-shadow: 0 -12px 30px rgba(31, 47, 45, 0.07);
}

.os-bar[hidden] {
  display: none !important;
}

.os-bar__progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  overflow: hidden;
  border-radius: 20px 20px 0 0;
  background: #eef2ef;
}

.os-bar__progress span {
  display: block;
  width: 33.333%;
  height: 100%;
  background: var(--color-green);
  transition: width 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.os-bar-copy--swap {
  animation: os-bar-copy 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes os-bar-copy {
  from {
    opacity: 0;
    transform: translate3d(0, 4px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.os-bar__back {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #e4e9e6;
  border-radius: 999px;
  background: #ffffff;
  color: #4b5563;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.os-bar__back svg {
  width: 17px;
  height: 17px;
}

.os-bar__back:hover {
  background: #f6f8f7;
  border-color: #cfd8d3;
}

.os-bar__back:disabled {
  opacity: 0;
  pointer-events: none;
}

.os-bar__mid {
  flex: 1 1 auto;
  min-width: 0;
  padding-left: 1px;
}

.os-bar__step {
  display: block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #9aa5a0;
  line-height: 1.2;
}

.os-bar__summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-top: 1px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-ink);
  line-height: 1.28;
  white-space: normal;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.os-bar__next {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  background: var(--color-green);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 800;
  padding: 0 19px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 128, 58, 0.18);
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.os-bar__next #os-bar-label {
  display: inline-block;
}

.os-bar__next svg {
  width: 16px;
  height: 16px;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.os-bar__next:hover {
  background: var(--color-green-dark);
  box-shadow: 0 8px 18px rgba(0, 128, 58, 0.22);
}

.os-bar__next:hover svg {
  transform: translateX(2px);
}

.os-bar__next:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(0, 128, 58, 0.18);
}

.os-bar__back:focus-visible,
.os-bar__next:focus-visible,
.os-progress__step:focus-visible {
  outline: 2px solid var(--color-orange);
  outline-offset: 2px;
}

/* A field marked wrong by the step gate. The main script has its own error slots; these
   are the prototype's own, and they are cleared as soon as the field is edited. */
/* A field that is wrong says so under itself: a drawn disc, then the sentence. The ring on the
   field is the same red at a third of the strength, so the mark and the box read as one thing
   without the box shouting. */
.os-error {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 8px 2px 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: #b42318;
  animation: os-error-in 0.18s ease both;
}

.os-error__mark {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: #d92d20;
}

.os-error__mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.os-error__text { min-width: 0; }

@keyframes os-error-in {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: none; }
}

.order-form__field.os-invalid input,
.order-form__field.os-invalid select {
  border-color: #e0705f;
  background: #fffafa;
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  .os-error { animation: none; }
}

/* The map stays where it is while a field is focused. It used to be `display: none` on
   focus, which removed 220px from the sheet the instant a customer tapped a field — the
   whole form jumped under the finger before the keyboard had even opened. The view above
   the footer scrolls, and the keyboard handler keeps the active field above the keyboard,
   so the map does not need to be taken away to make room. */

@media (max-width: 560px) {
  /* The sheet is bottom-aligned on a phone and keeps its full height. The keyboard covers
     its lower edge the way it covers a standard mobile form; the views gain scroll room
     above it, and the footer is simply underneath the keyboard while typing. */
  .order-modal.os-prototype {
    align-items: flex-end;
    padding: 16px;
  }

  .os-prototype .order-modal__dialog {
    max-height: calc(100dvh - 32px);
  }

  .os-prototype .os-views {
    padding: 64px 20px calc(20px + var(--os-kb, 0px));
  }

  .os-prototype .order-form__field input,
  .os-prototype .order-form__field select {
    font-size: 16px;
  }

  .os-bar {
    border-radius: 0 0 18px 18px;
  }
}

@media (max-width: 400px) {
  .os-bar {
    gap: 7px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .os-bar__back {
    width: 36px;
    height: 36px;
  }

  .os-bar__next {
    gap: 6px;
    padding: 0 14px;
    font-size: 12.5px;
  }

  .os-bar__summary {
    font-size: 11.4px;
  }

  .os-progress__label {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .os-step--in[data-os-direction="forward"],
  .os-step--in[data-os-direction="back"],
  .os-bar-copy--swap {
    animation: none;
  }

  .order-modal.os-prototype,
  .os-bar,
  .os-bar__progress span,
  .os-bar__next,
  .os-bar__next svg,
  .os-bar__back,
  .os-progress__dot {
    transition: none;
  }
}
