/*
 * ESR Türkiye — ana sayfa marka blokları (HOME2-BRANDS).
 * esr_collections (lisanslı koleksiyonlar: 1 büyük + 4 kart, kalanlar küçük kart şeridi),
 * esr_popular_devices (cihazına göre alışveriş kutuları), esr_brand_strip (marka şeridi).
 * Mobil önce (390px); 761px ve 1081px üstü genişler. Ürün fotoğrafları açık gri yüzeyde, multiply ile.
 */

/* ---------- Lisanslı koleksiyonlar ---------- */
.esr-collections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.esr-col-card {
  display: flex; flex-direction: column; min-width: 0; border-radius: var(--esr-radius); overflow: hidden;
  background: var(--esr-surface); color: var(--esr-text); transition: background-color 200ms ease;
}
.esr-col-lead { grid-column: 1 / -1; }
/* Tek kalan küçük kart satırı boş bırakmasın. */
.esr-collections > .esr-col-card:last-child:nth-child(even) { grid-column: 1 / -1; }

.esr-col-stage {
  display: grid; grid-template-columns: 1.35fr 1fr; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 6px 4px;
  height: 260px; padding: 20px 16px 0; box-sizing: border-box; overflow: hidden;
  contain: size; /* görseller kart yüksekliğini büyütmesin */
}
.esr-col-stage img {
  display: block; width: 100%; height: 100%; min-width: 0; min-height: 0;
  object-fit: contain; mix-blend-mode: multiply; transition: transform 500ms var(--esr-ease-out);
}
.esr-col-pic { display: contents; } /* <picture> ızgara öğesi olmasın; img doğrudan yerleşir */
.esr-col-stage-3 img:first-child { grid-row: span 2; }
.esr-col-stage-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); }
.esr-col-stage-1 { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }

.esr-col-shots {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); gap: 6px;
  height: 140px; padding: 14px 12px 0; box-sizing: border-box; overflow: hidden;
  contain: size;
}
.esr-col-shots-1 { grid-template-columns: minmax(0, 1fr); }
.esr-col-shots img {
  display: block; width: 100%; height: 100%; min-width: 0; object-fit: contain; object-position: center bottom;
  mix-blend-mode: multiply; transition: transform 400ms var(--esr-ease-out);
}

