/* Public catalog pages (/c, /p): plain server-rendered HTML for search engines and visitors
   arriving from them. Hand-written, no Tailwind: these pages must stay light and stable.
   Palette and shapes follow DESIGN.md (brand red, slate neutrals, rounded cards). */
:root {
  --red: #dc2626; --red-dark: #b91c1c; --red-soft: #fef2f2;
  --ink: #0f172a; --text: #334155; --muted: #64748b; --line: #e2e8f0; --bg: #f8fafc; --card: #fff;
  --radius: 14px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.55 'Onest', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }
a:focus-visible, .btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 6px; }
img { max-width: 100%; height: auto; display: block; }
h1, h2 { color: var(--ink); line-height: 1.25; margin: 0; }
h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 700; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-size: 0.875rem; margin: 4px 0 0; }

/* Header */
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); font-size: 1.05rem; }
.brand .wm { display: flex; flex-direction: column; line-height: 1; white-space: nowrap; }
.brand .wm b { font-weight: 800; letter-spacing: -0.01em; }
.brand .wm small { margin-top: 3px; font-size: 0.7rem; font-weight: 600; color: var(--muted); }
.wm-r { color: var(--red); } .wm-b { color: #1d6fb8; }
.top-nav { display: flex; align-items: center; gap: 6px; }
.top-nav > a:not(.btn) { padding: 8px 12px; font-weight: 600; color: var(--text); font-size: 0.9rem; }

/* Buttons */
.btn {
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px;
  padding: 9px 16px; border-radius: 12px; font-weight: 600; font-size: 0.9rem;
  border: 1px solid var(--line); background: #fff; color: var(--ink); transition: background .15s, color .15s;
}
.btn:hover { background: #f1f5f9; color: var(--ink); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 6px 16px -8px rgba(220, 38, 38, .7); }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.btn-wide { width: 100%; min-height: 48px; font-size: 1rem; }

/* Breadcrumbs */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 0; padding: 0; margin: 16px 0 12px; font-size: 0.8rem; color: var(--muted); }
.crumbs li + li::before { content: '/'; margin: 0 8px; color: #cbd5e1; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--red); }
@media (max-width: 640px) {
  .crumbs ol { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .crumbs ol::-webkit-scrollbar { display: none; }
}
.crumbs [aria-current] { color: var(--text); max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Page head */
.head { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.head .lead { margin: 8px 0 16px; max-width: 70ch; color: var(--text); }
.head-center { text-align: center; padding: 48px 20px; }
.head-center .lead { margin-left: auto; margin-right: auto; }
.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 0; }
.section-title { margin: 24px 0 12px; }

/* Chips */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 0.85rem; font-weight: 500; }
.chip span { color: var(--muted); font-size: 0.75rem; }
.chip-active { background: var(--red-soft); border-color: #fecaca; color: var(--red-dark); }

/* Product grid */
.grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.card a { display: flex; flex-direction: column; height: 100%; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; transition: box-shadow .15s, border-color .15s; }
.card a:hover { border-color: #cbd5e1; box-shadow: 0 8px 24px -16px rgba(15, 23, 42, .35); color: inherit; }
.card-img { position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: var(--bg); border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.card-img img { width: 100%; height: 100%; object-fit: contain; }
.card-name { font-size: 0.85rem; line-height: 1.35; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.card-price { margin-top: 6px; font-weight: 700; color: var(--red); }
.card-rub { font-size: 0.75rem; color: var(--muted); }
.badge { position: absolute; top: 6px; left: 6px; background: var(--red); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; }
.badge-inline { position: static; display: inline-block; }

/* Catalog departments */
.depts { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .depts { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .depts { grid-template-columns: repeat(3, 1fr); } }
.dept { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.dept h2 a { display: inline-flex; align-items: center; gap: 8px; }
.dept-icon { font-size: 1.3rem; }
.dept-subs { list-style: none; padding: 0; margin: 10px 0 0; font-size: 0.875rem; }
.dept-subs li { padding: 8px 0; border-top: 1px solid #f1f5f9; display: flex; justify-content: space-between; gap: 8px; }
.dept-subs span { color: var(--muted); font-size: 0.8rem; }

/* Pager */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 24px 0 8px; }
.pager ol { list-style: none; display: flex; gap: 4px; padding: 0; margin: 0; }
.page { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0 10px; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-weight: 600; font-size: 0.875rem; }
.page-current { background: var(--ink); border-color: var(--ink); color: #fff; }
.gap { display: inline-flex; align-items: center; padding: 0 4px; color: var(--muted); }

/* Product page */
.product { display: grid; gap: 16px; align-items: start; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
@media (min-width: 768px) { .product { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; padding: 24px; } }
.product-media { max-height: 520px; background: var(--bg); border-radius: 12px; display: flex; align-items: center; justify-content: center; aspect-ratio: 1; overflow: hidden; }
.product-media img { width: 100%; height: 100%; object-fit: contain; }
.product-info { display: flex; flex-direction: column; gap: 10px; align-self: center; }
.eyebrow { margin: 0; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.vi { margin: 0; color: var(--muted); font-style: italic; font-size: 0.9rem; }
.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 6px; }
.price-now { font-size: 1.75rem; font-weight: 800; color: var(--red); }
.price-rub { color: var(--muted); font-weight: 600; }
.soldout { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: #f1f5f9; color: var(--text); font-weight: 600; }
.hint { margin: 0; font-size: 0.8rem; color: var(--muted); }
.block { margin-top: 24px; }
.block > h2 { margin-bottom: 8px; }
.block > .muted { margin-bottom: 12px; }
.more { display: inline-block; margin-top: 12px; font-weight: 600; color: var(--red); }
.branches { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 0.9rem; }
.branches th, .branches td { text-align: left; padding: 10px 14px; border-top: 1px solid #f1f5f9; }
.branches th { background: var(--bg); color: var(--muted); font-weight: 600; font-size: 0.8rem; border-top: 0; }
.branches .num { text-align: right; white-space: nowrap; }
.branches s { color: var(--muted); font-size: 0.8rem; margin-right: 4px; }

/* Footer */
.foot { margin-top: 40px; background: #fff; border-top: 1px solid var(--line); padding: 24px 0 32px; font-size: 0.8rem; color: var(--muted); }
.foot p { max-width: 80ch; margin: 8px 0 0; line-height: 1.6; }
.foot-note { font-size: 0.75rem; color: #94a3b8; }
.foot-links { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; margin: 0 0 12px; }
.foot-links a { display: inline-block; padding: 6px 0; color: var(--text); font-weight: 500; }

@media (max-width: 480px) {
  h1 { font-size: 1.3rem; }
  .top-nav > a:not(.btn) { display: none; }
  .top-nav .btn { min-height: 36px; padding: 7px 12px; font-size: 0.85rem; }
  .brand { font-size: 0.95rem; gap: 8px; }
  .price-now { font-size: 1.5rem; }
}
