/* ============================================================
   RESET & BASE
   ============================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
 
body {
  font-family: Georgia, 'Times New Roman', serif;
  background: #0d0d14;
  color: #e8e4dc;
  line-height: 1.65;
}
 
/* ============================================================
   HEADER
   ============================================================ */
header {
  padding: 100px 20px 80px;
  text-align: center;
  border-bottom: 1px solid #2a2a3a;
  background: radial-gradient(ellipse at center top, #1a1a2e 0%, #0d0d14 70%);
}
 
h1 {
  font-family: Georgia, serif;
  font-size: 72px;
  font-weight: 700;
  letter-spacing: -2px;
  margin-bottom: 16px;
  color: #fff;
  text-shadow: 0 0 60px rgba(180, 4, 38, 0.4);
}
 
.subtitle {
  font-size: 20px;
  color: #aaa;
  font-style: italic;
  margin-bottom: 16px;
}
 
.byline {
  font-size: 11px;
  color: #666;
  letter-spacing: 2px;
  text-transform: uppercase;
}
 
/* ============================================================
   MAIN LAYOUT
   ============================================================ */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 60px 24px;
}
 
section {
  margin-bottom: 80px;
}
 
h2 {
  font-size: 32px;
  margin-bottom: 16px;
  color: #fff;
}
 
.section-title {
  font-size: 26px;
  margin-bottom: 8px;
  color: #fff;
  border-left: 4px solid #b40426;
  padding-left: 14px;
}
 
.section-desc {
  font-size: 16px;
  color: #bbb;
  margin-bottom: 20px;
  padding-left: 18px;
}
 
h3 {
  font-size: 18px;
  margin-top: 26px;
  margin-bottom: 10px;
  color: #ccc;
}
 
p {
  font-size: 16px;
  margin-bottom: 14px;
  color: #bbb;
}
 
/* ============================================================
   VIZ SECTION CARD
   ============================================================ */
.viz-section {
  background: #13131e;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.5);
}
 
/* ============================================================
   MAP CONTAINER & CANVAS
   ============================================================ */
.map-container {
  position: relative;
  width: 100%;
  margin-bottom: 14px;
  background: #0a0a14;
  border-radius: 4px;
  overflow: hidden;
}
 
.map-container canvas {
  width: 100%;
  height: auto;
  display: block;
  background: #f0f0f0;
  border: 1px solid #ccc;
  cursor: crosshair;
}
 
/* ============================================================
   TOOLTIP
   ============================================================ */
.tooltip {
  position: absolute;
  background: rgba(10, 10, 20, 0.95);
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  font-family: Menlo, Monaco, monospace;
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
  white-space: nowrap;
  z-index: 20;
  border: 1px solid #333;
}
 
/* ============================================================
   LEGEND
   ============================================================ */
.legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 14px;
}
 
.legend-bar {
  flex: 1;
  height: 12px;
  border-radius: 2px;
  border: 1px solid #333;
  background: linear-gradient(
    to right,
    rgb(59, 76, 192),
    rgb(150, 175, 230),
    rgb(245, 245, 245),
    rgb(245, 150, 130),
    rgb(180, 4, 38)
  );
}
 
.legend-label {
  font-family: Menlo, Monaco, monospace;
  font-size: 11px;
  color: #777;
  white-space: nowrap;
}
 
.caption {
  font-size: 13px;
  color: #bbb;
  font-style: italic;
  line-height: 1.5;
}
 
/* ============================================================
   MAIN MAP CONTROLS
   ============================================================ */
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
 
.year-btn {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 18px;
  border: 1px solid #333;
  background: #1a1a2e;
  color: #aaa;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}
 
.year-btn:hover {
  background: #222236;
  color: #fff;
  border-color: #555;
}
 
.year-btn.active {
  background: #b40426;
  color: #fff;
  border-color: #b40426;
}
 
/* ============================================================
   EXTREME EVENTS SECTION
   ============================================================ */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
 
.event-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: #1a1a2a;
  border: 1px solid #2a2a3a;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
 
.event-card:hover {
  background: #1e1e30;
  border-color: #444;
  transform: translateY(-1px);
}
 
.event-card.active {
  border-color: #b40426;
  background: #1e1018;
}
 
.event-card-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
 
.event-card-body {
  flex: 1;
}
 
.event-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  font-family: Georgia, serif;
}
 
.event-card-date {
  font-size: 12px;
  color: #fff;
  margin-bottom: 2px;
  font-style: italic;
}
 
.event-card-region {
  font-size: 12px;
  color: #fff;
}
 
.markers-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
 
/* ============================================================
   SIDE-BY-SIDE COMPARISON
   ============================================================ */
.split-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
 
.split-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 160px;
}
 
.split-control-group label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #777;
}
 
.split-control-group select {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 12px;
  background: #1a1a2e;
  color: #ddd;
  border: 1px solid #333;
  border-radius: 4px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
 
.split-vs {
  font-size: 18px;
  font-weight: 700;
  color: #555;
  letter-spacing: 2px;
  flex-shrink: 0;
  padding-top: 22px;
}
 
.split-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
 
.split-panel {
  position: relative;
}
 
.split-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
  margin-bottom: 6px;
  font-family: Menlo, Monaco, monospace;
}
 
