@import url('../fonts/fonts.css');

/* ==========================================================================
   Magma Gems — дизайн-система
   Принцип: тёмная витрина (герой, бренд-блоки) → светлый зал (каталог, карточки).
   Тёмное даёт «дорого» там, где человек смотрит; светлое не врёт про цвет камня
   там, где человек решает. Подробности — docs/design-system.md.
   ========================================================================== */

:root {
  /* Тёмная половина. Тёплый, не синий чёрный: холодный чёрный рядом с золотом
     уходит в «техно», тёплый — в ювелирную витрину. */
  --ink:        #0E0F12;
  --ink-2:      #14161B;
  --ink-3:      #1C1F26;
  --ink-line:   rgba(233, 226, 213, .13);
  --ink-line-2: rgba(233, 226, 213, .07);
  --on-ink:     #EFEAE1;
  --on-ink-dim: #9A948A;

  /* Светлая половина */
  --paper:      #FAF8F5;
  --card:       #FFFFFF;
  --line:       #E6DFD4;
  --line-soft:  #F0EAE0;
  --text:       #16181C;
  --muted:      #6A645C;
  /* #938C82 давал на светлом всего 3.14:1 при требуемых 4.5 — а этим цветом
     набраны надзаголовки карточек, статус, крошки и подписи фильтров.
     #766D62 → 4.79 на --paper и 5.08 на --card. */
  --faint:      #766D62;

  /* Акценты. Золото — только волосяные линии, подписи и цена: заливка золотом
     больших поверхностей и есть та «коричневая» ошибка первой версии. */
  --gold:       #C9A227;
  --gold-lift:  #E0C169;
  --gold-ink:   #8A6B12;
  --gold-wash:  #FBF4E2;
  --mineral:    #2F5F4B;
  --mineral-wash:#EBF2EE;
  --rare:       #8C2749;
  --rare-wash:  #FAECF0;

  /* Мера набора — длина строки. Целимся в 60–70 знаков: ниже 45 строка рвётся,
     выше 75 глаз теряет начало следующей.

     Выразить это в `ch` честно нельзя. `ch` — ширина знака «0», а он в Inter
     примерно на 19 % шире среднего кириллического знака. Прежние `72ch` давали
     не 72, а 86 знаков в строке; `62ch` у лида — до 83. Поэтому мера задана в
     rem и выверена замером (build/measure.js), а не подобрана на глаз. */
  --measure:      32rem;   /* 512px ≈ 61 знак (RU) / 73 (EN) */
  --measure-lead: 35rem;   /* 560px ≈ 61 знак при 18px */
  --measure-note: 30rem;   /* 480px — мелкий текст 13px */

  --radius:     2px;
  --radius-lg:  3px;
  --wrap:       1240px;
  --gut:        32px;    /* поля центрированного контейнера, ≤640 → 20 */
  --gut-wide:   40px;    /* поля full-width листинга, ≤720 → 20 */

  --shadow-card: 0 1px 2px rgba(20,16,10,.04), 0 12px 32px -12px rgba(20,16,10,.14);
  --shadow-lift: 0 2px 4px rgba(20,16,10,.06), 0 26px 56px -18px rgba(20,16,10,.22);

  --ease: cubic-bezier(.22,.61,.36,1);

  --header-h: 76px;
}

/* ---------- база ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 400 16px/1.6 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-feature-settings: 'kern' 1, 'liga' 1;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;         /* страховка: горизонтального скролла быть не должно */
}

/* height:auto обязателен: у изображений проставлены width/height (это снижает CLS),
   и без него резиновая ширина не тянет за собой высоту — картинка сплющивается. */
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: var(--radius);
}
.on-ink :focus-visible { outline-color: var(--gold-lift); }

/* Пропуск навигации. Прячем сдвигом, а не display:none — скрытое им выпадает
   из порядка табуляции, то есть ссылка перестаёт существовать ровно для тех,
   ради кого она есть. */
