* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-dark: #0a0a0a;
  --bg-card: #222222;
  --accent-red: #bd234a;
  --accent-hover: #d82b57;
  --text-white: #ffffff;
  --text-gray: #a0a0a0;
  --text-dark: #1a1a1a;
  --font-title: 'Cormorant Garamond', serif;
  --font-body: 'Montserrat', sans-serif;
}

html {
  height: 100%;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-white);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  margin: 0 auto;
  padding: 0 20px;
}

/* =========================================================
   Checkout page — Dragon Breath Tea
   Все переменные scoped на .checkout, чтобы не трогать base.css
   ========================================================= */

.checkout {
  --ch-bg: #000;
  --ch-card: #2a2a2a;
  --ch-accent: #b81e3f;
  --ch-accent-hover: #d02a4e;
  --ch-muted: #4b4b4b;
  --ch-line: #555;
  --ch-text: #fff;
  --ch-text-dim: #8a8a8a;
  --ch-border: #e6e6e6;
  --ch-green: #8fd14f;
  --ch-error: #ff6b7f;

  /* Подставь шрифты, которые уже подключены в шапке */
  --ch-font-serif: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  --ch-font-sans: 'Unbounded', 'Montserrat', Arial, sans-serif;

  /* Чёрный фон до низа экрана (105px — высота шапки) */
  min-height: calc(100vh - 105px);
  background: var(--ch-bg);
  color: var(--ch-text);
  font-family: var(--ch-font-sans);
}

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

.checkout__container {
  max-width: 1700px;
  margin: 0 auto;
  padding: 18px 35px 40px;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(360px, 1fr);
  gap: 24px;
  align-items: stretch;
}

/* Левая колонка растягивает карточку формы до высоты карточки заказа */
.checkout__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.checkout__main .checkout-form {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ---------- Title ---------- */
.checkout__title {
  margin: 0;
  font-family: var(--ch-font-serif);
  font-weight: 400;
  font-size: clamp(38px, 4vw, 54px);
  line-height: 1.15;
}
.checkout__title::after {
  content: "";
  display: block;
  width: 120px;
  height: 1px;
  margin-top: 14px;
  background: var(--ch-accent);
}

/* ---------- Steps ---------- */
.steps {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 26px 0 20px;
  padding: 0 0 0 6px;
}
.steps__item {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.steps__item:last-child { flex: 0 0 auto; }
.steps__item:not(:last-child)::after {
  content: "";
  flex: 1;
  height: 1px;
  margin: 0 12px;
  background: var(--ch-line);
}
.steps__num {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ch-muted);
  font-size: 15px;
  font-weight: 600;
}
.steps__item--active .steps__num { background: var(--ch-accent); }
.steps__label {
  margin-left: 10px;
  font-size: 15px;
  white-space: nowrap;
}

/* ---------- Form card ---------- */
.checkout-form {
  background: var(--ch-card);
  border-radius: 14px;
  padding: 24px 22px;
}
.checkout-form__section + .checkout-form__section { margin-top: 28px; }
.checkout-form__title {
  margin: 0 0 14px;
  font-family: var(--ch-font-serif);
  font-weight: 400;
  font-size: 32px;
}
.checkout-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
}
.checkout-form__alert {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--ch-error);
  border-radius: 10px;
  color: var(--ch-error);
  font-size: 14px;
}

/* ---------- Field (label inside border) ---------- */
.field {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 8px 14px 9px;
  border: 1px solid var(--ch-border);
  border-radius: 12px;
  cursor: text;
  transition: border-color .2s, box-shadow .2s;
}
.field[hidden] { display: none; }
/* Адрес почтомата — длинный: на всю строку, по центру, шириной как карточки доставки */
.field--wide {
  grid-column: 1 / -1;
  justify-self: center;
  width: 100%;
  max-width: 720px;
}
.field:focus-within {
  border-color: var(--ch-accent);
  box-shadow: 0 0 0 1px var(--ch-accent);
}
.field__label {
  font-size: 13px;
  line-height: 1.3;
  color: #ddd;
}
.field__input {
  width: 100%;
  padding: 2px 0 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ch-text);
  font: inherit;
  font-size: 18px;
}
.field__input::placeholder { color: #6d6d6d; }
.field__input:-webkit-autofill,
.field__input:-webkit-autofill:hover,
.field__input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ch-text);
  -webkit-box-shadow: 0 0 0 1000px var(--ch-card) inset;
  transition: background-color 9999s;
}
.field--error { border-color: var(--ch-error); }
.field__error {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ch-error);
}

