/* 03 «Каталог» — Figma node 34:313. Bento of 4 × 3 cells, 400 × 320 each at the 1800 width, 24 apart. */
.catalog { padding-top: calc(40 * var(--ui)); }

.catalog__intro { display: flex; flex-direction: column; align-items: flex-start; gap: calc(32 * var(--ui)); }
.catalog__intro .section-lead { position: relative; top: calc(-1 * var(--ui)); width: calc(560 * var(--ui)); }
.catalog__actions { display: flex; align-items: center; gap: calc(12 * var(--ui)); }
.catalog__actions .btn { min-width: calc(178 * var(--ui)); }

.search {
  display: flex;
  align-items: center;
  gap: calc(12 * var(--ui));
  width: calc(340 * var(--ui));
  height: calc(57 * var(--ui));
  padding: 0 calc(14 * var(--ui)) 0 calc(24 * var(--ui)); /* tighter right side: the full placeholder fits */
  border: 1px solid rgb(28 27 25 / .12);
  border-radius: var(--radius-full);
  background: rgb(255 255 255 / .25);
  cursor: text;
  transition: border-color .2s ease;
}
.search:focus-within { border-color: var(--color-bg-strong); }
.search__icon {
  flex: none;
  width: calc(20 * var(--ui));
  height: calc(20 * var(--ui));
  background: url("../assets/catalog/icon-search.svg") no-repeat center;
  background-size: calc(15.13 * var(--ui)) calc(15.13 * var(--ui));
}
.search input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  font: 500 calc(15 * var(--ui)) / 1.5 var(--font-ui);
  color: var(--color-text-primary);
  text-overflow: ellipsis;
}
.search input::placeholder { color: var(--color-text-secondary); opacity: 1; }

/* Button v2, Outline */
.btn--outline { border: 1.5px solid var(--color-bg-strong); color: var(--color-text-primary); }
@media (hover: hover) { .btn--outline:hover { background: rgb(28 27 25 / .06); } }

/* ───────────── Bento ───────────── */
.bento-wrap { container-type: inline-size; }
.bento {
  --gap: calc(24 * var(--ui));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: calc((100cqw - 3 * var(--gap)) / 5); /* a quarter of the width × 0.8: the photos' 5:4 */
  gap: var(--gap);
}
.tile {
  /* --t: one design pixel of tile text. Follows the tile's width (content 344 at the 1800 frame),
     so words keep clear of the product in the photo when tiles get narrow. */
  --t: min(var(--ui), 100cqw / 344);
  container-type: inline-size;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
  gap: calc(16 * var(--ui));
  padding: calc(28 * var(--ui));
  border-radius: calc(22 * var(--ui));
}
.tile__photo {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile__num {
  position: absolute;
  top: calc(29 * var(--t)); /* 29: Figma's baseline rounding */
  right: calc(28 * var(--t));
  font-weight: 600;
  font-size: max(11px, 14 * var(--t));
  line-height: max(14px, 17 * var(--t));
  letter-spacing: .04em;
  color: var(--color-text-secondary);
}
.tile__title {
  max-width: min(230 * var(--t), 100% - 24 * var(--t)); /* never runs under the tile number */
  font-family: var(--font-display);
  font-weight: 500;
  font-size: max(17px, 30 * var(--t));
  line-height: max(18px, 32 * var(--t));
  letter-spacing: -.02em;
}
.tags { display: flex; flex-wrap: wrap; gap: calc(8 * var(--t)); max-width: calc(230 * var(--t)); }
.tags li {
  padding: calc(4 * var(--t)) calc(12 * var(--t));
  border-radius: var(--radius-full);
  background: rgb(28 27 25 / .06);
  font-size: max(10px, 12 * var(--t));
  line-height: max(13px, 15 * var(--t));
  white-space: nowrap;
}

/* 01: the large tile, 2 × 2 cells */
.tile--kits { --t: min(var(--ui), 100cqw / 768); grid-column: span 2; grid-row: span 2; gap: calc(20 * var(--ui)); border-radius: calc(28 * var(--ui)); }
.tile--kits .tile__title {
  position: relative;
  top: calc(1 * var(--ui));
  margin-bottom: 0;
  max-width: calc(420 * var(--t));
  font-size: max(24px, 44 * var(--t));
  line-height: max(25px, 46 * var(--t));
  letter-spacing: -.025em;
}
.tile--kits .tags { max-width: calc(420 * var(--t)); }
.tile__text {
  max-width: calc(380 * var(--t));
  font-size: max(12px, 15 * var(--t));
  line-height: max(18px, 23 * var(--t));
  color: var(--color-text-secondary);
}
.tile__cta { position: absolute; bottom: calc(28 * var(--ui)); left: calc(28 * var(--ui)); }

/* Category tiles. The hover state is the one drawn on tile 03 in Figma: lighter, raised, with a button. */
.tile--category { transition: box-shadow .2s ease; }
.tile--category::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgb(255 255 255 / .28);
  opacity: 0;
  transition: opacity .2s ease;
}
.tile__link { outline: none; }
.tile__link::after { content: ""; position: absolute; inset: 0; z-index: 1; } /* the whole tile is the link */
.tile__go {
  position: absolute;
  bottom: calc(28 * var(--ui));
  left: calc(28 * var(--ui));
  opacity: 0;
  translate: 0 8px;
  transition: opacity .2s ease, translate .2s cubic-bezier(.23, 1, .32, 1), background-color .2s ease;
}
.tile--category:has(:focus-visible) { box-shadow: 0 calc(14 * var(--ui)) calc(36 * var(--ui)) rgb(38 26 13 / .14); outline: 2px solid var(--color-bg-strong); outline-offset: 3px; }
.tile--category:has(:focus-visible)::before { opacity: 1; }
.tile--category:has(:focus-visible) .tile__go { opacity: 1; translate: 0 0; }
@media (hover: hover) {
  .tile--category:hover { box-shadow: 0 calc(14 * var(--ui)) calc(36 * var(--ui)) rgb(38 26 13 / .14); }
  .tile--category:hover::before { opacity: 1; }
  .tile--category:hover .tile__go { opacity: 1; translate: 0 0; }
}