.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 200;
  padding: 12px 18px;
  background: var(--gold);
  color: #17140B;
  font-weight: 600;
  border-radius: var(--radius);
  transform: translateY(-160%);
  transition: transform .18s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* ---------- сетка ----------
   Контейнер по домашнему стандарту: ширина 100 %, ограничение максимумом, поля
   внутренним padding. Форма `width: min(1240px, 100% - 64px)` выглядит
   эквивалентной, но у неё есть `margin-inline: auto`, и любой `max-width` на том
   же элементе не сужает колонку, а ЦЕНТРУЕТ её в окне. На этом уже уехал
   заголовок героя. */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gut);
}

/* Листинги — во всю ширину: сетка каталога должна использовать большой экран.
   Текстовые блоки при этом остаются в колонке 1240 — длинные строки убивают
   и читаемость, и «дорогое» ощущение. */
.wrap--wide {
  max-width: none;
  padding-inline: var(--gut-wide);
}

.section { padding: 92px 0; }
.section--tight { padding: 64px 0; }
.section--ink {
  background: var(--ink);
  color: var(--on-ink);
}
.section--paper { background: var(--paper); }
.section--card { background: var(--card); }

/* ---------- типографика ---------- */
.display, h1, h2, h3 {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-weight: 400;
  letter-spacing: -.005em;
  line-height: 1.03;
  text-wrap: balance;
}
h1, .h1 { font-size: clamp(42px, 5.6vw, 82px); }
h2, .h2 { font-size: clamp(32px, 3.8vw, 54px); }
h3, .h3 { font-size: clamp(21px, 1.6vw, 26px); line-height: 1.15; }
h4, .h4 {
  margin: 0;
  font: 600 15px/1.35 Inter, sans-serif;
  letter-spacing: -.005em;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.lead {
  max-width: var(--measure-lead);
  color: var(--muted);
  font-size: 18px;
  line-height: 1.62;
}
.on-ink .lead, .section--ink .lead { color: var(--on-ink-dim); }

/* Надзаголовок: капитель с разрядкой и золотой чертой. Один такой элемент
   на блок — он и держит «дорогой» ритм страницы. */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  color: var(--gold-ink);
  font: 600 11px/1 Inter, sans-serif;
  letter-spacing: .19em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: '';
  width: 34px;
  height: 1px;
  background: var(--gold);
  flex: none;
}
.section--ink .eyebrow, .on-ink .eyebrow { color: var(--gold-lift); }

.muted { color: var(--muted); }
.section--ink .muted, .on-ink .muted { color: var(--on-ink-dim); }

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px 40px;
  align-items: end;
  margin-bottom: 48px;
}
.section-head > div { min-width: 0; }
.section-head p { margin-top: 18px; max-width: var(--measure); }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 13px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: 500 14px/1 Inter, sans-serif;
  letter-spacing: .02em;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s var(--ease), border-color .2s var(--ease),
              color .2s var(--ease), transform .2s var(--ease);
}
.btn:hover { border-color: var(--text); }
.btn:active { transform: translateY(1px); }

.btn--gold {
  border-color: var(--gold);
  background: var(--gold);
  color: #17140B;
  font-weight: 600;
}
.btn--gold:hover { background: var(--gold-lift); border-color: var(--gold-lift); }

.btn--ink {
  border-color: var(--text);
  background: var(--text);
  color: var(--paper);
}
.btn--ink:hover { background: #000; }

.btn--ghost-light {
  border-color: var(--ink-line);
  color: var(--on-ink);
}
.btn--ghost-light:hover { border-color: var(--on-ink); background: rgba(255,255,255,.05); }

.btn--sm { min-height: 40px; padding: 10px 18px; font-size: 13px; }

/* Текстовая ссылка-действие с подчёркиванием, которое растёт при наведении */
.link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  color: var(--mineral);
  font-weight: 500;
  font-size: 14px;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size .28s var(--ease);
}
.link:hover { background-size: 100% 1px; }
.section--ink .link, .on-ink .link { color: var(--gold-lift); }

