/* ============================================================
   «Пряники ручной работы» — каталог
   Палитра: кремовый / медовый / коричный / шоколадный
   ============================================================ */

:root {
  --cream: #fdf6ec;
  --cream-dark: #f6ead6;
  --honey: #e8a94c;
  --honey-soft: #f3c57e;
  --cinnamon: #b0713a;
  --cinnamon-dark: #7b4a2d;
  --chocolate: #3e2a1e;
  --chocolate-soft: #5a4030;
  --ink: #241610;
  --card-bg: #fffdf8;
  --shadow: 0 10px 30px rgba(62, 42, 30, 0.12);
  --radius: 18px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Georgia", "Times New Roman", serif;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(232, 169, 76, 0.18), transparent 60%),
    var(--cream);
  color: var(--chocolate);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.container {
  width: min(1100px, 100% - 2rem);
  margin: 0 auto;
  flex: 1;
}

/* ===== Шапка ===== */
.site-header {
  background-image:
    linear-gradient(rgba(222, 184, 135, 0.68), rgba(222, 184, 135, 0.8)),
    url("/static/logo1.jpg");
  background-size: cover;
  background-position: center;
  color: var(--ink);
  text-shadow: 0 1px 3px rgba(253, 246, 236, 0.7);
  padding: 1.8rem 0 1.6rem;
  box-shadow: 0 6px 24px rgba(62, 42, 30, 0.25);
}

.header-inner {
  width: min(1100px, 100% - 2rem);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 1rem; }

.brand-photo {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px dashed rgba(62, 42, 30, 0.45);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink);
}

.brand-slogan {
  font-size: 0.92rem;
  font-weight: 600;
  color: rgba(36, 22, 16, 0.92);
  font-style: italic;
}

.header-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* ===== Кнопки ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  border: 2px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn:hover { transform: translateY(-2px); }

.btn-outline {
  border-color: rgba(36, 22, 16, 0.7);
  color: var(--ink);
  font-weight: 700;
  text-shadow: none;
  background: rgba(253, 246, 236, 0.35);
}
.btn-outline:hover { background: rgba(253, 246, 236, 0.6); }

.btn-primary {
  background: var(--honey);
  color: var(--chocolate);
}
.btn-primary:hover { background: var(--honey-soft); }

/* ===== Интро каталога ===== */
.catalog-intro {
  padding: 2.4rem 0 1.2rem;
  text-align: center;
}

.catalog-intro h2 {
  font-size: 2rem;
  color: var(--cinnamon-dark);
  position: relative;
  display: inline-block;
  padding-bottom: 0.5rem;
}

.catalog-intro h2::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 0;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--honey), transparent);
}

.catalog-intro p {
  margin-top: 0.6rem;
  color: var(--chocolate-soft);
  font-style: italic;
}

/* ===== Каталог: карточки ===== */
.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 1.6rem;
  padding: 1.4rem 0 3rem;
}

.catalog-loading,
.catalog-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  font-size: 1.1rem;
  color: var(--chocolate-soft);
  font-style: italic;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 46%) minmax(0, 1fr);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(62, 42, 30, 0.18);
}

.card-photo {
  margin: 0;
  background: var(--cream-dark);
  cursor: zoom-in;
  overflow: hidden;
  min-height: 260px;
}

.card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.card:hover .card-photo img { transform: scale(1.05); }

.card-photo:hover { outline: 3px solid var(--honey); outline-offset: -3px; }

.card-text {
  padding: 1.4rem 1.5rem 1.6rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-title {
  font-size: 1.35rem;
  color: var(--cinnamon-dark);
  margin-bottom: 0.7rem;
  line-height: 1.3;
}

.card-desc {
  color: var(--chocolate-soft);
  font-size: 0.97rem;
  white-space: pre-line; /* сохраняем переносы строк из .txt */
  overflow-wrap: break-word;
}

/* ===== Лайтбокс ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.lightbox[hidden] { display: none; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 18, 10, 0.88);
  backdrop-filter: blur(3px);
}

.lightbox-figure {
  position: relative;
  max-width: min(920px, 100%);
  max-height: 100%;
  z-index: 1;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: 82vh;
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
  text-align: center;
  color: var(--cream);
  margin-top: 0.9rem;
  font-size: 1.1rem;
  font-style: italic;
}

.lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--honey);
  color: var(--chocolate);
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease;
}

.lightbox-close:hover { transform: rotate(90deg); }

/* ===== Подвал ===== */
.site-footer {
  background-image:
    linear-gradient(rgba(222, 184, 135, 0.72), rgba(222, 184, 135, 0.82)),
    url("/static/logo1.jpg");
  background-size: cover;
  background-position: center;
  color: rgba(36, 22, 16, 0.95);
  text-shadow: 0 1px 3px rgba(253, 246, 236, 0.65);
  margin-top: auto;
  padding: 1.8rem 0 1.4rem;
}

.footer-inner {
  width: min(1100px, 100% - 2rem);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-name { color: var(--ink); font-size: 1.15rem; font-weight: 700; }
.footer-note { font-style: italic; font-size: 0.9rem; }

.footer-contacts { display: flex; gap: 1.2rem; flex-wrap: wrap; }

.footer-contacts a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dashed rgba(36, 22, 16, 0.6);
}
.footer-contacts a:hover { color: var(--cinnamon-dark); }

.footer-copy {
  width: min(1100px, 100% - 2rem);
  margin: 1rem auto 0;
  font-size: 0.82rem;
  color: rgba(36, 22, 16, 0.8);
}

/* ===== Адаптив ===== */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; text-align: center; }
  .brand { flex-direction: column; }
  .header-actions { justify-content: center; }

  .catalog { grid-template-columns: 1fr; }

  /* Мобильная карточка: фото сверху, текст снизу */
  .card { grid-template-columns: 1fr; }
  .card-photo { min-height: 220px; max-height: 320px; }
  .card-text { padding: 1.2rem 1.2rem 1.4rem; }

  .lightbox-close { top: 6px; right: 6px; }

  /* Мобильная корзина — на всю ширину */
  .cart-drawer { width: 100%; }
}

