/* =========================================================
   Переплёт — книжный интернет-магазин (демо-заглушка)
   Палитра: крем / чернила / терракота / золото / хвоя
   ========================================================= */

:root {
  --cream: #fbf6ee;
  --cream-2: #f3ead9;
  --ink: #2b2118;
  --ink-soft: #4a3d30;
  --coral: #d9542b;
  --coral-dark: #b6431f;
  --gold: #c9a24b;
  --pine: #2f5d50;
  --paper: #ffffff;
  --line: #e6dcc8;
  --shadow: 0 14px 40px rgba(43, 33, 24, 0.16);
  --shadow-sm: 0 6px 18px rgba(43, 33, 24, 0.10);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1200px;
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Golos Text", "PT Sans", system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(217, 84, 43, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(47, 93, 80, 0.07), transparent 55%),
    var(--cream);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; font-weight: 700; }

.section { padding: 70px 0; }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; margin-bottom: 34px; flex-wrap: wrap;
}
.section-head h2 { font-size: clamp(28px, 4vw, 42px); }
.section-head .kicker {
  display: inline-block; font-size: 13px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--coral); font-weight: 600; margin-bottom: 8px;
}
.section-head .link-more { color: var(--pine); font-weight: 600; border-bottom: 2px solid transparent; transition: .2s; white-space: nowrap; }
.section-head .link-more:hover { border-color: var(--pine); }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 999px; padding: 12px 22px; font-weight: 600; font-size: 15px;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.btn-primary { background: var(--coral); color: #fff; box-shadow: 0 8px 20px rgba(217,84,43,.30); }
.btn-primary:hover { background: var(--coral-dark); transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--cream); }
.btn-sm { padding: 9px 16px; font-size: 14px; }

/* ---------- Верхняя плашка ---------- */
.topbar {
  background: var(--ink); color: var(--cream-2);
  font-size: 13.5px; letter-spacing: .02em;
}
.topbar .container { display: flex; justify-content: space-between; align-items: center; height: 40px; }
.topbar a:hover { color: var(--gold); }
.topbar .topbar-links { display: flex; gap: 20px; }

/* ---------- Шапка ---------- */
.header { position: sticky; top: 0; z-index: 50; background: rgba(251,246,238,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.header .container { display: flex; align-items: center; gap: 22px; height: 78px; }
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 800; font-size: 24px; }
.brand .logo { width: 40px; height: 40px; }
.brand b { color: var(--coral); }

.search { flex: 1; max-width: 560px; position: relative; }
.search input {
  width: 100%; border: 1.5px solid var(--line); background: var(--paper);
  border-radius: 999px; padding: 12px 48px 12px 20px; font-size: 15px; font-family: inherit; color: var(--ink);
  transition: border .2s, box-shadow .2s;
}
.search input:focus { outline: none; border-color: var(--coral); box-shadow: 0 0 0 4px rgba(217,84,43,.12); }
.search button {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--coral); border: none; border-radius: 999px; width: 38px; height: 38px;
  display: grid; place-items: center; color: #fff;
}
.search button:hover { background: var(--coral-dark); }

.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative; background: transparent; border: none; color: var(--ink-soft);
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; transition: .2s;
}
.icon-btn:hover { background: var(--cream-2); color: var(--ink); }
.icon-btn .badge {
  position: absolute; top: 5px; right: 5px; background: var(--coral); color: #fff;
  font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 999px;
  display: grid; place-items: center; padding: 0 4px;
}

.burger { display: none; }

/* ---------- Навигация-категории ---------- */
.catnav { border-bottom: 1px solid var(--line); background: var(--cream); }
.catnav .container { display: flex; gap: 6px; overflow-x: auto; padding-top: 6px; padding-bottom: 6px; }
.catnav a {
  white-space: nowrap; padding: 9px 16px; border-radius: 999px; font-size: 14.5px; font-weight: 500; color: var(--ink-soft);
  transition: .2s;
}
.catnav a:hover, .catnav a.active { background: var(--ink); color: var(--cream); }
.catnav::-webkit-scrollbar { height: 0; }