/* ---------- метки ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: var(--radius);
  background: var(--gold-wash);
  color: var(--gold-ink);
  font: 600 11px/1 Inter, sans-serif;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tag--stock  { background: var(--mineral-wash); color: var(--mineral); }
.tag--rare   { background: var(--rare-wash);    color: var(--rare); }
.tag--quiet  { background: var(--line-soft);    color: var(--muted); }
.section--ink .tag {
  background: rgba(201,162,39,.16);
  color: var(--gold-lift);
}

/* ==========================================================================
   Шапка
   ========================================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--ink);
  color: var(--on-ink);
  border-bottom: 1px solid var(--ink-line-2);
}
.header__bar {
  min-height: var(--header-h);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 32px;
}
.header__logo img { width: 168px; height: auto; }

.nav {
  display: flex;
  justify-content: center;
  gap: 4px;
}
.nav a {
  padding: 10px 14px;
  color: var(--on-ink-dim);
  font-size: 14px;
  letter-spacing: .01em;
  border-radius: var(--radius);
  transition: color .2s var(--ease);
}
.nav a:hover, .nav a[aria-current='page'] { color: var(--on-ink); }
.nav a[aria-current='page'] { box-shadow: inset 0 -1px 0 var(--gold); }

.header__actions { display: flex; align-items: center; gap: 8px; }

.lang {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 6px;
  color: var(--on-ink-dim);
  font: 500 12px/1 Inter, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.lang a { padding: 9px 5px; }
.lang a[aria-current] { color: var(--gold-lift); }
.lang span[aria-hidden] { opacity: .35; }

.burger {
  display: none;
  width: 44px; height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
}
.burger i {
  position: relative;
  width: 17px; height: 1px;
  background: var(--on-ink);
  transition: background .2s var(--ease);
}
.burger i::before, .burger i::after {
  content: '';
  position: absolute;
  left: 0;
  width: 17px; height: 1px;
  background: var(--on-ink);
  transition: transform .24s var(--ease);
}
.burger i::before { top: -6px; }
.burger i::after  { top: 6px; }
.burger[aria-expanded='true'] i { background: transparent; }
.burger[aria-expanded='true'] i::before { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded='true'] i::after  { transform: translateY(-6px) rotate(-45deg); }

/* Мобильное меню. В прежнем макете ссылки и CTA просто прятались на ≤700px,
   и на телефоне навигации не оставалось вовсе. */
.mmenu {
  position: fixed;
  inset: var(--header-h) 0 0;
  z-index: 89;
  display: none;
  flex-direction: column;
  padding: 24px var(--gut) 40px;
  background: var(--ink);
  color: var(--on-ink);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mmenu[data-open] { display: flex; }
.mmenu a {
  padding: 18px 0;
  border-bottom: 1px solid var(--ink-line-2);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 30px;
  line-height: 1.1;
}
.mmenu__foot { margin-top: 28px; display: grid; gap: 12px; }
body[data-lock] { overflow: hidden; }

/* ==========================================================================
   Герой
   ========================================================================== */
.hero {
  position: relative;
  background: var(--ink);
  color: var(--on-ink);
  isolation: isolate;
}
.hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}
.hero__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 82% 50%;   /* камень к правому краю, левая треть — под текст */
}
/* Затемнение слева под текст: фотография сама по себе контрастная, без градиента
   заголовок на ней читается только «иногда». */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(96deg, var(--ink) 4%, rgba(14,15,18,.92) 34%,
                    rgba(14,15,18,.42) 62%, rgba(14,15,18,.10) 100%),
    linear-gradient(to top, rgba(14,15,18,.75), transparent 42%);
}
/* Колонку текста ограничиваем на детях, а не на самом .wrap: max-width на
   элементе с `margin-inline:auto` центрует его в окне, и заголовок уезжает
   на камень вместо того, чтобы стоять в левой, специально затемнённой части. */
