/* ===== Первоисток — стили ===== */

:root {
  --bg: #FBF7E9;
  --bg-alt: #F1EBD2;
  --surface: #FFFFFF;
  --text: #24371F;
  --text-muted: #5A6B4C;
  --accent: #2E6B3E;
  --accent-dark: #1F4E2B;
  --yellow: #FFD414;
  --line: #E0DCBE;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(36, 55, 31, 0.12);
}

* { box-sizing: border-box; }

/* атрибут hidden должен побеждать любые display у оверлеев и кнопок */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: "Alegreya", Georgia, serif;
  line-height: 1.15;
  margin: 0 0 0.4em;
}

img { max-width: 100%; display: block; }

/* ===== Кнопки ===== */
.btn {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 14px 32px;
  font: 600 17px/1.2 "Inter", sans-serif;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.btn--primary {
  background: var(--accent);
  color: #FFF8EE;
}
.btn--primary:hover { background: var(--accent-dark); }
.btn--ghost {
  background: transparent;
  color: var(--accent);
}
.btn--ghost:hover { color: var(--accent-dark); }
.btn--wide { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn:focus-visible,
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ===== Экран 1: герой ===== */
.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 48px 20px;
}
.hero__inner {
  max-width: 1060px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 5fr 6fr;
  gap: 56px;
  align-items: center;
}
.hero__photo img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  height: auto;
}
.hero__logo {
  width: 96px;
  height: auto;
  margin-bottom: 20px;
}
.hero__brand {
  margin: 0 0 8px;
  font: 600 15px/1 "Inter", sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero h1 {
  font-size: clamp(44px, 7vw, 78px);
  font-weight: 700;
}
.hero__sub {
  color: var(--text-muted);
  font-size: 19px;
  max-width: 44ch;
  margin: 0 0 32px;
}

/* ===== Экран 2: каталог ===== */
.catalog {
  max-width: 1060px;
  margin: 0 auto;
  padding: 72px 20px;
}
.catalog h2,
.delivery h2 {
  font-size: clamp(32px, 4.5vw, 48px);
  margin-bottom: 32px;
}
.catalog__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px;
}
.product {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s;
}
.product:hover { box-shadow: var(--shadow); }
.product img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.product__body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.product h3 { font-size: 22px; margin: 0; }
.product__desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
  flex: 1;
}
.product__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}
.product__price { font: 700 22px/1 "Alegreya", serif; }
.product__weight { color: var(--text-muted); font-size: 14px; margin-left: 8px; }

/* плюсик и степпер количества */
.add-btn, .qty-btn {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #FFF8EE;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}
.add-btn:hover, .qty-btn:hover { background: var(--accent-dark); }
.add-btn svg, .qty-btn svg { width: 22px; height: 22px; }
.qty {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.qty__num {
  min-width: 28px;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.qty-btn--small { width: 40px; height: 40px; }

/* ===== Почему хлеб живой ===== */
.about { background: var(--bg-alt); }
.about__inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 72px 20px;
}
.about h2 {
  font-size: clamp(32px, 4.5vw, 48px);
  margin-bottom: 28px;
}
.about__quote {
  margin: 0 0 40px;
  padding: 24px 28px;
  background: var(--surface);
  border-left: 5px solid var(--yellow);
  border-radius: 0 var(--radius) var(--radius) 0;
  max-width: 720px;
}
.about__quote p {
  margin: 0 0 10px;
  font-family: "Alegreya", Georgia, serif;
  font-style: italic;
  font-size: 20px;
}
.about__quote cite {
  font-style: normal;
  font-size: 15px;
  color: var(--text-muted);
}
.about__quote a { color: var(--accent); }
.about__features {
  list-style: none;
  margin: 0 0 40px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 32px;
}
.about__features li { display: flex; gap: 16px; }
.about__features svg {
  width: 34px;
  height: 34px;
  flex: none;
  color: var(--accent);
  margin-top: 4px;
}
.about__features h3 { font-size: 20px; margin-bottom: 4px; }
.about__features p { margin: 0; color: var(--text-muted); font-size: 15px; }
.about__story { max-width: 720px; margin-bottom: 40px; }
.about__story h3 { font-size: 24px; }
.about__story p { color: var(--text-muted); }

/* галерея */
.gallery {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.gallery__item {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
}
.gallery__item img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s;
}
.gallery__item:hover img { opacity: 0.85; }

.about__docs { margin: 0; }
.about__docs a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s;
}
.about__docs a:hover { color: var(--accent-dark); text-decoration: underline; }
.about__docs svg { width: 24px; height: 24px; flex: none; }

/* лайтбокс */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 28, 17, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lightbox img {
  max-width: 100%;
  max-height: 92svh;
  border-radius: 8px;
}
.lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #FFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox__close svg { width: 24px; height: 24px; }

/* ===== Хранение ===== */
.storage__inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 72px 20px;
}
.storage h2 {
  font-size: clamp(32px, 4.5vw, 48px);
  margin-bottom: 12px;
}
.storage__lead {
  color: var(--text-muted);
  max-width: 62ch;
  margin: 0 0 36px;
}
.storage__steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 28px;
}
.storage__steps li {
  counter-increment: step;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.storage__steps li::before {
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--accent-dark);
  font: 700 18px/1 "Inter", sans-serif;
  margin-bottom: 14px;
}
.storage__steps h3 { font-size: 20px; margin-bottom: 6px; }
.storage__steps p { margin: 0; color: var(--text-muted); font-size: 15px; }

