/* ==========================================================================
   CJ Agencies v2 — Modern Website
   Palette derived from CJ logo deep-blue (#0a5a96)
   ========================================================================== */

/* ---------- Custom Properties ---------- */
:root {
  --primary: #0a5a96;
  --primary-dark: #063d68;
  --primary-darker: #031c30;
  --primary-light: #1e7cc4;
  --accent: #38bdf8;
  --surface: #f8fafc;
  --surface-2: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 20px 40px rgba(10,90,150,0.12);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width: 1200px;
  --nav-height: 72px;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--card);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--primary-light); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Layout ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 100px 0; }
.section-alt { background: var(--surface); }

.section-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 3rem;
  line-height: 1.7;
}

/* ---------- Navigation ---------- */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1100;
  transition: background var(--transition), box-shadow var(--transition);
  background: transparent;
}

#navbar.scrolled {
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--nav-height);
  position: relative;
  transition: justify-content var(--transition);
}

#navbar.scrolled .nav-container {
  justify-content: space-between;
}

.nav-logo {
  order: 1;
  margin-left: auto;
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
}

.nav-logo img {
  height: 28px;
  width: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

#navbar.scrolled .nav-logo img {
  opacity: 1;
  pointer-events: auto;
}

.nav-links {
  display: flex;
  gap: 32px;
  transition: transform var(--transition);
}

.nav-links a {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.85);
  transition: color var(--transition);
  position: relative;
}

#navbar.scrolled .nav-links a { color: var(--text-secondary); }
.nav-links a:hover { color: #fff; }
#navbar.scrolled .nav-links a:hover { color: var(--primary); }

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width var(--transition);
}
.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle span {
  display: block;
  width: 24px; height: 2px;
  background: #fff;
  transition: background var(--transition);
}
#navbar.scrolled .nav-toggle span { background: var(--text); }

.nav-mobile {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0; right: 0;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(20px);
  padding: 8px 24px 16px;
  box-shadow: var(--shadow-md);
}
.nav-mobile.open { display: block; }
.nav-mobile a {
  display: block;
  padding: 14px 0;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
}
.nav-mobile a:last-child { border-bottom: none; }

/* ---------- Hero ---------- */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  background: #0f172a;
}

/* Slideshow images */
.hero-slideshow {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-slide {
  position: absolute;
  inset: -10%; /* allow room for scale/pan */
  width: 120%;
  height: 120%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 2s ease-in-out;
  will-change: opacity, transform;
}

.hero-slide.active {
  opacity: 1;
}

/* Ken Burns: each slide gets a unique zoom/pan animation */
.hero-slide:nth-child(1).active { animation: kenburns1 8s ease-in-out forwards; }
.hero-slide:nth-child(2).active { animation: kenburns2 8s ease-in-out forwards; }
.hero-slide:nth-child(3).active { animation: kenburns3 8s ease-in-out forwards; }
.hero-slide:nth-child(4).active { animation: kenburns4 8s ease-in-out forwards; }

@keyframes kenburns1 {
  0%   { transform: scale(1)   translate(0, 0); }
  100% { transform: scale(1.08) translate(-1%, -1%); }
}
@keyframes kenburns2 {
  0%   { transform: scale(1.05) translate(1%, 0); }
  100% { transform: scale(1)    translate(-1%, 1%); }
}
@keyframes kenburns3 {
  0%   { transform: scale(1)   translate(-1%, 1%); }
  100% { transform: scale(1.1) translate(1%, -1%); }
}
@keyframes kenburns4 {
  0%   { transform: scale(1.08) translate(0, -1%); }
  100% { transform: scale(1)    translate(0, 1%); }
}

/* Dark overlay with subtle gradient for depth */
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.15) 40%, rgba(0,0,0,0.5) 100%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 0 24px;
}

.hero-logo {
  max-width: 480px;
  width: 85vw;
  margin: 0 auto 2rem;
  /* Normal logo colors — no filter */
  filter: drop-shadow(0 2px 12px rgba(0,0,0,0.3));
}

.hero-subtitle {
  color: rgba(255,255,255,0.6);
  font-size: clamp(0.85rem, 2vw, 1.15rem);
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hero-scroll {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(255,255,255,0.4);
  animation: bounce 2.5s ease infinite;
}
.hero-scroll svg { width: 28px; height: 28px; }

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(-8px); }
  60% { transform: translateX(-50%) translateY(-4px); }
}

/* ---------- About ---------- */
.about-content {
  max-width: 800px;
  margin: 0 auto 3.5rem;
  text-align: center;
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.9;
}

.stats-grid {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  max-width: 820px;
  margin: 0 auto;
}