.hero__inner {
  display: grid;
  align-content: center;
  /* svh, а не vh. В Safari на iPhone/iPad 100vh — высота экрана со СВЁРНУТОЙ
     панелью браузера, но при открытии страницы она развёрнута: низ героя с
     кнопками уходит под панель. Строка с vh оставлена фолбэком для старых
     браузеров. Ломается ровно iPad, который не попадает ни в один медиазапрос. */
  min-height: clamp(560px, 76vh, 820px);
  min-height: clamp(560px, 76svh, 820px);
  padding-block: 96px 72px;   /* именно block: shorthand затёр бы поля контейнера */
}
.hero__inner > * { max-width: 620px; }
.hero__inner > .hero__facts { max-width: 760px; }
.hero h1 {
  margin-bottom: 26px;
  font-size: clamp(46px, 6vw, 86px);
}
.hero h1 em {
  font-style: italic;
  color: var(--gold-lift);
}
.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 38px;
}
.hero__facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 56px;
  border-top: 1px solid var(--ink-line);
  padding-top: 26px;
}
.hero__facts b {
  display: block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 30px;
  font-weight: 500;
  color: var(--gold-lift);
  line-height: 1;
}
.hero__facts span {
  display: block;
  margin-top: 7px;
  color: var(--on-ink-dim);
  font-size: 13px;
  max-width: 20ch;
}

/* ==========================================================================
   Карточка камня в сетке
   ========================================================================== */
.grid-stones {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
  gap: 28px 24px;
}

/* Карточка — div, а не <a>: внутри есть кнопки, а <button> внутри <a> — невалидный
   HTML и путаница для скринридера. Кликабельность даёт растянутая ссылка заголовка. */
.p-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  transition: box-shadow .3s var(--ease), transform .3s var(--ease),
              border-color .3s var(--ease);
}
.p-card:hover {
  transform: translateY(-3px);
  border-color: var(--line);
  box-shadow: var(--shadow-lift);
}
.p-card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  padding: 26px;
  /* Единый фон под все камни. Фотографии обрезаны по контуру (build/prepare-stones.py),
     поэтому студийные подложки разного тона больше не спорят между собой. */
  background:
    radial-gradient(120% 96% at 50% 22%, #FFFFFF 0%, #FBF9F5 46%, #F3EFE8 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
}
.p-card__media img, .p-card__media picture {
  width: 82%;
  height: 82%;
  object-fit: contain;
  filter: drop-shadow(0 20px 26px rgba(38, 28, 12, .22));
  transition: transform .5s var(--ease);
}
.p-card:hover .p-card__media img { transform: scale(1.045); }
.p-card__flags {
  position: absolute;
  top: 12px; left: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 24px);
}
.p-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;                       /* прижимает подвал карточки вниз: без этого
                                    цена в соседних карточках стояла на разной
                                    высоте, и ряд выглядел рваным */
  padding: 20px 20px 18px;
}
.p-card__kicker {
  color: var(--faint);
  font: 500 11px/1 Inter, sans-serif;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.p-card__title {
  margin: 10px 0 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 25px;
  line-height: 1.1;
}
.p-card__link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--radius-lg);
}
/* Одна строка вместо таблицы «подпись → значение»: на карточке шириной 270 px
   две колонки dt/dd переносились по слогам и превращались в кашу. Полный набор
   характеристик всё равно живёт на странице камня. */