/* ---------- Слайдер / баннер ---------- */
.hero { padding: 30px 0 10px; }
.slider { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.slides { display: flex; transition: transform .6s cubic-bezier(.7,0,.2,1); }
.slide {
  min-width: 100%; padding: 56px clamp(28px, 6vw, 80px); min-height: 360px;
  display: flex; flex-direction: column; justify-content: center; gap: 18px; position: relative; color: #fff;
}
.slide h2 { font-size: clamp(30px, 5vw, 52px); max-width: 600px; }
.slide p { font-size: 18px; max-width: 480px; opacity: .95; }
.slide .slide-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.slide .tag { align-self: flex-start; background: rgba(255,255,255,.18); padding: 6px 14px; border-radius: 999px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; }
.slide-1 { background: linear-gradient(120deg, #b6431f, #d9542b 60%, #e88a4e); }
.slide-2 { background: linear-gradient(120deg, #1f4a40, #2f5d50 55%, #4d8a78); }
.slide-3 { background: linear-gradient(120deg, #7a5a1e, #c9a24b 60%, #e6c878); color: var(--ink); }
.slide-3 .tag { background: rgba(43,33,24,.14); }
.slide::after { content:""; position:absolute; inset:0; background: radial-gradient(500px 300px at 90% 20%, rgba(255,255,255,.18), transparent 70%); pointer-events:none; }

.slider .nav-dot-wrap { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 3; }
.nav-dot { width: 10px; height: 10px; border-radius: 999px; background: rgba(255,255,255,.5); border: none; transition: .2s; }
.nav-dot.active { background: #fff; width: 26px; }
.slider .arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 44px; height: 44px; border-radius: 999px; border: none; background: rgba(255,255,255,.25);
  color: #fff; font-size: 20px; display: grid; place-items: center; backdrop-filter: blur(4px); transition: .2s;
}
.slider .arrow:hover { background: rgba(255,255,255,.45); }
.slider .arrow.prev { left: 16px; } .slider .arrow.next { right: 16px; }

/* ---------- Преимущества ---------- */
.perks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 26px; }
.perk { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px; display: flex; gap: 14px; align-items: center; }
.perk .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--cream-2); display: grid; place-items: center; color: var(--coral); flex: none; }
.perk b { display: block; font-size: 15px; }
.perk span { font-size: 13px; color: var(--ink-soft); }

/* ---------- Сетка книг ---------- */
.book-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 22px; }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .2s, box-shadow .25s;
  position: relative;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.card .cover-wrap { position: relative; aspect-ratio: 3/4.4; background: var(--cream-2); overflow: hidden; }
.card .cover-wrap img { width: 100%; height: 100%; object-fit: cover; }
.card .label { position: absolute; top: 10px; left: 10px; background: var(--coral); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.card .label.new { background: var(--pine); }
.card .fav {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 999px;
  background: rgba(255,255,255,.9); border: none; display: grid; place-items: center; color: var(--ink-soft); transition: .2s;
}
.card .fav:hover { color: var(--coral); }
.card .fav.on { color: var(--coral); }
.card .body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .author { font-size: 12.5px; color: var(--ink-soft); }
.card .title { font-family: var(--font-display); font-size: 16.5px; font-weight: 700; line-height: 1.2; min-height: 40px; }
.card .rating { font-size: 13px; color: var(--gold); }
.card .rating span { color: var(--ink-soft); }
.card .price-row { display: flex; align-items: baseline; gap: 8px; margin-top: auto; padding-top: 6px; }
.card .price { font-size: 19px; font-weight: 800; }
.card .price-old { font-size: 14px; color: var(--ink-soft); text-decoration: line-through; }
.card .add { margin-top: 10px; width: 100%; }

/* Запасная обложка, если картинка не загрузилась */
.cover-fallback {
  width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: space-between;
  padding: 16px 14px; color: #fff; text-align: left;
}
.cover-fallback .cf-author { font-size: 12px; opacity: .85; }
.cover-fallback .cf-title { font-family: var(--font-display); font-size: 19px; font-weight: 800; line-height: 1.15; }
.cover-fallback .cf-foot { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; opacity: .8; }

/* ---------- Баннер подписки ---------- */
.cta {
  background: linear-gradient(120deg, var(--ink), #3c2e22);
  color: var(--cream); border-radius: var(--radius); padding: clamp(34px, 5vw, 60px);
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 30px; align-items: center;
}
.cta h2 { font-size: clamp(26px, 3.5vw, 40px); color: #fff; }
.cta p { opacity: .85; margin-top: 10px; }
.subscribe { display: flex; gap: 10px; flex-wrap: wrap; }
.subscribe input { flex: 1; min-width: 200px; border: none; border-radius: 999px; padding: 14px 20px; font-family: inherit; font-size: 15px; }
.subscribe input:focus { outline: 3px solid var(--gold); }

/* ---------- Подвал ---------- */
.footer { background: var(--ink); color: var(--cream-2); margin-top: 70px; padding: 56px 0 28px; }
.footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; }
.footer h4 { font-family: var(--font-display); color: #fff; font-size: 18px; margin-bottom: 16px; }
.footer ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer a { color: var(--cream-2); opacity: .85; font-size: 14.5px; }
.footer a:hover { opacity: 1; color: var(--gold); }
.footer .brand { color: #fff; margin-bottom: 14px; }
.footer .about-text { font-size: 14px; opacity: .8; max-width: 320px; }
.footer .socials { display: flex; gap: 10px; margin-top: 16px; }
.footer .socials a { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.08); display: grid; place-items: center; opacity: 1; }
.footer .socials a:hover { background: var(--coral); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 36px; padding-top: 22px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: 13px; opacity: .7; }

/* ---------- Корзина (выдвижная панель) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(43,33,24,.5); opacity: 0; visibility: hidden; transition: .25s; z-index: 90; }
.overlay.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 420px; max-width: 92vw; background: var(--cream);
  z-index: 100; transform: translateX(100%); transition: transform .3s cubic-bezier(.7,0,.2,1);
  display: flex; flex-direction: column; box-shadow: -20px 0 50px rgba(0,0,0,.2);
}
.drawer.open { transform: translateX(0); }
.drawer-head { padding: 22px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-size: 22px; }
.drawer-close { background: transparent; border: none; font-size: 26px; color: var(--ink-soft); line-height: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 22px; }
.cart-empty { text-align: center; color: var(--ink-soft); padding: 50px 10px; }
.cart-empty svg { color: var(--line); margin-bottom: 14px; }
.cart-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-item .ci-cover { width: 56px; height: 78px; border-radius: 8px; object-fit: cover; flex: none; background: var(--cream-2); }
.cart-item .ci-info { flex: 1; }
.cart-item .ci-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1.2; }
.cart-item .ci-author { font-size: 12.5px; color: var(--ink-soft); }
.cart-item .ci-price { font-weight: 800; margin-top: 4px; }
.qty { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.qty button { width: 30px; height: 30px; border: none; background: var(--paper); font-size: 17px; color: var(--ink); }
.qty button:hover { background: var(--cream-2); }
.qty span { min-width: 30px; text-align: center; font-weight: 600; font-size: 14px; }
.ci-remove { background: transparent; border: none; color: var(--ink-soft); font-size: 13px; margin-top: 8px; margin-left: 10px; }
.ci-remove:hover { color: var(--coral); }
.drawer-foot { padding: 20px 22px; border-top: 1px solid var(--line); background: var(--cream-2); }
.drawer-foot .total-row { display: flex; justify-content: space-between; font-size: 17px; margin-bottom: 14px; }
.drawer-foot .total-row b { font-size: 22px; }
.drawer-foot .btn { width: 100%; }

/* ---------- Тост-уведомление ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120%);
  background: var(--ink); color: var(--cream); padding: 14px 22px; border-radius: 999px;
  box-shadow: var(--shadow); z-index: 120; font-size: 14.5px; transition: transform .3s; display: flex; gap: 10px; align-items: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast svg { color: var(--gold); }

/* ---------- Внутренние страницы ---------- */
.page-hero { background: linear-gradient(120deg, var(--ink), #3c2e22); color: var(--cream); padding: 56px 0; }
.page-hero .crumbs { font-size: 13.5px; opacity: .75; margin-bottom: 12px; }
.page-hero .crumbs a:hover { color: var(--gold); }
.page-hero h1 { color: #fff; font-size: clamp(32px, 5vw, 52px); }
.page-hero p { opacity: .85; max-width: 620px; margin-top: 12px; font-size: 17px; }

.prose { max-width: 760px; }
.prose h2 { font-size: 28px; margin: 36px 0 14px; }
.prose p { margin-bottom: 16px; color: var(--ink-soft); }
.prose ul { margin: 0 0 16px 20px; color: var(--ink-soft); }
.prose li { margin-bottom: 8px; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 10px; }
.feature { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 26px; }
.feature .ico { width: 50px; height: 50px; border-radius: 14px; background: var(--cream-2); display: grid; place-items: center; color: var(--coral); margin-bottom: 14px; }
.feature h3 { font-size: 20px; margin-bottom: 8px; }
.feature p { font-size: 14.5px; color: var(--ink-soft); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 40px; }
.stat { text-align: center; }
.stat b { font-family: var(--font-display); font-size: 42px; color: var(--coral); display: block; }
.stat span { color: var(--ink-soft); font-size: 14px; }

/* Контакты */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.contact-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 22px; display: flex; gap: 16px; margin-bottom: 16px; }
.contact-card .ico { width: 46px; height: 46px; border-radius: 12px; background: var(--cream-2); display: grid; place-items: center; color: var(--coral); flex: none; }
.contact-card b { display: block; }
.contact-card span, .contact-card a { color: var(--ink-soft); font-size: 14.5px; }
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.form-field input, .form-field textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px;
  font-family: inherit; font-size: 15px; background: var(--paper); color: var(--ink); resize: vertical;
}
.form-field input:focus, .form-field textarea:focus { outline: none; border-color: var(--coral); box-shadow: 0 0 0 4px rgba(217,84,43,.1); }
.map-embed { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); margin-top: 18px; height: 280px; background: var(--cream-2);
  display: grid; place-items: center; color: var(--ink-soft); text-align: center; }

/* Личный кабинет */
.account-layout { display: grid; grid-template-columns: 260px 1fr; gap: 30px; align-items: start; }
.account-side { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 22px; }
.account-side .who { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.account-side .avatar { width: 52px; height: 52px; border-radius: 999px; background: var(--coral); color: #fff; display: grid; place-items: center; font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.account-side nav { display: flex; flex-direction: column; gap: 4px; }
.account-side nav a { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14.5px; color: var(--ink-soft); transition: .2s; display: flex; gap: 10px; align-items: center; }
.account-side nav a:hover { background: var(--cream-2); color: var(--ink); }
.account-side nav a.active { background: var(--ink); color: var(--cream); }
.account-panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 28px; }
.account-panel h2 { font-size: 24px; margin-bottom: 6px; }
.account-panel .muted { color: var(--ink-soft); margin-bottom: 22px; }
.order { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; margin-bottom: 14px; }
.order-top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.order-status { font-weight: 600; }
.order-status.done { color: var(--pine); }
.order-status.way { color: var(--coral); }
.order-books { font-size: 14px; color: var(--ink-soft); margin-top: 8px; }

/* ---------- Анимация появления ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Мобильное меню ---------- */
.mobile-menu { display: none; }

/* ---------- Адаптив ---------- */
@media (max-width: 1024px) {
  .book-grid { grid-template-columns: repeat(3, 1fr); }
  .perks { grid-template-columns: repeat(2, 1fr); }
  .footer .cols { grid-template-columns: 1fr 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .account-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar { display: none; }
  .search { display: none; }
  .burger { display: grid; }
  .cta { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .book-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .footer .cols { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; }
  .slide { min-height: 300px; padding: 36px 26px; }

  .mobile-menu {
    display: block; position: fixed; inset: 0 0 0 auto; width: 80%; max-width: 320px; background: var(--cream);
    z-index: 100; transform: translateX(100%); transition: transform .3s; padding: 26px; box-shadow: -10px 0 40px rgba(0,0,0,.2);
  }
  .mobile-menu.open { transform: translateX(0); }
  .mobile-menu .mm-close { background: transparent; border: none; font-size: 30px; color: var(--ink-soft); float: right; }
  .mobile-menu nav { display: flex; flex-direction: column; gap: 4px; margin-top: 40px; }
  .mobile-menu nav a { padding: 14px 12px; border-radius: var(--radius-sm); font-size: 17px; font-family: var(--font-display); }
  .mobile-menu nav a:hover { background: var(--cream-2); }
  .mobile-search { margin-top: 18px; position: relative; }
  .mobile-search input { width: 100%; border: 1.5px solid var(--line); border-radius: 999px; padding: 12px 18px; font-family: inherit; }
}
@media (max-width: 460px) {
  .book-grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
}