/* ===== Доставка ===== */
.delivery { background: var(--bg-alt); }
.delivery__inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 72px 20px;
}
.delivery__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 32px;
}
.delivery__list li { display: flex; gap: 16px; }
.delivery__list svg {
  width: 34px;
  height: 34px;
  flex: none;
  color: var(--accent);
  margin-top: 4px;
}
.delivery__list h3 { font-size: 20px; margin-bottom: 4px; }
.delivery__list p { margin: 0; color: var(--text-muted); font-size: 15px; }

/* ===== Футер ===== */
.footer {
  max-width: 1060px;
  margin: 0 auto;
  padding: 40px 20px 56px;
  color: var(--text-muted);
  font-size: 15px;
}

/* ===== Плавающая корзина ===== */
.cart-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #FFF8EE;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
  z-index: 30;
}
.cart-fab:hover { background: var(--accent-dark); }
.cart-fab svg { width: 28px; height: 28px; }
.cart-fab__count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  background: var(--yellow);
  color: var(--accent-dark);
  font: 700 13px/24px "Inter", sans-serif;
  text-align: center;
}

.footer a { color: var(--accent); }
.footer__legal {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 8px;
}

/* ===== Оверлеи: корзина и успех ===== */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(59, 42, 24, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  padding: 0;
}
.cart, .success {
  background: var(--bg);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92svh;
  overflow-y: auto;
  padding: 24px 24px 32px;
}
@media (min-width: 640px) {
  .cart-overlay { align-items: center; padding: 24px; }
  .cart, .success { border-radius: var(--radius); }
}
.cart__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.cart__head h2 { margin: 0; font-size: 30px; }
.cart__close {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}
.cart__close:hover { background: var(--bg-alt); }
.cart__close svg { width: 24px; height: 24px; }

.cart__items { list-style: none; margin: 0; padding: 0; }
.cart__items li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.cart__item-info { flex: 1; min-width: 0; }
.cart__item-name { font-weight: 600; font-size: 15px; margin: 0; }
.cart__item-price { color: var(--text-muted); font-size: 14px; margin: 0; }
.cart__empty { color: var(--text-muted); padding: 24px 0; }

.cart__total {
  font-size: 19px;
  text-align: right;
  margin: 16px 0 24px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font: 400 17px/1.4 "Inter", sans-serif;
  color: var(--text);
  transition: border-color 0.2s;
}
.field input:focus { border-color: var(--accent); outline: none; }
.field input[aria-invalid="true"] { border-color: #B3261E; }
.field__error, .cart__submit-error {
  color: #B3261E;
  font-size: 14px;
  margin: 6px 0 0;
}
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.cart__delivery-note {
  background: var(--bg-alt);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-muted);
  margin: 20px 0;
}

/* ===== Успех ===== */
.success { text-align: center; padding-top: 40px; }
.success__icon {
  width: 72px;
  height: 72px;
  color: var(--accent);
  margin: 0 auto 16px;
}
.success h2 { font-size: 34px; }
.success p {
  color: var(--text-muted);
  max-width: 40ch;
  margin: 0 auto 28px;
}
.success .btn { display: block; margin: 0 auto 12px; max-width: 420px; }

/* ===== Мобильная версия ===== */
@media (max-width: 760px) {
  .hero { padding: 32px 20px; }
  .hero__inner { grid-template-columns: 1fr; gap: 28px; }
  .hero__photo { max-width: 340px; margin: 0 auto; }
  .catalog, .delivery__inner { padding: 56px 20px; }
}

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