/* Pantry Club checkout — static demo, no dependencies.
   One accent (forest green), white surfaces on warm greys. */

:root {
  color-scheme: light;

  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-warm: #fbf9f6;
  --sand: #f4ecdc;

  --ink: #1f1c19;
  --ink-2: #57514a;
  --muted: #6a635b;

  --line: #e7e1d8;          /* decorative hairlines */
  --line-2: #dcd5ca;        /* card edges on the warm page */
  --field: #857d73;         /* control boundary: 4.06:1 on white */
  --field-hover: #5f584f;

  --green: #2d6a4f;
  --green-hover: #245a42;
  --green-dark: #1b4332;
  --green-50: #edf6f0;
  --green-100: #d3e9dc;

  --focus: #1b4332;

  --error: #b42318;
  --error-dark: #912018;
  --error-50: #fdf3f1;
  --error-line: #efc2bc;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(31, 28, 25, 0.05), 0 8px 24px rgba(31, 28, 25, 0.05);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

p,
h1,
h2,
dl,
dd {
  margin: 0;
}

/* No one-word last lines in running text; headings split evenly. */
p,
li,
dd {
  text-wrap: pretty;
}

h1,
h2 {
  text-wrap: balance;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 16px;
}

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

.demo-notice {
  background: var(--sand);
  border-bottom: 1px solid #e6d9bf;
  color: var(--ink);
  font-size: 14px;
}

.demo-notice__inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-block: 10px;
}

.demo-notice__icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--ink-2);
}

.brand-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--line-2);
}

.brand-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand__mark {
  flex: none;
}

.brand__name {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ---------- Page grid ---------- */

.checkout {
  display: grid;
  gap: 18px;
  padding-block: 0 56px;
}

/* Below the two-column layout every band (note, header, main, footer)
   shares one centred 720px column, so they keep one left edge. */
@media (max-width: 959px) {
  .wrap {
    max-width: 720px;
  }
}

/* ---------- Order summary ---------- */

.summary-toggle {
  display: none;
}

.summary-panel {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
}

.summary__title {
  font-size: 18px;
  line-height: 1.3;
  margin-bottom: 18px;
}

/* Kept whole where it fits; wraps inside itself only if it cannot fit. */
.nw {
  display: inline-block;
}

.summary-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.summary-item__art {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--sand);
}

.summary-item__name {
  font-weight: 700;
  line-height: 1.35;
}

.summary-item__meta {
  color: var(--muted);
  font-size: 14px;
}

.summary-facts {
  display: grid;
  gap: 8px;
  padding-block: 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.summary-facts__row,
.summary-lines__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.summary-facts dt {
  color: var(--muted);
}

.summary-facts dd {
  text-align: right;
  font-weight: 600;
}

.summary-lines {
  display: grid;
  gap: 8px;
  padding-top: 16px;
}

.summary-lines dd {
  font-variant-numeric: tabular-nums;
}

.summary-lines__row--promo dd,
.summary-lines__free {
  color: var(--green);
  font-weight: 600;
}

.code-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--green-50);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.summary-lines__row--total {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 18px;
  font-weight: 700;
}

.summary-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Steps ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.steps__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.steps__item + .steps__item::before {
  content: "";
  position: absolute;
  top: 15px;
  right: calc(50% + 22px);
  left: calc(-50% + 22px);
  height: 2px;
  border-radius: 1px;
  background: var(--line-2);
}

.steps__marker {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--field);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 700;
}

.steps__check {
  display: none;
  width: 18px;
  height: 18px;
}

.steps__item.is-done {
  color: var(--ink);
}