/* ============================================================
   Корзина
   ============================================================ */

/* Кнопка-переключатель в шапке */
.cart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}

.cart-icon { font-size: 1.05rem; line-height: 1; }

.cart-count {
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--honey);
  color: var(--chocolate);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.5rem;
  text-align: center;
  text-shadow: none;
}

.cart-count.pulse { animation: cart-pulse 0.4s ease; }

@keyframes cart-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* ===== Ряд цены + кнопка в карточке ===== */
.card-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1rem 1.5rem 1.3rem;
  border-top: 1px solid var(--cream-dark);
  background: linear-gradient(180deg, transparent, rgba(246, 234, 214, 0.5));
}

.card-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--cinnamon-dark);
}

.btn-add { margin-left: auto; }

.btn-add.added {
  background: var(--cinnamon-dark);
  color: var(--cream);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.btn:disabled:hover { background: var(--honey); }

/* Пока оформление заказа не готово — кнопка приглушённая */
.cart-checkout:disabled {
  background: var(--cream-dark);
  color: var(--chocolate-soft);
  font-weight: 600;
}

/* ===== Затемнение под панелью ===== */
.cart-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 18, 10, 0.5);
  z-index: 90;
}
.cart-backdrop[hidden] { display: none; }

/* ===== Выезжающая панель ===== */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  background: var(--cream);
  z-index: 91;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(30, 18, 10, 0.35);
  transform: translateX(105%);
  transition: transform 0.28s ease;
}

.cart-drawer.open { transform: translateX(0); }

.cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.3rem;
  border-bottom: 2px solid var(--cream-dark);
}

.cart-title {
  font-size: 1.35rem;
  color: var(--cinnamon-dark);
  line-height: 1.3;
}

.cart-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(36, 22, 16, 0.5);
  background: var(--cream-dark);
  color: var(--chocolate);
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.cart-close:hover { background: var(--honey-soft); transform: rotate(90deg); }

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 1.2rem;
}

.cart-empty {
  text-align: center;
  font-style: italic;
  color: var(--chocolate-soft);
  padding: 2.4rem 0.6rem;
}

.cart-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.cart-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto auto;
  gap: 0.6rem;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--cream-dark);
  border-radius: 14px;
  padding: 0.6rem 0.7rem;
}

.cart-thumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 10px;
}

.cart-item-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--cinnamon-dark);
  line-height: 1.3;
  overflow-wrap: break-word;
}

.cart-item-price {
  font-size: 0.82rem;
  color: var(--chocolate-soft);
  margin-top: 0.15rem;
}

.cart-item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.qty-btn {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 1px solid var(--cinnamon);
  background: var(--cream);
  color: var(--cinnamon-dark);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}
.qty-btn:hover:not(:disabled) { background: var(--honey-soft); }
.qty-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.qty-value {
  min-width: 1.6rem;
  text-align: center;
  font-weight: 700;
}

.cart-item-sum {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--cinnamon-dark);
  white-space: nowrap;
}

.cart-remove {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--chocolate-soft);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.cart-remove:hover {
  background: var(--cream-dark);
  color: var(--cinnamon-dark);
}

/* ===== Итого ===== */
.cart-foot {
  padding: 1rem 1.3rem 1.2rem;
  border-top: 2px solid var(--cream-dark);
  background: var(--cream-dark);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 1.05rem;
  color: var(--chocolate);
  margin-bottom: 0.9rem;
}
.cart-total strong {
  font-size: 1.3rem;
  color: var(--cinnamon-dark);
}

.cart-checkout { width: 100%; }

@media (max-width: 560px) {
  .cart-label { display: none; }
  .cart-toggle { padding: 0.6rem 0.9rem; }
}