/* ---------- Checkbox ---------- */
.checkbox {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 10px;
  margin: 24px 0 22px;
  cursor: pointer;
  user-select: none;
}
.checkbox__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.checkbox__box {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid var(--ch-accent);
  border-radius: 50%;
  color: transparent;
  transition: background .2s, color .2s;
}
.checkbox__box svg { width: 18px; height: 18px; }
.checkbox__input:checked + .checkbox__box {
  background: var(--ch-accent);
  color: var(--ch-text);
}
.checkbox__input:focus-visible + .checkbox__box {
  outline: 2px solid var(--ch-text);
  outline-offset: 2px;
}
.checkbox__text { font-size: 16px; }

/* ---------- Button ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 280px;
  padding: 13px 32px;
  border: 0;
  border-radius: 12px;
  background: var(--ch-accent);
  color: var(--ch-text);
  font-family: var(--ch-font-sans);
  font-size: 18px;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.btn-primary:hover { background: var(--ch-accent-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary:disabled:hover { background: var(--ch-accent); }
.btn-primary:disabled:active { transform: none; }
.btn-primary:disabled:hover .btn-primary__arrow { transform: none; }
.btn-primary__arrow {
  width: 24px;
  height: 24px;
  transition: transform .2s;
}
.btn-primary:hover .btn-primary__arrow { transform: translateX(4px); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: 170px;
  padding: 12px 30px;
  border: 1px solid var(--ch-border);
  border-radius: 12px;
  background: transparent;
  color: var(--ch-text);
  font-family: var(--ch-font-sans);
  font-size: 18px;
  cursor: pointer;
  transition: border-color .2s, color .2s, transform .1s;
}
.btn-secondary:hover { border-color: var(--ch-accent); }
.btn-secondary:active { transform: translateY(1px); }
.btn-secondary__arrow {
  width: 24px;
  height: 24px;
  transition: transform .2s;
}
.btn-secondary:hover .btn-secondary__arrow { transform: translateX(-4px); }

/* ---------- Checkout steps ---------- */
/* Активный шаг занимает всю высоту карточки формы */
.checkout-step {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.checkout-step[hidden] { display: none; }
/* Шаг 1: галочка и "Продолжить" прижаты к низу карточки */
.checkout-step[data-step="1"] .checkout-form__section { margin-bottom: 24px; }
.checkout-step[data-step="1"] .checkbox { margin-top: auto; }
.checkout-form__grid--3 { grid-template-columns: repeat(3, 1fr); }
.checkout-form__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.checkout-form__actions--split { justify-content: space-between; }
.checkout-form__alert[hidden],
.checkout-form__actions[hidden] { display: none; }

/* ---------- Шаг 3: заказ оформлен ---------- */
.order-done {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 12px;
  text-align: center;
}
.order-done__icon {
  width: 72px;
  height: 72px;
  color: var(--ch-accent);
}
.order-done__title {
  margin: 18px 0 0;
  font-family: var(--ch-font-serif);
  font-weight: 400;
  font-size: 44px;
  line-height: 1.15;
}
.order-done__number {
  margin: 14px 0 0;
  font-family: var(--ch-font-serif);
  font-size: 20px;
  color: #ddd;
}
.order-done__text {
  max-width: 520px;
  margin: 18px 0 0;
  font-family: var(--ch-font-serif);
  font-size: 18px;
  line-height: 1.5;
  color: #cfcfcf;
}
.order-done__divider {
  width: 140px;
  height: 1px;
  margin: 22px 0 0;
  background: var(--ch-accent);
}
.order-done__thanks {
  margin: 18px 0 0;
  font-size: 15px;
  color: #ddd;
}
.order-done__btn {
  margin-top: 30px;
  text-decoration: none;
}

/* После оформления заказа блок "Ваш заказ" скрыт, форма занимает всю ширину */
.order-summary[hidden] { display: none; }
.checkout__container--done { grid-template-columns: minmax(0, 1fr); }

/* ---------- Delivery method cards ---------- */
.delivery-methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* курьер и почтомат */
  gap: 16px;
  /* Карточки по центру, с отступами от краёв формы */
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}
.delivery-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 8px 12px 10px;
  border: 1px solid #8a8a8a;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.delivery-card:hover { border-color: var(--ch-border); }
