/* HOMM storefront — minimal, airy, one accent colour. */

:root {
  --ink: #14161a;
  --ink-soft: #3d4450;
  --muted: #737c8a;
  --line: #e6e8ec;
  --paper: #ffffff;
  --sand: #f7f5f1;
  --accent: #b07d3f;
  --accent-dark: #8d6230;
  --danger: #b3261e;
  --ok: #0b7a3b;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(20, 22, 26, .08);
  --max: 1240px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

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

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

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 12px; letter-spacing: -.01em; }
h1 { font-size: 34px; }
h2 { font-size: 26px; }
h3 { font-size: 19px; }

p { margin: 0 0 12px; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */

.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.header-top {
  display: flex; align-items: center; gap: 24px;
  padding: 18px 0;
}
.logo { font-size: 22px; font-weight: 700; letter-spacing: .16em; }
.logo span { color: var(--accent); }
.header-nav { display: flex; gap: 20px; margin-left: 8px; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
.header-nav a { font-size: 14px; color: var(--ink-soft); }
.header-actions { display: flex; align-items: center; gap: 18px; }
.header-actions a { font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.cart-badge {
  min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent);
  color: #fff; font-size: 12px; font-weight: 600; display: inline-flex;
  align-items: center; justify-content: center; padding: 0 6px;
}
.cart-badge[hidden] { display: none; }

.header-search { padding: 0 0 16px; }
.header-search form { display: flex; gap: 10px; }
.header-search input {
  flex: 1; padding: 12px 16px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 15px; background: var(--sand);
}
.header-search input:focus { outline: 2px solid #e6d3b7; border-color: var(--accent); }

/* ---------- buttons / forms ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 10px; border: 1px solid transparent;
  font-size: 15px; font-weight: 500; cursor: pointer; transition: .18s ease;
  background: var(--ink); color: #fff;
}
.btn:hover { background: #000; color: #fff; }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--ink); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--muted); padding: 8px 12px; }
.btn-ghost:hover { color: var(--danger); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 8px 14px; font-size: 14px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; font: inherit; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid #e6d3b7; border-color: var(--accent);
}
.field textarea { min-height: 90px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-note { font-size: 13px; color: var(--muted); }
.form-error { color: var(--danger); font-size: 14px; margin-top: 8px; }

/* ---------- layout blocks ---------- */

main { min-height: 60vh; padding: 32px 0 60px; }
.page-head { margin-bottom: 24px; }
.page-head p { color: var(--muted); max-width: 720px; }
.breadcrumbs { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs span { color: var(--ink-soft); }

.section { margin-bottom: 56px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-head a { font-size: 14px; color: var(--accent-dark); }

/* ---------- hero / banners ---------- */

.hero {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(120deg, #1b1e24, #3a3225);
  color: #fff; padding: 64px 48px; margin-bottom: 48px;
}
.hero h1 { font-size: 40px; max-width: 640px; margin-bottom: 14px; }
.hero p { color: rgba(255,255,255,.75); max-width: 520px; }
.hero .btn { margin-top: 12px; }
.hero-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .45; }

.banner-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 48px; }
.banner {
  position: relative; min-height: 180px; border-radius: var(--radius);
  overflow: hidden; background: var(--sand); padding: 24px;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner h3 { position: relative; }

/* ---------- categories ---------- */

.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.category-tile {
  position: relative; border-radius: var(--radius); background: var(--sand);
  padding: 22px; min-height: 120px; display: flex; align-items: flex-end;
  overflow: hidden; transition: transform .18s ease, box-shadow .18s ease;
}
.category-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.category-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .35; }
.category-tile span { position: relative; font-weight: 600; }

/* ---------- product cards ---------- */

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; }

.product-card {
  position: relative; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: #fff;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #d8dade; }

.product-media {
  position: relative; aspect-ratio: 1 / 1; background: var(--sand);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.product-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.product-card:hover .product-media img { transform: scale(1.04); }
.product-media .placeholder {
  font-size: 34px; font-weight: 700; letter-spacing: .1em; color: #c9c3b8;
}
.product-badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; z-index: 2; }
.badge {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 6px; background: #fff; color: var(--ink);
}
.badge-hit { background: #fff1e4; color: #a95e12; }
.badge-new { background: #e9f4ec; color: #1c6b3a; }
.badge-stock { background: #eef2f7; color: var(--ink-soft); }
.badge-out { background: #fbeeed; color: var(--danger); }

.product-body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-brand { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.product-name { font-size: 15px; line-height: 1.35; }
.product-name a:hover { color: var(--accent-dark); }
.product-price { margin-top: auto; display: flex; align-items: baseline; gap: 8px; padding-top: 8px; }
.price-now { font-size: 18px; font-weight: 600; }
.price-old { font-size: 14px; color: var(--muted); text-decoration: line-through; }

.product-actions { padding: 0 16px 16px; }

/* ---------- catalog layout ---------- */

.catalog-layout { display: grid; grid-template-columns: 250px 1fr; gap: 32px; align-items: start; }

.filters { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; position: sticky; top: 16px; }
.filters h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 14px; }
.filter-group { margin-bottom: 22px; }
.filter-group h4 { font-size: 14px; margin-bottom: 8px; }
.filter-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.filter-list a { font-size: 14px; color: var(--ink-soft); padding: 3px 0; }
.filter-list a.active { color: var(--accent-dark); font-weight: 600; }
.filter-price { display: flex; gap: 8px; }
.filter-price input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.filter-actions { display: flex; flex-direction: column; gap: 8px; }

.catalog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.catalog-toolbar .count { color: var(--muted); font-size: 14px; }
.catalog-toolbar select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { font-size: 13px; background: var(--sand); border-radius: 20px; padding: 5px 12px; color: var(--ink-soft); }
.chip a { margin-left: 6px; color: var(--muted); }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px; padding: 0 10px;
}
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }

.empty-state { border: 1px dashed var(--line); border-radius: var(--radius); padding: 48px 24px; text-align: center; color: var(--muted); }

/* ---------- product page ---------- */

.product-layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 44px; align-items: start; }
.gallery-main { border-radius: var(--radius); overflow: hidden; background: var(--sand); aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-main .placeholder { font-size: 64px; color: #c9c3b8; letter-spacing: .1em; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.gallery-thumbs button { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; padding: 0; width: 72px; height: 72px; background: var(--sand); cursor: pointer; }
.gallery-thumbs button.active { border-color: var(--accent); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }

.product-info h1 { font-size: 30px; margin-bottom: 10px; }
.product-sku { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.product-price-lg { display: flex; align-items: baseline; gap: 12px; margin: 18px 0; }
.product-price-lg .price-now { font-size: 30px; }
.stock { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 18px; }
.stock .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.stock.out .dot { background: var(--danger); }
.buy-row { display: flex; gap: 12px; align-items: stretch; margin: 20px 0 12px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { width: 42px; height: 46px; border: 0; background: #fff; font-size: 18px; cursor: pointer; color: var(--ink); }
.qty input { width: 56px; height: 46px; border: 0; text-align: center; font: inherit; }
.product-desc { color: var(--ink-soft); margin: 24px 0; }
.specs { width: 100%; border-collapse: collapse; font-size: 15px; }
.specs tr { border-bottom: 1px solid var(--line); }
.specs td { padding: 10px 0; vertical-align: top; }
.specs td:first-child { color: var(--muted); width: 45%; padding-right: 16px; }

/* ---------- cart ---------- */

.cart-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 36px; align-items: start; }
.cart-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cart-row { display: grid; grid-template-columns: 84px 1fr auto; gap: 16px; padding: 16px; border-bottom: 1px solid var(--line); align-items: center; }
.cart-row:last-child { border-bottom: 0; }
.cart-thumb { width: 84px; height: 84px; border-radius: 8px; background: var(--sand); overflow: hidden; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #c9c3b8; }
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-row h4 { font-size: 15px; margin-bottom: 4px; }
.cart-row .muted { font-size: 13px; color: var(--muted); }
.cart-row .row-actions { display: flex; align-items: center; gap: 12px; }
.summary { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; position: sticky; top: 16px; }
.summary h3 { margin-bottom: 16px; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 15px; color: var(--ink-soft); }
.summary-row.total { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 14px; font-size: 19px; color: var(--ink); font-weight: 600; }

/* ---------- account ---------- */

.account-layout { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: start; }
.account-nav { display: flex; flex-direction: column; gap: 4px; }
.account-nav button {
  text-align: left; padding: 11px 14px; border: 0; background: transparent;
  border-radius: 8px; font: inherit; cursor: pointer; color: var(--ink-soft);
}
.account-nav button.active { background: var(--sand); color: var(--ink); font-weight: 600; }
.account-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font-size: 22px; }

.order-card { border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 12px; }
.order-card .order-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.order-card .order-number { font-weight: 600; }
.order-items { font-size: 14px; color: var(--ink-soft); }
.balance-card { border-radius: 10px; background: var(--sand); padding: 20px; margin-bottom: 20px; }
.balance-card .value { font-size: 30px; font-weight: 600; }

/* ---------- toast ---------- */

.toast-stack { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px;
  font-size: 14px; box-shadow: var(--shadow); animation: toast-in .2s ease;
  max-width: 340px;
}
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- footer ---------- */

.site-footer { background: var(--sand); border-top: 1px solid var(--line); padding: 44px 0 28px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.footer-grid h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 12px; }
.footer-grid a, .footer-grid p { font-size: 14px; color: var(--ink-soft); display: block; margin: 0 0 8px; }
.footer-bottom { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 18px; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- responsive ---------- */

@media (max-width: 1020px) {
  .catalog-layout, .product-layout, .cart-layout, .account-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
  .summary { position: static; }
  .hero { padding: 44px 28px; }
  .hero h1 { font-size: 30px; }
}

@media (max-width: 720px) {
  h1 { font-size: 26px; }
  .header-top { flex-wrap: wrap; gap: 12px; }
  .header-nav {
    order: 3; flex: 1 0 100%; width: 100%;
    overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .header-nav a { white-space: nowrap; }
  .header-actions { margin-left: auto; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .product-body { padding: 10px 12px 14px; }
  .product-actions { padding: 0 12px 12px; }
  .cart-row { grid-template-columns: 64px 1fr; }
  .cart-thumb { width: 64px; height: 64px; }
  .footer-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}