.esr-col-caption { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 14px; min-width: 0; }
.esr-col-caption b { font: 600 16px/1.2 var(--esr-font-display); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.esr-col-caption span { font-size: 13px; color: var(--esr-muted); white-space: nowrap; }
.esr-col-lead .esr-col-caption b { font-size: 21px; }

/* Kalan koleksiyonlar: mobilde yatay şerit, geniş ekranda sarmalı ızgara. */
.esr-col-rail {
  margin: 10px 0 0; padding: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: 64%; gap: 10px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
}
.esr-col-rail::-webkit-scrollbar { display: none; }
.esr-col-rail > * { scroll-snap-align: start; min-width: 0; }
.esr-col-rail:focus-visible, .esr-device-grid:focus-visible, .esr-brand-strip:focus-visible { outline: 2px solid var(--esr-text); outline-offset: 4px; border-radius: 4px; }
.esr-col-mini {
  display: flex; align-items: center; gap: 12px; height: 100%; box-sizing: border-box;
  padding: 8px 14px 8px 8px; border-radius: var(--esr-radius-sm); background: var(--esr-surface);
  color: var(--esr-text); transition: background-color 200ms ease;
}
.esr-col-mini-img { flex: 0 0 56px; height: 56px; display: flex; align-items: center; justify-content: center; }
.esr-col-mini-img img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.esr-col-mini-copy { display: flex; flex-direction: column; min-width: 0; }
.esr-col-mini-copy b { font: 600 15px/1.2 var(--esr-font-display); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.esr-col-mini-copy span { font-size: 13px; color: var(--esr-muted); }

@media (hover: hover) and (pointer: fine) {
  .esr-col-card:hover, .esr-col-mini:hover { background: var(--esr-surface-2); }
  .esr-col-card:hover .esr-col-stage img { transform: translateY(-4px); }
  .esr-col-card:hover .esr-col-shots img { transform: translateY(-4px); }
}

/* ---------- Cihazına göre alışveriş ---------- */
/* Mobil: yatay şerit (region + tabindex); 761px+: tek satır, kutu en çok 220px. */
.esr-device-grid {
  margin: 0; padding: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: 42%; gap: 10px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
}
.esr-device-grid::-webkit-scrollbar { display: none; }
.esr-device-grid > * { scroll-snap-align: start; min-width: 0; }
.esr-device-tile {
  display: flex; flex-direction: column; height: 236px; box-sizing: border-box; padding: 14px 14px 0;
  border-radius: var(--esr-radius); background: var(--esr-surface); color: var(--esr-text);
  overflow: hidden; transition: background-color 200ms ease;
}
.esr-device-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.esr-device-copy b { font: 600 15px/1.2 var(--esr-font-display); letter-spacing: -0.01em; }
.esr-device-copy span { font-size: 13px; color: var(--esr-muted); }
.esr-device-img { flex: 1; min-height: 0; display: flex; align-items: flex-end; justify-content: center; padding-top: 10px; }
.esr-device-img img {
  display: block; width: auto; height: 100%; max-width: 100%; object-fit: contain; object-position: center bottom;
  mix-blend-mode: multiply; transition: transform 300ms var(--esr-ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .esr-device-tile:hover { background: var(--esr-surface-2); }
  .esr-device-tile:hover img { transform: translateY(-4px); }
}

/* ---------- Marka şeridi ---------- */
.esr-brand-strip {
  margin: 0; padding: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: 38%; gap: 10px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
}
.esr-brand-strip::-webkit-scrollbar { display: none; }
.esr-brand-strip > * { scroll-snap-align: start; min-width: 0; }
.esr-brand-mark {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  height: 84px; box-sizing: border-box; padding: 10px 12px; text-align: center;
  border-radius: var(--esr-radius-sm); background: var(--esr-surface); color: var(--esr-text);
  transition: background-color 200ms ease;
}
.esr-brand-mark b {
  font: 600 17px/1.15 var(--esr-font-display); letter-spacing: -0.015em;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.esr-brand-mark img { display: block; max-width: 100%; height: 28px; width: auto; object-fit: contain; mix-blend-mode: multiply; }
.esr-brand-mark span { font-size: 12px; color: var(--esr-muted); }
@media (hover: hover) and (pointer: fine) { .esr-brand-mark:hover { background: var(--esr-surface-2); } }

/* ---------- 761px+ ---------- */
@media (min-width: 761px) {
  .esr-collections { grid-template-columns: 1.3fr 1fr 1fr; gap: 12px; }
  .esr-col-lead { grid-column: auto; grid-row: span 2; }
  .esr-collections > .esr-col-card:last-child:nth-child(even) { grid-column: span 2; }
  .esr-col-lead .esr-col-stage { flex: 1; height: auto; min-height: 380px; padding: 32px 28px 8px; gap: 12px 8px; }
  .esr-col-shots { flex: 1; height: auto; min-height: 200px; padding: 18px 16px 0; gap: 8px; }
  .esr-col-caption { flex-direction: row; justify-content: space-between; align-items: baseline; gap: 12px; padding: 16px 20px 18px; }
  .esr-col-caption b { font-size: 19px; }
  .esr-col-lead .esr-col-caption b { font-size: 24px; }

  /* Görünür marka sayısına göre: 1 → tek geniş kart, 2 → yan yana, 3 → büyük + 2 dikey. */
  .esr-collections-n1 { grid-template-columns: minmax(0, 1fr); }
  .esr-collections-n1 .esr-col-lead { grid-row: auto; }
  .esr-collections-n1 .esr-col-lead .esr-col-stage { min-height: 360px; }
  .esr-collections-n1 .esr-col-stage-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); }
  .esr-collections-n1 .esr-col-stage-3 img:first-child { grid-row: auto; }
  .esr-collections-n2 { grid-template-columns: 1.3fr 1fr; }
  .esr-collections-n2 .esr-col-lead { grid-row: auto; }
  .esr-collections.esr-collections-n2 > .esr-col-card:last-child:nth-child(even) { grid-column: auto; }
  .esr-collections-n3 { grid-template-columns: 1.3fr 1fr; }

  .esr-col-rail {
    grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px; margin-top: 12px; overflow: visible;
  }
  .esr-col-mini { padding: 10px 16px 10px 10px; }
  .esr-col-mini-img { flex-basis: 64px; height: 64px; }

  /* Tek satır: her kutu 0–220px arası (6 kutu ~1200px içerikte ~190px); az kutu sola yaslı kalır, sarmaz. */
  .esr-device-grid { grid-auto-flow: column; grid-auto-columns: minmax(0, 220px); grid-template-columns: none; justify-content: start; gap: 12px; overflow: visible; }
  .esr-device-tile { height: 264px; padding: 16px 16px 0; }
  .esr-device-copy b { font-size: 17px; }

  .esr-brand-strip { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; overflow: visible; }
  .esr-brand-mark { height: 96px; }
  .esr-brand-mark b { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .esr-col-stage img, .esr-col-shots img, .esr-device-img img { transition: none; }
  .esr-col-card:hover .esr-col-stage img, .esr-col-card:hover .esr-col-shots img, .esr-device-tile:hover img { transform: none; }
}
