/* ===== Design tokens ===================================================== */
:root {
  --font: "Golos Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  /* Straw: the page is the haystack, so it is warm and light; the things worth
     finding — measurements — are the one cool colour on it. Every pair below is
     checked against WCAG AA for its real use (body text, button label, badge). */
  --bg: #faf6ec;            /* warm cream */
  --bg-2: #f2ead7;
  --surface: #ffffff;
  --ink: #2a2113;           /* warm near-black */
  --ink-2: #54452a;
  --muted: #7b6c52;
  --line: #e9dfc6;
  --line-2: #d8c9a6;
  --accent: #8a5e0c;        /* bronze: carries white label text at 5.7:1 */
  --accent-2: #6f4b08;
  --accent-soft: #fbeecb;
  --straw: #f0c352;         /* the bright note: brand mark, highlights; ink on it, never white */
  --straw-soft: #fdf3dc;
  --meas: #14513a;          /* measurement badges: green, the needle in the straw */
  --meas-soft: #e2f0e7;
  --meas-line: #bcdcc8;
  --ok: #2e6b3f;
  --ok-soft: #e6f2ea;
  --warn: #7a4b00;
  --warn-soft: #fdf0d2;
  --danger: #a11d2c;
  --danger-soft: #fbe3e5;
  --focus: #1d5fbf;
  --shadow-1: 0 1px 2px rgba(42, 33, 19, .06), 0 4px 14px rgba(42, 33, 19, .06);
  --shadow-2: 0 10px 30px rgba(42, 33, 19, .12);
  --r-1: 10px; --r-2: 16px; --r-3: 24px; --r-pill: 999px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --container: 1200px;
  --tap: 44px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t-fast: 140ms; --t-med: 240ms;
}
@media (prefers-reduced-motion: reduce) {
  :root { --t-fast: 0ms; --t-med: 0ms; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ===== Base ============================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--bg); min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--accent-2); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 var(--s-3); text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 1.2rem + 2.4vw, 3rem); }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 var(--s-3); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.tiny { font-size: .8rem; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

.container { width: min(100% - 2 * var(--s-4), var(--container)); margin-inline: auto; }
@media (min-width: 768px) { .container { width: min(100% - 2 * var(--s-6), var(--container)); } }
main { flex: 1; }
.section { padding-block: var(--s-7); }
.section-tight { padding-block: var(--s-5); }

/* ===== Header ============================================================ */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, white); backdrop-filter: saturate(140%) blur(10px); border-bottom: 1px solid var(--line); }
.site-header .bar { display: flex; align-items: center; gap: var(--s-4); min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--ink); letter-spacing: -0.01em; }
.brand svg { width: 30px; height: 30px; }
.nav { display: none; gap: var(--s-2); margin-left: var(--s-4); }
.nav a { padding: 10px 12px; border-radius: var(--r-1); text-decoration: none; color: var(--ink-2); font-weight: 500; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--bg-2); color: var(--ink); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-2); display: inline-grid; place-items: center; font-weight: 700; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 1.6rem; }
.menu-toggle { display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); border-radius: var(--r-1); border: 1px solid var(--line); background: var(--surface); }
@media (min-width: 900px) { .nav { display: flex; } .menu-toggle { display: none; } }
.mobile-nav { display: none; border-top: 1px solid var(--line); padding: var(--s-3) 0 var(--s-4); }
.mobile-nav[data-open="true"] { display: block; }
.mobile-nav a { display: block; padding: 12px 8px; text-decoration: none; color: var(--ink); font-weight: 500; border-radius: var(--r-1); min-height: var(--tap); }
.mobile-nav a:hover { background: var(--bg-2); }