.p-card__meta {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.section--ink .p-card__meta { color: var(--on-ink-dim); }
/* Затемнение --faint нужно светлому каталогу, но на тёмной витрине тот же
   цвет опускается до 3.4:1 — там берём цвет тёмного контекста. */
.section--ink .p-card__kicker, .on-ink .p-card__kicker,
.section--ink .p-card__note, .on-ink .p-card__note { color: var(--on-ink-dim); }
.p-card__foot {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.p-card__price {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 25px;
  line-height: 1;
}
.p-card__price--ask {
  font-family: Inter, sans-serif;
  font-size: 14px;
  color: var(--muted);
}
.p-card__price small { font-size: 15px; color: var(--muted); }
.p-card__note { color: var(--faint); font-size: 12px; }

/* Карточка на тёмном фоне (витрина главной) */
.section--ink .p-card {
  background: var(--ink-2);
  border-color: var(--ink-line-2);
  color: var(--on-ink);
}
.section--ink .p-card__media {
  background: radial-gradient(120% 96% at 50% 24%, #262A32 0%, #1A1D23 52%, #131519 100%);
}
.section--ink .p-card__specs dd { color: var(--on-ink); }
.section--ink .p-card__title { color: var(--on-ink); }
/* «по запросу» набрано цветом для светлой карточки; на тёмной витрине
   главной это давало 3.09:1 при требуемых 4.5. */
.section--ink .p-card__price--ask, .on-ink .p-card__price--ask { color: var(--on-ink-dim); }

/* ==========================================================================
   Каталог: фильтры + сетка
   ========================================================================== */
/* Ширина колонки фильтров через clamp, а не фиксированные px: жёсткая ширина
   на промежуточных экранах либо давит сетку, либо оставляет пустоту. */
.catalog {
  display: grid;
  grid-template-columns: clamp(216px, 19vw, 272px) minmax(0, 1fr);
  gap: clamp(28px, 3vw, 48px);
  align-items: start;
}
/* На десктопе оболочка прозрачна для грида: .filters остаётся его колонкой. */
.filters-shell { display: contents; }
.filters { position: sticky; top: calc(var(--header-h) + 20px); }
.filters__head { display: none; }   /* заголовок и «закрыть» нужны только в шторке */
.filters-back { display: none; }
.filters__group + .filters__group {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}
.filters__title {
  margin-bottom: 12px;
  color: var(--faint);
  font: 600 11px/1 Inter, sans-serif;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .18s var(--ease), background .18s var(--ease),
              color .18s var(--ease);
}
.chip:hover { border-color: var(--text); color: var(--text); }
.chip[aria-pressed='true'] {
  border-color: var(--text);
  background: var(--text);
  color: var(--paper);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 14px;
}
.toolbar b { color: var(--text); font-weight: 600; }
.toolbar__controls {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;             /* иначе select не даёт группе сжаться и уезжает за край */
}
.select {
  min-height: 40px;
  padding: 9px 34px 9px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card)
    url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236A645C' stroke-width='1.4'/%3E%3C/svg%3E")
    no-repeat right 13px center;
  font-size: 14px;
  appearance: none;
  cursor: pointer;
}
.empty {
  padding: 64px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--muted);
}
.filters__mobile { display: none; }

/* ==========================================================================
   Карточка камня (страница)
   ========================================================================== */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-block: 22px;        /* block: элемент несёт и класс .wrap с полями */
  color: var(--faint);
  font-size: 13px;
}
.crumbs li::after { content: '·'; margin-left: 8px; opacity: .6; }
.crumbs li:last-child::after { content: none; }
.crumbs a:hover { color: var(--text); }

.stone {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 56px;
  align-items: start;
}
.stone__stage {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  padding: 8%;
  background: radial-gradient(118% 92% at 50% 20%, #FFFFFF 0%, #FAF7F2 48%, #F1ECE3 100%);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
}
.stone__stage img {
  width: 100%; height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 34px 44px rgba(38, 28, 12, .26));
}
.stone h1 { font-size: clamp(36px, 4vw, 58px); margin-bottom: 14px; }
.stone__flags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.stone__price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 14px;
  margin: 28px 0 6px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 44px;
  line-height: 1;
}
.stone__price--ask { font-size: 30px; color: var(--muted); }
.stone__cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 34px; }

.specs {
  border-top: 1px solid var(--line);
  margin: 0;
}
.specs > div {
  display: grid;
  grid-template-columns: minmax(0, 168px) minmax(0, 1fr);
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 15px;
}
.specs dt { color: var(--muted); }
.specs dd { margin: 0; }