.steps__item.is-done .steps__marker {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.steps__item.is-done .steps__num {
  display: none;
}

.steps__item.is-done .steps__check {
  display: block;
}

.steps__item.is-done::before,
.steps__item.is-current::before {
  background: var(--green);
}

.steps__item.is-current {
  color: var(--ink);
  font-weight: 700;
}

.steps__item.is-current .steps__marker {
  border-color: var(--green);
  color: var(--green-dark);
  box-shadow: 0 0 0 4px var(--green-100);
}

/* ---------- Panels / steps ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px 16px 28px;
}

.step__head {
  margin-bottom: 28px;
}

.step__title {
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}

.step__title:focus,
.confirmation__title:focus {
  outline: none;
}

.step__intro {
  color: var(--ink-2);
}

.group {
  min-width: 0;
  margin: 0 0 32px;
  padding: 0;
  border: 0;
}

.group__legend {
  padding: 0;
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.group__hint {
  margin: -6px 0 14px;
}

.optional {
  color: var(--muted);
  font-weight: 400;
}

.hint {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

/* ---------- Fields ---------- */

.fields {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 22px 16px;
}

.field {
  grid-column: span 12;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field--state {
  grid-column: span 7;
}

.field--zip {
  grid-column: span 5;
}

@media (min-width: 560px) {
  .field--half {
    grid-column: span 6;
  }

  .field--city {
    grid-column: span 5;
  }

  .field--state {
    grid-column: span 4;
  }

  .field--zip {
    grid-column: span 3;
  }
}

.field__label {
  font-weight: 600;
  line-height: 1.4;
}

.input {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--field);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: inset 0 1px 2px rgba(31, 28, 25, 0.06);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:hover {
  border-color: var(--field-hover);
}

.input:focus-visible {
  border-color: var(--green-dark);
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.input[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: inset 0 0 0 1px var(--error);
}

.input[readonly] {
  background: var(--surface-warm);
}

.input--card {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.input--short {
  max-width: 20rem;
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.select {
  position: relative;
}

.select select {
  appearance: none;
  padding-right: 40px;
  cursor: pointer;
}

.select__chevron {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  color: var(--ink-2);
  pointer-events: none;
}

.field--day .select {
  max-width: 320px;
}

.field__note {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--green-dark);
  font-size: 14px;
}

.counter {
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.counter.is-low {
  color: var(--ink);
  font-weight: 700;
}

/* Errors: an icon, words and a thicker edge, never colour alone. */

.field__error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--error);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.field__error .icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.error-summary {
  margin: -8px 0 28px;
  padding: 16px 20px 18px;
  border: 1px solid var(--error-line);
  border-left: 5px solid var(--error);
  border-radius: var(--radius);
  background: var(--error-50);
  scroll-margin-top: 16px;
}

.error-summary:focus {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.error-summary__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--error-dark);
  font-size: 18px;
  line-height: 1.35;
}

.error-summary__title .icon {
  color: var(--error);
}

.error-summary__intro {
  margin: 0 0 8px 30px;
  color: var(--ink-2);
  font-size: 15px;
}

.error-summary__list {
  margin: 0;
  padding-left: 48px;
}

.error-summary__list li + li {
  margin-top: 4px;
}

.error-summary__list a {
  color: var(--error-dark);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.error-summary__list a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Plan cards ---------- */

.plans {
  display: grid;
  gap: 18px;
}

.plan {
  position: relative;
  display: block;
  cursor: pointer;
}

.plan__input,
.choice__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  appearance: none;
  border: 1px solid var(--field);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.plan__input:hover,
.choice__input:hover {
  border-color: var(--field-hover);
}

.plan__input:checked,
.choice__input:checked {
  border: 2px solid var(--green);
  background: var(--green-50);
}

.plan__input:focus-visible,
.choice__input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.choice__input[aria-invalid="true"] {
  border: 2px solid var(--error);
  background: var(--error-50);
}

.choice__input[aria-invalid="true"] + .choice__body .choice__box {
  border-color: var(--error);
}

.plan__body {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  grid-template-areas:
    "radio title price"
    ".     meta  price";
  align-items: center;
  column-gap: 14px;
  row-gap: 2px;
  padding: 16px 18px;
}

.plan__radio {
  grid-area: radio;
  width: 22px;
  height: 22px;
  border: 2px solid var(--field);
  border-radius: 50%;
  background: var(--surface);
}

.plan__input:checked + .plan__body .plan__radio {
  border-color: var(--green);
  background: var(--green);
  box-shadow: inset 0 0 0 4px var(--surface);
}

.plan__title {
  grid-area: title;
  font-weight: 700;
  line-height: 1.35;
}

.plan__meta {
  grid-area: meta;
  color: var(--muted);
  font-size: 14px;
}

.plan__price {
  grid-area: price;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
  text-align: right;
}

.plan__amount {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.plan__per {
  color: var(--muted);
  font-size: 14px;
}

/* The pill straddles the card's top edge, so it labels the card without
   adding a row and all three plans keep the same height. */
.plan__badge {
  position: absolute;
  top: -11px;
  left: 54px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

@media (max-width: 479px) {
  .plan__body {
    column-gap: 12px;
    padding-inline: 16px;
  }

  .plan__badge {
    left: 50px;
  }

  .plan__amount {
    font-size: 18px;
  }

  .plan__sep,
  .plan__dot {
    display: none;
  }

  .plan__people,
  .plan__meals {
    display: block;
  }

  .plan__meals {
    font-weight: 400;
  }

  .plan__meta {
    display: flex;
    flex-direction: column;
  }
}

/* ---------- Checkbox tiles ---------- */

.choices {
  display: grid;
  gap: 10px;
}

@media (min-width: 480px) {
  .choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.choice {
  position: relative;
  display: block;
  cursor: pointer;
}

.choice__input {
  border-radius: var(--radius);
}

.choice__body {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 16px;
}

.choice__box {
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--field);
  border-radius: 6px;
  background: var(--surface);
  color: #fff;
}

.choice__box svg {
  width: 16px;
  height: 16px;
  opacity: 0;
}

.choice__input:checked + .choice__body .choice__box {
  border-color: var(--green);
  background: var(--green);
}

.choice__input:checked + .choice__body .choice__box svg {
  opacity: 1;
}

.choice--terms .choice__body {
  align-items: flex-start;
}

.choice--terms .choice__box {
  margin-top: 1px;
}

.billing-preview {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.billing-preview:empty {
  display: none;
}

.billing-fields {
  margin-top: 20px;
}

/* ---------- Promo ---------- */

.promo {
  margin-bottom: 8px;
}

/* The promo is its own section, a peer of "Card details" and "Billing
   address", so its label takes the section-heading size. */
.promo__label {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.promo__row {
  display: flex;
  gap: 10px;
}

.promo__input {
  flex: 1;
  min-width: 0;
  max-width: 320px;
  text-transform: uppercase;
}

.promo__input::placeholder {
  text-transform: none;
}

.promo__message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.promo__message:empty {
  display: none;
}

.promo__message.is-success {
  color: var(--green-dark);
}

.promo__message.is-success .icon {
  color: var(--green);
}

.promo__message.is-error {
  color: var(--error);
}

.promo__message .icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.btn--primary {
  min-width: 180px;
  background: var(--green);
  color: #fff;
}

.btn--primary:hover {
  background: var(--green-hover);
}

.btn--primary:active {
  background: var(--green-dark);
}

.btn--secondary {
  border-color: var(--field);
  background: var(--surface);
  color: var(--ink);
}

.btn--secondary:hover {
  border-color: var(--field-hover);
  background: var(--surface-warm);
}

.promo__button {
  min-height: 48px;
  padding-inline: 20px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.actions .btn--primary {
  margin-left: auto;
}

@media (max-width: 559px) {
  .actions .btn--primary {
    flex: 1;
    min-width: 0;
  }
}

/* ---------- Review ---------- */

.review {
  display: grid;
  gap: 16px;
  margin-bottom: 28px;
}

.review__block {
  padding: 18px 20px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface-warm);
}

.review__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.review__title {
  font-size: 18px;
  line-height: 1.3;
}

.review__edit {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  margin-right: -12px;
  border-radius: 8px;
  color: var(--green-dark);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.review__edit:hover {
  background: var(--green-50);
}

.review__edit:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.review__list {
  display: grid;
  gap: 8px;
}

.review__row {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 16px;
}

.review__row dt {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.review__row dd {
  overflow-wrap: anywhere;
}

@media (max-width: 479px) {
  .review__row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

/* ---------- Confirmation ---------- */

.confirmation {
  padding-block: 40px;
  text-align: center;
}

.confirmation__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  color: var(--green);
}

.confirmation__title {
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.confirmation__lead {
  margin-top: 8px;
  color: var(--ink-2);
}

.confirmation__facts {
  display: grid;
  gap: 0;
  max-width: 480px;
  margin: 28px auto 0;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  text-align: left;
}

.confirmation__fact {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 18px;
}

.confirmation__fact + .confirmation__fact {
  border-top: 1px solid var(--line);
}

.confirmation__fact dt {
  color: var(--muted);
}

.confirmation__fact dd {
  font-weight: 600;
}

.confirmation__order {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.confirmation__note {
  max-width: 480px;
  margin: 20px auto 0;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 479px) {
  .confirmation__fact {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .confirmation__fact dd {
    overflow-wrap: anywhere;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  padding-block: 24px 40px;
  border-top: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Phone and tablet: summary becomes a disclosure ---------- */

@media (max-width: 959px) {
  .summary {
    margin-inline: -16px;
  }

  .summary-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 56px;
    padding: 10px 16px;
    border: 0;
    border-bottom: 1px solid var(--line-2);
    background: var(--surface-warm);
    color: var(--green-dark);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
  }

  .summary-toggle:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: -3px;
  }

  .summary-toggle__label {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .summary-toggle__chevron {
    transition: transform 0.2s ease;
  }

  .summary.is-open .summary-toggle__chevron {
    transform: rotate(180deg);
  }

  .summary-toggle__total {
    color: var(--ink);
    font-size: 18px;
    font-variant-numeric: tabular-nums;
  }

  .summary-panel {
    display: none;
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
    padding: 20px 16px 22px;
    background: var(--surface-warm);
  }

  .summary.is-open .summary-panel {
    display: block;
  }

  .summary__title {
    font-size: 16px;
    margin-bottom: 14px;
  }
}

@media (min-width: 560px) {
  .wrap {
    padding-inline: 24px;
  }

  .panel {
    padding: 36px 40px 40px;
  }

  .step__title {
    font-size: 30px;
  }
}

@media (min-width: 560px) and (max-width: 959px) {
  .summary {
    margin-inline: 0;
    margin-top: 20px;
  }

  .summary-toggle {
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
  }

  .summary.is-open .summary-toggle {
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .summary-panel {
    border-width: 0 1px 1px;
    border-radius: 0 0 var(--radius) var(--radius);
  }
}

@media (min-width: 960px) {
  .wrap {
    padding-inline: 32px;
  }

  .checkout {
    grid-template-columns: minmax(0, 1fr) 360px;
    column-gap: 40px;
    align-items: start;
    padding-top: 32px;
  }

  .flow {
    grid-column: 1;
    grid-row: 1;
  }

  .summary {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
