/* ── Products page ─────────────────────────────── */

.products {
  margin: 32px 50px 80px;
}

/* ── Header row (title + sort) ────────────────── */

.products__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
}

.products__title {
  font-size: 48px;
  font-weight: 700;
  text-transform: uppercase;
  color: #111;
  line-height: 1.1;
}

.sort-dropdown {
  position: relative;
  flex-shrink: 0;
}

.sort-dropdown__btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: #f4f4f4;
  border: 1px solid #111;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Sansation', Arial, sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #111;
  white-space: nowrap;
  transition: background 0.2s;
}

.sort-dropdown__btn:hover {
  background: #eaeaea;
}

.sort-dropdown__arrow {
  width: 16px;
  height: 16px;
  display: block;
  transition: transform 0.2s;
  filter: invert(1);
}

.sort-dropdown.open .sort-dropdown__arrow {
  transform: rotate(180deg);
}

.sort-dropdown__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 100%;
  background: #fff;
  border: 1px solid #111;
  border-radius: 10px;
  list-style: none;
  margin: 0;
  padding: 6px 0;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.sort-dropdown__option {
  display: block;
  width: 100%;
  padding: 10px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Sansation', Arial, sans-serif;
  font-size: 18px;
  font-weight: 400;
  color: #111;
  text-align: left;
  white-space: nowrap;
  transition: background 0.15s;
}

.sort-dropdown__option:hover {
  background: #f4f4f4;
}

.sort-dropdown__option--active {
  font-weight: 700;
  color: #ff7d01;
}

/* ── Brand cards ──────────────────────────────── */

.brands {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.brand-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 63px 0 55px 60px;
  background: white;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border: 6px solid #fff;
  transition: .2s ease-in-out;
}

.brand-card * {
  transition: .2s ease-in-out;
}

.brand-card:hover {
  border: 6px solid #FF7D01;
  background: #171717;
}

.brand-card:hover .brand-card__title,
.brand-card:hover .brand-card__desc {
  color: #fff;
}

.brand-card--dark {
  border-radius: 20px;
  border: 4px solid #ff7d01;
  background: #171717;
  color: white;
}

.brand-card__title {
  font-size: 64px;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.1;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.brand-card__desc {
  font-size: 18px;
  line-height: 1.45;
  max-width: 60%;
  overflow-wrap: break-word;
  word-break: break-word;
  position: relative;
  z-index: 1;
}

/* РВСА — robot arm image, absolutely positioned at right, overflows top */
.brand-card__img {
  position: absolute;
  right: -100px;
  top: -15px;
  pointer-events: none;
}

.brand-card__img img {
  width: 480.626px;
  height: 319.195px;  
  transform: rotate(16.571deg);
}

/* CUPAM — helmet, narrow strip at right */
.brand-card__img--cupam {
  top: -10px;
  height: 110%;
  right: 50px;
}

.brand-card__img--cupam img {
  transform: none;
  object-fit: cover;
  object-position: left top;
  width: 100%;
  height: 100%;
  right: auto;
  left: 0;
  top: 0;
}

/* Wrapper (used in РВСА card) */
.brand-card__wrapper {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  z-index: 1;
}

/* ── Product grid ─────────────────────────────── */

.products__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 50px;
}

.product-card {
  background: #fff;
  border-radius: 20px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.25s;
}

.product-card:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
}

.product-card__img-wrap {
  position: relative;
  margin: 10px 10px 0;
  border: 1px solid #e2e2e2;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: #f4f4f4;
}

.product-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-card__arrow {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: #ff7d01;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  rotate: -90deg;
}

.product-card__arrow img {
  width: 16px;
  height: 16px;
  display: block;
}

/* Body: Figma values — 30px top gap, 40px left padding */
.product-card__body {
  padding: 30px 20px 40px 40px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex: 1;
}

.product-card__title {
  font-size: 23px;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.2;
  color: #111;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: none;
}

.product-card__title span {
  color: #ff7d01;
}

.product-card__desc {
  font-size: 18px;
  line-height: 1.4;
  color: #666;
  overflow-wrap: break-word;
}

/* ── Pagination ───────────────────────────────── */

.products__pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.pag-page:nth-last-child {
  display: none;
}

