:root {
  --paper: #ffffff;
  --ink: #111111;
  --muted: #5f595a;
  --rule: #ddd6d6;
  --rule-soft: #eee7e8;
  --surface: rgba(247, 241, 242, 0.46);
  --accent: #7a1f2b;
  --accent-hover: #4f111a;
  --accent-soft: rgba(122, 31, 43, 0.17);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  border-top: 3px solid var(--accent);
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

header {
  width: calc(100% - 20px);
  min-height: 68px;
  margin: 10px auto 0;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(122, 31, 43, 0.12);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(122, 31, 43, 0.06);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  font-size: 15px;
}

header a {
  color: var(--accent);
  font-weight: 500;
  letter-spacing: -0.025em;
}

main {
  width: min(1380px, calc(100% - 44px));
  margin: 0 auto;
  padding: 60px 0 44px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 7px;
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 500;
  letter-spacing: -0.045em;
}

h2 {
  margin-top: 5px;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.035em;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.intro,
.section-heading,
.browser-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.sample-summary,
#chart-selection {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.chart-scope {
  display: flex;
  align-items: center;
  gap: 12px;
}

#show-all-deals {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--rule-soft);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.44);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

#show-all-deals:hover,
#show-all-deals:focus-visible,
#show-all-deals[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--ink);
  outline: none;
}

#show-all-deals[aria-pressed="true"] {
  background: rgba(122, 31, 43, 0.08);
}

.dataset-meta {
  display: grid;
  justify-items: end;
  gap: 9px;
}

.dataset-select {
  display: grid;
  gap: 6px;
}

.dataset-select span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dataset-select select {
  min-width: 230px;
  min-height: 38px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--rule-soft);
  border-radius: 9px;
  background-color: rgba(255, 255, 255, 0.44);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.dataset-select select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(122, 31, 43, 0.1);
}

.timeline-card,
.deal-browser,
.deal-detail {
  border: 1px solid var(--rule-soft);
  background: var(--surface);
}

.timeline-card {
  margin-top: 34px;
  padding: 24px 24px 18px;
  border-radius: 14px;
}

.chart-scroll {
  margin-top: 28px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

#timeline-chart {
  display: block;
  width: 100%;
  min-width: 780px;
  height: 300px;
  overflow: visible;
}

.chart-grid,
.chart-axis {
  stroke: var(--rule-soft);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-label,
.chart-value {
  fill: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart-bar {
  fill: var(--accent-soft);
  cursor: pointer;
  transition: fill 140ms ease;
}

.chart-bar:hover,
.chart-bar:focus,
.chart-bar.is-selected {
  fill: var(--accent);
  outline: none;
}

.chart-bar:focus-visible {
  stroke: var(--ink);
  stroke-width: 2;
}

.explorer {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(440px, 1.45fr);
  gap: 14px;
  margin-top: 14px;
}

.deal-browser,
.deal-detail {
  min-height: 530px;
  border-radius: 14px;
}

.browser-heading {
  display: grid;
  align-items: start;
  justify-content: stretch;
  gap: 14px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--rule-soft);
}

.browser-controls {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.search-field {
  display: block;
  min-width: 0;
  flex: 1;
}

.sort-field {
  display: block;
}

.search-field input,
.sort-field select {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--rule-soft);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.44);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: none;
}

.search-field input {
  width: 100%;
}

.sort-field select {
  width: 180px;
  padding-right: 30px;
  cursor: pointer;
}

.search-field input::placeholder {
  color: var(--muted);
}

.search-field input:focus,
.sort-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(122, 31, 43, 0.1);
}

.deal-list {
  max-height: 474px;
  overflow-y: auto;
}

.deal-row {
  width: 100%;
  padding: 16px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 18px;
  border: 0;
  border-bottom: 1px solid var(--rule-soft);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.deal-row:hover,
.deal-row:focus,
.deal-row.is-selected {
  background: rgba(255, 255, 255, 0.48);
  outline: none;
}

.deal-row:focus-visible {
  box-shadow: inset 3px 0 0 var(--accent);
}

.deal-target {
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deal-buyer,
.deal-date {
  color: var(--muted);
  font-size: 12px;
}

.deal-buyer {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deal-date {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-variant-numeric: tabular-nums;
}

.empty-list {
  padding: 28px 22px;
  color: var(--muted);
  font-size: 13px;
}

.deal-detail {
  padding: 28px;
}

.detail-empty {
  min-height: 470px;
  display: grid;
  place-content: center;
  text-align: center;
}

.detail-empty p:last-child {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.detail-head {
  padding-bottom: 25px;
  border-bottom: 1px solid var(--rule-soft);
}

.detail-head h2 {
  max-width: 740px;
  margin-top: 8px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.06;
}

.detail-head .acquirer-line {
  margin-top: 11px;
  color: var(--muted);
  font-size: 14px;
}

.buyer-source {
  display: inline-block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.buyer-source:hover,
.buyer-source:focus-visible {
  color: var(--accent-hover);
}

.buyer-source.is-unavailable {
  border-bottom: 0;
}

.detail-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-item {
  min-height: 112px;
  padding: 22px 18px 18px 0;
  border-bottom: 1px solid var(--rule-soft);
}

.detail-item:nth-child(3n + 2),
.detail-item:nth-child(3n + 3) {
  padding-left: 18px;
  border-left: 1px solid var(--rule-soft);
}

.detail-item dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-item dd {
  margin: 11px 0 0;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.detail-item small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.data-note {
  max-width: 780px;
  margin: 18px 2px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

noscript {
  display: block;
  margin: 24px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 820px) {
  header {
    width: calc(100% - 16px);
    min-height: 58px;
    margin-top: 8px;
    padding: 0 18px;
    border-radius: 10px;
    font-size: 14px;
  }

  main {
    width: calc(100% - 24px);
    padding-top: 38px;
  }

  .intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .dataset-meta {
    width: 100%;
    justify-items: start;
  }

  .dataset-select,
  .dataset-select select {
    width: 100%;
  }

  .timeline-card {
    margin-top: 26px;
    padding: 20px 16px 15px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .chart-scope {
    align-items: flex-end;
    flex-direction: column;
    gap: 8px;
  }

  .explorer {
    grid-template-columns: 1fr;
  }

  .deal-browser,
  .deal-detail {
    min-height: auto;
  }

  .deal-list {
    max-height: 420px;
  }

  .deal-detail {
    padding: 22px;
  }

  .detail-empty {
    min-height: 250px;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-item:nth-child(3n + 2),
  .detail-item:nth-child(3n + 3) {
    padding-left: 0;
    border-left: 0;
  }

  .detail-item:nth-child(even) {
    padding-left: 16px;
    border-left: 1px solid var(--rule-soft);
  }
}

@media (max-width: 520px) {
  .browser-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .search-field,
  .search-field input,
  .sort-field,
  .sort-field select,
  .browser-controls {
    width: 100%;
  }

  .browser-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-item,
  .detail-item:nth-child(even) {
    padding-left: 0;
    border-left: 0;
  }
}
