/* ============================================================
   «Тофас и друзья» — дизайн-система
   Минимализм, белый + кремовый, тёплые акценты.
   ============================================================ */

:root {
  --bg: #FAF6EF;            /* кремовый фон страницы */
  --surface: #FFFFFF;       /* карточки, шапка */
  --surface-2: #F4EDE1;     /* мягкие подложки */
  --text: #33291F;          /* тёплый тёмно-коричневый */
  --muted: #8C7F6D;         /* вторичный текст */
  --accent: #B98A5E;        /* карамель */
  --accent-dark: #9A6F45;
  --accent-soft: #F0E4D3;
  --danger: #C25B4E;
  --danger-soft: #F7E4E1;
  --ok: #6E9B6B;
  --ok-soft: #E6F0E4;
  --info: #7B8FA6;
  --info-soft: #E8EDF3;
  --border: #EAE0D0;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 8px 28px rgba(80, 60, 30, .10);
  --shadow-soft: 0 2px 12px rgba(80, 60, 30, .06);
  --font-head: Georgia, 'Times New Roman', serif;
  --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent-dark); text-decoration: none; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.25; margin: 0 0 .5em; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Шапка ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: 16px;
}

.logo {
  font-family: var(--font-head);
  font-size: 1.3rem; font-weight: 700; color: var(--text);
  white-space: nowrap;
}
.logo:hover { color: var(--accent-dark); }

.nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.nav a { color: var(--muted); font-size: .95rem; }
.nav a:hover { color: var(--text); }
.nav .nav-cart { position: relative; }

.cart-badge {
  display: inline-block; min-width: 20px; height: 20px; padding: 0 5px;
  margin-left: 4px; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: .75rem; line-height: 20px; text-align: center; font-weight: 600;
}

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 26px; border: none; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-family: var(--font-body); font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { background: var(--accent-dark); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-outline { background: transparent; color: var(--accent-dark); border: 1.5px solid var(--accent); }
.btn-outline:hover { background: var(--accent-soft); color: var(--accent-dark); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); transform: none; box-shadow: none; }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #A84A3E; }

.btn-sm { padding: 7px 16px; font-size: .88rem; }
.btn-block { width: 100%; }

/* ---------- Герой ---------- */

.hero { padding: 72px 0 56px; }
.hero-grid {
  display: grid; grid-template-columns: 1.1fr .9fr;
  gap: 48px; align-items: center;
}
.hero-title { font-size: clamp(2rem, 4.5vw, 3.1rem); margin-bottom: 18px; }
.hero-sub { font-size: 1.15rem; color: var(--muted); margin: 0 0 28px; max-width: 46ch; }
.hero-art img { border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- Секции ---------- */

.section { padding: 52px 0; }
.section-title { font-size: 1.8rem; margin-bottom: 8px; }
.section-sub { color: var(--muted); margin: 0 0 32px; max-width: 60ch; }

/* ---------- Шаги «как это работает» ---------- */

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.step-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 28px 24px; box-shadow: var(--shadow-soft);
}
.step-num {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem; margin-bottom: 14px;
}
.step-card h3 { font-size: 1.15rem; }
.step-card p { color: var(--muted); margin: 0; font-size: .95rem; }

/* ---------- Каталог ---------- */

.grid-toys {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 26px;
}

.toy-card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-soft); color: var(--text);
  transition: transform .18s ease, box-shadow .18s ease;
  display: flex; flex-direction: column;
}
.toy-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); color: var(--text); }
.toy-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.toy-card-body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.toy-name { font-family: var(--font-head); font-size: 1.25rem; font-weight: 600; }
.toy-desc { color: var(--muted); font-size: .92rem; flex: 1; }
.toy-price { font-weight: 700; font-size: 1.1rem; margin-top: 6px; }

.tag {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-dark);
  font-size: .8rem; font-weight: 600; width: fit-content;
}

/* ---------- Страница игрушки: история ---------- */

.story { background: var(--surface); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow-soft); }
.story-photos { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; margin: 20px 0; }
.story-photos img { height: 220px; border-radius: var(--radius-sm); flex-shrink: 0; }
.story-text p { line-height: 1.75; margin: 0 0 1em; }