.stat-card {
  text-align: center;
  padding: 40px 24px 36px;
  flex: 0 1 220px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 50px rgba(10,90,150,0.13);
}

.stat-card:hover::before {
  transform: scaleX(1);
}

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(10,90,150,0.07), rgba(56,189,248,0.1));
  color: var(--primary);
  margin-bottom: 20px;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-icon svg {
  width: 28px; height: 28px;
}

.stat-card:hover .stat-icon {
  transform: scale(1.12) rotate(-4deg);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}

.stat-value {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 10px;
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---------- Brands ---------- */
.brands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
}

.brand-card {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border-radius: var(--radius);
  padding: 2.25rem 1.75rem 1.75rem;
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.brand-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 24px 48px rgba(10,90,150,0.14);
}

/* NEW badge */
.brand-new-badge {
  position: absolute;
  top: 16px; right: 16px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: 999px;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(245,158,11,0.4);
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(245,158,11,0.4); }
  50% { box-shadow: 0 2px 16px rgba(245,158,11,0.6); }
}

.brand-card-logo {
  height: 80px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  margin-bottom: 1.25rem;
  position: relative;
  z-index: 1;
  transition: transform 0.4s ease;
}

.brand-card:hover .brand-card-logo { transform: scale(1.05); }

.brand-card-name {
  /* Visually hidden — logo is sufficient, name kept for accessibility */
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.brand-card-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.8;
  flex: 1;
  margin-bottom: 1.25rem;
  position: relative;
  z-index: 1;
}

.brand-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: gap var(--transition), color var(--transition), background var(--transition), border-color var(--transition);
  position: relative;
  z-index: 1;
}
.brand-card-link:hover {
  gap: 10px;
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}
.brand-card-link svg { width: 14px; height: 14px; }

/* Brand loading skeleton */
.brand-skeleton {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.skeleton-line {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
.skeleton-logo { width: 120px; height: 48px; }
.skeleton-title { width: 140px; height: 18px; }
.skeleton-text { width: 100%; height: 14px; }
.skeleton-text-short { width: 80%; height: 14px; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Map / Dealer Locator ---------- */
.map-wrapper {
  max-width: 900px;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.map-controls {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

.map-search-wrapper {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 400px;
}

.map-search-wrapper input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--surface);
}

.map-search-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10,90,150,0.1);
  background: var(--card);
}

.map-search-wrapper .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--text-muted);
}

.map-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}
.map-search-dropdown.active { display: block; }

.map-search-dropdown .item {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--surface);
  font-size: 0.875rem;
  transition: background var(--transition);
}
.map-search-dropdown .item:hover { background: var(--surface); }
.map-search-dropdown .item .city { color: var(--text-muted); font-size: 0.75rem; }

.map-search-dropdown .group-header {
  padding: 8px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  cursor: pointer;
}

.map-search-dropdown .branch-item {
  padding: 8px 16px 8px 28px;
  cursor: pointer;
  border-bottom: 1px solid var(--surface);
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: background var(--transition);
}
.map-search-dropdown .branch-item:hover { background: var(--surface); }
.map-search-dropdown .branch-item .branch-detail { color: var(--text-muted); font-size: 0.7rem; }

.map-search-dropdown .no-results {
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

.map-brand-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.map-brand-filter label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.map-brand-filter select {
  flex: 1;
  padding: 10px 36px 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") no-repeat right 12px center;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.map-brand-filter select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10,90,150,0.1);
}
.map-brand-filter select option {
  padding: 8px 12px;
  font-size: 0.875rem;
}
.map-brand-filter select option:disabled {
  color: var(--text-muted);
  background: var(--surface-2);
}

.map-stats {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: auto;
}

.map-filter-bar {
  display: none;
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(10,90,150,0.04), rgba(56,189,248,0.04));
  border-bottom: 1px solid var(--border);
}
.map-filter-bar.visible { display: block; }

.map-active-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 2px 0; }

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s ease, opacity var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.filter-tag:hover { opacity: 0.85; transform: scale(0.97); }
.filter-tag .remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  font-size: 0.7rem;
  font-weight: bold;
  line-height: 1;
  margin-left: 2px;
}

