/* static/constructor.css
 *
 * Стили страницы конструктора букета (templates/constructor.html —
 * десктоп, templates/constructor_mobile.html — мобильная версия).
 * Один файл на обе версии: адаптивная сетка сама подстраивается под
 * ширину экрана через media-запросы ниже, поведение/разметка страницы
 * идентичны — раздельные шаблоны нужны были для собственного <head>
 * (viewport/PWA-теги, переключение темы) и собственного URL под каждую
 * версию (см. rhf/urls.py: constructor / constructor_mobile), а не для
 * разной вёрстки.
 *
 * Переключение светлой/тёмной темы — та же схема, что и в styles-mobile.css
 * / styles.css: атрибут data-theme на <html> выставляется инлайн-скриптом
 * в <head> шаблона (см. критический стиль там же), здесь только палитра.
 * Цвета взяты из уже существующего бренда сайта — приглушённый тёплый фон,
 * акцент #c41e3a (см. <meta name="theme-color"> в index_mobile.html).
 */

:root {
  --rhf-bg: #f7f5f0;
  --rhf-surface: #ffffff;
  --rhf-surface-2: #fbfaf6;
  --rhf-text: #1e1c1a;
  --rhf-muted: #78766d;
  --rhf-border: #e6e2d6;
  --rhf-accent: #c41e3a;
  --rhf-accent-contrast: #ffffff;
  --rhf-accent-soft: #fbe7ea;
  --rhf-success: #2e7d32;
  --rhf-success-soft: #e8f5e9;
  --rhf-shadow: 0 2px 10px rgba(30, 28, 26, 0.06);
  /* Подложка под описание, когда оно лежит оверлеем поверх фото в попапе
     (см. .rhf-c-popup-desc-overlay ниже) — цвет привязан к теме (белёсый
     здесь, тёмный в html[data-theme="dark"]/@media prefers-color-scheme),
     а не к самому фото: непрозрачность подобрана так, чтобы текст (var(
     --rhf-text), тоже тема-зависимый) читался поверх ЛЮБОГО фото, светлого
     или тёмного. 92% — почти сплошная заливка у нижнего края (там, где
     текст), сама подложка — градиент к прозрачному кверху (см. правило
     ниже), чтобы верх фото оставался открытым. */
  --rhf-popup-scrim: rgba(255, 255, 255, 0.92);

  /* Футер (см. .rhf-c-footer ниже) — сознательно НЕ завязан на --rhf-bg/
     --rhf-surface выше: это тот же тёмный "подвал", что и на главной
     (.footer в styles.css/styles-dark.css), с собственной, всегда тёмной
     палитрой, одинаковой по духу в обеих темах конструктора. */
  --rhf-footer-bg: #333333;
  --rhf-footer-heading: #ffffff;
  --rhf-footer-text: #bbbbbb;
  --rhf-footer-border: #555555;
  --rhf-footer-copy: #999999;
}

html[data-theme="dark"] {
  --rhf-bg: #121212;
  --rhf-surface: #1b1b1a;
  --rhf-surface-2: #202020;
  --rhf-text: #ecebe7;
  --rhf-muted: #a6a49b;
  --rhf-border: #333230;
  --rhf-accent: #e35a71;
  --rhf-accent-contrast: #121212;
  --rhf-accent-soft: rgba(227, 90, 113, 0.16);
  --rhf-success: #6fbf73;
  --rhf-success-soft: rgba(111, 191, 115, 0.14);
  --rhf-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  /* 88% тёмного фона поверхности (--rhf-surface) — тот же принцип, что и
     в светлой теме выше, зеркально: тёмная подложка + светлый var(
     --rhf-text) вместо белой подложки + тёмный текст. */
  --rhf-popup-scrim: rgba(18, 18, 18, 0.88);

  /* Тёмная тема футера — то же соотношение, что и в styles-dark.css:
     фон ещё темнее (#0f0f0f), а заголовки колонок перекрашены в
     фирменный акцент вместо белого — чтобы подвал не сливался с и без
     того тёмным фоном страницы. Акцент здесь литеральный (#c41e3a), а не
     через --rhf-accent (тот в тёмной теме светлее, #e35a71) — тот же
     принцип "постоянного" акцента, что и у .rhf-c-wordmark-dot выше. */
  --rhf-footer-bg: #0f0f0f;
  --rhf-footer-heading: #c41e3a;
  --rhf-footer-text: #bbbbbb;
  --rhf-footer-border: #333333;
  --rhf-footer-copy: #777777;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --rhf-bg: #121212;
    --rhf-surface: #1b1b1a;
    --rhf-surface-2: #202020;
    --rhf-text: #ecebe7;
    --rhf-muted: #a6a49b;
    --rhf-border: #333230;
    --rhf-accent: #e35a71;
    --rhf-accent-contrast: #121212;
    --rhf-accent-soft: rgba(227, 90, 113, 0.16);
    --rhf-success: #6fbf73;
    --rhf-success-soft: rgba(111, 191, 115, 0.14);
    --rhf-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
    --rhf-popup-scrim: rgba(18, 18, 18, 0.88);
    --rhf-footer-bg: #0f0f0f;
    --rhf-footer-heading: #c41e3a;
    --rhf-footer-text: #bbbbbb;
    --rhf-footer-border: #333333;
    --rhf-footer-copy: #777777;
  }
}