/* The yellow figure tile */
.tile--stat { justify-content: space-between; background: var(--color-bg-accent); }
.tile__arc {
  position: absolute;
  top: calc(-236 * var(--ui));
  right: calc(-196 * var(--ui));
  z-index: -1;
  width: calc(360 * var(--ui));
  height: calc(360 * var(--ui));
} /* the exported image already carries its 35% opacity */
.tile__label {
  position: relative;
  top: calc(1 * var(--ui));
  font-weight: 600;
  font-size: calc(14 * var(--ui));
  line-height: calc(17 * var(--ui));
  letter-spacing: .04em;
  text-transform: uppercase;
}
.tile__figure { display: flex; flex-direction: column; gap: calc(8 * var(--ui)); }
.tile__figure p {
  max-width: calc(330 * var(--t));
  font-size: max(11px, 15 * var(--t));
  line-height: max(17px, 23 * var(--t));
  color: var(--color-text-on-accent-muted);
}
.tile__figure .tile__big {
  max-width: none;
  font-family: var(--font-display);
  font-size: min(calc(72 * var(--ui)), 21cqw);
  line-height: .96;
  letter-spacing: -.035em;
  white-space: nowrap;
  color: var(--color-text-primary);
}

/* ───────────── More categories ───────────── */
.more { display: flex; flex-wrap: wrap; align-items: center; gap: calc(12 * var(--ui)); }
.more__label {
  font-weight: 600;
  font-size: calc(14 * var(--ui));
  line-height: normal;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}
.more__list { display: flex; flex-wrap: wrap; gap: calc(12 * var(--ui)); }
.pill {
  display: block;
  padding: calc(12 * var(--ui)) calc(20 * var(--ui));
  border: 1px solid rgb(28 27 25 / .12);
  border-radius: var(--radius-full);
  font-size: calc(15 * var(--ui));
  line-height: calc(23 * var(--ui));
  transition: background-color .2s ease, border-color .2s ease;
}
.pill--accent { border: 0; background: var(--color-bg-accent); } /* no stroke in Figma, so 2px smaller */
@media (hover: hover) {
  .pill:hover { background: rgb(28 27 25 / .06); border-color: rgb(28 27 25 / .24); }
  .pill--accent:hover { background: var(--color-bg-accent-hover); }
}

/* ───────────── Narrower windows ─────────────
   Figma has only the 1800 frame. */
@media (max-width: 1279px) {
  /* the headline and the intro no longer fit side by side, nor do four tiles */
  .catalog .section-head { flex-direction: column; align-items: flex-start; }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: calc((100cqw - var(--gap)) * .4); }
}
@media (max-width: 1099px) {
  .catalog { padding-block: 40px 72px; }
  .catalog__intro { gap: 24px; }
  .catalog__intro .section-lead { width: auto; }
  .bento { --gap: 16px; }
}
@media (max-width: 699px) {
  .catalog__actions { flex-direction: column; align-items: stretch; align-self: stretch; }
  .search { width: auto; height: 56px; }
  .bento { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; }
  .tile { aspect-ratio: 5 / 4; }
  .tile--kits { grid-column: auto; grid-row: auto; aspect-ratio: auto; padding-bottom: 0; }
  /* the kit photo goes under its text, cropped to the products on its right side */
  .tile--kits { background: #f1ece6; }
  .tile--kits .tile__photo { position: static; z-index: auto; order: 9; width: calc(100% + 56px); height: auto; margin: 0 -28px; aspect-ratio: 1; object-position: 90% 50%; }
  .tile__cta { position: static; }
  .tile__go { display: none; } /* the whole tile is tappable */
  .tile--kits .tile__title { max-width: calc(100% - 32px); font-size: clamp(26px, 9cqw, 34px); line-height: 1.06; }
  .tile--kits .tile__text { max-width: 100%; font-size: 15px; line-height: 23px; }
  .tile--kits .tags { max-width: 100%; }
  .tile--kits .tags li { padding: 4px 12px; font-size: 12px; line-height: 15px; }
  .tile--stat { gap: 40px; aspect-ratio: auto; min-height: 260px; }
}
