@font-face {
  font-family: 'Circular XX';
  src: url('brandguideline/Document fonts/CircularXX-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'Circular XX';
  src: url('brandguideline/Document fonts/CircularXX-Medium.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
}

@font-face {
  font-family: 'Circular XX';
  src: url('brandguideline/Document fonts/CircularXX-Italic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
}

:root {
  color-scheme: light;
  --bg: #f6f2ee;
  --panel: rgba(255, 255, 255, 0.82);
  --text: #422a17;
  --muted: #7a6f67;
  --accent: #ae3f25;
  --accent-2: #6a4f04;
  --accent-3: #6e0a00;
  --selected: #ae3f25;
  --baseline: #144169;
  --line: rgba(66, 42, 23, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Circular XX', sans-serif;
  background: radial-gradient(circle at top left, #fcf5ed 0%, var(--bg) 55%, #e9e5d9 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.6s ease, color 0.6s ease;
}

body.heatwave-active {
  background: radial-gradient(circle at top left, #d69f92 0%, var(--accent) 55%, var(--accent-3) 100%);
  color: #fff5f0;
}

.background-glow {
  position: fixed;
  inset: auto;
  width: 36rem;
  height: 36rem;
  filter: blur(100px);
  opacity: 0.35;
  pointer-events: none;
  transition: opacity 0.6s ease, background 0.6s ease;
}

.glow-a {
  top: -8rem;
  left: -8rem;
  background: var(--accent-2);
}

.glow-b {
  right: -8rem;
  bottom: -6rem;
  background: var(--accent-3);
}

body.heatwave-active .background-glow {
  opacity: 0.6;
  background: var(--accent-3);
}

.heatwave-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  background: repeating-linear-gradient(
    transparent 0%,
    rgba(110, 10, 0, 0.08) 50%,
    transparent 100%
  );
  mix-blend-mode: multiply;
  transition: opacity 0.6s ease;
}

body.heatwave-active .heatwave-overlay {
  opacity: 1;
  animation: heat-shimmer 2.4s ease-in-out infinite;
}

@keyframes heat-shimmer {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-6px) scaleY(1.015); }
}

.flame-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
}

.flame-particle {
  position: absolute;
  bottom: -2rem;
  font-size: 1.4rem;
  opacity: 0;
  filter: drop-shadow(0 0 6px rgba(255, 120, 30, 0.6));
}

.app-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.chart-card,
.chart-wrapper {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(180, 90, 20, 0.12);
}

.chart-card {
  border-radius: 30px;
  padding: 1.3rem;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.eyebrow {
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 0.5rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3.4vw, 2.3rem);
  line-height: 1.1;
}

.source-note {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.source-note a {
  color: var(--accent);
  font-weight: 600;
}

.chart-intro {
  margin: 0 0 1rem;
  padding: 0.85rem 1.1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.chart-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.year-label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.year-select {
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}

.year-select:focus {
  border-color: var(--accent);
}

.heatwave-btn {
  border-radius: 999px;
  padding: 0.55rem 1rem;
  border: 1px solid rgba(255, 106, 0, 0.4);
  background: linear-gradient(135deg, rgba(255, 106, 0, 0.15), rgba(255, 61, 61, 0.15));
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.heatwave-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 106, 0, 0.25);
}

.heatwave-btn[aria-pressed='true'] {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #fff;
  box-shadow: 0 0 24px rgba(255, 60, 0, 0.5);
}

.stat-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 0.9rem 0 1rem;
}

.stat-tile {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.7rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.extreme-banner {
  opacity: 0;
  transform: translateY(-8px);
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  border-radius: 12px;
  padding: 0.55rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 0 30px rgba(255, 80, 0, 0.4);
  pointer-events: none;
}

.legend-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.legend-title {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.size-legend {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.size-legend-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0.2rem;
  border-radius: 8px;
  transition: color 0.15s ease;
}

.size-legend-item:hover,
.size-legend-item.active {
  color: var(--text);
}

.size-legend-item svg {
  overflow: visible;
}

.chart-status {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.3rem;
}

.legend-selected {
  background: var(--selected);
  box-shadow: 0 0 12px rgba(255, 87, 34, 0.5);
}

.legend-baseline {
  background: var(--baseline);
}

.chart-wrapper {
  position: relative;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.5);
  padding: 0.75rem;
}

svg {
  width: 100%;
  height: auto;
  display: block;
}

.data-point {
  cursor: pointer;
  transition: filter 0.15s ease;
  transform-box: fill-box;
  transform-origin: center;
}

.data-point.dimmed {
  opacity: 0.06 !important;
}

.data-point.extreme-point {
  filter: drop-shadow(0 0 6px rgba(255, 61, 0, 0.7));
}

.tooltip {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  background: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--bg);
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -110%);
  min-width: 150px;
  font-size: 0.88rem;
  z-index: 5;
  line-height: 1.4;
}

.tooltip strong {
  font-size: 0.98rem;
}

.tooltip .tip-extreme {
  color: var(--accent-2);
  font-weight: 800;
}

/* ---------- calendar heatmap ---------- */

.calendar-hint {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.calendar-grid {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.calendar-month-row {
  display: grid;
  grid-template-columns: 2.4rem repeat(31, minmax(0, 1fr));
  gap: 3px;
  align-items: center;
}

.calendar-month-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.cal-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: transform 0.12s ease;
}

.cal-cell:hover {
  transform: scale(1.25);
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.cal-cell.cal-empty {
  visibility: hidden;
}

.cal-cell.cal-extreme::after {
  content: '🔥';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
}

.cal-cell.cal-highlight {
  outline: 2px solid var(--selected);
  outline-offset: 1px;
  transform: scale(1.3);
  z-index: 3;
}

.cal-visit-dot {
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
}

@media (max-width: 860px) {
  .stat-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .legend-row {
    flex-direction: column;
  }

  .calendar-month-row {
    grid-template-columns: 1.8rem repeat(31, minmax(0, 1fr));
  }
}