* { box-sizing: border-box; }

body.rhf-constructor {
  margin: 0;
  background: var(--rhf-bg);
  color: var(--rhf-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Шапка — единый со всем сайтом порядок: логотип, затем словесный знак
   "Red•House•Farm" (см. .rhf-c-wordmark/.rhf-c-wordmark-dot — то же
   начертание и те же красные точки, что и в шапке index.html/index_mobile.html,
   см. .logo/.wordmark в styles.css), затем название раздела —
   "Конструктор букета" (.rhf-c-page-tag). Сам заголовок страницы
   ("Собери свой букет") — это <h1>, но НЕ здесь, а в теле страницы (см.
   .rhf-c-page-title ниже) — так же, как на страницах оферты/политики
   (templates/offer.html: .legal-header только с брендом, <h1> — в
   .legal-hero внутри <main>). */
.rhf-c-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 6px;
  gap: 12px;
  padding: 14px 20px;
  background: var(--rhf-surface);
  border-bottom: 1px solid var(--rhf-border);
}

.rhf-c-logo {
  height: 30px;
  width: auto;
  flex-shrink: 0;
}

.rhf-c-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.rhf-c-wordmark {
  font-family: 'Cormorant', Georgia, 'Times New Roman', serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  font-size: 16px;
  color: var(--rhf-text);
  display: inline-block;
  transform: scaleX(0.92);
  transform-origin: left center;
  white-space: nowrap;
}

.rhf-c-wordmark-dot {
  display: inline-block;
  width: 0.26em;
  height: 0.26em;
  margin: 0 0.12em;
  border-radius: 50%;
  /* Фирменный акцент — постоянный красный, тот же #c41e3a, что и в шапке
     сайта в обеих темах (styles.css/styles-dark.css), а не
     тема-зависимый --rhf-accent (тот в тёмной теме светлее). */
  background: #c41e3a;
  vertical-align: 0.16em;
}

.rhf-c-page-tag {
  min-width: 0;
  flex: 0 1 auto;
  padding-left: 14px;
  margin-left: 4px;
  border-left: 1px solid var(--rhf-border);
  /* Крупнее и весомее прежнего (было 13px, var(--rhf-muted)) — по просьбе
     сделать надпись раздела заметнее рядом с брендом; на мобильной версии
     это всё равно не видно — там правило ниже (@media max-width: 859.98px)
     скрывает .rhf-c-page-tag целиком. */
  font-family: 'Cormorant', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--rhf-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rhf-c-back {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 13.5px;
  color: var(--rhf-muted);
  text-decoration: none;
  border: 1px solid var(--rhf-border);
  border-radius: 999px;
  padding: 7px 14px;
  white-space: nowrap;
}
.rhf-c-back:hover { color: var(--rhf-text); border-color: var(--rhf-muted); }

/* Бейдж "текущая сумма" в шапке — только на мобильной раскладке (см.
   @media max-width: 859.98px ниже): на десктопе панель "Ваш букет" и так
   всегда на виду (sticky, см. .rhf-c-side), а на мобильном она уходит
   вниз, под сетку цветов, и пересчёт суммы при наборе стеблей оказывается
   за пределами экрана. На десктопе бейдж поэтому скрыт по умолчанию. */
.rhf-c-header-cart {
  display: none;
}

/* Собственные отступы (не элемент .rhf-c-wrap-грида, а отдельный блок
   сразу под шапкой) — max-width/padding подобраны так, чтобы текст
   визуально совпадал по левому краю с содержимым .rhf-c-wrap ниже. */
.rhf-c-page-title {
  font-family: 'Cormorant', Georgia, serif;
  font-weight: 700;
  font-size: 26px;
  line-height: 1.15;
  max-width: 1080px;
  margin: 20px auto 0;
  padding: 0 20px;
  letter-spacing: 0.2px;
}

.rhf-c-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 20px 100px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.rhf-c-intro {
  font-size: 14px;
  color: var(--rhf-muted);
  max-width: 62ch;
  margin: 0;
}

.rhf-c-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  align-content: start;
}

.rhf-c-card {
  background: var(--rhf-surface);
  border: 1px solid var(--rhf-border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--rhf-shadow);
}

/* Одна статичная картинка (первое фото вида цветка, см.
   FlowerType.first_image_url) — без пролистывания/галереи, в отличие от
   карточки товара на сайте. Пустая заглушка (нет фото у этого вида цветка
   ещё не подтянуты/загружены) — тот же квадрат с эмодзи-цветком по центру. */
.rhf-c-card-photo {
  aspect-ratio: 2 / 3;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: var(--rhf-surface-2);
}

.rhf-c-card-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rhf-c-card-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.rhf-c-card-photo-clickable {
  cursor: pointer;
  position: relative;
}
/* Лёгкая подсказка, что фото кликабельно — рамка акцентом при наведении/фокусе
   (без наведения на сенсорных экранах ничего не меняется, и это нормально —
   там кликабельность и так очевидна по тапу). */
.rhf-c-card-photo-clickable:hover,
.rhf-c-card-photo-clickable:focus-visible {
  box-shadow: inset 0 0 0 2px var(--rhf-accent);
}

.rhf-c-card-name {
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.25;
}

.rhf-c-card-price {
  font-size: 13px;
  color: var(--rhf-accent);
  font-weight: 600;
}

.rhf-c-card-meta {
  font-size: 11.5px;
  color: var(--rhf-muted);
  margin-top: -4px;
}

.rhf-c-card-avail {
  font-size: 11.5px;
  color: var(--rhf-muted);
}

.rhf-c-stepper {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--rhf-surface-2);
  border: 1px solid var(--rhf-border);
  border-radius: 10px;
  overflow: hidden;
}