.pag-arrow {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #ff7d01;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

.pag-arrow--next {
  rotate: -90deg;
}

.pag-arrow--prev {
  rotate: 90deg;
}

.pag-arrow:hover { opacity: 0.85; }

.pag-arrow img {
  width: 14px;
  height: 14px;
  display: block;
}

.pag-page {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: #fff;
  font-family: 'Sansation', Arial, sans-serif;
  font-size: 18px;
  font-weight: 400;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.pag-page:hover { background: #f0f0f0; }

.pag-page--active {
  background: #ff7d01;
  color: #fff;
}

.pag-page--active:hover { background: #ff7d01; }

/* ════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════ */

/* ── ≤1500px — 4 cols, cards narrower, scale title down */
@media (max-width: 1500px) {
  .product-card__title { font-size: 19px; }
  .product-card__body  { padding: 24px 16px 30px 30px; gap: 12px; }
}

/* ── ≤1300px — 4 cols still, compact further */
@media (max-width: 1300px) {
  .product-card__title { font-size: 16px; }
  .product-card__desc  { font-size: 15px; }
  .product-card__body  { padding: 20px 14px 26px 24px; gap: 10px; }

  .brand-card__desc    { max-width: 60%; }
}

/* ── ≤1200px — switch to 3 cols (wider cards → more space for text) */
@media (max-width: 1200px) {
  .products { margin: 32px 40px 60px; }

  .products__grid { grid-template-columns: repeat(3, 1fr); }

  .product-card__title { font-size: 20px; }
  .product-card__desc  { font-size: 17px; }
  .product-card__body  { padding: 26px 18px 32px 32px; gap: 12px; }

  .brand-card          { padding: 44px 0 40px 44px; min-height: 260px; }
  .brand-card__title   { font-size: 52px; }
  .brand-card__desc    { font-size: 16px; max-width: 60%; }

  .brands { gap: 20px; }
}

/* ── ≤960px — 2 cols, brand cards stack vertically */
@media (max-width: 960px) {
  .products { margin: 24px 28px 60px; }

  .products__title { font-size: 36px; }

  .brands { grid-template-columns: 1fr; gap: 16px; }

  .brand-card         { padding: 40px 0 36px 40px; min-height: 220px; }
  .brand-card__title  { font-size: 44px; }
  .brand-card__desc   { font-size: 15px; max-width: 65%; }

  .products__grid { grid-template-columns: repeat(2, 1fr); }

  .product-card__title { font-size: 18px; }
  .product-card__desc  { font-size: 15px; }
  .product-card__body  { padding: 22px 16px 28px 28px; gap: 10px; }
}

/* ── ≤768px — 2 cols, further compact */
@media (max-width: 768px) {
  .products { margin: 20px 20px 48px; }

  .products__title { font-size: 30px; }
  .sort-dropdown__btn  { font-size: 16px; padding: 9px 16px; }

  .brand-card__title { font-size: 36px; }
  .brand-card__desc  { font-size: 14px; max-width: 70%; }
  .brand-card        { min-height: 190px; padding: 32px 0 28px 32px; }

  .products__grid { gap: 14px; }

  .product-card__title { font-size: 15px; }
  .product-card__desc  { font-size: 13px; }
  .product-card__body  { padding: 16px 12px 20px 20px; gap: 8px; }
}

/* ── ≤640px — still 2 cols but tightest padding */
@media (max-width: 640px) {
  .products { margin: 16px 14px 40px; }

  .products__title { font-size: 26px; }
  .sort-dropdown__btn  { font-size: 13px; padding: 8px 12px; }
  .sort-dropdown__arrow { width: 14px; height: 14px; }

  .brands { gap: 12px; }
  .brand-card        { padding: 28px 0 24px 24px; min-height: 160px; }
  .brand-card__title { font-size: 30px; }
  .brand-card__desc  { font-size: 13px; max-width: 72%; }

  .products__grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  .product-card__title { font-size: 13px; line-height: 1.25; }
  .product-card__desc  { font-size: 12px; }
  .product-card__body  { padding: 12px 10px 16px 16px; gap: 6px; }

  .product-card__img-wrap { margin: 8px 8px 0; }

  .product-card__arrow { width: 32px; height: 32px; top: 12px; right: 12px; }
  .product-card__arrow img { width: 12px; height: 12px; }

  .pag-arrow,
  .pag-page { width: 40px; height: 40px; font-size: 15px; }
}

/* ── ≤420px — 1 col */
@media (max-width: 420px) {
  .products { margin: 14px 12px 36px; }

  .brand-card__img { display: none; }
  .brand-card__desc { max-width: 100%; }

  .products__grid { grid-template-columns: 1fr; }

  .product-card__title { font-size: 20px; }
  .product-card__desc  { font-size: 15px; }
  .product-card__body  { padding: 22px 20px 28px 28px; gap: 10px; }

  .product-card__img-wrap { margin: 10px 10px 0; }

  .product-card__arrow { width: 40px; height: 40px; top: 20px; right: 20px; }
  .product-card__arrow img { width: 16px; height: 16px; }
}