/* ===== Buttons and inputs =============================================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 10px 18px; border-radius: var(--r-pill); border: 1px solid transparent; font-weight: 600; text-decoration: none; transition: background var(--t-fast) var(--ease), color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast); white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); color: #fff; }
.btn-secondary { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-secondary:hover { border-color: var(--ink-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-2); color: var(--ink); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: #f1cdd2; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn .spinner { display: none; }
.btn[data-loading="true"] .spinner { display: inline-block; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s-4); }
.field label, .label { font-weight: 600; font-size: .95rem; }
.field .hint { color: var(--muted); font-size: .85rem; }
.input, .select, .textarea { width: 100%; min-height: var(--tap); padding: 10px 14px; border: 1px solid var(--line-2); border-radius: var(--r-1); background: var(--surface); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(29, 95, 191, .15); outline: none; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.textarea { min-height: 120px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%234a423b' stroke-width='1.6' d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: var(--tap); padding: 6px 0; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.form-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; margin-top: var(--s-4); }
.form-narrow { max-width: 480px; }

.notice { padding: 12px 16px; border-radius: var(--r-2); border: 1px solid var(--line); background: var(--surface); margin-bottom: var(--s-4); }
.notice-ok { background: var(--ok-soft); border-color: #c7dfcd; color: var(--ok); }
.notice-warn { background: var(--warn-soft); border-color: #ecd7a6; color: var(--warn); }
.notice-danger { background: var(--danger-soft); border-color: #eebfc5; color: var(--danger); }
.notice-info { background: #e8eef8; border-color: #c9d6ec; color: #234b8a; }
.notice ul { margin: 6px 0 0 18px; padding: 0; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill); background: var(--bg-2); color: var(--ink-2); font-size: .9rem; font-weight: 500; border: 1px solid transparent; }
.chip button { border: 0; background: transparent; padding: 0 0 0 4px; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: var(--muted); }
.chip button:hover { background: var(--line); color: var(--ink); }
.chip-accent { background: var(--accent-soft); color: var(--accent-2); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); padding: var(--s-5); box-shadow: var(--shadow-1); }
.grid-2 { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.row { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.divider { border: 0; border-top: 1px solid var(--line); margin: var(--s-5) 0; }

/* ===== Footer ============================================================ */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); padding: var(--s-6) 0 max(var(--s-5), env(safe-area-inset-bottom)); margin-top: var(--s-7); color: var(--ink-2); }
.site-footer .cols { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
@media (min-width: 768px) { .site-footer .cols { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.site-footer h4 { font-size: .9rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: var(--s-2); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
.site-footer .legal { margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--line-2); font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: var(--s-3); justify-content: space-between; }

/* ===== Landing =========================================================== */
.hero { padding: clamp(28px, 6vw, 72px) 0 clamp(24px, 5vw, 56px); display: grid; gap: var(--s-6); align-items: center; grid-template-columns: 1fr; }
@media (min-width: 900px) { .hero { grid-template-columns: 7fr 5fr; } }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--accent-2); font-weight: 600; font-size: .9rem; margin-bottom: var(--s-3); }
.hero .eyebrow::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.hero h1 { font-size: clamp(2rem, 1.2rem + 3.4vw, 3.6rem); margin-bottom: var(--s-4); }
.hero p.lead { font-size: 1.15rem; color: var(--ink-2); max-width: 44ch; }
.hero-search { display: flex; gap: 8px; margin-top: var(--s-5); padding: 8px; border-radius: var(--r-3); background: var(--surface); box-shadow: var(--shadow-2); border: 1px solid var(--line); flex-wrap: wrap; }
.hero-search .input { flex: 1 1 260px; border: 0; box-shadow: none; min-height: 48px; }
.hero-search .btn { flex: 0 0 auto; }
.hero-note { margin-top: var(--s-3); color: var(--muted); font-size: .9rem; }
.hero-art { position: relative; aspect-ratio: 4 / 5; border-radius: var(--r-3); overflow: hidden; background: linear-gradient(160deg, #e9dccd, #d7c2a8 55%, #b98c66); box-shadow: var(--shadow-2); max-height: 560px; }
.hero-art svg { width: 100%; height: 100%; }
.stat-row { display: grid; gap: var(--s-4); grid-template-columns: repeat(2, 1fr); margin-top: var(--s-6); }
@media (min-width: 768px) { .stat-row { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); padding: var(--s-4); }
.stat .n { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.examples { display: grid; gap: var(--s-3); grid-template-columns: 1fr; }
@media (min-width: 640px) { .examples { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .examples { grid-template-columns: repeat(3, 1fr); } }
.example { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); padding: var(--s-4); transition: transform var(--t-med) var(--ease), box-shadow var(--t-med), border-color var(--t-fast); min-height: var(--tap); }
.example:hover { transform: translateY(-2px); box-shadow: var(--shadow-1); border-color: var(--line-2); color: var(--ink); }
.example .fam { color: var(--accent-2); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.example .q { font-size: 1.05rem; font-weight: 500; margin-top: 4px; }
.steps { counter-reset: step; display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 768px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.step { position: relative; padding: var(--s-4) var(--s-4) var(--s-4) 56px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 16px; top: 16px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: .9rem; }
.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq summary { cursor: pointer; font-weight: 600; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: var(--tap); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.4rem; font-weight: 400; }
.faq details[open] summary::after { content: "–"; }
.faq .a { padding: 0 0 var(--s-4); color: var(--ink-2); max-width: 70ch; }

/* ===== Search page ====================================================== */
.search-layout { display: grid; gap: var(--s-5); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1024px) { .search-layout { grid-template-columns: 300px 1fr; } }
.search-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); padding: var(--s-4); box-shadow: var(--shadow-1); display: grid; gap: var(--s-3); }
.search-main { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .search-main { grid-template-columns: 1fr auto; } }
.search-main .input { min-height: 48px; font-size: 1.05rem; }
.search-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.family-select { display: flex; gap: 6px; flex-wrap: wrap; }
.family-select label { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; min-height: 40px; font-size: .95rem; }
.family-select input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.family-select label:has(input:checked) { background: var(--ink); color: #fff; border-color: var(--ink); }
.family-select label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.family-select label[data-empty="true"] { color: var(--muted); border-style: dashed; }
.filters-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); padding: var(--s-4); }
.filters-panel h3 { font-size: 1rem; margin: 0; }
.filters-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s-3); }
.filter-group { border-top: 1px solid var(--line); padding: var(--s-3) 0; }
.filter-group > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; min-height: var(--tap); align-items: center; }
.filter-group > summary::-webkit-details-marker { display: none; }
.filter-group > summary::after { content: "▾"; color: var(--muted); }
.filter-group[open] > summary::after { content: "▴"; }
.filter-field { margin-top: var(--s-3); }
.filter-field .label { display: block; margin-bottom: 4px; font-size: .9rem; }
.multi { display: flex; flex-wrap: wrap; gap: 6px; }
.multi label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--bg); font-size: .88rem; cursor: pointer; min-height: 36px; }
.multi input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.multi label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
.multi label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 1px; }
.range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.range .input { min-height: 40px; padding: 6px 10px; }
.filters-actions { position: sticky; bottom: 0; background: var(--surface); padding-top: var(--s-3); margin-top: var(--s-3); border-top: 1px solid var(--line); display: flex; gap: 8px; }
.drawer { position: fixed; inset: 0; z-index: 60; display: none; }
.drawer[data-open="true"] { display: block; }
.drawer .scrim { position: absolute; inset: 0; background: rgba(31, 26, 22, .45); }
.drawer .panel { position: absolute; inset: 0 0 0 auto; width: min(100%, 420px); background: var(--surface); overflow: auto; padding: var(--s-4) var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom)); transform: translateX(100%); transition: transform var(--t-med) var(--ease); display: flex; flex-direction: column; }
.drawer[data-open="true"] .panel { transform: none; }
@media (min-width: 1024px) { .drawer, .drawer[data-open="true"] { display: contents; } .drawer .scrim { display: none; } .drawer .panel { position: static; width: auto; transform: none; padding: 0; overflow: visible; background: transparent; } }
.results-head { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; justify-content: space-between; margin-bottom: var(--s-4); }
.view-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-pill); overflow: hidden; }
.view-toggle button { border: 0; background: var(--surface); padding: 8px 12px; min-width: var(--tap); min-height: 40px; color: var(--ink-2); }
.view-toggle button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.interp { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); padding: var(--s-4); margin-bottom: var(--s-4); }
.interp h3 { font-size: 1rem; margin-bottom: 8px; }
.interp .k { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }

.results { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 560px) { .results { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .results { grid-template-columns: repeat(3, 1fr); gap: var(--s-5); } }
@media (min-width: 1500px) { .results { grid-template-columns: repeat(4, 1fr); } }
.results[data-view="list"] { grid-template-columns: 1fr; }
.rcard { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); overflow: hidden; display: flex; flex-direction: column; transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); animation: cardIn var(--t-med) var(--ease) both; }
.rcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-1); }
.rcard .ph { position: relative; aspect-ratio: 4 / 5; background: var(--bg-2); overflow: hidden; }
.rcard .ph img { width: 100%; height: 100%; object-fit: cover; background: var(--bg-2); }
.rcard .ph .count { position: absolute; right: 8px; bottom: 8px; background: rgba(20,32,27,.72); color: #fff; font-size: .75rem; padding: 3px 8px; border-radius: var(--r-pill); }
.rcard .ph .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.rcard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.rcard .t { font-weight: 600; line-height: 1.3; font-size: 1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.rcard .t a { color: inherit; text-decoration: none; }
.rcard .t a::after { content: ""; position: absolute; inset: 0; }
.rcard .ex { display: none; color: var(--ink-2); font-size: .9rem; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.rcard .price { font-weight: 700; font-size: 1.1rem; margin-top: auto; }
.rcard .rub { color: var(--muted); font-weight: 500; font-size: .9rem; margin-left: 6px; }
.rcard .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: .82rem; }
.rcard .warn { display: inline-flex; align-items: center; gap: 4px; color: var(--warn); font-size: .8rem; position: relative; z-index: 1; }
/* measurement badges: the service's key advantage, always visible on the card */
.meas-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.meas-badges .mb { display: inline-flex; align-items: baseline; gap: 4px; padding: 3px 8px; border-radius: 8px; background: var(--meas-soft); border: 1px solid var(--meas-line); color: var(--meas); font-size: .8rem; font-weight: 600; line-height: 1.2; }
.meas-badges .mb b { font-weight: 700; }
.meas-badges .mb.more { background: transparent; border-style: dashed; font-weight: 500; }
.meas-badges .none { color: var(--muted); font-size: .8rem; }
/* phones: one column, horizontal card with a large photo on the left */
@media (max-width: 559px) {
  .rcard { flex-direction: row; }
  .rcard .ph { width: 42%; flex: none; aspect-ratio: 4 / 5; }
  .rcard .body { padding: 10px 12px 12px; gap: 6px; }
  .rcard .t { font-size: .95rem; -webkit-line-clamp: 3; }
}
.results[data-view="list"] .rcard { flex-direction: row; }
.results[data-view="list"] .rcard .ph { width: 160px; flex: none; aspect-ratio: 4 / 5; }
.results[data-view="list"] .rcard .ex { display: -webkit-box; }
@media (min-width: 640px) { .results[data-view="list"] .rcard .ph { width: 220px; } .results[data-view="list"] .rcard .ex { -webkit-line-clamp: 4; } }
.skeleton { background: linear-gradient(90deg, var(--bg-2) 25%, #f6f1ea 37%, var(--bg-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--r-2); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.sk-card { aspect-ratio: 3 / 4.6; }
.wait { display: flex; align-items: center; gap: 12px; padding: var(--s-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); margin-bottom: var(--s-4); }
.wait .spinner { border-color: var(--line-2); border-top-color: var(--accent); width: 20px; height: 20px; }
.more { display: flex; justify-content: center; margin: var(--s-6) 0; }
.empty { text-align: center; padding: var(--s-7) var(--s-4); background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r-3); }
.empty h3 { margin-bottom: 8px; }
.guest-cta { background: linear-gradient(135deg, var(--accent-soft), #fff); border: 1px solid #ebd2c4; border-radius: var(--r-2); padding: var(--s-5); display: grid; gap: var(--s-3); }

/* ===== Modal ============================================================= */
.modal { position: fixed; inset: 0; z-index: 70; display: none; align-items: center; justify-content: center; padding: var(--s-4); }
.modal[data-open="true"] { display: flex; }
.modal .scrim { position: absolute; inset: 0; background: rgba(31,26,22,.5); }
.modal .box { position: relative; width: min(100%, 520px); max-height: calc(100dvh - 2 * var(--s-4)); overflow: auto; background: var(--surface); border-radius: var(--r-3); padding: var(--s-5); box-shadow: var(--shadow-2); animation: pop var(--t-med) var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal .close { position: absolute; right: 10px; top: 10px; width: var(--tap); height: var(--tap); border: 0; background: transparent; border-radius: 50%; font-size: 1.4rem; }
.modal .close:hover { background: var(--bg-2); }

/* ===== Item page ========================================================= */
.item-layout { display: grid; gap: var(--s-5); grid-template-columns: 1fr; grid-template-areas: "gallery" "info" "desc"; }
.item-layout > .gallery { grid-area: gallery; } .item-layout > .stack { grid-area: info; } .item-layout > .item-desc { grid-area: desc; }
@media (min-width: 900px) { .item-layout { grid-template-columns: 7fr 5fr; align-items: start; grid-template-areas: "gallery info" "desc info"; } }
.item-desc .desc { white-space: pre-line; line-height: 1.55; }
.meas-card { border-color: var(--meas-line); background: linear-gradient(180deg, #fffaf0, #fff); }
.meas-card h3 { color: var(--meas); }
.gallery { position: relative; }
.gallery .main { position: relative; aspect-ratio: 3 / 4; max-height: 78dvh; background: #f2ede6; border-radius: var(--r-2); overflow: hidden; border: 1px solid var(--line); }
.gallery .main img { width: 100%; height: 100%; object-fit: contain; }
.gallery .main button.zoom { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; cursor: zoom-in; }
.gallery .gnav { position: absolute; top: 50%; transform: translateY(-50%); width: var(--tap); height: var(--tap); border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.92); display: grid; place-items: center; }
.gallery .gnav.prev { left: 8px; } .gallery .gnav.next { right: 8px; }
.gallery .counter { position: absolute; left: 12px; bottom: 12px; background: rgba(31,26,22,.7); color: #fff; font-size: .8rem; padding: 4px 10px; border-radius: var(--r-pill); }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; }
.thumbs button { flex: none; width: 64px; height: 84px; border-radius: var(--r-1); overflow: hidden; border: 2px solid transparent; padding: 0; background: #f2ede6; scroll-snap-align: start; }
.thumbs button[aria-current="true"] { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(20,16,14,.96); display: none; align-items: center; justify-content: center; }
.lightbox[data-open="true"] { display: flex; }
.lightbox img { max-width: 100vw; max-height: 100dvh; object-fit: contain; }
.lightbox .close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; color: #fff; background: rgba(255,255,255,.12); border: 0; width: var(--tap); height: var(--tap); border-radius: 50%; font-size: 1.4rem; }
.lightbox .gnav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.12); color: #fff; border: 0; width: var(--tap); height: var(--tap); border-radius: 50%; }
.lightbox .prev { left: 12px; } .lightbox .next { right: 12px; }
.price-block { display: flex; flex-direction: column; gap: 4px; padding: var(--s-4); background: var(--bg-2); border-radius: var(--r-2); }
.price-block .p { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; }
.price-block .r { color: var(--ink-2); font-size: 1.05rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; } }
.desc { white-space: pre-line; overflow-wrap: anywhere; }
.orig { background: var(--bg-2); border-radius: var(--r-2); padding: var(--s-4); }
.orig summary { cursor: pointer; font-weight: 600; min-height: var(--tap); display: flex; align-items: center; }
.cta-bar { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 92%, white); padding: 10px 0 max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); z-index: 30; }
@media (min-width: 900px) { .cta-bar { position: static; background: transparent; border: 0; padding: 0; } }
.meas-table { width: 100%; border-collapse: collapse; }
.meas-table th, .meas-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.meas-table th { font-weight: 600; color: var(--ink-2); font-size: .9rem; }

/* ===== Buyers ============================================================ */
.buyer-card { display: grid; gap: var(--s-4); grid-template-columns: 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); padding: var(--s-4); }
@media (min-width: 768px) { .buyer-card { grid-template-columns: 1fr 1.2fr; } }
.buyer-head { display: flex; gap: 12px; align-items: center; }
.draft { width: 100%; min-height: 160px; }
.route-ok { color: var(--ok); } .route-unknown { color: var(--warn); }

/* ===== Measurements help ================================================= */
.meas-layout { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
@media (min-width: 900px) { .meas-layout { grid-template-columns: 1fr 1fr; align-items: start; } }
.schema { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); padding: var(--s-4); position: sticky; top: 80px; }
.schema svg { width: 100%; height: auto; }
.schema .legend { display: grid; gap: 6px; margin-top: var(--s-3); font-size: .92rem; grid-template-columns: 1fr; }
.schema .legend b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .8rem; margin-right: 8px; }
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--bg-2); border-radius: var(--r-pill); margin-bottom: var(--s-3); }
.tabs button { border: 0; background: transparent; padding: 8px 14px; border-radius: var(--r-pill); font-weight: 600; color: var(--ink-2); min-height: 40px; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ===== Account / business =============================================== */
.acc-grid { display: grid; gap: var(--s-5); grid-template-columns: 1fr; }
@media (min-width: 900px) { .acc-grid { grid-template-columns: 260px 1fr; align-items: start; } }
.acc-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 80px; }
.acc-nav a { padding: 10px 12px; border-radius: var(--r-1); text-decoration: none; color: var(--ink-2); min-height: var(--tap); display: flex; align-items: center; }
.acc-nav a:hover { background: var(--bg-2); color: var(--ink); }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.table-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 10px; border-radius: var(--r-pill); font-size: .8rem; font-weight: 600; background: var(--bg-2); color: var(--ink-2); }
.badge-ok { background: var(--ok-soft); color: var(--ok); } .badge-warn { background: var(--warn-soft); color: var(--warn); } .badge-muted { background: var(--bg-2); color: var(--muted); }

/* ===== Legal ============================================================= */
.prose { max-width: 76ch; }
.prose h2 { margin-top: var(--s-6); font-size: 1.4rem; }
.prose h3 { margin-top: var(--s-5); }
.prose li { margin-bottom: 6px; }
.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.prose th, .prose td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }

/* ===== Toasts ============================================================ */
.toasts { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--r-2); box-shadow: var(--shadow-2); animation: rise var(--t-med) var(--ease) both; }

/* narrow phones (320–479): the header keeps brand + primary action + menu; "Войти" lives in the menu */
@media (max-width: 479px) {
  .hide-xs { display: none !important; }
  .header-actions .btn-primary { padding-left: 12px; padding-right: 12px; }
  .header-actions .nowrap { max-width: 96px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }
}

/* ===== Narrow-screen fixes from the design QA (320–768) ================ */
/* grid items must be allowed to shrink below their content (long buttons, tables) */
.grid-2 > *, .grid-3 > *, .steps > *, .results > *, .acc-grid > *, .item-layout > *, .meas-layout > *, .search-layout > *, .buyer-card > *, .hero > * { min-width: 0; }
.card, .table-wrap { min-width: 0; max-width: 100%; }
.btn { max-width: 100%; white-space: normal; text-align: center; }
/* tap targets on touch screens: small buttons grow to 44 px */
@media (max-width: 767px), (pointer: coarse) {
  .btn-sm { min-height: var(--tap); padding-top: 8px; padding-bottom: 8px; }
}
/* 320–479: compact brand, compact primary action, avatar-only account button */
@media (max-width: 479px) {
  .site-header .bar { gap: 8px; }
  .brand { font-size: 1rem; gap: 6px; }
  .brand svg { width: 26px; height: 26px; }
  .header-actions .btn-primary { padding-left: 10px; padding-right: 10px; font-size: .95rem; }
  .header-actions .nowrap { display: none; }
  .header-actions .btn-ghost[href="/account"] { padding-right: 8px; }
}

