/* 07 «Бренди» — Figma node 48:436 (1800 × 800).
   Interaction follows the notes «07–08 — інтерактив для верстки». */

/* --m: one design pixel of the marquees. */
.brands { --m: var(--ui); gap: 0; padding: calc(112 * var(--ui)) 0 0; overflow: clip; }

.brands__head { display: flex; align-items: flex-start; justify-content: space-between; gap: calc(40 * var(--ui)); padding-inline: calc(64 * var(--u)); }
.brands__heading { display: flex; flex-direction: column; align-items: flex-start; gap: calc(13 * var(--ui)); }
.brands__heading .section-title { margin-left: calc(-4 * var(--ui)); }

.brands__intro { width: calc(480 * var(--ui)); margin-top: calc(64 * var(--ui)); }
.brands__lead { font-size: calc(18 * var(--ui)); line-height: calc(24 * var(--ui)); color: var(--color-text-secondary); }
.brands__stats { display: flex; gap: calc(48 * var(--ui)); margin-top: calc(32 * var(--ui)); }
/* fixed widths: the second figure must not shift while the first one counts */
.brands__stats li { display: flex; flex-direction: column; gap: calc(4 * var(--ui)); width: calc(124 * var(--ui)); }
.brands__stats li + li { width: calc(194 * var(--ui)); }
.brands__stats strong { position: relative; top: calc(1 * var(--ui)); font-family: var(--font-display); font-weight: 500; font-size: calc(44 * var(--ui)); line-height: calc(46 * var(--ui)); letter-spacing: -.025em; white-space: nowrap; }
.brands__stats span { font-size: calc(13 * var(--ui)); line-height: calc(16 * var(--ui)); color: var(--color-text-secondary); }

/* ───────────── Marquees ─────────────
   Without JavaScript or with reduced motion the brands simply wrap; brands.js turns on the loop. */
.marquee { margin-top: calc(112 * var(--ui)); }
.marquee--outline { margin-top: calc(38 * var(--m)); }
.marquee__group { display: flex; flex-wrap: wrap; align-items: center; row-gap: calc(40 * var(--m)); padding-inline: calc(64 * var(--u)); }
.marquee__item { display: flex; align-items: center; gap: calc(40 * var(--m)); padding-right: calc(40 * var(--m)); }
.marquee__star {
  flex: none;
  width: calc(28 * var(--m));
  height: calc(28 * var(--m));
  background: url("../assets/brands/star.svg") center / contain no-repeat;
  transition: translate .45s cubic-bezier(.23, 1, .32, 1);
}

.brands:not(.brands--live) .marquee__item:last-child .marquee__star { display: none; }

.brands--live .marquee { height: calc(112 * var(--m)); }
.brands--live .marquee--outline { height: calc(84 * var(--m)); }
.brands--live .marquee__skew { height: 100%; }
.brands--live .marquee__track { display: flex; width: max-content; height: 100%; }
.brands--live .marquee__track.is-gliding { transition: translate .5s cubic-bezier(.23, 1, .32, 1); }
.brands--live .marquee__group { flex: none; flex-wrap: nowrap; padding: 0; }

.brand {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-start;
  gap: calc(12 * var(--m));
  height: calc(84 * var(--m));
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-text-primary);
  font: inherit;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
/* the yellow pill grows behind the name, so nothing in the row moves */
.brand::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: calc(-14 * var(--m)) calc(-32 * var(--m));
  border-radius: var(--radius-full);
  background: var(--color-bg-accent);
  opacity: 0;
  transform: scale(.9, .72);
  transition: opacity .2s ease, transform .45s cubic-bezier(.23, 1, .32, 1);
}
.brand__name {
  display: block;
  padding-right: .035em; /* Figma adds no tracking after the last glyph */
  font-family: var(--font-display);
  font-weight: 500;
  font-size: calc(88 * var(--m));
  line-height: calc(84 * var(--m));
  letter-spacing: -.035em;
}
.brand__cat { display: block; font-weight: 500; font-size: max(11px, 12 * var(--m)); line-height: 1.25; color: var(--color-text-secondary); transition: color .2s ease; }
.brand__name, .brand__cat { transition: translate .45s cubic-bezier(.23, 1, .32, 1), color .35s ease; }

/* outline row: 1.2 px outside the glyph, as in Figma — the page-coloured fill hides the inner half */
.marquee--outline .brand__name { color: var(--color-bg-page); -webkit-text-stroke: calc(2.4 * var(--m)) var(--color-text-primary); paint-order: stroke fill; }

