/* Gulp1 — design system ported from scotchpie.org (repos-antigravity/scotchpie-bun) */

:root {
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-hover: #f1f5f9;
  --color-border: #cbd5e1;

  --color-text-main: #0f172a;
  --color-text-muted: #475569;
  --color-text-light: #64748b;

  --color-navbar-bg: #0f172a;
  --color-navbar-text: #f8fafc;

  --color-primary: #1e3a8a;
  --color-primary-hover: #1e40af;
  --color-accent-amber: #b45309;

  --badge-independent-bg: #ccfbf1;
  --badge-independent-text: #115e59;
  --badge-chain-bg: #dbeafe;
  --badge-chain-text: #1e40af;

  --pin-independent: #0f766e;
  --pin-chain: #1e40af;
  --pin-user: #b45309;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------- */
/* NAVBAR                                                */
/* ---------------------------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--color-navbar-bg);
  color: var(--color-navbar-text);
  box-shadow: var(--shadow-md);
}

.navbar-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.brand-logo img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: #e2e8f0;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.15s ease-in-out;
}

.nav-links a:hover,
.nav-links a.active {
  color: #fbbf24;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--color-primary-hover);
}

.btn-amber {
  background-color: #d97706;
  color: #ffffff;
}
.btn-amber:hover {
  background-color: #b45309;
}

.btn-outline-dark {
  background-color: transparent;
  border-color: var(--color-border);
  color: var(--color-text-main);
}
.btn-outline-dark:hover {
  background-color: var(--color-surface-hover);
}

/* ---------------------------------------------------- */
/* HERO                                                  */
/* ---------------------------------------------------- */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 3rem 1.5rem;
  border-bottom: 4px solid #d97706;
}

.hero-container {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
}

.hero-title span.highlight {
  color: #fbbf24;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: #cbd5e1;
  max-width: 780px;
  margin: 0 auto 2rem auto;
  font-weight: 400;
}

.hero-search-box {
  max-width: 700px;
  margin: 0 auto 1.5rem auto;
  display: flex;
  gap: 0.5rem;
  background: white;
  padding: 0.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.hero-search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.6rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--color-text-main);
}

.hero-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.filter-chip {
  background-color: rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease,
    box-shadow 0.15s ease;
}

.filter-chip:hover {
  background-color: rgba(251, 191, 36, 0.25);
  color: #fbbf24;
  border-color: #fbbf24;
  transform: translateY(-1px);
}

.filter-chip.active {
  background-color: #fbbf24;
  color: #0f172a;
  border-color: #fbbf24;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

/* ---------------------------------------------------- */
/* MAIN LAYOUT                                           */
/* ---------------------------------------------------- */
.main-wrapper {
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  flex: 1;
}

.brand-tiles-section {
  margin-bottom: 1.75rem;
}

.brand-tiles-heading {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-light);
  margin-bottom: 0.75rem;
}

.brand-tiles-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.brand-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.7rem 1.1rem;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
  min-width: 120px;
}

.brand-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.brand-tile.active {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.brand-tile .brand-tile-name {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-text-main);
}

.brand-tile .brand-tile-cuisine {
  display: block;
  font-size: 0.78rem;
  color: var(--color-primary);
  margin-top: 0.2rem;
}

.brand-tile .brand-tile-count {
  display: block;
  font-size: 0.78rem;
  color: var(--color-text-light);
  margin-top: 0.15rem;
}

.brand-tile.active .brand-tile-name {
  color: #ffffff;
}

.brand-tile.active .brand-tile-cuisine {
  color: #e0e7ff;
}

.brand-tile.active .brand-tile-count {
  color: #cbd5e1;
}

.directory-split {
  display: grid;
  grid-template-columns: 1fr 480px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 992px) {
  .directory-split {
    grid-template-columns: 1fr;
  }
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.results-count {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.brand-select {
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text-main);
  background: var(--color-surface);
}

.stockists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* Stockist card */
.baker-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  color: inherit;
  cursor: pointer;
}

