:root {
  color-scheme: light;
  --ink: #16201f;
  --muted: #62706d;
  --line: #d9e1de;
  --panel: rgba(255, 255, 255, 0.9);
  --accent: #b91c1c;
  --accent-dark: #7f1d1d;
  --gold: #d99224;
  --green: #0f766e;
  --bg: #f5f2ec;
  --shadow: 0 24px 70px rgba(31, 41, 55, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 18%, rgba(185, 28, 28, 0.16), transparent 28rem),
    linear-gradient(135deg, #f7f3eb 0%, #eef4f2 54%, #f9f6ef 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

button:hover {
  background: var(--accent-dark);
  box-shadow: 0 12px 28px rgba(127, 29, 29, 0.22);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 500px);
  gap: 28px;
  align-items: end;
  min-height: 460px;
  padding: 42px;
  border: 1px solid rgba(22, 32, 31, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(110deg, rgba(15, 23, 42, 0.76), rgba(127, 29, 29, 0.38)),
    url("https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1800&q=85") center/cover;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-copy {
  max-width: 640px;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.25);
}

.eyebrow {
  margin: 0 0 14px;
  color: #ffd6a7;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: 5.8rem;
  line-height: 0.92;
  max-width: 8.5ch;
}

.lede {
  max-width: 620px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.15rem;
  line-height: 1.55;
}

.search-panel,
.insight-panel,
.summary-grid article,
.detail-grid article,
.map-panel,
.results {
  border: 1px solid rgba(22, 32, 31, 0.1);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 42px rgba(31, 41, 55, 0.12);
  backdrop-filter: blur(18px);
}

.search-panel {
  padding: 22px;
}

.search-panel label,
.controls label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 850;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 9px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input {
  min-height: 54px;
  padding: 0 16px;
  font-size: 1rem;
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.search-row button {
  min-width: 104px;
  padding: 0 22px;
}

.controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

select {
  min-height: 44px;
  padding: 0 12px;
}

#sampleBtn {
  min-height: 44px;
  padding: 0 16px;
  color: var(--accent-dark);
  background: #f8e6e2;
}

.status {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.data-as-of {
  margin: 18px 0 -4px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 18px 0;
}

.summary-grid article,
.detail-grid article {
  padding: 20px;
}

.summary-grid span,
.detail-grid span {
  display: block;
  margin-bottom: 6px;
  font-size: 2rem;
  font-weight: 900;
}

.detail-grid span .rating-description {
  display: inline;
  font-size: 0.72em;
  line-height: 1.05;
}

.summary-grid p,
.detail-grid p {
  margin: 0;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: -6px 0 18px;
}

.results-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.insight-panel {
  align-self: start;
  padding: 24px;
  position: sticky;
  top: 18px;
}

.insight-panel h2,
.toolbar h2 {
  margin-bottom: 10px;
  font-size: 1.35rem;
}

.insight-panel p {
  color: var(--muted);
  line-height: 1.6;
}

.place-meta {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.meta-chip {
  padding: 10px 12px;
  border-radius: 8px;
  background: #eef4f2;
  color: #29413d;
  font-size: 0.9rem;
  font-weight: 750;
}

.toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.toolbar select {
  max-width: 190px;
}

.results {
  min-height: 180px;
  padding: 10px;
}

.map-panel {
  padding: 20px;
}

.rating-legend {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.panel-heading {
  display: flex;
  gap: 16px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-heading h2 {
  margin-bottom: 0;
  font-size: 1.2rem;
}

.panel-heading p {
  max-width: 430px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.panel-heading.compact {
  display: block;
}

.panel-heading.compact h2 {
  margin-bottom: 6px;
}

.track-map {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e9e4c7;
}

.map-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 0;
  background: #fff;
}

.track-map svg {
  display: block;
  width: 100%;
  min-height: 320px;
}

.track-year {
  fill: #101817;
  font-size: 15px;
  font-weight: 950;
  paint-order: stroke;
  stroke: #f8f3dc;
  stroke-linejoin: round;
  stroke-width: 5px;
}

.map-attribution {
  fill: #33413f;
  font-size: 11px;
  font-weight: 800;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-linejoin: round;
  stroke-width: 4px;
}

.map-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 430px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  list-style: none;
}

.map-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px;
  border-radius: 8px;
  background: #f8faf9;
}

.map-index {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: #fff;
  background: var(--track-color);
  font-size: 0.78rem;
  font-weight: 950;
}

.map-list b {
  display: block;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.25;
}

.map-list small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.25;
}

.empty-map {
  display: grid;
  place-items: center;
  min-height: 320px;
  color: var(--muted);
  text-align: center;
}

.map-note {
  margin: 10px 12px 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.legend-grid {
  display: grid;
  gap: 10px;
}

.legend-grid span {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f3f6f4;
  color: #40504d;
  font-size: 0.92rem;
  line-height: 1.35;
}

.legend-grid b {
  display: inline-block;
  min-width: 42px;
  color: var(--ink);
}

.disclaimer-panel {
  margin-top: 18px;
  padding: 22px 24px;
  border: 1px solid rgba(127, 29, 29, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 14px 34px rgba(31, 41, 55, 0.1);
}

.disclaimer-panel h2 {
  margin-bottom: 10px;
  font-size: 1.15rem;
}

.disclaimer-panel p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.disclaimer-panel p:last-child {
  margin-bottom: 0;
}

.disclaimer-panel a {
  color: var(--accent-dark);
  font-weight: 850;
}

.results.empty {
  display: grid;
  place-items: center;
  min-height: 240px;
  color: var(--muted);
  text-align: center;
}

.event-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.event-card:last-child {
  border-bottom: 0;
}

.scale-badge {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 950;
}

.event-card h3 {
  margin: 0 0 6px;
  font-size: 1.08rem;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.event-meta span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f3f6f4;
}

.narrative {
  margin-bottom: 0;
  color: #40504d;
  line-height: 1.5;
}

.narrative-full,
.narrative.expanded .narrative-preview {
  display: none;
}

.narrative.expanded .narrative-full {
  display: inline;
}

.read-more {
  margin-left: 8px;
  padding: 0;
  color: var(--accent-dark);
  background: transparent;
  border-radius: 0;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.read-more:hover {
  color: var(--accent);
  background: transparent;
  box-shadow: none;
  transform: none;
}

.warning {
  color: #fff;
}

.event-meta span.warning {
  background: var(--accent);
  color: #fff;
  font-weight: 850;
}

@media (max-width: 860px) {
  .hero,
  .results-layout,
  .summary-grid,
  .detail-grid,
  .map-stage {
    grid-template-columns: 1fr;
  }

  .map-list {
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .hero {
    min-height: auto;
    padding: 26px;
  }

  h1 {
    max-width: 9ch;
    font-size: 4.2rem;
  }

  .insight-panel {
    position: static;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1160px);
    padding-top: 10px;
  }

  .hero {
    padding: 18px;
  }

  .search-row,
  .controls,
  .event-card,
  .panel-heading {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    display: grid;
    gap: 6px;
  }

  .search-row button,
  #sampleBtn {
    min-height: 48px;
  }

  h1 {
    font-size: 3.1rem;
  }
}