.rhf-c-stepper button {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--rhf-text);
  font-size: 17px;
  cursor: pointer;
  line-height: 1;
}
.rhf-c-stepper button:disabled { color: var(--rhf-border); cursor: not-allowed; }
.rhf-c-stepper button:active:not(:disabled) { background: var(--rhf-accent-soft); }

.rhf-c-stepper output {
  min-width: 28px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 14px;
}

.rhf-c-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--rhf-muted);
  padding: 40px 16px;
  font-size: 14px;
}

/* === Панель сборки текущего букета === */
.rhf-c-panel {
  background: var(--rhf-surface);
  border: 1px solid var(--rhf-border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--rhf-shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* #cart-section (см. constructor.js: renderCart) — просто display:flex
   выше НЕ перебивался бы браузерным [hidden]{display:none}: правило
   автора всегда выигрывает у UA-таблицы стилей независимо от
   специфичности, поэтому без явного переопределения ниже панель "Корзина"
   (и форма оформления заказа внутри неё) была бы видна даже при
   hidden — то есть ДО того, как в корзину что-то добавили. */
.rhf-c-panel[hidden] {
  display: none;
}

.rhf-c-panel h2 {
  margin: 0;
  font-size: 15px;
  font-family: 'Cormorant', Georgia, serif;
  font-weight: 700;
}

.rhf-c-current-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
}

.rhf-c-current-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.rhf-c-current-row span:last-child { color: var(--rhf-muted); white-space: nowrap; }

.rhf-c-current-empty {
  font-size: 13px;
  color: var(--rhf-muted);
}

.rhf-c-progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--rhf-border);
  overflow: hidden;
}
.rhf-c-progress-fill {
  height: 100%;
  background: var(--rhf-accent);
  border-radius: 999px;
  transition: width .25s ease;
}
.rhf-c-progress-note {
  font-size: 12px;
  color: var(--rhf-muted);
}
.rhf-c-progress-note.rhf-c-ok { color: var(--rhf-success); }
/* Превышена максимальная сумма букета (см. MAX_TOTAL/maxExceeded в
   constructor.js) — тот же акцентный красный, что и полоса прогресса
   (.rhf-c-progress-fill), просто жирнее, чтобы отличаться от обычного
   "ещё не набрано". */