/* stacked table on phones (sessions list): each row becomes a block, headers are hidden */
@media (max-width: 599px) {
  .table.stack thead { display: none; }
  .table.stack tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .table.stack td { display: block; padding: 2px 0; border: 0; }
  .table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
}

/* search form at 320: the text input must not dictate the grid track width */
.search-form > *, .search-main > *, .search-tools > * { min-width: 0; }
.search-main .input { width: 100%; min-width: 0; }
/* icon buttons (drawer close) are full tap targets */
.drawer button[aria-label], .view-toggle button { min-width: var(--tap); min-height: var(--tap); }
@media (max-width: 767px), (pointer: coarse) { .search-tools .select { min-height: var(--tap); } }

/* sort control wraps under its label on narrow screens instead of pushing the page wider */
.search-tools label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.search-tools .select { max-width: 100%; }

/* compact measurement rows in the filter panel: label | от | до */
.filter-field.meas-row { display: grid; grid-template-columns: 1fr 76px 76px; gap: 8px; align-items: center; }
.filter-field.meas-row .label { margin: 0; font-weight: 500; }
.filter-field.meas-row .input { min-height: 40px; padding: 6px 8px; text-align: center; }
.filter-field.meas-row .hint { grid-column: 1 / -1; margin: 0; }
.filter-group .more-meas { margin-top: 6px; }
.filter-group .more-meas summary { cursor: pointer; color: var(--accent); font-size: .9rem; padding: 6px 0; }

/* measurement read from a photo (tape / annotation / size table): dotted marker */
.meas-badges .mb.photo { border-style: dashed; }
.meas-badges .mb.photo::before { content: "📷"; font-size: .75em; margin-right: 2px; }
