/**
 * City Cards 2025 - Modern Card-Based City Links
 * Enhanced minimal design with location icons, badges, service labels, and hover previews
 * Responsive grid layout with pagination support
 *
 * Version: 1.0.0
 * Last Updated: 2025-11-13
 */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* Colors */
  --city-card-bg: #FFFFFF;
  --city-card-border: #E5E7EB;
  --city-card-hover-border: #0047BA;
  --city-card-text-primary: #1F2937;
  --city-card-text-secondary: #6B7280;
  --city-card-icon-color: #0047BA;
  --city-card-badge-bg: #EFF6FF;
  --city-card-badge-text: #0047BA;
  --city-card-service-color: #0047BA;
  --city-card-preview-bg: #FFFFFF;
  --city-card-preview-shadow: rgba(0, 0, 0, 0.15);

  /* Spacing */
  --city-card-padding: 1.25rem;
  --city-card-gap: 1.5rem;
  --city-card-icon-size: 1.25rem;
  --city-card-border-radius: 0.75rem;

  /* Typography */
  --city-card-font-name: 600;
  --city-card-font-postal: 400;
  --city-card-font-service: 600;

  /* Shadows */
  --city-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --city-card-shadow-hover: 0 8px 24px rgba(0, 71, 186, 0.15);
  --city-card-preview-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);

  /* Transitions */
  --city-card-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Container & Section Layout
   ============================================ */

.city-cards-section {
  position: relative;
  width: 100%;
  padding: var(--space-16, 4rem) 0;
  background: #FFFFFF;
}

.city-cards-section__header {
  margin-bottom: var(--space-12, 3rem);
  text-align: left;
}

.city-cards-section__title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  color: #121212;
  margin: 0 0 var(--space-4, 1rem) 0;
  line-height: 1.2;
}

.city-cards-section__description {
  font-size: 1.125rem;
  color: var(--city-card-text-secondary);
  margin: 0;
  max-width: 60ch;
  line-height: 1.6;
}

/* ============================================
   City Cards Grid
   ============================================ */

.city-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--city-card-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Override global li styles from style.css to prevent bullet points */
.city-cards-grid > li {
  list-style: none !important;
}

.city-card__preview-services > li {
  list-style: none !important;
}

/* Balanced grid - 3-4 cards per row on desktop */
@media (min-width: 1024px) {
  .city-cards-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .city-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 640px) and (max-width: 767px) {
  .city-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 639px) {
  .city-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   City Card Base Styles
   ============================================ */

.city-card {
  position: relative;
  background: var(--city-card-bg);
  border: 1px solid var(--city-card-border);
  border-radius: var(--city-card-border-radius);
  padding: var(--city-card-padding);
  transition: var(--city-card-transition);
  box-shadow: var(--city-card-shadow);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}

.city-card:hover,
.city-card:focus {
  border-color: var(--city-card-hover-border);
  box-shadow: var(--city-card-shadow-hover);
  transform: translateY(-2px);
  outline: none;
}

.city-card:focus-visible {
  outline: 2px solid var(--city-card-hover-border);
  outline-offset: 2px;
}

/* ============================================
   Card Header with Icon
   ============================================ */

.city-card__header {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}

.city-card__icon {
  flex-shrink: 0;
  width: var(--city-card-icon-size);
  height: var(--city-card-icon-size);
  color: var(--city-card-icon-color);
  transition: var(--city-card-transition);
}

.city-card:hover .city-card__icon {
  transform: scale(1.1);
}

.city-card__content {
  flex: 1;
  min-width: 0;
}

/* ============================================
   Card Title & Postal Code
   ============================================ */

.city-card__name {
  font-size: 1rem;
  font-weight: var(--city-card-font-name);
  color: var(--city-card-text-primary);
  margin: 0 0 0.25rem 0;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.city-card__postal {
  font-size: 0.875rem;
  font-weight: var(--city-card-font-postal);
  color: var(--city-card-text-secondary);
  margin: 0;
  line-height: 1.4;
}

/* ============================================
   Department Badge
   ============================================ */

.city-card__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  background: var(--city-card-badge-bg);
  color: var(--city-card-badge-text);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

/* ============================================
   Service Label
   ============================================ */

.city-card__service {
  font-size: 0.8125rem;
  font-weight: var(--city-card-font-service);
  color: var(--city-card-service-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0.25rem 0 0 0;
  line-height: 1.2;
}

/* ============================================
   Hover Preview Overlay
   ============================================ */

.city-card__preview {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--city-card-preview-bg);
  border: 1px solid var(--city-card-hover-border);
  border-radius: var(--city-card-border-radius);
  padding: 1rem;
  box-shadow: var(--city-card-preview-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--city-card-transition);
  z-index: 10;
  pointer-events: none;
}

.city-card:hover .city-card__preview,
.city-card:focus .city-card__preview {
  opacity: 1;
  visibility: visible;
  transform: translateY(0.5rem);
}

.city-card__preview-phone {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--city-card-icon-color);
  margin-bottom: 0.75rem;
}

.city-card__preview-phone svg {
  width: 1.125rem;
  height: 1.125rem;
}

.city-card__preview-services {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.city-card__preview-service {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--city-card-text-primary);
  line-height: 1.4;
}

.city-card__preview-service svg {
  width: 1rem;
  height: 1rem;
  color: #10B981;
  flex-shrink: 0;
}

/* ============================================
   Pagination - Load More
   ============================================ */

.city-cards-pagination {
  margin-top: var(--space-12, 3rem);
  text-align: center;
}

.city-cards-load-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  background: #FFFFFF;
  border: 2px solid var(--city-card-hover-border);
  border-radius: 0.5rem;
  color: var(--city-card-hover-border);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--city-card-transition);
  box-shadow: var(--city-card-shadow);
}