.rhf-c-progress-note.rhf-c-error { color: var(--rhf-accent); font-weight: 600; }

.rhf-c-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 14px;
}
.rhf-c-total-row strong { font-size: 20px; font-variant-numeric: tabular-nums; }

.rhf-c-btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 13px 18px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--rhf-accent);
  color: var(--rhf-accent-contrast);
  transition: opacity .15s ease, transform .05s ease;
}
.rhf-c-btn:disabled { opacity: .4; cursor: not-allowed; }
.rhf-c-btn:active:not(:disabled) { transform: scale(0.98); }
.rhf-c-btn.rhf-c-btn-ghost {
  background: transparent;
  color: var(--rhf-text);
  border: 1px solid var(--rhf-border);
}

/* === Корзина собранных букетов === */
.rhf-c-cart-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rhf-c-cart-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--rhf-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--rhf-surface-2);
}

.rhf-c-cart-item-body { flex: 1; min-width: 0; }
.rhf-c-cart-item-title { font-size: 13.5px; font-weight: 600; }
.rhf-c-cart-item-desc { font-size: 12px; color: var(--rhf-muted); margin-top: 2px; }
.rhf-c-cart-item-price { font-size: 13px; font-weight: 600; white-space: nowrap; }

.rhf-c-cart-item-remove {
  border: none;
  background: none;
  color: var(--rhf-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}
.rhf-c-cart-item-remove:hover { color: var(--rhf-accent); }

/* === Форма оформления заказа === */
.rhf-c-field { display: flex; flex-direction: column; gap: 5px; }
/* #c-address-wrap (см. constructor.js: initCheckoutForm) — то же самое
   переопределение, что и у .rhf-c-panel[hidden] выше: без него поле адреса
   было бы видно и при выбранном "Самовывоз". */
.rhf-c-field[hidden] { display: none; }
.rhf-c-field label { font-size: 12.5px; color: var(--rhf-muted); }
.rhf-c-field input[type="text"],
.rhf-c-field input[type="tel"],
.rhf-c-field input[type="email"],
.rhf-c-field textarea {
  font: inherit;
  font-size: 14.5px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--rhf-border);
  background: var(--rhf-surface);
  color: var(--rhf-text);
}
.rhf-c-field input:focus, .rhf-c-field textarea:focus {
  outline: none;
  border-color: var(--rhf-accent);
}
.rhf-c-field-error {
  font-size: 12px;
  color: var(--rhf-accent);
  min-height: 15px;
}

.rhf-c-radio-row { display: flex; gap: 10px; }
.rhf-c-radio-row label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--rhf-border);
  border-radius: 10px;
  padding: 10px;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--rhf-muted);
}
.rhf-c-radio-row input { accent-color: var(--rhf-accent); }
.rhf-c-radio-row label:has(input:checked) {
  border-color: var(--rhf-accent);
  color: var(--rhf-text);
  background: var(--rhf-accent-soft);
}

.rhf-c-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--rhf-muted);
}
.rhf-c-consent input { margin-top: 3px; accent-color: var(--rhf-accent); }
.rhf-c-consent a { color: var(--rhf-text); }

