:root {
  --bg: #faf9f7;          /* общий фон */
  --text: #1f2937;        /* основной текст */
  --muted: #6b7280;       /* приглушённый текст */
  --line: #e5ded3;        /* границы, разделители */

  --brand: #c7a97a;       /* фирменный бежево-золотистый */
  --brand-600: #b89362;   /* тёмнее — при наведении */
  --brand-100: #f3ede4;   /* очень светлый вариант */
}

/* ===== BASE ===== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  color: var(--text);
  background: var(--bg);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.container { width: min(1200px, 92%); margin-inline: auto; }

/* =======================================================
   HEADER / NAV
======================================================= */
header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  backdrop-filter: saturate(160%) blur(6px);
}
.nav {
  display: flex; align-items: center; justify-content: flex-start;
  gap: 28px; padding: 14px 0;
}
.brand { font-weight: 700; letter-spacing: .2px; font-size: 22px; }

/* навигация как кнопки */
header nav ul {
  display: flex; gap: 14px; list-style: none; margin: 0; padding: 0;
}
header nav a {
  display: inline-block;
  padding: 8px 16px;
  background: var(--brand-100);
  color: var(--text);
  font-weight: 500;
  border-radius: 10px;
  border: 1px solid var(--brand-100);
  transition: all 0.25s ease;
}
header nav a:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand-600);
  box-shadow: 0 2px 6px rgba(199, 169, 122, 0.3);
}

/* мобильное выравнивание меню */
@media (max-width: 680px) {
  .nav { flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px 0; }
  header nav ul { flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 12px; }
  header nav li { display: flex; flex: 0 0 auto; }
  header nav a { white-space: nowrap; padding: 8px 14px; font-size: 15px; border-radius: 12px; }
}
@media (max-width: 380px) {
  header nav a { padding: 7px 12px; font-size: 14px; }
}

/* =======================================================
   HERO
======================================================= */
.hero{
  position: relative; border-radius: 20px; overflow: hidden;
  min-height: 420px;
  background: url("/icons/banner.png") center/cover no-repeat;
  color: #fff;
}
.hero::before{
  content:""; position:absolute; inset:0;
  background: rgba(0,0,0,0.22); /* 0.18–0.28 по вкусу */
  z-index:0;
}
.hero-inner{ position: relative; z-index:1; max-width: 760px; padding: 56px 28px; }
.hero h1{ margin: 0 0 10px; font-size: clamp(28px, 6vw, 44px); line-height: 1.15; font-weight: 800; }
.hero p{ margin: 0 0 20px; color: rgba(255,255,255,0.88); font-size: clamp(15px, 2.6vw, 18px); }

.hero-actions{ display:flex; gap:12px; flex-wrap:wrap; }
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding: 12px 18px; border-radius: 12px; border:1px solid transparent;
  font-weight: 600; text-decoration: none; transition: all .2s ease; cursor: pointer;
}
.btn-primary{ background: var(--brand); color:#fff; border-color: var(--brand); }
.btn-primary:hover{ background: var(--brand-600); border-color: var(--brand-600); }
.btn-outline{
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: rgba(255,255,255,0.35);
  backdrop-filter: saturate(120%) blur(2px);
}
.btn-outline:hover{ background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.55); }

@media (max-width: 680px){
  .hero{ min-height: 360px; }
  .hero-inner{ padding: 36px 18px; }
  .hero-actions{ gap:10px; }
}

