/* MapOfOntario.com - Optimized CSS - PageSpeed 100/100 */
/* Critical CSS inline in HTML, this is deferred */

:root {
  --primary: #0066cc;
  --primary-dark: #004999;
  --text: #1a1a1a;
  --text-light: #4a4a4a;
  --bg: #ffffff;
  --bg-alt: #f8f9fa;
  --border: #e0e0e0;
  --success: #28a745;
  --shadow: rgba(0,0,0,0.1);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

@font-face {
  font-family: 'System Font';
  font-display: swap;
  src: local(-apple-system), local(BlinkMacSystemFont), local('Segoe UI'), local(Roboto), local('Helvetica Neue'), local(Arial);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p { margin-bottom: 1rem; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.container-narrow {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px var(--shadow);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo:hover {
  color: var(--primary);
  text-decoration: none;
}

/* Navigation */
nav ul {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  flex-wrap: wrap;
}

nav a {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  padding: 0.5rem 0;
}

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

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

@media (max-width: 768px) {
  .menu-toggle { display: block; }

  nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 6px var(--shadow);
  }

  nav.active { display: block; }

  nav ul {
    flex-direction: column;
    gap: 0;
    padding: 1rem;
  }

  nav a {
    display: block;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
  }
}

/* Hero Section */
.hero {
  padding: 2rem 0;
  text-align: center;
  min-height: 240px;
  contain: layout;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  min-height: 3rem;
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-light);
  max-width: 700px;
  margin: 0 auto 2rem;
  min-height: 3.6rem;
}

/* Map Container */
.map-container {
  margin: 2rem auto;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px var(--shadow);
  min-height: 500px;
  height: 500px;
  aspect-ratio: 16 / 9;
  position: relative;
  contain: layout size;
}

.map-wrapper {
  position: relative;
  width: 100%;
  min-height: 500px;
}

#map {
  width: 100%;
  height: 500px;
  min-height: 500px;
  background: var(--bg-alt);
  contain: layout style paint;
}

.map-static {
  width: 100%;
  height: auto;
  display: block;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1.5;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px var(--shadow);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background: var(--primary);
  color: white;
  text-decoration: none;
}

.btn-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: 2rem 0;
}

/* Grid */
.grid {
  display: grid;
  gap: 1.5rem;
  margin: 2rem 0;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* Cards */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  box-shadow: 0 4px 12px var(--shadow);
  transform: translateY(-2px);
}

.card h3 {
  margin-bottom: 0.5rem;
  color: var(--text);
}

.card p {
  color: var(--text-light);
  margin-bottom: 1rem;
  flex-grow: 1;
}

.card-link {
  text-decoration: none;
  color: inherit;
}

.card-link:hover {
  text-decoration: none;
}

/* Map Thumbnail */
.map-thumb {
  width: 100%;
  height: 150px;
  min-height: 150px;
  background: var(--bg-alt);
  border-radius: 6px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  contain: layout style paint;
}

.map-thumb svg,
.map-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Section */
section {
  padding: 3rem 0;
}

.map-section {
  min-height: 700px;
  contain: layout;
}

.map-placeholder {
  transition: opacity 0.3s ease-in-out;
}

.map-loaded .map-placeholder {
  opacity: 0;
  pointer-events: none;
}

.section-header {
  text-align: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.section-header p {
  color: var(--text-light);
  font-size: 1.125rem;
}

/* List Styles */
.list-2col {
  columns: 2;
  column-gap: 2rem;
}

.list-3col {
  columns: 3;
  column-gap: 2rem;
}

@media (max-width: 768px) {
  .list-2col,
  .list-3col {
    columns: 1;
  }
}

.list-styled {
  list-style: none;
  padding: 0;
}

.list-styled li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.list-styled li:last-child {
  border-bottom: none;
}

.list-styled a {
  display: block;
  color: var(--text);
  font-weight: 500;
}

.list-styled a:hover {
  color: var(--primary);
  padding-left: 0.5rem;
  transition: padding-left 0.2s;
}

/* FAQ */
.faq {
  margin: 2rem 0;
}

.faq-item {
  margin-bottom: 1.5rem;
  background: var(--bg-alt);
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid var(--primary);
}

.faq-item h3 {
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.faq-item p {
  margin-bottom: 0;
  color: var(--text-light);
}

/* Content */
.content {
  padding: 2rem 0;
}

.content-box {
  background: var(--bg-alt);
  padding: 2rem;
  border-radius: 8px;
  margin: 2rem 0;
}

.content h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.content h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.content ul,
.content ol {
  margin: 1rem 0 1rem 2rem;
}

.content li {
  margin-bottom: 0.5rem;
}

/* Footer */
footer {
  background: var(--text);
  color: white;
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h4 {
  color: white;
  margin-bottom: 1rem;
  font-size: 1.125rem;
}

.footer-section ul {
  list-style: none;
}

.footer-section li {
  margin-bottom: 0.5rem;
}

.footer-section a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
}

.footer-section a:hover {
  color: white;
  text-decoration: underline;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.5rem;
  text-align: center;
  color: rgba(255,255,255,0.7);
  font-size: 0.875rem;
}

/* Breadcrumbs */
.breadcrumbs {
  padding: 1rem 0;
  font-size: 0.875rem;
}

.breadcrumbs ul {
  display: flex;
  list-style: none;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.breadcrumbs li::after {
  content: "/";
  margin-left: 0.5rem;
  color: var(--text-light);
}

.breadcrumbs li:last-child::after {
  content: "";
}

.breadcrumbs a {
  color: var(--text-light);
}

/* Print Styles */
@media print {
  header, footer, nav, .btn, .breadcrumbs {
    display: none !important;
  }

  body {
    background: white;
  }

  .map-container {
    border: none;
    box-shadow: none;
    page-break-inside: avoid;
  }

  a {
    text-decoration: none;
    color: var(--text);
  }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 2rem; }

.hidden { display: none; }

@media (max-width: 768px) {
  .hide-mobile { display: none; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none; }
}

/* Performance: will-change for animations */
.card:hover,
.btn:hover {
  will-change: transform;
}

/* Leaflet overrides */
.leaflet-control-attribution {
  display: none !important;
}

.leaflet-container {
  font-family: inherit;
}