.crosshair {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 10;
}
 
.crosshair::before,
.crosshair::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.7);
}
 
.crosshair::before {
  width: 1px;
  height: 20px;
  top: -10px;
  left: 0;
}
 
.crosshair::after {
  width: 20px;
  height: 1px;
  top: 0;
  left: -10px;
}
 
.crosshair.hidden {
  display: none;
}
 
/* Compare tooltip */
.compare-tooltip {
  background: rgba(10, 10, 20, 0.97);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 14px 18px;
  margin-top: 14px;
  font-family: Menlo, Monaco, monospace;
  font-size: 13px;
}
 
.compare-tooltip.hidden {
  display: none;
}
 
.compare-tooltip-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 8px;
}
 
.cmp-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
 
.cmp-period {
  font-size: 11px;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 1px;
}
 
.cmp-temp {
  font-size: 22px;
  font-weight: 700;
  color: #ccc;
  transition: color 0.2s;
}
 
.cmp-divider {
  width: 1px;
  height: 40px;
  background: #333;
}
 
.cmp-coords {
  font-size: 12px;
  color: #555;
}
 
/* ============================================================
   ANOMALY MAP
   ============================================================ */
.anomaly-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
 
.anomaly-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 160px;
}
 
.anomaly-control-group label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #777;
}
 
.anomaly-control-group select {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 12px;
  background: #1a1a2e;
  color: #ddd;
  border: 1px solid #333;
  border-radius: 4px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
 
.anomaly-arrow {
  font-size: 22px;
  color: #555;
  flex-shrink: 0;
  padding-top: 22px;
}
 
.anomaly-btn {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 24px;
  background: #b40426;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  align-self: flex-end;
  flex-shrink: 0;
}
 
.anomaly-btn:hover {
  background: #d0052d;
}
 
.anomaly-btn:disabled {
  background: #555;
  cursor: not-allowed;
}
 
.anomaly-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a14;
  color: #555;
  font-style: italic;
  font-size: 15px;
  text-align: center;
  padding: 20px;
}
 
.anomaly-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 10px;
}
 
.anomaly-legend-bar {
  flex: 1;
  height: 12px;
  border-radius: 2px;
  border: 1px solid #333;
  background: linear-gradient(
    to right,
    rgb(30, 100, 200),
    rgb(200, 220, 255),
    rgb(255, 255, 255),
    rgb(255, 200, 200),
    rgb(200, 30, 30)
  );
}
 
/* ============================================================
   GLOBE
   ============================================================ */
#globe-container {
  width: 100%;
  height: 520px;
  background: radial-gradient(ellipse at center, #0d0d20 0%, #000 100%);
  border-radius: 6px;
  cursor: grab;
}
 
#globe-container:active {
  cursor: grabbing;
}
 
/* ============================================================
   WRITEUP
   ============================================================ */
.writeup {
  background: #13131e;
  border: 1px solid #2a2a3a;
  border-left: 4px solid #b40426;
  border-radius: 8px;
  padding: 28px 32px;
}
 
.writeup h2 {
  margin-bottom: 20px;
}
 
/* ============================================================
   FOOTER
   ============================================================ */
footer {
  border-top: 1px solid #1e1e2e;
  padding: 30px 20px;
  text-align: center;
}
 
footer p {
  font-size: 12px;
  color: #555;
  letter-spacing: 1px;
}
 
/* ============================================================
   INTRO
   ============================================================ */
.intro {
  padding: 10px 0 0;
}
 
.intro h2 {
  margin-bottom: 16px;
}
 
/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 700px) {
  h1 { font-size: 42px; }
  .subtitle { font-size: 16px; }
  main { padding: 30px 16px; }
  .viz-section { padding: 18px; }
  .split-container { grid-template-columns: 1fr; }
  .split-vs { padding-top: 0; }
  .anomaly-controls { flex-direction: column; }
  .anomaly-arrow { padding-top: 0; transform: rotate(90deg); }
  .events-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   NARRATIVE
   ============================================================ */
.narrative {
  background: #13131e;
  border: 1px solid #2a2a3a;
  border-left: 4px solid #b40426;
  border-radius: 8px;
  padding: 28px 32px;
  max-width: 100%;
  margin: 0 0 80px;
}

.narrative p {
  font-size: 18px;
  line-height: 1.8;
  color: #ccc;
}

.takeaway h2 {
  font-size: 28px;
  margin-bottom: 20px;
  color: #fff;
}

.takeaway h3 {
  font-size: 18px;
  margin: 24px 0 12px;
  color: #ccc;
}

.takeaway ul {
  padding-left: 20px;
  color: #bbb;
  font-size: 16px;
  line-height: 2;
}

.takeaway a {
  color: #b40426;
  text-decoration: none;
}

.takeaway a:hover {
  text-decoration: underline;
}