/* =======================================================
   FEATURES (общие карточки преимуществ)
======================================================= */
section { padding: 28px 0; } /* общий вертикальный ритм */
.features{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feat{
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; box-shadow: 0 1px 0 rgba(0,0,0,.02);
  transition: all .18s ease;
}
.feat:hover{ border-color: #e9e2d8; box-shadow: 0 4px 14px rgba(0,0,0,.05); transform: translateY(-1px); }
.feat b{ display:block; font-weight:700; margin-bottom:6px; color: var(--text); }
.muted{ color: var(--muted); }
@media (max-width: 900px){ .features{ grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px){ .features{ grid-template-columns: 1fr; } }

/* =======================================================
   CATALOG
======================================================= */
#catalog{ padding: 40px 0; }
.section-title{ font-size: 22px; font-weight: 700; margin-bottom: 20px; color: var(--text); text-align: left; }

.grid{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 1000px){ .grid{ grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px){ .grid{ grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px){ .grid{ grid-template-columns: 1fr; } }

.card{
  background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; transition: all .2s ease;
  height: 100%;
}
.card:hover{ box-shadow: 0 4px 14px rgba(0,0,0,.05); transform: translateY(-2px); }
.card img{ width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #f3f3f3; }
.card-body{ padding: 14px; }
.card-body .title{ font-weight: 600; font-size: 16px; margin: 0 0 6px; }
.card-body .muted{ color: var(--muted); font-size: 13px; }
.price{ font-weight: 700; color: var(--text); }

.card-actions{ display:flex; gap: 8px; padding: 14px; padding-top: 0; flex-wrap: wrap; }
.card-actions .btn{ flex:1 1 48%; font-size:14px; padding:10px; }

/* Mobile-friendly stacking */
@media (max-width: 520px){
  .card-body{ padding: 12px; }
  .card-body .title{ font-size: 15px; }
  .card-body .muted{ font-size: 13px; }
  .card-actions{ padding: 12px; gap: 10px; }
  .card-actions .btn{ flex:1 1 100%; min-height: 42px; }
}

.card-more { padding: 0 14px 14px; }
.btn-more{
  width:100%; padding:10px; border-radius:10px;
  border:1px solid var(--brand); background:#fff; color: var(--brand-600);
  font-weight:600; transition: all .25s ease;
}
.btn-more:hover{ background: var(--brand); color:#fff; }

/* кнопки в карточках — контраст и центрирование */
.grid .btn { display:inline-flex; align-items:center; justify-content:center; text-align:center;
  font-weight:600; padding:10px 18px; border-radius:10px; line-height:1.3; transition:all .2s ease-in-out; }
.grid .btn-primary { background:#c3a47e; color:#fff; border:none; }
.grid .btn-primary:hover { background:#b49068; }
.grid .btn-outline { background:transparent; border:1px solid #c3a47e; color:#c3a47e; }
.grid .btn-outline:hover { background:#c3a47e; color:#fff; }

/* =======================================================
   DELIVERY
======================================================= */
#delivery { padding: 50px 0; background: var(--brand-100); border-radius: 18px; margin-top: 30px; }
#delivery .section-title{ text-align:center; font-size:22px; font-weight:700; margin-bottom:26px; }
#delivery .features{ display:grid; grid-template-columns: repeat(3,1fr); gap:18px; width:min(1100px,92%); margin:0 auto; }
#delivery .feat{ background:#fff; border:1px solid var(--line); border-radius:14px; padding:16px 18px; text-align:center; transition: all .25s; }
#delivery .feat:hover{ box-shadow:0 4px 12px rgba(0,0,0,.06); transform: translateY(-2px); border-color: var(--brand); }
#delivery .muted{ color: var(--muted); font-size:14px; }
@media (max-width: 900px){ #delivery .features{ grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px){ #delivery .features{ grid-template-columns: 1fr; } #delivery .feat{ padding:14px; } }

/* =======================================================
   CONTACTS
======================================================= */
#contacts { padding: 60px 0; text-align: center; }
#contacts .section-title{ font-size:22px; font-weight:700; margin-bottom:28px; }
.contacts { display:flex; flex-wrap:wrap; justify-content:center; gap:12px 14px; width:min(900px,90%); margin:0 auto; }
.chip{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  background:#fff; border:1px solid var(--line); border-radius:20px; padding:10px 18px;
  font-weight:500; color:var(--text); transition: all .25s ease;
}
.chip:hover{ background: var(--brand); border-color: var(--brand); color:#fff; transform: translateY(-2px); }
@media (max-width: 560px){ #contacts{ padding:50px 0; } .chip{ padding:10px 16px; font-size:15px; } }

/* =======================================================
   FOOTER
======================================================= */
footer { border-top: 1px solid var(--line); background:#fff; padding:24px 0 40px; color: var(--muted); font-size:15px; }
.footer-inner { display:flex; justify-content:space-between; align-items:center; gap:16px; flex-wrap:wrap; width:min(1200px,92%); margin-inline:auto; }
.footer-inner div { display:flex; align-items:center; gap:6px; }
@media (max-width: 560px){ .footer-inner{ flex-direction: column; text-align:center; gap:6px; } }

/* =======================================================
   MODALS (ORDER + DETAIL)
======================================================= */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0,0,0,0.45);
  overscroll-behavior: contain;
}
.modal.open { display: flex; }

.modal-card{
  display:flex; flex-direction:column;
  width: min(560px, 94%);
  max-height: 90vh;
  background:#fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  animation: popup .25s ease;
}
@keyframes popup{ from{ transform: translateY(20px); opacity:0; } to{ transform: translateY(0); opacity:1; } }

.modal-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px; background: var(--brand-100); border-bottom:1px solid var(--line);
}
.modal-head strong{ font-size:18px; color: var(--text); }
.modal-head .x{ background:transparent; border:0; font-size:24px; line-height:1; cursor:pointer; color: var(--muted); transition: color .2s; }
.modal-head .x:hover{ color: var(--brand-600); }

.modal-body{
  flex: 1 1 auto; min-height: 0;
  overflow: auto; -webkit-overflow-scrolling: touch;
  padding: 18px;
}

/* форма заказа */
form.grid{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
form.grid .full{ grid-column: 1 / -1; }
label{ display:block; font-weight:600; font-size:13px; margin-bottom:4px; color: var(--text); }
input, textarea{
  width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:#fff; font-size:15px;
  transition: border-color .2s;
}
input:focus, textarea:focus{ border-color: var(--brand); outline: none; }
.form-actions{ display:flex; gap:10px; justify-content:flex-end; margin-top:8px; }
.btn { border-radius: 12px; } /* уже описан выше, оставляем консистентность */
.btn-primary { background: var(--brand); color:#fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-outline { background:#fff; color: var(--text); border:1px solid var(--line); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand-600); }

/* модалка деталей товара */
.modal-detail img{ width:100%; max-width:300px; border-radius:10px; object-fit:cover; background:#f7f7f7; }
.detail-content{ display:flex; gap:20px; flex-wrap:wrap; }
.detail-info{ flex:1; min-width:220px; }
.detail-info h3{ margin-top:0; font-size:22px; font-weight:700; }
.detail-info p{ margin-bottom:10px; }
.detail-actions{ display:flex; gap:10px; margin-top:14px; }
.detail-actions .btn{
  display:inline-flex; align-items:center; justify-content:center; text-align:center;
  padding:12px 18px; min-height:46px; font-weight:600; border-radius:10px; line-height:1.2;
}
.detail-actions .btn-outline { background:#fff; border:1px solid var(--line); color: var(--text); }
.detail-actions .btn-outline:hover { background: var(--brand); color:#fff; border-color: var(--brand); }

/* списки в описании товара */
.desc-list{ margin:8px 0 0; padding-left:18px; }
.desc-list li{ margin:4px 0; line-height:1.4; }
#detailDesc p{ margin:0 0 6px; }
#detailDesc{ white-space: pre-line; }

/* мобильная модалка: полноэкранная, шапка/кнопки липкие и скролл внутри */
@media (max-width: 600px){
  .modal{ padding:0; }
  .modal-card{ width:100%; height:100vh; max-height:100vh; border-radius:0; border:0; }
  .modal-head{ position: sticky; top:0; z-index:2; }
  .modal-body{ padding:16px; height:auto; }
  .detail-content{ flex-direction: column; align-items:center; gap:14px; }
  .modal-detail img{ max-width:100%; max-height:40vh; }
  .detail-actions{
    position: sticky; bottom:0; z-index:2;
    background:#fff; padding-top:10px; margin-top:12px; border-top:1px solid var(--line);
    display:grid; grid-template-columns:1fr 1fr; gap:10px;
  }
  .detail-actions .btn{ min-height:44px; font-size:15px; }
}

/* =======================================================
   SMALL UTILITIES
======================================================= */
.hidden { display: none !important; }

/* ===== GALLERY ===== */
.detail-gallery { width: 100%; max-width: 360px; }
/* Сцена галереи заполняется картинкой целиком */
.detail-stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #f7f7f7;
  aspect-ratio: 4 / 3;          /* фиксируем «коробку» */
}

/* Перекрываем общий .modal-detail img */
.detail-stage img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;             /* заполняем без «пустых полей» */
  object-position: center;       /* центрируем кадр */
  display: block;
}

/* Чтобы общий стиль не ограничивал картинку в сцене */
.modal-detail .detail-stage img { max-width: none; }

.g-prev, .g-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,.4); color: #fff; border: 0;
  width: 32px; height: 36px; border-radius: 6px;
  cursor: pointer; transition: opacity .2s;
}
.g-prev { left: 8px; } .g-next { right: 8px; }
.g-prev:hover, .g-next:hover { opacity: .85; }

.thumbs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px; margin-top: 10px;
}
.thumbs button {
  padding: 0; border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; background: #fff; cursor: pointer;
  outline: none;
}
.thumbs img { width: 100%; height: 56px; object-fit: cover; display: block; }
.thumbs button.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(199,169,122,.25) inset; }

@media (max-width: 600px){
  .detail-gallery { max-width: 100%; }
}

/* =======================================================
   FULLSCREEN IMAGE VIEWER
======================================================= */
#fullscreenViewer {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
#fullscreenViewer.open { display: flex; }

#fullscreenImg {
  max-width: 95%;
  max-height: 95%;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
  cursor: zoom-out;
}

/* =======================================================
   FULLSCREEN IMAGE VIEWER
======================================================= */
.fs-viewer{
  position: fixed; inset: 0; z-index: 2000;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,.92);
}
.fs-viewer.open{ display: flex; }

#fsImg{
  max-width: 96vw; max-height: 92vh;
  object-fit: contain; border-radius: 10px;
  box-shadow: 0 0 24px rgba(0,0,0,.5);
  user-select: none;
}

.fs-btn{
  position: absolute; border: 0; cursor: pointer;
  width: 44px; height: 44px; border-radius: 10px;
  background: rgba(255,255,255,.15); color: #fff; font-size: 28px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .2s, transform .1s;
}
.fs-btn:hover{ background: rgba(255,255,255,.25); }
.fs-btn:active{ transform: scale(.97); }

.fs-prev{ left: 18px; top: 50%; transform: translateY(-50%); }
.fs-next{ right: 18px; top: 50%; transform: translateY(-50%); }
.fs-close{ right: 16px; top: 12px; font-size: 30px; width: 40px; height: 40px; }

.fs-counter{
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  color: #fff; background: rgba(0,0,0,.35);
  padding: 6px 10px; border-radius: 10px; font-weight: 600; font-size: 14px;
}

/* На телефоне — побольше кликабельные зоны */
@media (max-width: 600px){
  .fs-btn{ width: 52px; height: 52px; font-size: 30px; }
}

.fab-tg{
  position: fixed; right: 16px; bottom: 16px; z-index: 1200;
  background: #229ED9; color: #fff; text-decoration: none;
  padding: 12px 14px; border-radius: 999px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.fab-tg:hover{ filter: brightness(1.05); }
@media (min-width: 992px){ .fab-tg{ bottom: 24px; right: 24px; } }


/* Container-scoped hero (no full-bleed) */
.hero{
background-color: #b9a489; /* fallback color if banner is missing */
}
.hero-inner{
  max-width: 860px;
  padding: clamp(32px, 6vw, 72px) clamp(18px, 4vw, 56px);
}
.hero h1{
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  letter-spacing: 0.2px;
}
@media (min-width: 1024px){
  .hero-inner{ padding-left: clamp(48px, 6vw, 96px); }
}

/* === Overrides: Card price + Detail gallery layout === */
/* Card price pill, right under title */
.card-body .price{
  color: var(--brand-600);
  background: var(--brand-100);
  display: inline-block;
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 15px;
  margin: 6px 0 8px;
}

/* Center gallery inside detail modal; place price under title */
.modal-detail .detail-content{ justify-content: center; }
.modal-detail .detail-gallery{ flex: 0 0 460px; max-width: 100%; margin: 0 auto 12px; }
.modal-detail .detail-stage{ border-radius: 12px; overflow: hidden; box-shadow: 0 4px 18px rgba(0,0,0,.06); }
.modal-detail .detail-stage img{ border-radius: 12px; }
.modal-detail .detail-info{ display:flex; flex-direction:column; gap:8px; }
.modal-detail #detailName{ order: 1; }
.modal-detail #detailPrice{ order: 2; color: var(--brand-600); background: var(--brand-100); display:inline-block; padding:6px 10px; border-radius:10px; font-weight:800; width: fit-content; }
.modal-detail #detailDesc{ order: 3; }
/* Ensure actions go after content */
.modal-detail .detail-actions{ order: 4; margin-top: 10px; }

@media (min-width: 860px){
  .modal-detail .detail-content{ justify-content: flex-start; }
  .modal-detail .detail-gallery{ margin: 0; }
}

/* Compact spacing on mobile modal and better centering */
@media (max-width: 600px){
  .modal-body{ padding: 10px 12px; }
  .modal-detail .detail-content{ display: grid; grid-template-columns: 1fr; justify-items: center; gap: 12px; max-width: 520px; margin: 0 auto; }
  .modal-detail .detail-gallery{ width: 100%; max-width: 520px; margin: 0; }
  .thumbs{ margin-top: 8px; }
  .detail-actions{ gap: 10px; }
  .detail-actions .btn{ min-height: 44px; }
  .modal-detail #detailName{ margin: 8px 0 4px; }
  .modal-detail #detailPrice{ margin: 6px 0 8px; }
}
