/* =========================================================
   Store directory page
   ========================================================= */

/* Safety net: even with the .dir-chip-row fix below, this stops any
   future element that grows past 100vw from making the whole page
   swipeable left/right on mobile. Doesn't affect .dir-toolbar's
   position: sticky, since that's relative to normal document scroll,
   not a new scroll container. */
html, body { overflow-x: hidden; }

/* ---------- Breadcrumb ---------- */
.dir-breadcrumb {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.dir-breadcrumb nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.dir-breadcrumb a { color: var(--muted); transition: color .15s ease; }
.dir-breadcrumb a:hover { color: var(--primary-darker); }
.dir-breadcrumb .is-current { color: var(--text); font-weight: 600; }
.dir-breadcrumb svg { flex-shrink: 0; color: var(--muted-2); }

/* ---------- Hero ---------- */
.dir-hero {
  position: relative;
  background: linear-gradient(160deg, var(--primary-darker) 0%, var(--primary-dark) 46%, var(--primary) 100%);
  overflow: hidden;
  padding: 56px 0 46px;
}
.dir-hero::before,
.dir-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  pointer-events: none;
}
.dir-hero::before { width: 420px; height: 420px; top: -220px; right: -120px; }
.dir-hero::after { width: 260px; height: 260px; bottom: -160px; left: -80px; background: rgba(255,255,255,0.06); }
.dir-hero-inner { position: relative; z-index: 1; text-align: center; }
.dir-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.12);
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  margin: 0 0 18px;
}
.dir-hero h1 {
  color: #fff;
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.12;
  margin: 0 0 14px;
}
.dir-hero p {
  color: rgba(255,255,255,0.88);
  font-size: 16px;
  max-width: 560px;
  margin: 0 auto 30px;
}

.dir-search {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  height: 58px;
  padding: 0 8px 0 22px;
}
.dir-search svg { flex-shrink: 0; color: var(--muted-2); }
.dir-search input {
  flex: 1 1 auto;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  padding: 0 12px;
  color: var(--text);
  min-width: 0;
}
.dir-search input::placeholder { color: var(--muted-2); }
.dir-search-clear {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  color: var(--muted);
  flex-shrink: 0;
}
.dir-search-clear:hover { background: var(--background); }
.dir-search.has-value .dir-search-clear { display: inline-flex; }
.dir-search-count {
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
}

/* ---------- Stats band ---------- */
.dir-stats {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.dir-stats-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  padding: 26px 0;
  text-align: center;
}
.dir-stat-num {
  font-size: 26px;
  font-weight: 800;
  color: var(--primary-darker);
  letter-spacing: -0.02em;
}
.dir-stat-lbl {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

/* ---------- Featured stores ---------- */
.dir-featured-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--sp-4) var(--sp-3);
}
.dir-store-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 14px;
  box-shadow: var(--shadow-xs);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.dir-store-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-tint-border);
}
.dir-store-card .store-tile-logo { width: 72px; height: 72px; }
.dir-store-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.dir-store-card-cat {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--primary-light);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

/* ---------- Sticky filter/toolbar ---------- */
.dir-toolbar {
  position: sticky;
  top: var(--header-height);
  z-index: 40;
  background: rgba(246,247,246,0.94);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.dir-toolbar-inner { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dir-chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  /* Flex items default to min-width: auto, which stops this row from
     ever shrinking below the combined width of its flex-shrink:0,
     white-space:nowrap chips. Without this, the row (and everything
     containing it — .dir-toolbar-inner, .container, <body>) grows to
     fit all the chips instead of clipping them, so the WHOLE PAGE
     becomes wider than the viewport and swipes drag the entire screen
     left/right instead of just this chip strip. min-width: 0 lets the
     row actually shrink to its container's width so overflow-x: auto
     scrolls internally the way it's meant to. */
  min-width: 0;
}
.dir-chip-row::-webkit-scrollbar { display: none; }
.dir-chip {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.dir-chip:hover { border-color: var(--primary-tint-border); }
.dir-chip.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.dir-chip-count {
  opacity: .75;
  font-weight: 600;
  margin-left: 4px;
}

.dir-alpha-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.dir-alpha-btn {
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  border-radius: var(--radius-sm);
  transition: background .15s ease, color .15s ease;
}
.dir-alpha-btn:hover { background: var(--primary-light); color: var(--primary-darker); }
.dir-alpha-btn.is-active { background: var(--primary); color: #fff; }
.dir-alpha-btn.is-disabled { color: var(--muted-2); pointer-events: none; opacity: .45; }

/* ---------- Directory listing ---------- */
.dir-letter-group { scroll-margin-top: calc(var(--header-height) + 130px); }
.dir-letter-group + .dir-letter-group { margin-top: var(--sp-6); }
.dir-letter-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: var(--sp-4);
}
.dir-letter-badge {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dir-letter-line { flex: 1 1 auto; height: 1px; background: var(--border); }

.dir-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
}
.dir-row-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.dir-row-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--primary-tint-border);
}
.dir-row-logo {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.dir-row-logo img { width: 72%; height: 72%; object-fit: contain; }
.dir-row-logo-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  color: var(--primary-darker);
  background: var(--primary-light);
}
.dir-row-body { min-width: 0; flex: 1 1 auto; }
.dir-row-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dir-row-cat {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dir-row-chevron { color: var(--muted-2); flex-shrink: 0; }
.dir-row-card:hover .dir-row-chevron { color: var(--primary-dark); }

.dir-empty-state {
  display: none;
  text-align: center;
  padding: 60px 20px;
}
.dir-empty-state.is-visible { display: block; }
.dir-empty-state svg { color: var(--muted-2); margin: 0 auto 14px; }
.dir-empty-state h3 { font-size: 18px; margin-bottom: 6px; }
.dir-empty-state p { color: var(--muted); font-size: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .dir-featured-grid { grid-template-columns: repeat(4, 1fr); }
  .dir-grid { grid-template-columns: repeat(2, 1fr); }
  .dir-stats-inner { grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
}
@media (max-width: 640px) {
  .dir-featured-grid { grid-template-columns: repeat(3, 1fr); }
  .dir-grid { grid-template-columns: 1fr; }
  .dir-hero { padding: 40px 0 34px; }
  .dir-search { height: 52px; }
  .dir-toolbar { top: var(--header-height); }
}