.delivery-card:has(.delivery-card__input:checked) { border-color: var(--ch-accent); }
.delivery-card:has(.delivery-card__input:focus-visible) {
  box-shadow: 0 0 0 1px var(--ch-accent);
}
.delivery-card__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.delivery-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.delivery-card__radio {
  position: relative;
  width: 12px;
  height: 12px;
  border: 1px solid var(--ch-border);
  border-radius: 50%;
}
.delivery-card__input:checked ~ .delivery-card__head .delivery-card__radio { border-color: var(--ch-accent); }
.delivery-card__input:checked ~ .delivery-card__head .delivery-card__radio::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--ch-accent);
}
.delivery-card__icon {
  font-size: 24px;
  line-height: 1;
}
.delivery-card__input:checked ~ .delivery-card__head .delivery-card__icon { color: var(--ch-accent); }
.delivery-card__name {
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}
.delivery-card__meta {
  font-size: 13px;
  color: #ddd;
}
.delivery-card__price {
  margin-top: 12px;
  font-size: 14px;
  color: var(--ch-accent);
}

/* ---------- Order summary ---------- */
.order-summary {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--ch-card);
  border-radius: 14px;
  padding: 20px 18px 18px 20px;
}
.order-summary__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.order-summary__title {
  margin: 0;
  font-family: var(--ch-font-serif);
  font-weight: 400;
  font-size: 34px;
}
.order-summary__edit {
  margin-right: 26px;
  font-size: 13px;
  color: var(--ch-accent);
  text-decoration: none;
}
.order-summary__edit:hover { text-decoration: underline; }

.order-summary__list {
  display: flex;
  flex-direction: column;
  gap: 26px;
  max-height: 480px;
  margin: 16px 0 0;
  padding: 0 6px 0 0;
  list-style: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ch-muted) transparent;
}
.order-summary__list::-webkit-scrollbar { width: 4px; }
.order-summary__list::-webkit-scrollbar-thumb {
  background: var(--ch-muted);
  border-radius: 4px;
}
.order-summary__empty {
  margin: 20px 0;
  font-size: 18px;
  line-height: 1.5;
  color: #bdbdbd;
}
.order-summary__empty a {
  color: #ff4f78; /* ярче основного акцента, чтобы ссылку было видно на тёмном фоне */
  font-weight: 600;
  transition: color .2s;
}
.order-summary__empty a:hover {
  color: #ff7c99;
  text-decoration: underline;
}

/* Item */
.order-item {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 16px;
  align-items: start;
}
.order-item__img {
  width: 120px;
  aspect-ratio: 1 / 0.95;
  border-radius: 3px;
  overflow: hidden;
  background: #3a3a3a;
}
.order-item__img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.order-item__name {
  margin: 4px 0 8px;
  font-family: var(--ch-font-serif);
  font-weight: 500;
  font-size: 23px;
  line-height: 1.2;
}
.order-item__meta {
  margin: 0;
  font-size: 13px;
}
.order-item__price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding-top: 4px;
  padding-right: 10px;
  white-space: nowrap;
}
.order-item__sum {
  font-family: var(--ch-font-serif);
  font-size: 24px;
  color: var(--ch-accent);
}
.order-item__qty {
  font-size: 12px;
  color: #bbb;
}

