/* ============================================================
   DESIGN TOKENS — Self-Service Car Wash Directory
   Art direction: "Industrial Clean" — concrete, water, utility
   Palette: Cool slate foundation + bright blue water accent
   ============================================================ */

:root {
  /* Type Scale (fluid) */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);

  /* Spacing (4px base) */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
  --content-full: 100%;

  /* Fonts */
  --font-display: 'Switzer', 'Helvetica Neue', sans-serif;
  --font-body: 'General Sans', 'Helvetica Neue', sans-serif;
}

/* ============================================================
   LIGHT MODE — Cool concrete with blue water accent
   ============================================================ */
:root, [data-theme="light"] {
  --color-bg:             #f4f5f7;
  --color-surface:        #ffffff;
  --color-surface-2:      #f9fafb;
  --color-surface-offset: #edf0f3;
  --color-surface-offset-2: #e4e8ec;
  --color-surface-dynamic: #d8dde3;
  --color-divider:        #d1d5db;
  --color-border:         #c4c9d0;

  --color-text:           #1a1d23;
  --color-text-muted:     #6b7280;
  --color-text-faint:     #9ca3af;
  --color-text-inverse:   #f9fafb;

  /* Primary — "Spray Blue" */
  --color-primary:        #0369a1;
  --color-primary-hover:  #075985;
  --color-primary-active: #0c4a6e;
  --color-primary-highlight: #e0f2fe;

  /* Success */
  --color-success:        #16a34a;
  --color-success-highlight: #dcfce7;

  /* Warning */
  --color-warning:        #d97706;

  /* Error */
  --color-error:          #dc2626;

  /* Shadows */
  --shadow-sm: 0 1px 2px oklch(0.25 0.01 250 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.25 0.01 250 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.25 0.01 250 / 0.12);
}

/* ============================================================
   DARK MODE — Deep slate with glowing blue accent
   ============================================================ */
[data-theme="dark"] {
  --color-bg:             #111318;
  --color-surface:        #1a1d24;
  --color-surface-2:      #21252d;
  --color-surface-offset: #171a20;
  --color-surface-offset-2: #252930;
  --color-surface-dynamic: #2d323a;
  --color-divider:        #2d323a;
  --color-border:         #374151;

  --color-text:           #e5e7eb;
  --color-text-muted:     #9ca3af;
  --color-text-faint:     #6b7280;
  --color-text-inverse:   #1a1d23;

  --color-primary:        #38bdf8;
  --color-primary-hover:  #7dd3fc;
  --color-primary-active: #0ea5e9;
  --color-primary-highlight: #1e3a5f;

  --color-success:        #4ade80;
  --color-success-highlight: #14532d;

  --color-warning:        #fbbf24;
  --color-error:          #f87171;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:             #111318;
    --color-surface:        #1a1d24;
    --color-surface-2:      #21252d;
    --color-surface-offset: #171a20;
    --color-surface-offset-2: #252930;
    --color-surface-dynamic: #2d323a;
    --color-divider:        #2d323a;
    --color-border:         #374151;
    --color-text:           #e5e7eb;
    --color-text-muted:     #9ca3af;
    --color-text-faint:     #6b7280;
    --color-text-inverse:   #1a1d23;
    --color-primary:        #38bdf8;
    --color-primary-hover:  #7dd3fc;
    --color-primary-active: #0ea5e9;
    --color-primary-highlight: #1e3a5f;
    --color-success:        #4ade80;
    --color-success-highlight: #14532d;
    --color-warning:        #fbbf24;
    --color-error:          #f87171;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
    --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
    --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
  }
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

@media (min-width: 768px) {
  .container { padding-inline: var(--space-8); }
}

/* ============================================================
   HEADER / NAV
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: oklch(from var(--color-bg) l c h / 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-divider);
  padding: var(--space-3) 0;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--color-text);
}

.logo-mark { color: var(--color-primary); }

.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.logo-text span {
  display: block;
  font-weight: 400;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  background: transparent;
}

.theme-toggle:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: clamp(var(--space-12), 8vw, var(--space-24)) 0 clamp(var(--space-8), 4vw, var(--space-16));
  text-align: left;
}

.hero-eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--color-text);
  margin-bottom: var(--space-4);
  max-width: 20ch;
}

.hero-description {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 55ch;
  margin-bottom: var(--space-6);
}

.hero-stats {
  display: flex;
  gap: var(--space-8);
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  flex-direction: column;
}

.hero-stat-number {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.hero-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-section {
  padding-bottom: var(--space-8);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.filter-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  margin-right: var(--space-2);
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-highlight);
}

.filter-btn.active {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

.filter-btn.active:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: var(--color-text-inverse);
}

.filter-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-left: var(--space-2);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   DIRECTORY TABLE
   ============================================================ */
.directory-section {
  padding-bottom: clamp(var(--space-12), 6vw, var(--space-24));
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.directory-table {
  font-size: var(--text-sm);
}

.directory-table thead {
  background: var(--color-surface-offset);
}

.directory-table th {
  padding: var(--space-3) var(--space-4);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface-offset);
}

.directory-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
}

.directory-table tbody tr {
  transition: background var(--transition-interactive);
}

.directory-table tbody tr:hover {
  background: var(--color-surface-offset);
}