.baker-card:hover,
.baker-card.selected {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.baker-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.baker-card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.baker-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.baker-type-badge {
  flex-shrink: 0;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.type-independent_baker {
  background-color: var(--badge-independent-bg);
  color: var(--badge-independent-text);
  border: 1px solid #99f6e4;
}

.type-regional_chain {
  background-color: var(--badge-chain-bg);
  color: var(--badge-chain-text);
  border: 1px solid #bfdbfe;
}

.baker-card-location {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.baker-card-desc {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.baker-card-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag-pill {
  background-color: var(--color-surface-hover);
  color: var(--color-text-muted);
  border-radius: var(--radius-full);
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
}

.card-website-link {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
}
.card-website-link:hover {
  text-decoration: underline;
}

/* ---------------------------------------------------- */
/* MAP                                                   */
/* ---------------------------------------------------- */
.map-sticky-container {
  position: sticky;
  top: 80px;
  height: calc(100vh - 110px);
  min-height: 480px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

.map-popup {
  font-family: var(--font-sans);
  padding: 2px;
  max-width: 220px;
}
.map-popup .popup-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}
.map-popup .popup-name {
  margin: 6px 0 3px;
  font-size: 0.95rem;
  color: var(--color-text-main);
  font-weight: 700;
}
.map-popup .popup-address {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.3;
}
.map-popup .popup-directions {
  display: block;
  text-align: center;
  background: #15803d;
  color: white;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
}

.leaflet-popup-content-wrapper {
  border-radius: 10px !important;
  box-shadow: var(--shadow-lg) !important;
}

/* ---------------------------------------------------- */
/* BRAND PAGE                                            */
/* ---------------------------------------------------- */
.brand-page-header {
  margin-bottom: 1.5rem;
}

.brand-page-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-text-main);
  letter-spacing: -0.02em;
}

.brand-page-header .muted {
  color: var(--color-text-light);
  margin-top: 0.25rem;
}

.brand-page-desc {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  max-width: 640px;
  margin-top: 0.6rem;
  line-height: 1.55;
}

.brand-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  margin-top: 0.85rem;
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

.brand-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.brand-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  margin-bottom: 1rem;
}
.back-link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

#brandMap {
  width: 100%;
  height: 100%;
}

.brand-section-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-text-main);
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
}

.retailer-region-group {
  margin-bottom: 1.75rem;
}

.retailer-region-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 0.75rem;
}

.retailer-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

.retailer-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.retailer-item strong {
  font-size: 0.92rem;
  color: var(--color-text-main);
}

.retailer-item .muted {
  color: var(--color-text-muted);
  font-size: 0.83rem;
  margin-top: 0.2rem;
  line-height: 1.35;
}

/* ---------------------------------------------------- */
/* FORMS (submit / admin)                                */
/* ---------------------------------------------------- */
.form-section {
  max-width: 560px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.form-section h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-text-main);
  margin-bottom: 0.5rem;
}

.form-section > p {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--color-text-main);
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.15);
}

.latlng-row {
  display: flex;
  gap: 1rem;
}
.latlng-row .form-group {
  flex: 1;
}

.tag-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.tag-checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.status-line {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-top: 0.35rem;
}

/* ---------------------------------------------------- */
/* FOOTER                                                */
/* ---------------------------------------------------- */
.footer {
  background-color: var(--color-navbar-bg);
  color: #94a3b8;
  padding: 2.5rem 1.5rem;
  margin-top: auto;
  border-top: 1px solid #1e293b;
  text-align: center;
  font-size: 0.9rem;
}
.footer strong {
  color: #f8fafc;
}

/* ---------------------------------------------------- */
/* RESPONSIVE                                            */
/* ---------------------------------------------------- */
@media (max-width: 700px) {
  .map-sticky-container {
    position: static;
    height: 340px;
    min-height: 0;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.7rem;
  }
  .hero-subtitle {
    font-size: 1rem;
  }
  .hero-search-box {
    flex-direction: column;
  }
}