.rhf-c-status {
  font-size: 13.5px;
  border-radius: 10px;
  padding: 10px 12px;
  display: none;
}
.rhf-c-status.rhf-c-status-error { display: block; background: var(--rhf-accent-soft); color: var(--rhf-accent); }
.rhf-c-status.rhf-c-status-success { display: block; background: var(--rhf-success-soft); color: var(--rhf-success); }

.rhf-c-disabled-note {
  max-width: 480px;
  margin: 60px auto;
  text-align: center;
  color: var(--rhf-muted);
  font-size: 14px;
  padding: 0 20px;
}

/* === Попап "подробнее о цветке" (клик на фото карточки, см. constructor.js:
   openFlowerPopup) — вся галерея вида цветка с прокруткой + описание. === */
.rhf-c-popup-open { overflow: hidden; }

.rhf-c-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 18, 16, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
/* См. комментarий у .rhf-c-popup-gallery[hidden] ниже — то же самое
   переопределение нужно и здесь: overlay.hidden управляется из JS
   (openFlowerPopup/closeFlowerPopup), а наш display:flex выше иначе
   перебивал бы браузерное [hidden]{display:none} при равной специфичности. */
.rhf-c-popup-overlay[hidden] {
  display: none;
}

.rhf-c-popup {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--rhf-surface);
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.rhf-c-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.rhf-c-popup-close:hover { background: rgba(0, 0, 0, 0.65); }

/* Горизонтальная прокрутка всех фото вида цветка — снап по одному кадру,
   работает и свайпом на телефоне, и колесом/перетаскиванием на десктопе. */
.rhf-c-popup-gallery {
  position: relative;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  aspect-ratio: 2 / 3;
  background: var(--rhf-surface-2);
  border-radius: 18px 18px 0 0;
}
.rhf-c-popup-gallery img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  scroll-snap-align: start;
}

/* Описание — оверлеем поверх фото, прижато к нижнему краю (см. constructor.js:
   openFlowerPopup — узел .rhf-c-popup-desc-overlay создаётся один раз и
   доклеивается внутрь .rhf-c-popup-gallery после каждой перерисовки фото).
   position:absolute внутри .rhf-c-popup-gallery (см. position:relative выше)
   — при горизонтальной прокрутке нескольких фото подложка с текстом остаётся
   на месте, не уезжает вместе с кадром. ЭКСПЕРИМЕНТ: раньше описание шло
   отдельным блоком под фото — после перехода на портретные 2:3 (см.
   .rhf-c-card-photo/.rhf-c-popup-gallery выше) это стало давать вертикальную
   прокрутку всего попапа на невысоких окнах. Если у вида цветка вообще нет
   фото — описание вместо этого показывается обычным текстом под попапом,
   см. .rhf-c-popup-desc-fallback ниже (иначе оно бы просто исчезло вместе со
   скрытой галереей). */
.rhf-c-popup-desc-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 70%;
  overflow-y: auto;
  padding: 28px 16px 14px;
  /* Градиент, а не сплошная плашка — так подложка мягко сходит на нет
     кверху и не режет фото жёсткой линией; у нижнего края (там текст)
     --rhf-popup-scrim уже почти непрозрачен (см. :root выше), поэтому
     читаемость не зависит от того, светлое фото или тёмное. */
  background: linear-gradient(to top, var(--rhf-popup-scrim) 55%, transparent 100%);
  color: var(--rhf-text);
}

.rhf-c-popup-body {
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rhf-c-popup-name {
  margin: 0;
  font-family: 'Cormorant', Georgia, serif;
  font-weight: 700;
  font-size: 20px;
}

.rhf-c-popup-meta {
  font-size: 12.5px;
  color: var(--rhf-muted);
}

.rhf-c-popup-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
}

/* .rhf-c-popup-gallery уже задаёт свой display:flex — без этого явного
   переопределения атрибут [hidden] от браузерной таблицы стилей по умолчанию
   (тоже display:none, но из "происхождения" UA, а не автора) проигрывал бы
   нашему правилу выше при равной специфичности. */
.rhf-c-popup-gallery[hidden],
.rhf-c-popup-desc-overlay[hidden],
.rhf-c-popup-meta[hidden],
.rhf-c-popup-desc[hidden] {
  display: none;
}