/* ---------- Страница игрушки: товар ---------- */

.product { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.gallery-main img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; }
.gallery-thumbs img {
  width: 68px; height: 68px; object-fit: cover; border-radius: var(--radius-sm);
  cursor: pointer; border: 2px solid transparent; opacity: .75;
}
.gallery-thumbs img:hover { opacity: 1; }
.gallery-thumbs img.active { border-color: var(--accent); opacity: 1; }

.product-info h1 { font-size: 1.9rem; }
.product-price { font-size: 1.6rem; font-weight: 700; margin: 14px 0; }
.stock-ok { color: var(--ok); font-size: .92rem; font-weight: 600; }
.stock-low { color: var(--danger); font-size: .92rem; font-weight: 600; }

.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--border); border-radius: 999px; overflow: hidden; }
.qty button {
  width: 40px; height: 40px; border: none; background: transparent;
  font-size: 1.2rem; cursor: pointer; color: var(--muted);
}
.qty button:hover { background: var(--surface-2); color: var(--text); }
.qty input {
  width: 46px; height: 40px; border: none; text-align: center;
  font-size: 1rem; font-family: var(--font-body); background: transparent; color: var(--text);
}
.qty input:focus { outline: none; }

.buy-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 20px 0; }

.notice {
  background: var(--accent-soft); border-radius: var(--radius-sm);
  padding: 14px 18px; font-size: .92rem; color: var(--accent-dark);
}

/* ---------- Формы ---------- */

.form-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 36px; box-shadow: var(--shadow-soft);
  max-width: 460px; margin: 48px auto;
}
.form-card h1 { font-size: 1.6rem; text-align: center; margin-bottom: 24px; }
.form-wide { max-width: 640px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: .88rem; color: var(--muted); margin-bottom: 6px; font-weight: 600; }

.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 1rem; color: var(--text);
  background: var(--surface); transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 100px; }

.form-error { color: var(--danger); font-size: .9rem; margin: 10px 0; min-height: 1.2em; }
.form-hint { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.form-footer { text-align: center; margin-top: 18px; font-size: .92rem; color: var(--muted); }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

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

.cart-list { display: flex; flex-direction: column; gap: 14px; }
.cart-row {
  display: grid; grid-template-columns: 90px 1fr auto auto auto;
  gap: 18px; align-items: center;
  background: var(--surface); border-radius: var(--radius);
  padding: 14px 18px; box-shadow: var(--shadow-soft);
}
.cart-row img { width: 90px; height: 70px; object-fit: cover; border-radius: var(--radius-sm); }
.cart-row .toy-name { font-size: 1.05rem; }
.cart-remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.2rem; }
.cart-remove:hover { color: var(--danger); }

.cart-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 26px; padding: 20px 24px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-soft);
}
.cart-total-sum { font-size: 1.4rem; font-weight: 700; }

/* ---------- Статусы заказов ---------- */

.status-pill {
  display: inline-block; padding: 4px 14px; border-radius: 999px;
  font-size: .82rem; font-weight: 600; white-space: nowrap;
}
.status-new { background: var(--accent-soft); color: var(--accent-dark); }
.status-paid { background: var(--ok-soft); color: var(--ok); }
.status-shipped { background: var(--info-soft); color: var(--info); }
.status-done { background: var(--surface-2); color: var(--muted); }
.status-cancelled { background: var(--danger-soft); color: var(--danger); }

/* ---------- Таблицы (админка, заказы) ---------- */