.trust {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 1px;
  margin-top: 40px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.trust > div { padding: 20px; background: var(--card); }
.trust h4 { margin-bottom: 6px; }
.trust p { color: var(--muted); font-size: 13px; }

/* ==========================================================================
   Контентные блоки
   ========================================================================== */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 20px;
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 232px;
  padding: 26px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--card);
  transition: border-color .25s var(--ease), transform .25s var(--ease),
              box-shadow .25s var(--ease);
}
.tile:hover {
  transform: translateY(-3px);
  border-color: var(--line);
  box-shadow: var(--shadow-card);
}
.tile h3 { margin-top: auto; }
.tile p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.tile__count {
  align-self: flex-start;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font: 500 12px/1 Inter, sans-serif;
}
.tile a::after { content: ''; position: absolute; inset: 0; }

.section--ink .tile {
  background: var(--ink-2);
  border-color: var(--ink-line-2);
  color: var(--on-ink);
}
.section--ink .tile:hover { border-color: var(--ink-line); }
.section--ink .tile__count { border-color: var(--ink-line); color: var(--on-ink-dim); }

/* Разворот «текст + фото» во всю ширину: картинки full-bleed, текст — в колонке.
   Длинные строки поверх фото убивают и читаемость, и «дорогое» ощущение. */
.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 0;
  background: var(--ink);
  color: var(--on-ink);
}
.split__text { padding: clamp(40px, 6vw, 88px); }
.split__media { position: relative; align-self: stretch; min-height: 420px; }
.split__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.split--flip .split__text { order: 2; }

.steps { counter-reset: s; display: grid; gap: 1px; background: var(--line-soft); }
.steps > li {
  counter-increment: s;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 22px;
  padding: 26px 4px;
  background: var(--paper);
}
.steps > li::before {
  content: counter(s, decimal-leading-zero);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 30px;
  color: var(--gold);
  line-height: 1;
}
.steps h3 { margin-bottom: 6px; }
.steps p { color: var(--muted); font-size: 15px; max-width: var(--measure); }

.faq details {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.faq summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  cursor: pointer;
  list-style: none;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 23px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--gold); font-size: 22px; }
.faq details[open] summary::after { content: '–'; }
.faq p { margin-top: 14px; color: var(--muted); max-width: var(--measure); }

/* Ширину строки ограничиваем на ДЕТЯХ, а не на самом .prose.
   Блок всегда несёт и класс .wrap, у которого есть `margin-inline: auto`.
   Более узкий `max-width` на том же элементе выигрывает, и колонка не
   прижимается к левому краю контейнера, а центруется в окне: заголовок
   страницы оставался на x=100, а текст под ним уезжал на x=389 — узкая
   полоса посреди страницы. Ровно та же ловушка была у героя. */
.prose > * { max-width: var(--measure); }
.prose h2 { margin: 48px 0 16px; }
.prose h3 { margin: 32px 0 10px; }
.prose p, .prose li { color: var(--muted); }
.prose ul { margin: 0 0 1em; padding-left: 22px; list-style: disc; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--mineral); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- форма заявки ---------- */
.form { display: grid; gap: 18px; max-width: 560px; }
/* Сноска под формой набрана 13px и на всю ширину формы давала 79 знаков в
   строке — мелкий кегль требует более короткой меры, а не той же. */
.form .muted { max-width: var(--measure-note); }
.field { display: grid; gap: 7px; }
.field > span { font-size: 13px; color: var(--muted); }
.field input, .field textarea, .field select {
  min-height: 48px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 15px;
}
.field textarea { min-height: 128px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--gold); }
.field [aria-invalid='true'] { border-color: var(--rare); }
.field__err { color: var(--rare); font-size: 13px; min-height: 0; }
.consent {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  font-size: 13px;
  color: var(--muted);
}
.consent input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--gold); }

/* ==========================================================================
   Подвал
   ========================================================================== */