.city-cards-load-more:hover,
.city-cards-load-more:focus {
  background: var(--city-card-hover-border);
  color: #FFFFFF;
  transform: translateY(-2px);
  box-shadow: var(--city-card-shadow-hover);
  outline: none;
}

.city-cards-load-more:focus-visible {
  outline: 2px solid var(--city-card-hover-border);
  outline-offset: 2px;
}

.city-cards-load-more svg {
  width: 1.25rem;
  height: 1.25rem;
  transition: var(--city-card-transition);
}

.city-cards-load-more:hover svg {
  transform: translateY(2px);
}

/* Loading state */
.city-cards-load-more--loading {
  pointer-events: none;
  opacity: 0.6;
}

.city-cards-load-more--loading svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Hidden state */
.city-cards-pagination.hidden {
  display: none;
}

/* ============================================
   Count Display
   ============================================ */

.city-cards-count {
  margin-top: var(--space-8, 2rem);
  text-align: center;
  font-size: 0.875rem;
  color: var(--city-card-text-secondary);
}

.city-cards-count__current {
  font-weight: 600;
  color: var(--city-card-text-primary);
}

.city-cards-count__total {
  font-weight: 600;
  color: var(--city-card-text-primary);
}

/* ============================================
   Hidden Cities (for pagination)
   ============================================ */

.city-card.hidden {
  display: none;
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 767px) {
  .city-cards-section {
    padding: var(--space-12, 3rem) 0;
  }

  .city-cards-section__title {
    font-size: 1.75rem;
  }

  .city-cards-section__description {
    font-size: 1rem;
  }

  .city-card {
    padding: 1rem;
  }

  .city-card__name {
    font-size: 0.9375rem;
  }

  .city-cards-load-more {
    width: 100%;
    max-width: 300px;
  }

  /* Disable hover preview on mobile */
  .city-card__preview {
    display: none;
  }
}

@media (max-width: 479px) {
  .city-cards-section__header {
    margin-bottom: var(--space-8, 2rem);
  }

  .city-card__name {
    font-size: 0.875rem;
  }

  .city-card__postal {
    font-size: 0.8125rem;
  }

  .city-card__badge {
    font-size: 0.6875rem;
    padding: 0.1875rem 0.625rem;
  }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
  .city-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .city-card__preview {
    display: none !important;
  }

  .city-cards-pagination {
    display: none !important;
  }

  .city-card.hidden {
    display: flex !important;
  }
}

/* ============================================
   Accessibility Enhancements
   ============================================ */

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .city-card,
  .city-card__icon,
  .city-card__preview,
  .city-cards-load-more,
  .city-cards-load-more svg {
    transition: none;
    animation: none;
  }

  .city-card:hover,
  .city-card:focus {
    transform: none;
  }

  .city-cards-load-more:hover {
    transform: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .city-card {
    border-width: 2px;
  }

  .city-card:hover,
  .city-card:focus {
    border-width: 3px;
  }
}

/* Dark mode support (future-proofing) */
@media (prefers-color-scheme: dark) {
  :root {
    --city-card-bg: #1F2937;
    --city-card-border: #374151;
    --city-card-hover-border: #3B82F6;
    --city-card-text-primary: #F9FAFB;
    --city-card-text-secondary: #D1D5DB;
    --city-card-icon-color: #60A5FA;
    --city-card-badge-bg: #1E3A8A;
    --city-card-badge-text: #BFDBFE;
    --city-card-service-color: #60A5FA;
    --city-card-preview-bg: #111827;
  }
}

/* ============================================
   Performance Optimizations
   ============================================ */

/* GPU acceleration for transforms */
.city-card,
.city-card__preview {
  will-change: transform;
}

/* Contain layout shifts */
.city-cards-grid {
  contain: layout style;
}

/* ============================================
   End of City Cards 2025 Stylesheet
   ============================================ */