.brand:focus-visible { outline: 0; }
.brand.is-lit::before { opacity: 1; transform: none; }
.brand.is-lit .brand__name, .brand.is-lit .brand__cat { color: var(--color-text-primary); }
.brand:focus-visible::before { opacity: 1; transform: none; box-shadow: 0 0 0 2px var(--color-bg-strong); }
.brand:focus-visible .brand__name, .brand:focus-visible .brand__cat { color: var(--color-text-primary); translate: 0 calc(-2 * var(--m)); }
.marquee__item:has(.brand:focus-visible) > .marquee__star { translate: calc(16 * var(--m)) 0; }
.marquee__item:has(+ .marquee__item > .brand:focus-visible) > .marquee__star { translate: calc(-16 * var(--m)) 0; }
@media (hover: hover) {
  .brand:hover::before { opacity: 1; transform: none; }
  .brand:hover .brand__name, .brand:hover .brand__cat { color: var(--color-text-primary); translate: 0 calc(-2 * var(--m)); }
  /* the neighbouring stars step aside to give the pill room */
  .marquee__item:has(.brand:hover) > .marquee__star { translate: calc(16 * var(--m)) 0; }
  .marquee__item:has(+ .marquee__item > .brand:hover) > .marquee__star { translate: calc(-16 * var(--m)) 0; }
}

.brands__note {
  position: relative;
  top: calc(1 * var(--ui)); /* 1px lower: Figma's baseline rounding */
  margin-top: calc(45 * var(--ui));
  padding-inline: calc(64 * var(--u));
  font-weight: 600;
  font-size: calc(14 * var(--ui));
  line-height: calc(17 * var(--ui));
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}
.brands__rule { height: 1px; margin: calc(63 * var(--ui)) calc(64 * var(--u)) 0; background: rgb(28 27 25 / .12); }

/* ───────────── Catalog filtered by a brand (03) ───────────── */
/* keeps the category cards' own hover shadow transition (catalog.css) */
.catalog .tile { transition: opacity .45s ease, box-shadow .2s ease; }
.catalog.is-filtered .tile:not(.is-match) { opacity: .28; }
/* sticks to the bottom of the screen while the catalog is in view, takes no room in the page */
.catalog__filter { position: sticky; bottom: 20px; z-index: 5; display: flex; align-items: flex-end; justify-content: center; height: 0; pointer-events: none; }
.catalog__filter-pill {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 100%;
  padding: 8px 8px 8px 22px;
  border-radius: 28px;
  background: var(--color-bg-strong);
  color: var(--color-text-inverse);
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 12px 32px rgb(28 27 25 / .25);
  opacity: 0;
  visibility: hidden;
  translate: 0 12px;
  transition: opacity .3s ease, translate .45s cubic-bezier(.23, 1, .32, 1), visibility .45s;
}
.catalog__filter.is-on .catalog__filter-pill { opacity: 1; visibility: visible; translate: none; pointer-events: auto; }
.catalog__filter-clear { flex: none; padding: 10px 16px; border: 0; border-radius: var(--radius-full); background: var(--color-bg-accent); color: var(--color-text-primary); font: 600 13px / 1.2 var(--font-ui); cursor: pointer; }

/* ───────────── Narrower windows (Figma has only the 1800 frame) ───────────── */
@media (max-width: 1099px) {
  .brands { --m: .72px; gap: 0; padding: 72px 0 0; }
  .brands__head { flex-direction: column; gap: 24px; padding-inline: 20px; }
  .brands__heading .section-title { margin-left: 0; font-size: clamp(34px, 11cqw, 88px); }
  .brands__intro { width: auto; max-width: 480px; margin-top: 0; }
  .brands__lead { font-size: 16px; line-height: 1.45; }
  .brands__stats { gap: 32px; margin-top: 24px; }
  .brands__stats li, .brands__stats li + li { width: auto; min-width: 124px; }
  .brands__stats li + li { min-width: 168px; }
  .brands__stats strong { font-size: clamp(32px, 9cqw, 44px); }
  .marquee { margin-top: 56px; }
  .marquee__group { padding-inline: 20px; }
  .brands__note { margin-top: 40px; padding-inline: 20px; font-size: 12px; line-height: 1.5; }
  .brands__rule { margin: 48px 20px 0; }
}
@media (max-width: 699px) {
  .brands { --m: .54px; }
  .brands__stats { gap: 20px; }
  .brands__stats li, .brands__stats li + li { min-width: 0; flex: 1; }
}
@media (min-width: 600px) and (max-width: 1099px) {
  .brands__head, .marquee__group, .brands__note { padding-inline: 40px; }
  .brands__rule { margin-inline: 40px; }
  .brands--live .marquee__group { padding: 0; }
}