.footer {
  padding: 76px 0 32px;
  background: var(--ink);
  color: var(--on-ink-dim);
  font-size: 14px;
}
.footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
  gap: 44px 32px;
}
.footer__brand img { width: 176px; margin-bottom: 20px; }
.footer h4 {
  margin-bottom: 16px;
  color: var(--on-ink);
  font: 600 11px/1 Inter, sans-serif;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.footer li { margin-bottom: 11px; }
.footer a:hover { color: var(--on-ink); }
.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--ink-line-2);
  font-size: 13px;
}

/* ---------- cookie-баннер, тосты, модалки ---------- */
.cookie {
  position: fixed;
  left: 20px; right: 20px; bottom: 20px;
  z-index: 120;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 780px;
  margin-inline: auto;
  padding: 20px 24px;
  background: var(--ink-2);
  color: var(--on-ink);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
  font-size: 14px;
}
.cookie a { color: var(--gold-lift); text-decoration: underline; }

.toasts {
  position: fixed;
  left: 50%; bottom: 26px;
  z-index: 130;
  display: grid;
  gap: 8px;
  transform: translateX(-50%);
}
.toast {
  padding: 13px 20px;
  background: var(--ink-2);
  color: var(--on-ink);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: 0 18px 40px rgba(0,0,0,.34);
}

.modal-back {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8,9,11,.66);
}
.modal {
  width: min(520px, 100%);
  padding: 32px;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 90px rgba(0,0,0,.3);
}
.modal h3 { margin-bottom: 12px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ---------- появление при прокрутке ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.reveal[data-shown] { opacity: 1; transform: none; }

/* ==========================================================================
   Адаптив. Проверяется замером на 375 / 768 / 1000 / 1440.
   ========================================================================== */
/* ── 1080: навигация → бургер ────────────────────────────────────────────
   Полная шапка требует ≥1054 px. Порог 1000, стоявший здесь раньше, оставлял
   слепую зону 1001–1080: на iPad 768 портретом всё ещё срабатывал, а вот на
   1024–1080 меню и кнопки уже не помещались. */
@media (max-width: 1080px) {
  .nav { display: none; }
  .burger { display: inline-flex; }
  .header__bar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; }
  /* В компактной шапке остаются лого + переключатель языка + бургер.
     «Задать вопрос» продублирована в бургер-меню. */
  .header__actions .btn:not(.burger) { display: none; }

  .split { grid-template-columns: minmax(0, 1fr); }
  .split--flip .split__text { order: 0; }
  .split__media { min-height: 320px; }
}

/* ── 960: каталог и карточка в одну колонку, фильтры → шторка ───────────── */
@media (max-width: 960px) {
  .catalog { grid-template-columns: minmax(0, 1fr); gap: 0; }

  /* Выезжающая шторка справа. В потоке панель фильтров занимала целый экран
     перед первой карточкой — на телефоне до товара приходилось листать вслепую.

     Оболочка с overflow:hidden обязательна. Без неё закрытая шторка стоит за
     правым краем и даёт горизонтальный скролл: `position:fixed; right:0`
     отсчитывается от вьюпорта ВМЕСТЕ с полосой прокрутки, а критерий приёмки —
     scrollWidth === clientWidth. body{overflow-x:hidden} тут не спасает:
     фиксированный элемент не обрезается overflow предка. */
  .filters-shell {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 109;
    overflow: hidden;
    pointer-events: none;
  }
  .filters-shell[data-open] { pointer-events: auto; }

  .filters {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    width: min(88vw, 340px);
    padding: 20px 24px 32px;
    background: var(--card);
    border-left: 1px solid var(--line);
    box-shadow: -24px 0 60px rgba(20, 16, 10, .18);
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(100%);
    /* visibility убирает закрытую шторку из порядка табуляции: иначе с
       клавиатуры Tab уходит в невидимые фильтры. Задержка равна длительности
       выезда, чтобы анимация закрытия оставалась видимой. */
    visibility: hidden;
    transition: transform .3s var(--ease), visibility 0s linear .3s;
  }
  .filters[data-open] {
    transform: translateX(0);
    visibility: visible;
    transition: transform .3s var(--ease), visibility 0s;
  }
  .filters__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line-soft);
  }
  .filters__head b { font-size: 15px; }
  /* Затемнение ведём состоянием оболочки, а не атрибутом hidden: `display:block`
     в этом медиазапросе перебивает браузерное `display:none` от [hidden], и
     закрытая шторка оставляла серую пелену поверх каталога. */
  .filters-back {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(8, 9, 11, .5);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s var(--ease);
  }
  .filters-back[hidden] { display: none; }          /* состояние без JS */
  .filters-shell[data-open] .filters-back { opacity: 1; pointer-events: auto; }
  .filters__mobile { display: inline-flex; }

  .stone { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .stone__stage { position: static; }

  .footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 28px; }
  .footer__brand { grid-column: 1 / -1; }
}