.directory-table tbody tr:last-child td {
  border-bottom: none;
}

.directory-table tbody tr.hidden {
  display: none;
}

.biz-name {
  font-weight: 600;
  color: var(--color-text);
  min-width: 160px;
  max-width: 220px;
}

.biz-address {
  color: var(--color-text-muted);
  min-width: 140px;
  max-width: 200px;
}

.biz-phone {
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.biz-phone a {
  color: var(--color-primary);
  text-decoration: none;
}

.biz-phone a:hover {
  text-decoration: underline;
}

.biz-hours {
  color: var(--color-text);
  white-space: nowrap;
}

.biz-area {
  color: var(--color-text-muted);
}

.amenity-cell {
  text-align: center;
  font-size: var(--text-sm);
}

.amenity-yes {
  color: var(--color-success);
  font-weight: 600;
}

.amenity-no {
  color: var(--color-error);
  font-weight: 600;
}

.amenity-unknown {
  color: var(--color-text-faint);
}

/* ============================================================
   LEGEND
   ============================================================ */
.legend {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
  padding: var(--space-4) 0 var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* ============================================================
   NEIGHBORHOOD SECTIONS
   ============================================================ */
.neighborhoods-section {
  padding-bottom: clamp(var(--space-12), 6vw, var(--space-24));
}

.neighborhoods-section > .container > h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2);
}

.neighborhoods-section > .container > p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-8);
}

.neighborhood-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--space-4);
}

.neighborhood-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: box-shadow var(--transition-interactive),
              border-color var(--transition-interactive);
}

.neighborhood-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.neighborhood-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.neighborhood-card .nc-count {
  font-size: var(--text-xs);
  color: var(--color-primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-3);
}

.neighborhood-card ul {
  list-style: none;
  padding: 0;
}

.neighborhood-card li {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding: var(--space-1) 0;
  border-top: 1px solid var(--color-divider);
}

.neighborhood-card li:first-child {
  border-top: none;
}

/* ============================================================
   FAQ SECTION
   ============================================================ */
.faq-section {
  padding: clamp(var(--space-12), 6vw, var(--space-24)) 0;
  background: var(--color-surface-offset);
}

.faq-section h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-8);
}

.faq-list {
  max-width: var(--content-default);
}

.faq-item {
  border-bottom: 1px solid var(--color-divider);
}

.faq-question {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) 0;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  text-align: left;
  gap: var(--space-4);
}

.faq-question:hover {
  color: var(--color-primary);
}

.faq-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--color-text-muted);
}

.faq-item.open .faq-icon {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-answer-inner {
  padding-bottom: var(--space-5);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  padding: var(--space-12) 0 var(--space-8);
  border-top: 1px solid var(--color-divider);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

@media (min-width: 768px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.footer-text {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.footer-links {
  display: flex;
  gap: var(--space-4);
  font-size: var(--text-xs);
}

.footer-links a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--color-primary);
}

/* ============================================================
   SCROLL REVEAL ANIMATION
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   NO RESULTS
   ============================================================ */
.no-results {
  display: none;
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--color-text-muted);
}

.no-results.show {
  display: block;
}

.no-results-icon {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-3);
}

.no-results h3 {
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

/* ============================================================
   MOBILE TABLE CARDS
   ============================================================ */
@media (max-width: 767px) {
  .table-wrapper {
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: visible;
  }

  .directory-table,
  .directory-table thead,
  .directory-table tbody,
  .directory-table th,
  .directory-table td,
  .directory-table tr {
    display: block;
  }

  .directory-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
  }

  .directory-table tbody tr {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
  }

  .directory-table tbody tr:hover {
    box-shadow: var(--shadow-sm);
  }

  .directory-table td {
    padding: var(--space-1) 0;
    border-bottom: none;
  }

  .directory-table td::before {
    content: attr(data-label);
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-faint);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
  }

  .directory-table td:nth-child(1) { /* # */
    display: none;
  }

  .directory-table td:nth-child(2) { /* Name */
    grid-column: 1 / -1;
  }

  .directory-table td:nth-child(3) { /* Address */
    grid-column: 1 / -1;
  }

  .directory-table td:nth-child(4) { /* Phone */
    grid-column: 1;
  }

  .directory-table td:nth-child(5) { /* Hours */
    grid-column: 2;
  }

  .directory-table td:nth-child(6) { /* Area */
    grid-column: 1 / -1;
  }

  /* Amenities row */
  .directory-table td:nth-child(7),
  .directory-table td:nth-child(8),
  .directory-table td:nth-child(9),
  .directory-table td:nth-child(10) {
    grid-column: auto;
  }

  .biz-name { min-width: 0; }
  .biz-address { min-width: 0; }

  .amenity-cell {
    text-align: left;
  }
}

/* ============================================================
   SCROLL HINT (mobile table)
   ============================================================ */
@media (min-width: 768px) and (max-width: 1023px) {
  .table-wrapper {
    position: relative;
  }
  .table-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(to right, transparent, var(--color-surface));
    pointer-events: none;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  }
}

/* ============================================================
   BACK TO TOP
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  transform: translateY(8px);
  z-index: 40;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--color-primary-hover);
}

/* ============================================================
   SKIP LINK
   ============================================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: var(--space-2);
}
