/* #order section (app/views/home/_order.html.erb, app/views/orders/_field.html.erb). */
@layer sections {
  .order {
    flex: 1 0 auto;
    padding-bottom: clamp(64px, 8vw, 112px);
  }

  .order__title {
    margin-bottom: clamp(22px, 3vw, 36px);
    text-wrap: balance;
  }

  /* Three numbered steps (.pl-steps grid) */
  .order__steps {
    list-style: none;
    margin: 0 0 clamp(36px, 5vw, 64px);
    padding: 0;
  }

  .order__step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px 20px;
    border-radius: var(--pl-r-chip);
    background: var(--pl-sand-50);
  }

  .order__step-num {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: var(--pl-r-pill);
    background: var(--pl-ink);
    color: var(--pl-paper);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
  }

  .order__step-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-top: 5px;
  }

  .order__step-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
  }

  .order__step-text {
    font-size: 15px;
    line-height: 1.5;
    color: var(--pl-muted);
  }

  /* #checkout: form column + sticky summary (.pl-checkout grid) */
  .order__checkout {
    scroll-margin-top: var(--pl-scroll-margin-checkout);
  }

  .order__form {
    margin: 0;
  }

  .order__h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.01em;
  }

  /* Left column: delivery details */
  .order__details {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .order__fields {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  /* Name + phone side by side while each can be 200px wide. */
  .order__pair {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
  }

  .order__field {
    min-width: 0;
  }

  .order__pair > .order__field {
    flex: 1 1 200px;
  }

  .order__label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
  }

  /* Error slot under each required field; empty until M2 fills it. */
  .order__error {
    min-height: 23px;
    padding-top: 3px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--pl-error);
  }

  .order__delivery {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding-top: 4px;
  }

  .order__delivery-label {
    font-size: 14px;
    font-weight: 600;
  }

  .order__chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .order__chip {
    padding: 6px 12px;
    border: 1.5px solid var(--pl-border);
    border-radius: var(--pl-r-pill);
    font-size: 14px;
    font-weight: 600;
  }

  /* Right column: the green summary card (.pl-sticky) */
  .order__summary {
    min-width: 0;
    padding: clamp(20px, 2.6vw, 30px);
    border-radius: var(--pl-r-card);
    background: var(--pl-green-800);
    color: var(--pl-paper);
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .order__product {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
  }

  .order__thumb {
    flex: none;
    width: 60px;
    height: 60px;
    border-radius: var(--pl-r-thumb);
    background: var(--pl-green-950);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .order__thumb-art {
    display: block;
    width: 40px;
    height: 39px;
    fill: var(--pl-paper);
  }

  /* Sized by its content, so on narrow desktop columns the price drops to its
     own row before the product name wraps; phones keep the 160px basis. */
  .order__product-text {
    flex: 1 1 auto;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    line-height: 1.35;
  }

  .order__product-name {
    font-size: 17px;
    font-weight: 700;
  }

  .order__product-meta {
    font-size: 14.5px;
    color: var(--pl-green-200);
  }

  .order__unit-price {
    flex: none;
    margin-left: auto;
    font-size: 17px;
    font-weight: 700;
  }

  /* Quantity row: label + pieces, − [input] + */
  .order__qty {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 12px;
    padding: 14px 0;
    border-top: 1px solid var(--pl-line-light);
    border-bottom: 1px solid var(--pl-line-light);
  }

  .order__qty-text {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
  }

  .order__qty-label {
    font-size: 15.5px;
    font-weight: 600;
  }

  .order__qty-pieces {
    font-size: 14px;
    color: var(--pl-green-200);
  }

  .order__stepper {
    display: flex;
    align-items: center;
    gap: 2px;
  }

  .order__qty-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--pl-r-pill);
    background: var(--pl-fill-light-strong);
    color: var(--pl-paper);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* The real quantity field, dressed as the design's plain number. */
  /* 44px wide: a full touch target. scroll-margin as for .pl-input. */
  .order__qty-input {
    scroll-margin-top: calc(var(--pl-header-h) + 40px);
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    font-size: 19px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    appearance: textfield;
    -moz-appearance: textfield;
  }

  .order__qty-input::-webkit-inner-spin-button,
  .order__qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  .order__qty-input:focus {
    outline: none;
  }

  .order__qty-input:focus-visible {
    outline: 2px solid var(--pl-paper);
    outline-offset: 0;
  }

  /* Delivery, payment and total rows */
  .order__rows {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
  }

  .order__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    font-size: 15.5px;
  }

  .order__row-label {
    color: var(--pl-green-200);
  }

  .order__row-value {
    margin: 0;
    font-weight: 600;
    text-align: right;
  }

  /* Fee value with the "free from 3 packs" hint under it. */
  .order__fee {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
  }

  .order__fee-hint {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--pl-cream);
  }

  .order__row--total {
    margin-top: 4px;
    padding-top: 13px;
    border-top: 1px solid var(--pl-line-light);
    font-size: 16px;
  }

  .order__total-label {
    font-size: 17px;
    font-weight: 700;
  }

  .order__total {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }

  .order__submit {
    width: 100%;
    min-height: 58px;
    padding: 0 24px;
    border: 0;
    border-radius: var(--pl-r-control);
    background: var(--pl-cream);
    color: var(--pl-green-950);
    font-size: 17.5px;
    font-weight: 700;
  }

  /* Ordering closed: one card in place of the form. */
  .order__paused {
    max-width: 640px;
    margin: 0 auto;
    padding: clamp(22px, 2.8vw, 32px);
    border-radius: var(--pl-r-card);
    background: var(--pl-green-800);
    color: var(--pl-paper);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 13px;
  }

  .order__paused-title {
    margin: 0;
    font-size: clamp(23px, 2.6vw, 28px);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.015em;
    text-wrap: balance;
  }

  .order__paused-text {
    margin: 0;
    font-size: 16.5px;
    line-height: 1.6;
    color: var(--pl-green-200);
  }

  .order__paused-phone {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 8px;
    min-height: 48px;
    padding: 0 24px;
    border: 1.5px solid var(--pl-paper);
    border-radius: var(--pl-r-pill);
    color: var(--pl-paper);
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
  }

  .order__paused-number {
    white-space: nowrap;
  }

  @media (max-width: 480px) {
    .order__product-text {
      flex: 1 1 160px;
    }
  }
}