.reset-btn {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.reset-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

#dealer-map { width: 100%; position: relative; }

.map-fullscreen-btn {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 1000;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.map-fullscreen-btn:hover { background: #fff; color: var(--primary); transform: scale(1.05); }
.map-fullscreen-btn svg { width: 18px; height: 18px; }

.map-wrapper.map-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  max-width: none;
  border-radius: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.map-wrapper.map-fullscreen #dealer-map {
  flex: 1;
  height: auto;
}
.map-wrapper.map-fullscreen .map-fullscreen-btn {
  top: 16px; right: 16px;
  width: 40px; height: 40px;
}
.map-wrapper.map-fullscreen .map-body {
  flex: 1;
  height: auto;
}
.map-wrapper.map-fullscreen .nearby-panel {
  width: 320px;
  height: auto;
}

.popup-title { font-weight: 600; font-size: 0.95rem; color: #0f172a; margin-bottom: 4px; }
.popup-branch { font-size: 0.85rem; color: #94a3b8; margin-bottom: 4px; }
.popup-address { font-size: 0.85rem; color: #475569; margin-bottom: 8px; }
.popup-brands { display: flex; flex-wrap: wrap; gap: 3px; }
.popup-brand-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  color: #fff;
}

.popup-route-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 5px 12px;
  background: var(--primary);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 999px;
  text-decoration: none;
  transition: background var(--transition);
}
.popup-route-btn:hover { background: var(--primary-dark); }
.popup-route-btn svg { flex-shrink: 0; }

/* ---------- Location Button ---------- */
.map-location-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.map-location-btn:hover { color: var(--primary); border-color: var(--primary); }
.map-location-btn svg { width: 18px; height: 18px; }
.map-location-btn.locating {
  color: var(--primary);
  animation: pulse-locate 1s ease infinite;
}
@keyframes pulse-locate {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- Map Body + Nearby Panel ---------- */
.map-body {
  display: flex;
  position: relative;
  height: 500px;
}
.map-body #dealer-map {
  flex: 1;
  min-width: 0;
  height: 100%;
}
.nearby-panel {
  display: none;
  width: 300px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: #fff;
  overflow: hidden;
  flex-direction: column;
  height: 100%;
}
.nearby-panel.visible {
  display: flex;
}
.nearby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.nearby-header h4 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}
.nearby-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0 4px;
  line-height: 1;
}
.nearby-close:hover { color: var(--text); }
.nearby-radius {
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.nearby-radius label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.nearby-radius strong {
  color: var(--primary);
  font-weight: 700;
}
.nearby-radius input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.nearby-radius input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  cursor: grab;
}
.nearby-radius input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  cursor: grab;
}
.nearby-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.nearby-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.nearby-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0 12px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background var(--transition);
}
.nearby-item:hover { background: #f8fafc; }
.nearby-item-name {
  grid-column: 1;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nearby-item-branch {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.nearby-item-city {
  grid-column: 1;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.nearby-item-dist {
  grid-column: 2;
  grid-row: 1;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

/* ---------- Contact ---------- */
.contact-grid {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.contact-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 0;
  font-size: 1.1rem;
  color: var(--text-secondary);
}
.contact-item svg {
  width: 24px; height: 24px;
  color: var(--primary);
  flex-shrink: 0;
}
.contact-item a { color: var(--text-secondary); }
.contact-item a:hover { color: var(--primary); }

/* ---------- Footer ---------- */
footer {
  background: var(--primary-darker);
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 48px;
  padding: 64px 0 48px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.footer-brand .footer-logo {
  height: 48px;
  margin-bottom: 12px;
  /* Normal CJ logo, no invert */
}

.footer-tagline {
  color: rgba(255,255,255,0.45);
  font-size: 0.85rem;
  line-height: 1.6;
}

.footer-contact h4,
.footer-social h4 {
  color: rgba(255,255,255,0.9);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}

.footer-contact p {
  margin-bottom: 6px;
  line-height: 1.7;
}

footer a { color: rgba(255,255,255,0.6); transition: color var(--transition); }
footer a:hover { color: #fff; }

.footer-social-links {
  display: flex;
  gap: 12px;
}

.footer-social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.footer-social-links a:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
  transform: translateY(-2px);
}

.footer-bottom {
  padding: 24px 0;
  text-align: center;
  color: rgba(255,255,255,0.35);
  font-size: 0.8rem;
}
.footer-credit {
  margin-top: 6px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.2);
}
.footer-credit a {
  color: rgba(255,255,255,0.3);
  text-decoration: none;
  transition: color 0.3s ease;
}
.footer-credit a:hover { color: rgba(255,255,255,0.55); }

/* ---------- Back to Top ---------- */
.back-to-top {
  position: fixed;
  bottom: 32px; right: 32px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition), transform var(--transition), background var(--transition);
  z-index: 999;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover { background: var(--primary-dark); }
.back-to-top svg { width: 20px; height: 20px; }

/* ---------- Scroll Reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* stagger animation for brand cards */
.brand-card.reveal { transition-delay: calc(var(--i, 0) * 60ms); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .nav-logo { right: 64px; }
  .section { padding: 56px 0; }
  .container { padding: 0 20px; }
  .section-title { margin-bottom: 0.75rem; }
  .section-subtitle { font-size: 1rem; margin-bottom: 2rem; }

  .hero-logo { max-width: 280px; margin-bottom: 1.25rem; }
  .hero-subtitle { letter-spacing: 0.12em; }
  .hero-scroll { bottom: 28px; }

  .about-content { font-size: 1rem; line-height: 1.8; margin-bottom: 2.5rem; }

  .stats-grid { gap: 16px; }
  .stat-card { flex: 0 1 100%; max-width: 360px; padding: 32px 20px 28px; }
  .stat-value { font-size: 2.5rem; }
  .stat-icon { width: 48px; height: 48px; border-radius: 12px; margin-bottom: 14px; }
  .stat-icon svg { width: 24px; height: 24px; }

  .brands-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .map-wrapper { border-radius: var(--radius-sm); overflow: visible; }
  .map-controls {
    padding: 10px 12px;
    gap: 8px;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .map-search-wrapper {
    flex: 1 1 100%;
    max-width: 100%;
    min-width: 0;
    order: 1;
  }
  .map-search-wrapper input { padding: 9px 12px 9px 36px; font-size: 0.82rem; }
  .map-search-wrapper .search-icon { left: 10px; width: 16px; height: 16px; }
  .map-brand-filter {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    gap: 0;
    order: 2;
  }
  .map-brand-filter label { display: none; }
  .map-brand-filter select { padding: 9px 30px 9px 10px; font-size: 0.82rem; }
  .map-location-btn {
    width: 36px;
    height: 36px;
    order: 3;
  }
  .map-location-btn svg { width: 16px; height: 16px; }
  .map-stats {
    order: 4;
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    margin-left: 0;
    padding: 0;
    opacity: 0.7;
  }
  .map-filter-bar { padding: 8px 12px; }
  .filter-tag { font-size: 0.72rem; padding: 5px 10px; }
  .map-active-filters { gap: 6px; }

  /* Map takes more vertical space on mobile */
  .map-body { height: auto; }
  #dealer-map { height: 50vh; min-height: 300px; }
  .map-fullscreen-btn { top: 8px; right: 8px; width: 32px; height: 32px; }
  .map-fullscreen-btn svg { width: 16px; height: 16px; }

  /* Nearby panel as bottom sheet overlay */
  .map-body { flex-direction: column; position: relative; }
  .nearby-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 55%;
    border-left: none;
    border-top: none;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
    z-index: 800;
    overflow: hidden;
  }
  .nearby-panel.visible { display: flex; }
  .nearby-panel::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 8px auto 0;
    flex-shrink: 0;
  }
  .nearby-header { padding: 8px 14px 8px; }
  .nearby-header h4 { font-size: 0.85rem; }
  .nearby-radius { padding: 6px 14px 10px; }
  .nearby-radius label { font-size: 0.78rem; margin-bottom: 4px; }
  .nearby-list { max-height: none; }
  .nearby-item { padding: 8px 14px; }
  .nearby-item-name { font-size: 0.82rem; }

  /* Search dropdown mobile */
  .map-search-dropdown {
    max-height: 50vh;
    left: -12px;
    right: -12px;
  }

  /* Fullscreen mode on mobile */
  .map-wrapper.map-fullscreen .nearby-panel {
    width: 100%;
    max-height: 50%;
  }

  .contact-grid { gap: 20px; }
  .contact-item { font-size: 0.95rem; gap: 12px; }
  .contact-item svg { width: 22px; height: 22px; flex-shrink: 0; }

  .back-to-top { bottom: 20px; right: 20px; width: 44px; height: 44px; }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }
  .footer-inner .footer-brand { display: flex; flex-direction: column; align-items: center; }
  .footer-brand .footer-logo { margin: 0 auto 12px; }
  .footer-social-links { justify-content: center; }
  .footer-bottom { padding: 20px 0; }
}

@media (max-width: 480px) {
  .section { padding: 44px 0; }
  .container { padding: 0 16px; }
  .stat-value { font-size: 2rem; }
  .stat-card { padding: 28px 16px 24px; }
  .brand-card { padding: 1.5rem 1.25rem; }
  .hero-logo { max-width: 220px; }
  #dealer-map { height: 45vh; min-height: 260px; }
  .map-controls { padding: 8px 10px; gap: 6px; }
  .map-search-wrapper input { padding: 8px 10px 8px 32px; font-size: 0.8rem; }
  .map-brand-filter select { padding: 8px 28px 8px 8px; font-size: 0.8rem; }
  .map-location-btn { width: 34px; height: 34px; }
  .nearby-panel { max-height: 60%; }
  .nearby-item { padding: 7px 12px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .brands-grid { grid-template-columns: repeat(2, 1fr); }
}
