/* ============================================================
   Chain Store Map — layout, sidebar toggles, and map styles.
   ============================================================ */

/* The store map keeps the site's evergreen as its own accent - it is the
   page the palette was picked from, so these are the defaults already. */

.stores-main {
  flex: 1;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  box-sizing: border-box;
  text-align: left;
}

.stores-header {
  text-align: center;
  padding: 1.75rem 1.5rem;
  background: var(--page-accent-dark);
  color: white;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}

.stores-header h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.4rem, 3.5vw, 2.1rem);
  font-weight: 700;
}

.stores-intro {
  font-size: clamp(0.85rem, 1.8vw, 0.98rem);
  margin: 0 auto;
  max-width: 700px;
  opacity: 0.92;
}

#stores-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.25rem;
  align-items: start;
}

#stores-sidebar {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 1.25rem;
  border-radius: var(--radius);
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.stores-sidebar-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stores-sidebar-actions .action-btn {
  flex: 1;
  padding: 0.55rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--accent-wash);
  color: var(--page-accent-dark);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.stores-sidebar-actions .action-btn:hover {
  background: color-mix(in srgb, var(--page-accent) 20%, var(--accent-wash));
}

#chain-toggle-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chain-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
}

.chain-toggle-row:hover {
  background: var(--paper);
}

.chain-toggle-row input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--page-accent-dark);
  cursor: pointer;
  flex-shrink: 0;
}

.chain-swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.chain-toggle-row .chain-name {
  flex: 1;
  color: var(--ink);
}

.chain-toggle-row .chain-count {
  font-size: 0.78rem;
  color: var(--ink-faint);
  font-weight: 600;
}

.chain-toggle-row.no-data {
  opacity: 0.5;
}

.chain-toggle-row.no-data .chain-count {
  font-style: italic;
}

.stores-note {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.75rem;
  color: var(--ink-faint);
  line-height: 1.5;
}

.stores-note code {
  background: #f7fafc;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-size: 0.85em;
}

#map {
  height: calc(100vh - 12rem);
  min-height: 480px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

/* ---- Loading / failure states ---- */

.stores-state {
  margin: 0;
  padding: 1.25rem 0.6rem;
  font-size: 0.85rem;
  color: var(--ink-faint);
}

/* Centered in the map box when the map itself never arrived. */
.stores-state-error {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  justify-content: center;
  align-items: center;
  text-align: center;
  height: 100%;
  padding: 2rem;
  box-sizing: border-box;
  color: var(--ink-soft);
}

.stores-state-error strong {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--ink);
}

.stores-state-error span {
  max-width: 42ch;
  font-size: 0.9rem;
}

/* A chain whose data file failed to load, vs one that genuinely has no
   locations in the source data. */
.chain-toggle-row.failed {
  opacity: 0.85;
}

.chain-toggle-row.failed .chain-count {
  color: #a4442f;
  font-style: normal;
}

.stores-note-error {
  display: block;
  margin-top: 0.4rem;
  color: #a4442f;
}

.stores-popup {
  font-size: 0.85rem;
  line-height: 1.5;
}

.stores-popup strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
  color: var(--page-accent-dark);
}

.stores-popup-source {
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--ink-faint);
  font-style: italic;
}

/* ============================================================
   Responsive breakpoints
   ============================================================ */
@media (max-width: 900px) {
  #stores-layout {
    grid-template-columns: 1fr;
  }

  #stores-sidebar {
    position: static;
    max-height: none;
  }

  #map {
    height: 65vh;
  }
}

@media (max-width: 480px) {
  .stores-main {
    padding: 0.75rem;
  }
}