/* === Десктоп: двухколоночная раскладка === */
@media (min-width: 860px) {
  .rhf-c-wrap {
    grid-template-columns: 1fr 340px;
    align-items: start;
  }
  .rhf-c-main { grid-column: 1; }
  .rhf-c-side {
    grid-column: 2;
    position: sticky;
    top: 78px;
  }
  .rhf-c-intro { grid-column: 1 / -1; }
}

/* === Футер — тот же, что и на десктопной версии главной (templates/
   index.html: <footer class="footer">, см. .footer/.footer-columns/
   .footer-column/.social-links/.copyright/.footer-credit в styles.css/
   styles-dark.css) — разметка и структура колонок повторены один в один,
   классы свои (rhf-c-footer*), чтобы не зависеть от styles.css (тот на
   странице конструктора не подключён) и не пересекаться с ним по имени.
   Показывается только на десктопе (см. display:none в мобильном
   media-запросе ниже) — по просьбе, "как у десктопной версии индексной
   страницы", в мобильную версию конструктора футер не добавлялся. */
.rhf-c-footer {
  margin-top: 40px;
  background: var(--rhf-footer-bg);
  color: var(--rhf-footer-text);
  padding: 40px 0 20px;
}

.rhf-c-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

.rhf-c-footer-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.rhf-c-footer-column h4 {
  margin: 0 0 15px;
  font-size: 1.1rem;
  color: var(--rhf-footer-heading);
}

.rhf-c-footer-column p,
.rhf-c-footer-column a {
  display: block;
  margin-bottom: 8px;
  font-size: 0.95rem;
  color: var(--rhf-footer-text);
  text-decoration: none;
}

.rhf-c-footer-column a:hover {
  text-decoration: underline;
}

.rhf-c-footer-column p a {
  display: inline;
  margin-bottom: 0;
}

.rhf-c-footer-social a {
  margin-right: 15px;
  /* Как и в styles.css/styles-dark.css — постоянный акцент, а не
     тема-зависимый var(--rhf-accent) (см. .rhf-c-wordmark-dot выше). */
  color: #c41e3a;
}

.rhf-c-footer-hr {
  border: none;
  border-top: 1px solid var(--rhf-footer-border);
  margin: 0;
}

.rhf-c-footer-copyright {
  text-align: center;
  margin: 20px 0 0;
  padding-top: 20px;
  font-size: 0.9rem;
  color: var(--rhf-footer-copy);
}

.rhf-c-footer-credit {
  text-align: center;
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--rhf-footer-copy);
  opacity: 0.8;
}

.rhf-c-footer-credit a {
  display: inline;
  color: inherit;
  text-decoration: underline;
}

/* На мобильных панель сборки НЕ прилипает (на маленьком экране это
   съедало бы слишком много места) — просто идёт в потоке после сетки. */
