/* Brand Directory + Brand Profile, per the Paper "Cubbi Website" Brands artboards. */

/* ---------- Directory ---------- */
.brands-page {
  background: var(--cream-100);
}
.brands-header {
  max-width: 82.5rem;
  margin-inline: auto;
  padding: 2.5rem clamp(1.25rem, 4vw, 4rem) 2rem;
}
.brands-header p {
  color: var(--ink-muted);
  max-width: 62rem;
  margin-bottom: 0.9em;
}
.brands-panel {
  background: var(--surface);
  padding: 1rem clamp(1.25rem, 4vw, 4rem) 4rem;
}
.brands-panel > * {
  max-width: 82.5rem;
  margin-inline: auto;
}
.category-rail {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  padding-block: 0.5rem;
  scrollbar-width: none;
}
.category-rail::-webkit-scrollbar {
  display: none;
}
.category-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 0;
  cursor: pointer;
  font: 500 0.75rem var(--font);
  color: var(--ink);
  min-width: 3.5rem;
  flex-shrink: 0;
}
.category-chip .chip-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: var(--lilac-100);
  color: var(--purple-700);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.category-chip.is-active .chip-icon {
  background: var(--green-700);
  color: var(--lilac-500);
}
.category-chip.is-active {
  font-weight: 700;
  color: var(--green-700);
}
.brands-section-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--green-700);
  margin: 2rem 0 1rem;
}
.brand-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(9.5rem, 16.5%, 12.5rem);
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.brand-rail::-webkit-scrollbar {
  display: none;
}
.rail-dots {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.rail-dot {
  width: 1.1rem;
  height: 0.3rem;
  border-radius: var(--radius-pill);
  border: 0;
  padding: 0;
  background: var(--lilac-100);
  cursor: pointer;
}
.rail-dot.is-active {
  background: var(--purple-500);
}
.pick-card {
  position: relative;
  display: flex;
  align-items: flex-end;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  text-decoration: none;
  background: linear-gradient(180deg, var(--green-600), var(--green-900));
  scroll-snap-align: start;
}
.pick-card > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pick-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.72));
}
.pick-card .pick-copy {
  position: relative;
  z-index: 1;
  padding: 0.9rem 1rem;
  color: #fff;
}
.pick-card .pick-copy strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
}
.pick-card .pick-copy span {
  font-size: 0.8rem;
  opacity: 0.9;
}
.rank-badge {
  position: absolute;
  z-index: 1;
  top: 0.75rem;
  left: 0.75rem;
  background: var(--lilac-500);
  color: var(--purple-700);
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
}
.brands-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0 1rem;
  flex-wrap: wrap;
}
.brands-toolbar .brands-section-title {
  margin: 0;
}
.brand-search {
  margin-left: auto;
  font: 400 0.95rem var(--font);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.55rem 1.1rem;
  min-width: 14rem;
}
.brand-search:focus {
  outline: 2px solid var(--green-500);
  outline-offset: 1px;
}
.all-brands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr));
  gap: 1.5rem;
}
.brand-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 15rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(160deg, var(--green-600), var(--green-900));
  isolation: isolate;
}
/* Deterministic gradient variety when a brand has no image, like the design's colour cards. */
.brand-tile[data-hue="1"] { background: linear-gradient(160deg, #33619b, #101c3a); }
.brand-tile[data-hue="2"] { background: linear-gradient(160deg, #b3312f, #4a0f18); }
.brand-tile[data-hue="3"] { background: linear-gradient(160deg, #7c3a63, #2c0f22); }
.brand-tile[data-hue="4"] { background: linear-gradient(160deg, #b78ab5, #4e2044); }
.brand-tile[data-hue="5"] { background: linear-gradient(160deg, #c77b3a, #5a2c0d); }
.brand-tile[data-hue="0"] { background: linear-gradient(160deg, #4d84b6, #123048); }
.brand-tile > img.tile-photo {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.brand-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.12) 30%, rgba(0, 0, 0, 0.78));
}
.brand-tile .tile-logo {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 3rem;
  height: 3rem;
  border-radius: 12px;
  background: #fff;
  object-fit: contain;
  padding: 0.3rem;
}
.brand-tile .tile-offer {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--lilac-500);
  color: var(--purple-700);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.9rem;
  max-width: 60%;
  text-align: right;
}
.brand-tile h3 {
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 0.1em;
}
.brand-tile .tile-cat {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* ---------- Profile ---------- */
.brand-profile-hero {
  display: grid;
  grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
  max-width: 76rem;
  margin-inline: auto;
  padding: 1.25rem 1.25rem 2rem;
}
.brand-profile-hero .profile-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 40px rgba(22, 56, 39, 0.18);
}
.brand-profile-hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 0.4em;
}
.profile-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}
.join-card {
  background: var(--lilac-100);
  border-radius: var(--radius-lg);
  box-shadow: 5px 5px 0 var(--purple-500);
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 1.75rem;
  text-align: center;
}
.join-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--purple-700);
  margin-bottom: 1rem;
}
.join-card .join-signup {
  display: block;
  background: var(--purple-700);
  color: #fff;
  font: 800 1rem var(--font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
}
.join-card .join-signup:hover {
  background: var(--purple-500);
}
.join-card .join-login {
  display: block;
  background: #fff;
  color: var(--purple-700);
  font: 700 0.95rem var(--font);
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}
.offer-block h3 {
  color: var(--green-700);
  font-size: 1.2rem;
  margin: 1.25rem 0 0.4rem;
}
.brand-profile-hero > div > p {
  color: var(--ink-muted);
}
.brand-profile-hero.no-media {
  grid-template-columns: 1fr;
  max-width: 46rem;
}
.offer-block .offer-desc {
  font-size: 0.95rem;
  color: var(--ink-muted);
  margin: 0 0 0.4rem;
}
.offer-block h4 {
  font-size: 0.95rem;
  margin: 0 0 0.35rem;
  color: var(--green-700);
}
.offer-block .offer-terms {
  font-size: 0.85rem;
  color: var(--ink-muted);
  line-height: 1.55;
}
.top-picks {
  background: var(--cream-100);
  padding: 2.25rem 0 4rem;
}
.top-picks .container {
  max-width: 82.5rem;
}
.top-picks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
  gap: 1.4rem;
  margin-top: 1.25rem;
}
.top-pick-card {
  background: #fff;
  border-radius: var(--radius-md);
  overflow: hidden;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(22, 56, 39, 0.08);
  position: relative;
  transition: transform 0.15s ease;
}
.top-pick-card:hover {
  transform: translateY(-3px);
}
.top-pick-card .pick-img {
  display: block;
  aspect-ratio: 3 / 2;
  width: 100%;
  object-fit: cover;
  background: linear-gradient(160deg, var(--green-100), var(--green-500));
}
.top-pick-card .tile-offer {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  background: var(--lilac-100);
  color: var(--purple-700);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.7rem;
}
.top-pick-card .pick-body {
  display: block; /* it's a span — inline wrapping blocks makes phantom line boxes */
  padding: 0.6rem 0.9rem 0.75rem;
}
.top-pick-card .pick-body strong {
  display: block;
  color: var(--green-700); /* CUB-223 */
  font-size: 1rem;
  line-height: 1.25;
  margin-bottom: 0.15rem;
}
.top-pick-card .pick-body span {
  display: block;
  color: var(--ink-muted);
  font-size: 0.85rem;
  line-height: 1.3;
}

@media (max-width: 47.9rem) {
  .brand-profile-hero {
    grid-template-columns: 1fr;
    padding-top: 1.75rem;
  }
  .brands-panel {
    padding-inline: 1rem;
    border-radius: 18px;
  }
  .brands-toolbar .brand-search {
    margin-left: 0;
    width: 100%;
  }
}

.shop-by-category {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--green-700);
  margin: 0 0 0.75rem;
}
.brand-tile .brand-tile .tile-offer + .brand-tile .profile-media {
  position: relative;
}
@media (max-width: 47.9rem) {
  .brand-profile-hero {
    padding-bottom: 1rem;
  }
  .top-picks {
    padding: 1.25rem 0 2.75rem;
  }
  /* Top Picks scroll 2-up on phones, per the mobile profile artboard */
  .top-picks-grid {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(11.5rem, 45%);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.5rem;
  }
  .top-pick-card {
    scroll-snap-align: start;
  }
}

/* Cards are divs with a stretched primary link (hearts must not nest inside the card link). */
.card-link {
  text-decoration: none;
  color: inherit;
}
.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
}
.pick-card .pick-copy,
.pick-card .pick-copy strong,
.pick-card .pick-copy span {
  color: #fff;
}
.brand-tile h3 .card-link {
  position: static;
}

/* Back to the directory — lilac chip in the app's design language. */
.profile-topbar {
  max-width: 76rem;
  margin-inline: auto;
  padding: 1.5rem 1.25rem 0;
}
.back-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--lilac-100);
  color: var(--purple-700);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  border-radius: var(--radius-pill);
  padding: 0.5rem 1rem 0.5rem 0.7rem;
}
.back-chip:hover {
  background: var(--lilac-500);
}

/* Squiggle hugs the Top Picks heading (kill the global h2 bottom margin). */
.top-picks h2.display {
  margin-bottom: 0;
}
.top-picks .squiggle {
  margin-top: -0.1rem;
}

/* CUB-200: Top Picks — one line with scroll arrows and a straight underline. */
.line-underline {
  height: 0.4rem;
  width: 10.4rem;
}
.top-picks-scroller {
  position: relative;
  margin-top: 1.25rem;
}
.top-picks-scroller .top-picks-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(11rem, 18%, 13.5rem);
  grid-template-columns: none;
  gap: 1.25rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin-top: 0;
  padding-bottom: 0.25rem;
}
.top-picks-scroller .top-picks-grid::-webkit-scrollbar {
  display: none;
}
.rail-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 0;
  background: #fff;
  color: var(--green-700);
  box-shadow: 0 4px 12px rgba(22, 56, 39, 0.18);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rail-arrow:hover {
  background: var(--lilac-100);
}
.rail-arrow-prev { left: -1rem; }
.rail-arrow-next { right: -1rem; }
/* Arrows hide only where a finger can swipe; a mouse in a narrow window keeps them
   (the rail's scrollbar is suppressed, so the arrows are its only mouse control). */
@media (hover: none) and (pointer: coarse) {
  .rail-arrow { display: none; }
}
@media (max-width: 47.9rem) {
  /* Keep the documented two-up sizing on phones (this selector must outrank the
     scroller rule above). */
  .top-picks-scroller .top-picks-grid {
    grid-auto-columns: minmax(11.5rem, 45%);
  }
}

/* Word-aligned underline (same pattern as home.css — needed locally on this page). */
.brands-header .uword {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}
.brands-header .uword .uword-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.1em;
  width: 100%;
  height: 0.22em;
}