/* Item controls: − qty + and delete */
.order-item__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.qty-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--ch-line);
  border-radius: 999px;
  overflow: hidden;
}
.qty-control__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ch-text);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.qty-control__btn:hover:not(:disabled) {
  background: var(--ch-accent);
}
.qty-control__btn:disabled {
  color: var(--ch-muted);
  cursor: not-allowed;
}
.qty-control__value {
  min-width: 26px;
  font-size: 14px;
  text-align: center;
  color: var(--ch-text);
}
.order-item__delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ch-text-dim);
  font-size: 16px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.order-item__delete:hover:not(:disabled) {
  color: var(--ch-accent-hover);
  background: rgba(184, 30, 63, 0.12);
}
.order-item__delete:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Totals */
.order-summary__totals {
  margin: auto 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--ch-line);
}
.order-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px 6px 0;
}
.order-summary__row dt { font-size: 15px; }
.order-summary__value {
  margin: 0;
  font-family: var(--ch-font-serif);
  font-size: 24px;
}
.order-summary__value--accent { color: var(--ch-accent); }
.order-summary__value--free   { color: var(--ch-green); }

.order-summary__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  padding: 14px 10px 0 0;
  border-top: 1px solid var(--ch-line);
  font-family: var(--ch-font-serif);
  font-size: 30px;
}

/* Delivery note */
.delivery-note {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  padding: 12px 16px;
  border: 1px solid var(--ch-border);
  border-radius: 12px;
}
.delivery-note__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  color: var(--ch-accent);
}
.delivery-note__title {
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: 600;
}
.delivery-note__text {
  margin: 0;
  font-size: 13px;
  color: #ddd;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .checkout__container {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0;
  }
  .order-summary__list { max-height: none; }

  /* В одну колонку "Ваш заказ" идёт сразу под заголовком, а шаги и форма
     (данные, доставка) — под ним. display: contents "раскрывает" левую колонку,
     чтобы её крошки, заголовок, шаги и форму можно было расставить через order */
  .checkout__main { display: contents; }
  .checkout__main > .breadcrumbs { order: 1; }
  .checkout__title { order: 2; }
  .order-summary {
    order: 3;
    margin-top: 24px;
  }
  .steps { order: 4; }
  .checkout-form { order: 5; }
}

@media (max-width: 600px) {
  .checkout__container { padding: 14px 16px 40px; }
  .order-done__title { font-size: 34px; }
  .order-done__number { font-size: 18px; }
  .order-done__text { font-size: 16px; }
  .order-done__text br { display: none; }
  .checkout-form { padding: 18px 14px; }
  .checkout-form__title,
  .order-summary__title { font-size: 28px; }
  .checkout-form__grid { grid-template-columns: 1fr; }
  .steps__label { font-size: 12px; margin-left: 6px; }
  .steps__item:not(:last-child)::after { margin: 0 8px; }
  .btn-primary { width: 100%; min-width: 0; }
  .btn-secondary { min-width: 0; padding: 9px 18px; }
  .delivery-methods { grid-template-columns: 1fr; }
  .checkout-form__actions--split .btn-primary { width: auto; flex: 1; }
  /* Цена и кнопки уходят под название, иначе на узком экране не влезают по ширине */
  .order-item { grid-template-columns: 72px minmax(0, 1fr); }
  .order-item__img { width: 72px; grid-row: span 2; }
  .order-item__price {
    grid-column: 2;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
  .order-item__price,
  .order-summary__row,
  .order-summary__total { padding-right: 0; }
  .order-summary__edit { margin-right: 0; }
  .order-item__controls { gap: 4px; }
  .qty-control__btn,
  .order-item__delete { width: 32px; height: 32px; }
}