/* ── 760: компактное лого ───────────────────────────────────────────────── */
@media (max-width: 760px) {
  :root { --header-h: 66px; }
  .header__logo img { width: 138px; }
  .section-head { grid-template-columns: minmax(0, 1fr); gap: 20px; margin-bottom: 32px; }
}

/* ── 720: поля full-width листинга сравниваются с полями контейнера ─────── */
@media (max-width: 720px) {
  :root { --gut-wide: 20px; }
}

/* ── 640: поля контейнера уже, вертикальный ритм плотнее ────────────────── */
@media (max-width: 640px) {
  :root { --gut: 20px; }
  .section { padding: 62px 0; }
  .section--tight { padding: 46px 0; }
  .hero__inner { min-height: auto; padding-block: 76px 56px; }
  .hero__facts { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .hero__facts b { font-size: 26px; }
  .hero__cta .btn { flex: 1 1 100%; }
  /* «Показать фильтры» и селект сортировки в одну строку не влезали, и селект
     уходил за правый край. min-width:0 обязателен — без него select не даёт
     группе сжаться. */
  .toolbar__controls { flex: 1 1 100%; }
  .toolbar__controls .select { flex: 1; min-width: 0; }
  .grid-stones { grid-template-columns: repeat(auto-fill, minmax(min(100%, 158px), 1fr)); gap: 18px 14px; }
  .p-card__media { padding: 14px; }
  .p-card__body { padding: 15px 14px 14px; }
  .p-card__title { font-size: 20px; }
  .stone__price { font-size: 34px; }
  .stone__cta .btn { flex: 1 1 100%; }
  .specs > div { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 11px 0; }
  .steps > li { grid-template-columns: 40px minmax(0, 1fr); gap: 14px; }
  .footer__grid { grid-template-columns: minmax(0, 1fr); }
  .cookie { left: 12px; right: 12px; bottom: 12px; padding: 16px; }
}

/* ── 400: товары в одну колонку ─────────────────────────────────────────── */
@media (max-width: 400px) {
  .grid-stones { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .header__logo img { width: 124px; }

  /* Карточка разворачивается горизонтально. Квадратная сцена во всю ширину
     давала карточку высотой ~1180 px: восемь позиций — это 9 экранов вслепую.
     «Одна колонка» из стандарта — про одну карточку в ряду, а не про
     обязательно вертикальную карточку. */
  .p-card { flex-direction: row; align-items: stretch; }
  .p-card__media {
    flex: 0 0 42%;
    aspect-ratio: auto;
    padding: 10px;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  }
  .p-card__body { justify-content: center; padding: 14px 14px 14px 12px; }
  .p-card__title { font-size: 21px; }
  .p-card__foot { padding-top: 12px; }
  .p-card__flags { top: 8px; left: 8px; }
}

/* Крупные тап-таргеты только на сенсорных экранах — вид на десктопе не меняется */
@media (pointer: coarse) {
  .nav a, .footer a, .crumbs a, .link { min-height: 44px; display: inline-flex; align-items: center; }
  .chip { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .header, .footer, .cookie, .toasts, .skip-link, .hero__media { display: none; }
  body { background: #fff; }
}
