:root {
  color-scheme: light dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

main {
  max-width: 1400px;
  width: 100%;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  padding: 2.5rem;
  backdrop-filter: blur(6px);
  box-shadow: 0 20px 60px rgba(8, 47, 73, 0.45);
}

h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin: 0 0 1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

h1 + .process-book-link {
  display: block;
  margin-top: -1.5rem;
}

h1,
.process-book-link {
  transition: color 0.2s ease, transform 0.2s ease;
}

.heading {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

@media (min-width: 640px) {
  .heading {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }
}

.links-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .links-container {
    flex-direction: row;
    gap: 0.75rem;
  }
}

.process-book-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.85rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(94, 234, 212, 0.5);
  background: rgba(45, 212, 191, 0.12);
  color: #5eead4;
}

.process-book-link:hover {
  color: #0f172a;
  background: rgba(94, 234, 212, 0.85);
  border-color: rgba(45, 212, 191, 0.85);
  transform: translateY(-1px);
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  margin: 2rem 0 1rem;
  letter-spacing: 0.04em;
}

p {
  line-height: 1.75;
  margin: 0 0 1.5rem;
}

.map-container {
  margin-top: 1.5rem;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow: inset 0 0 30px rgba(8, 47, 73, 0.35);
}

#global-map {
  width: 100%;
  height: 800px;
  transition: opacity 0.3s ease;
}

#global-map:fullscreen {
  width: 100vw;
  height: 100vh;
}

#global-map:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
}

#global-map:-moz-full-screen {
  width: 100vw;
  height: 100vh;
}

#global-map:-ms-fullscreen {
  width: 100vw;
  height: 100vh;
}

.map-error {
  padding: 1.5rem;
  text-align: center;
  color: #fca5a5;
  font-size: 1rem;
}

.leaflet-popup-content-wrapper {
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
}

.leaflet-popup-content strong {
  color: #38bdf8;
}

footer {
  margin-top: 2.5rem;
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.7);
  text-align: center;
}

/* Time slider styles */
.time-slider-control {
  background: none;
  border: none;
  box-shadow: none;
  pointer-events: auto;
  touch-action: none;
}

.time-slider-control * {
  pointer-events: auto;
  touch-action: none;
}

.time-slider-container {
  background: rgba(255, 255, 255, 0.95);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  min-width: 500px;
  max-width: 800px;
}

.time-slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 1rem;
}

.current-year-display {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.05em;
}

.time-slider-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.play-pause-btn,
.lock-btn,
.fullscreen-btn {
  background: #3b82f6;
  border: none;
  border-radius: 8px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  color: white;
  font-size: 1.2rem;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

.play-pause-btn:hover,
.lock-btn:hover,
.fullscreen-btn:hover {
  background: #2563eb;
  transform: scale(1.05);
}

.play-pause-btn:active,
.lock-btn:active,
.fullscreen-btn:active {
  transform: scale(0.95);
}

.lock-btn {
  background: #3b82f6;
}

.lock-btn:hover {
  background: #10b981;
}

.fullscreen-btn {
  background: #3b82f6;
}

.time-slider-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.time-slider-input {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #e5e7eb;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.time-slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.time-slider-input::-webkit-slider-thumb:hover {
  background: #2563eb;
  transform: scale(1.1);
}

.time-slider-input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.time-slider-input::-moz-range-thumb:hover {
  background: #2563eb;
  transform: scale(1.1);
}

.time-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 500;
}

@media (max-width: 640px) {
  .time-slider-container {
    min-width: 90%;
    padding: 0.875rem 1rem;
  }
  
  .current-year-display {
    font-size: 1.5rem;
  }
  
  .play-pause-btn,
  .lock-btn,
  .fullscreen-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  
  .time-slider-buttons {
    gap: 0.375rem;
  }
}

/* Prevent map interaction when hovering over slider */
.time-slider-container {
  pointer-events: auto;
}

.time-slider-container * {
  pointer-events: auto;
}

/* Legend styles */
.legend-control {
  background: none;
  border: none;
  box-shadow: none;
}

.legend-container {
  background: rgba(255, 255, 255, 0.95);
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  min-width: 180px;
  font-size: 0.875rem;
}

.legend-title {
  font-weight: 700;
  font-size: 1rem;
  color: #0f172a;
  margin-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 8px;
}

.legend-section {
  margin-bottom: 12px;
}

.legend-section:last-child {
  margin-bottom: 0;
}

.legend-section-title {
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  font-size: 0.875rem;
}

.gdp-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gdp-gradient {
  height: 20px;
  width: 100%;
  border-radius: 4px;
  background: linear-gradient(to right, 
    #fef3c7 0%,
    #fde68a 10%,
    #fcd34d 20%,
    #fbbf24 30%,
    #f59e0b 40%,
    #d97706 50%,
    #b45309 60%,
    #92400e 70%,
    #78350f 80%,
    #451a03 90%,
    #7f1d1d 100%
  );
  border: 1px solid #d1d5db;
}

.gdp-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #6b7280;
  font-weight: 500;
}

.earthquake-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #374151;
  font-size: 0.875rem;
}

.legend-symbol {
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.leaflet-marker-icon,
.leaflet-circle-marker {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.leaflet-interactive {
  transition: fill-opacity 0.4s ease, opacity 0.4s ease;
}

.data-coverage-note {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 8px;
  font-style: italic;
}

/* Charts section styles */
.charts-section {
  margin-top: 3rem;
}

.charts-section h2 {
  margin-bottom: 2rem;
}

.charts-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.chart-wrapper {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 1.5rem;
  backdrop-filter: blur(6px);
}

.chart-wrapper h3 {
  font-size: 1.1rem;
  margin: 0 0 1rem 0;
  color: #e2e8f0;
  font-weight: 600;
}

.chart {
  width: 100%;
  min-height: 300px;
}

.chart svg {
  width: 100%;
  height: 100%;
}

.chart .bar {
  fill: #3b82f6;
  transition: fill 0.2s ease;
}

.chart .bar:hover {
  fill: #60a5fa;
}

.chart .axis {
  color: #94a3b8;
}

.chart .axis text {
  fill: #94a3b8;
  font-size: 0.75rem;
}

.chart .axis line,
.chart .axis path {
  stroke: #475569;
}

.chart .label {
  fill: #e2e8f0;
  font-size: 0.875rem;
  font-weight: 500;
}

@media (max-width: 768px) {
  .charts-container {
    grid-template-columns: 1fr;
  }
}

.chart-tooltip {
  z-index: 10000;
}

