/* PRODUCTS (ALL BRANDS) */

.p.intro{
  max-width:70ch;
  margin-top:12px;
}

.brand-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:14px;
  /* Prevent a single filtered result from stretching to fill the grid's min-height */
  align-content:start;
}

.brand-card{
  border:1px solid var(--line);
  border-radius: var(--radius);
  background:#fff;
  padding:18px;
  min-height:150px;
  box-shadow: var(--shadow-sm);
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
  cursor: pointer;
}

.brand-card:hover{
  transform: translateY(-4px);
  border-color: rgba(0,0,0,.12);
  box-shadow: var(--shadow-md);
}

.logo-wrap{
  height:52px;
  display:flex;
  align-items:center;
  justify-content: flex-start; /* Left-align logos */
}

.brand-card img{
  max-height:42px;
  max-width:100%;
  width:auto;
  height:auto;
  display:block;
  object-fit:contain;
  filter:none;
  opacity:1;
  transition: filter .22s var(--ease), opacity .22s var(--ease);
}

/* Grayscale on hover */
.brand-card:hover img{
  filter: grayscale(1) saturate(0) contrast(1.05);
  opacity:.78;
}

.meta{
  margin-top:14px;
  display:flex;
  flex-direction:column;
}

.name{
  font-family:"Space Grotesk", Inter, system-ui, sans-serif;
  font-weight:900;
  letter-spacing:-.02em;
  font-size: 15px;
}

.tag{
  margin-top:4px;
  font-size:13px;
  color: var(--muted);
}

.cta{
  margin-top:8px;
  font-size:12px;
  color: var(--text);
  display:inline-flex;
  align-items:center;
  gap:6px;
  align-self:flex-end;
  text-align:right;
  position:relative;
  transition: transform .18s var(--ease), color .18s var(--ease);
}
.cta::before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:-2px;
  height:1px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .24s var(--ease);
}
.cta::after{
  content:"→";
  opacity:.8;
}
.brand-card:hover .cta{
  color: var(--red);
  transform: translateX(2px);
}
.brand-card:hover .cta::before{
  transform: scaleX(1);
}

/* Responsive */
@media (max-width:980px){
  .brand-grid{ 
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  .brand-card{
    min-height: 140px;
    padding: 16px;
  }
}

@media (max-width:720px){
  .brand-grid{ 
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width:480px){
  .brand-grid{ 
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .brand-card{
    min-height: 120px;
  }
  .logo-wrap{
    height: 48px;
  }
  .brand-card img{
    max-height: 38px;
  }
}

/* PRODUCTS TOOLBAR (SEARCH + FILTERS) */
.products-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.search-wrap{
  position:relative;
  flex:1 1 320px;
  max-width:520px;
}

.search-input{
  width:100%;
  height:46px;
  padding:0 44px 0 44px;
  border:1px solid var(--line);
  border-radius: 999px;
  background:#fff;
  box-shadow: var(--shadow-sm);
  font: 500 14px/1.2 Inter, system-ui, sans-serif;
  color: var(--text);
  outline:none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}

/* Hide the browser's built-in clear (X) for type="search" so we only show our custom clear button */
.search-input[type="search"]::-webkit-search-cancel-button,
.search-input[type="search"]::-webkit-search-decoration{
  -webkit-appearance:none;
  appearance:none;
}
.search-input[type="search"]::-ms-clear,
.search-input[type="search"]::-ms-reveal{
  display:none;
  width:0;
  height:0;
}

.search-input::placeholder{ color: var(--muted); }

/* Hover and focus states for search input */
.search-input:hover,
.search-input:focus{
  border-color: rgba(209,15,27,.35);
  box-shadow: 0 0 0 4px rgba(209,15,27,.08);
}

.search-ico{
  position:absolute;
  left:16px;
  top:50%;
  width:18px;
  height:18px;
  transform: translateY(-50%);
  fill: var(--muted);
  pointer-events:none;
  transition: fill .15s var(--ease);
}

.search-wrap:hover .search-ico,
.search-wrap:focus-within .search-ico{
  fill: var(--red);
}

.search-clear{
  position:absolute;
  right:10px;
  top:50%;
  transform: translateY(-50%);
  width:28px;
  height:28px;
  border-radius:999px;
  border:1px solid transparent;
  background:transparent;
  color: var(--muted);
  display:none;
  align-items:center;
  justify-content:center;
  font-size:18px;
  line-height:1;
  cursor:pointer;
}

.search-clear:hover{
  color: var(--text);
  background: rgba(0,0,0,.04);
  border-color: var(--line);
}

.filters{
  position: relative;
  display:flex;
  gap:8px;
  flex:0 0 auto;
  flex-wrap:nowrap;
  justify-content:flex-start;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:none;
  -ms-overflow-style:none;
  width:100%;
  padding:2px 4px 6px 2px;
}

.filters::-webkit-scrollbar{
  display:none;
}

/* Scroll indicators (fade gradients) */
.filters::before,
.filters::after{
  content: "";
  position: absolute;
  top: 0;
  bottom: 6px;
  width: 32px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s var(--ease);
  z-index: 1;
}

/* Left fade indicator */
.filters::before{
  left: 0;
  background: linear-gradient(to right, var(--bg) 0%, transparent 100%);
}

/* Right fade indicator */
.filters::after{
  right: 0;
  background: linear-gradient(to left, var(--bg) 0%, transparent 100%);
}

/* Show indicators when scrollable (mobile only) */
@media (max-width: 520px){
  .filters::after{
    opacity: 1; /* Show right indicator by default on mobile */
  }
  
  /* Hide right indicator when scrolled to end (handled by JS or just always show) */
  .filters.scrolled-start::before{
    opacity: 1;
  }
  
  .filters.scrolled-end::after{
    opacity: 0;
  }
}

.filter-btn{
  height:40px;
  padding:0 14px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#fff;
  color: var(--text);
  font: 600 13px/1 Inter, system-ui, sans-serif;
  letter-spacing:.02em;
  cursor:pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
  flex:0 0 auto;
  white-space:nowrap;
  position: relative;
  z-index: 2;
}

.filter-btn:hover{
  border-color: rgba(209,15,27,.35);
  color: var(--red);
  background: rgba(209,15,27,.06);
}

.filter-btn.is-selected{
  border-color: rgba(209,15,27,.45);
  color: var(--red);
  background: rgba(209,15,27,.08);
}

/* Responsive toolbar */
@media (max-width: 520px){
  .search-wrap{ 
    max-width:100%; 
  }
  .filters{
    width:100%;
  }
}