@media (max-width: 859.98px) {
  .rhf-c-wrap { padding-bottom: 40px; }

  /* Шапка мобильного конструктора — по образцу шапки мобильного каталога
     (см. .header/.logo-img в styles-mobile.css): круглый бейдж под
     логотип вместо плоской картинки, ссылка "Каталог" — в левый угол
     (order: -1, без изменения разметки — так же, как это уже сделано в
     остальных местах сайта через CSS-порядок, а не перестановку HTML),
     логотип с названием — по центру за счёт margin: 0 auto (растягивает
     свободное место поровну по обе стороны), и новый бейдж суммы — в
     правый угол (см. .rhf-c-header-cart выше и ниже). Без env(safe-area)
     раньше — добавлено для паритета с index_mobile.html на "чёлочных"
     телефонах. */
  .rhf-c-header {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
  }

  .rhf-c-back {
    order: -1;
    margin-left: 0;
  }

  /* Название раздела в шапке — избыточно на мобильном: страница и так уже
     начинается с <h1>"Собери свой букет" (см. .rhf-c-page-title) сразу под
     шапкой, а места в одну строку с "Каталог"/логотипом/суммой корзины
     на узком экране уже не остаётся. */
  .rhf-c-page-tag {
    display: none;
  }

  .rhf-c-brand {
    margin: 0 auto;
    min-width: 0;
  }

  /* Тот же круглый бейдж-рамка вокруг логотипа, что и в шапке мобильного
     каталога (.logo-img в styles-mobile.css) — размер чуть компактнее,
     чтобы уместиться в одном ряду со ссылкой "Каталог" и суммой корзины. */
  .rhf-c-logo {
    height: 34px;
    width: 34px;
    padding: 5px;
    box-sizing: border-box;
    border: 1px solid var(--rhf-border);
    border-radius: 50%;
    background: var(--rhf-surface);
    object-fit: contain;
  }

  .rhf-c-wordmark {
    font-size: 12.5px;
  }

  .rhf-c-header-cart {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    border: none;
    background: none;
    padding: 0;
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    color: var(--rhf-accent);
    cursor: pointer;
    white-space: nowrap;
  }

  .rhf-c-header-cart-icon {
    font-size: 16px;
    line-height: 1;
  }

  /* Пока в конструкторе ещё ничего не выбрано и корзина пуста — сумма
     0 ₽, бейдж приглушаем, чтобы не выглядел как ложное уведомление. */
  .rhf-c-header-cart.rhf-c-header-cart--empty {
    opacity: 0.5;
  }

  /* Футер (.rhf-c-footer) добавлен только в десктопную версию конструктора
     (templates/constructor.html) — в мобильной (constructor_mobile.html)
     разметки футера вообще нет, но на случай попадания этого файла в
     мобильный шаблон в будущем — на всякий случай прячем и здесь. */
  .rhf-c-footer {
    display: none;
  }
}

/* =====================================================================
   Страница флориста (redhousefarm.ru/florist, templates/florist.html /
   florist_mobile.html / florist_login.html) — переиспользует ВСЮ верстку
   и переменные темы конструктора (.rhf-c-card/.rhf-c-stepper/.rhf-c-panel/
   .rhf-c-field/.rhf-c-btn/.rhf-c-current-row и т.д. выше в этом файле),
   здесь только то, чего у конструктора не было: бейдж оптовой скидки на
   карточке, подсказка под степпером и центрированная карточка входа.
   ===================================================================== */

/* Карточкам флориста нужно немного больше места, чем квадратным карточкам
   конструктора — на них ещё строка "В наличии: N шт." и бейдж скидки. */
.rhf-f-grid {
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
}

/* Бейдж "-10%" — появляется на карточке, как только выбранное количество
   достигло порога оптовой скидки (см. FLORIST_BULK_DISCOUNT_THRESHOLD в
   orders/serializers.py, приходит в шаблон как bulk_threshold/bulk_percent
   и используется в static/js/florist.js). Акцентный цвет — тот же, что и
   у .rhf-c-card-price, но с плашкой фона, чтобы читалось как "статус", а
   не как ещё одна строка текста. */
.rhf-f-card-discount {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--rhf-accent-soft);
  color: var(--rhf-accent);
  font-size: 11px;
  font-weight: 700;
}
.rhf-f-card-discount[hidden] { display: none; }

/* Подсказка под степпером количества — правило "от 10, далее кратно 5"
   (обычное состояние, приглушённый цвет) или предупреждение "максимум N
   шт." при попытке набрать больше остатка (см. .rhf-f-card-qty-note--warn
   ниже, акцентный красный — та же семантика, что у .rhf-c-progress-note.
   rhf-c-error в конструкторе). */
.rhf-f-card-qty-note {
  font-size: 11px;
  color: var(--rhf-muted);
  min-height: 14px;
}
.rhf-f-card-qty-note.rhf-f-card-qty-note--warn {
  color: var(--rhf-accent);
  font-weight: 600;
}

/* Карточка недоступна флористу прямо сейчас (весь остаток уже выбран в
   текущем заказе) — приглушаем, но не прячем, чтобы позиция не "прыгала"
   по сетке при изменении количества у соседних карточек. */
.rhf-f-card--depleted {
  opacity: 0.55;
}

/* === Форма входа (florist_login.html) === */
.rhf-f-login-wrap {
  display: flex;
  justify-content: center;
  padding: 48px 16px;
}