.table-wrap {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-soft); overflow-x: auto;
}
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th {
  text-align: left; padding: 14px 18px;
  color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 13px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table select { padding: 6px 10px; border: 1.5px solid var(--border); border-radius: 8px; font-family: var(--font-body); background: var(--surface); color: var(--text); }

/* ---------- Админка ---------- */

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 18px; margin-bottom: 34px; }
.stat-card { background: var(--surface); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-soft); }
.stat-value { font-size: 1.9rem; font-weight: 700; font-family: var(--font-head); }
.stat-label { color: var(--muted); font-size: .85rem; margin-top: 2px; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 26px 0; }
.tabs a {
  padding: 8px 18px; border-radius: 999px; font-size: .92rem; font-weight: 600;
  color: var(--muted); background: transparent;
}
.tabs a:hover { background: var(--surface-2); color: var(--text); }
.tabs a.active { background: var(--text); color: #fff; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 34px 0 22px; }
.page-head h1 { margin: 0; font-size: 1.7rem; }

.thumb-list { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.thumb-item { position: relative; }
.thumb-item img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.thumb-item button {
  position: absolute; top: -7px; right: -7px; width: 22px; height: 22px;
  border-radius: 50%; border: none; background: var(--danger); color: #fff;
  font-size: .8rem; line-height: 1; cursor: pointer;
}

/* ---------- Пустые состояния и тосты ---------- */

.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-icon { font-size: 2.6rem; margin-bottom: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: 13px 26px; border-radius: 999px;
  font-size: .95rem; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease; z-index: 100; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-error { background: var(--danger); }

/* ---------- Подвал ---------- */

.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 64px; }
.footer-inner {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 32px; padding: 44px 20px 20px; flex-wrap: wrap;
}
.footer-brand { max-width: 340px; }
.footer-brand .logo { font-size: 1.15rem; }
.footer-tagline { color: var(--muted); font-size: .9rem; margin: 8px 0 0; }

.socials { display: flex; gap: 12px; }
.socials a {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--surface-2); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, transform .15s ease;
}
.socials a:hover { background: var(--accent-soft); transform: translateY(-2px); }
.socials svg { width: 20px; height: 20px; fill: currentColor; }

.footer-copy {
  width: 100%; text-align: center; color: var(--muted); font-size: .85rem;
  border-top: 1px solid var(--border); margin-top: 10px; padding: 16px 0 4px;
}

/* ---------- Оплата (тестовый режим) ---------- */

.pay-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--info-soft); color: var(--info);
  padding: 6px 16px; border-radius: 999px; font-size: .85rem; font-weight: 600;
}

.success-box { text-align: center; padding: 60px 20px; }
.success-box .success-icon { font-size: 3.4rem; margin-bottom: 16px; }
.success-box h1 { font-size: 1.9rem; }

/* ---------- Отзывы и рейтинг ---------- */

.stars { display: inline-flex; gap: 1px; font-size: 1rem; line-height: 1; letter-spacing: 1px; }
.stars .st { color: #D9CDBA; }
.stars .st.on { color: #E3A93C; }
.stars-sm { font-size: .85rem; }

.rating-line { display: flex; align-items: center; gap: 7px; font-size: .85rem; color: var(--muted); }

.reviews-list { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.review-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px 24px; box-shadow: var(--shadow-soft);
}
.review-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.review-author { font-weight: 700; }
.review-date { color: var(--muted); font-size: .82rem; }
.review-text { margin: 0; line-height: 1.65; white-space: pre-line; }

.review-form { margin-top: 26px; }
.star-input { display: inline-flex; gap: 4px; }
.star-input button {
  background: none; border: none; cursor: pointer; padding: 2px;
  font-size: 1.7rem; line-height: 1; color: #D9CDBA;
  transition: transform .12s ease, color .12s ease;
}
.star-input button.on { color: #E3A93C; }
.star-input button:hover { transform: scale(1.2); }

/* ---------- «Живой» интерфейс ---------- */

.tilt { transition: transform .18s ease-out, box-shadow .18s ease; transform-style: preserve-3d; will-change: transform; }
.tilt.tilting { transition: box-shadow .18s ease; }

.hero-art { transition: transform .25s ease-out; will-change: transform; }

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}
.floaty { animation: floaty 5.5s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .floaty { animation: none; }
  .tilt, .hero-art { transition: none; }
}

/* ---------- Адаптив ---------- */

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero { padding: 44px 0 36px; }
  .product { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .header-inner { flex-direction: column; padding: 10px 0; gap: 8px; }
  .cart-row { grid-template-columns: 70px 1fr; grid-auto-rows: auto; }
  .cart-row img { width: 70px; height: 56px; }
  .row-2 { grid-template-columns: 1fr; }
  .form-card { padding: 26px 20px; }
  .story { padding: 24px 18px; }
  .footer-inner { flex-direction: column; }
}