.rhf-f-login-card {
  width: 100%;
  max-width: 360px;
}
.rhf-f-login-card h2 {
  margin: 0;
  font-family: 'Cormorant', Georgia, serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--rhf-text);
}

.rhf-f-login-hint {
  margin: -4px 0 4px;
  font-size: 13px;
  color: var(--rhf-muted);
}

.rhf-f-login-error {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--rhf-accent-soft);
}

/* ===========================================================
   Страница отзыва (redhousefarm.ru/review) — templates/review.html /
   review_mobile.html, static/js/reviews.js. Переиспользует базовые
   классы конструктора выше (.rhf-c-wrap/.rhf-c-panel/.rhf-c-field/
   .rhf-c-btn/.rhf-c-status/.rhf-c-field-error/.rhf-c-consent) — здесь
   только то, чего у конструктора не было: карточки выбора покупки,
   звёзды рейтинга, превью загруженных фото.
   =========================================================== */

.rhf-rv-wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.rhf-rv-step-title {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 700;
  color: var(--rhf-text);
}

/* Карточки выбора конкретной покупки (шаг 2, только если позиций
   несколько) — фото здесь ОБРЕЗАННОЕ (object-fit: cover), это фото
   ТОВАРА из каталога, служит только опознавательным значком для выбора,
   а не собственным фото отзыва (то, что грузит клиент, показывается
   БЕЗ обрезки — см. .rhf-rv-photo-thumb ниже). */
.rhf-rv-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--rhf-border);
  border-radius: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.rhf-rv-item-card:hover {
  border-color: var(--rhf-accent);
}

.rhf-rv-item-card:has(input:checked) {
  border-color: var(--rhf-accent);
  background: var(--rhf-accent-soft);
}

.rhf-rv-item-card input[type="radio"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--rhf-accent);
}

.rhf-rv-item-thumb {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 8px;
  object-fit: cover;
  background: var(--rhf-surface-2);
}

.rhf-rv-item-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.rhf-rv-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rhf-rv-item-name {
  font-weight: 600;
  color: var(--rhf-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rhf-rv-item-meta {
  font-size: 13px;
  color: var(--rhf-muted);
}

.rhf-rv-selected-summary {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--rhf-surface-2);
  color: var(--rhf-muted);
  font-size: 13px;
  margin-bottom: 16px;
}

/* Звёзды рейтинга — крупные кликабельные кнопки без рамки/фона. */
.rhf-rv-stars {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}

.rhf-rv-stars button {
  background: none;
  border: none;
  padding: 2px;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  color: var(--rhf-border);
  transition: color 0.15s ease, transform 0.1s ease;
}

.rhf-rv-stars button:hover {
  transform: scale(1.08);
}

.rhf-rv-stars button.star-filled {
  color: var(--rhf-accent);
}

.rhf-rv-rating-hint {
  font-size: 12px;
  color: var(--rhf-muted);
  margin-bottom: 16px;
}

/* Загрузка фото — до 5 штук, показываем в ИСХОДНОЙ ориентации (без
   обрезки): контейнер задаёт только max-height, ширина следует за
   натуральными пропорциями фото (см. явное требование задачи —
   "отображать каждую фотографию нужно в том же формате что и
   загружена"). */
.rhf-rv-photos-field {
  margin-bottom: 18px;
}

.rhf-rv-photos-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.rhf-rv-photos-count {
  font-size: 13px;
  color: var(--rhf-muted);
}

.rhf-rv-photos-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rhf-rv-photo-thumb {
  position: relative;
  max-height: 120px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--rhf-shadow);
}

.rhf-rv-photo-thumb img {
  display: block;
  max-height: 120px;
  width: auto;
  max-width: 160px;
}

.rhf-rv-photo-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rhf-rv-done {
  text-align: center;
  padding: 40px 20px;
}

.rhf-rv-done-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.rhf-rv-done-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--rhf-text);
  margin-bottom: 8px;
}

.rhf-rv-done-text {
  color: var(--rhf-muted);
}

.rhf-rv-step-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
}

.rhf-rv-back-link {
  background: none;
  border: none;
  color: var(--rhf-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 10px 4px;
}

.rhf-rv-back-link:hover {
  color: var(--rhf-accent);
}
