/* === Design tokens === */
:root {
  --bg: #0a0b0d;
  --bg-elev: #13151a;
  --bg-elev-2: #1c1f26;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --muted-2: #6b7280;
  --accent: #ffdf1a;
  --accent-2: #ffd000;
  --danger: #ff5a5a;
  --warning: #ffb84d;
  --ok: #4ade80;
  --link: #6ee7ff;
  --border: #2a2d35;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --max: 1160px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  font-size: 17px;
  overflow-x: hidden;
}

a {
  color: var(--link);
  text-underline-offset: 3px;
}

a:hover, a:focus {
  color: var(--accent);
}

sup a {
  font-size: 0.7em;
  color: var(--muted-2);
  text-decoration: none;
  margin-left: 0.1em;
}

sup a:hover, sup a:focus {
  color: var(--accent);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: var(--bg);
  color: var(--text);
  padding: 0.5rem 1rem;
  border: 2px solid var(--accent);
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.container {
  width: min(92%, var(--max));
  margin-inline: auto;
}

section {
  padding: clamp(4rem, 10vw, 7rem) 0;
  position: relative;
}

section + section::before {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(80%, 800px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

/* === Typography === */
h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.8rem, 8vw, 6.2rem);
  font-weight: 800;
}

h2 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 700;
  margin-bottom: 1.25rem;
}

h3 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 650;
  margin-bottom: 0.8rem;
}

p {
  margin: 0 0 1.2rem;
}

.kicker {
  display: inline-block;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
}

.lede {
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  color: var(--muted);
  max-width: 42rem;
  line-height: 1.6;
}

.caption, figcaption, .source-note {
  font-size: 0.85rem;
  color: var(--muted-2);
  line-height: 1.5;
}

.source-note a {
  color: var(--muted);
}

/* === Cards === */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.2rem, 3vw, 2rem);
  box-shadow: var(--shadow);
}

.callout {
  border-left: 4px solid var(--accent);
  background: linear-gradient(90deg, rgba(255, 223, 26, 0.06), transparent 40%);
  padding: 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
}

.callout.danger {
  border-left-color: var(--danger);
  background: linear-gradient(90deg, rgba(255, 90, 90, 0.06), transparent 40%);
}

.callout.warning {
  border-left-color: var(--warning);
  background: linear-gradient(90deg, rgba(255, 184, 77, 0.06), transparent 40%);
}

/* === Hero === */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 8rem 0 5rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 223, 26, 0.08), transparent 30%),
    radial-gradient(circle at 80% 70%, rgba(110, 231, 255, 0.06), transparent 35%);
  pointer-events: none;
}

.hero .container {
  position: relative;
  z-index: 2;
}

.hero h1 {
  max-width: 18ch;
  margin: 0 auto 1.5rem;
}

.hero .price {
  font-family: var(--mono);
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.04em;
  margin: 0.5rem 0 1.5rem;
  line-height: 1;
}

.hero .price .currency {
  font-size: 0.5em;
  vertical-align: super;
  margin-right: 0.1em;
}

.hero .byline {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 2rem;
}

.hero .byline a {
  color: var(--muted);
}

.hero .byline a:hover {
  color: var(--accent);
}

/* === Counters === */
.counter {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.counter-unit {
  font-size: 0.5em;
  color: var(--muted);
  margin-left: 0.15em;
}

.big-stat {
  text-align: center;
  margin: 2rem 0;
}

.big-stat .number {
  font-family: var(--mono);
  font-size: clamp(4rem, 12vw, 9rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  display: block;
}

.big-stat .label {
  color: var(--muted);
  font-size: 1rem;
  margin-top: 0.5rem;
  display: block;
}

/* === Bidding timeline === */
.bidding-wrap {
  position: relative;
}

.bidding-timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 2rem 0 1rem;
  position: relative;
}

.bidding-timeline::before {
  content: "";
  position: absolute;
  top: 2rem;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.bid {
  position: relative;
  z-index: 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.bid.revealed {
  opacity: 1;
  transform: translateY(0);
}

.bid .bidder {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  margin-bottom: 0.5rem;
}

.bid .amount {
  font-family: var(--mono);
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 700;
  color: var(--accent);
  display: block;
}

.bid .note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.4rem;
  min-height: 2.4em;
}

.bid.winner {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.bid.backup {
  border-color: var(--warning);
}

.bid-cta {
  margin-top: 1rem;
  text-align: center;
}

.replay-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.replay-btn:hover, .replay-btn:focus {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

/* === Data scale / bubbles === */
.scale-intro {
  margin-bottom: 2rem;
}

.scale-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}

.bubble-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 1.2rem;
  margin: 2rem 0;
  min-height: 320px;
}

.bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 50%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem;
  aspect-ratio: 1 / 1;
  min-width: 80px;
  transition: transform 0.35s ease, border-color 0.2s;
  cursor: default;
  position: relative;
}

.bubble:hover, .bubble:focus {
  border-color: var(--accent);
  z-index: 2;
}

.bubble .num {
  font-family: var(--mono);
  font-size: clamp(0.8rem, 2vw, 1.2rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.bubble .name {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.2;
  margin-top: 0.3rem;
  max-width: 100%;
}

.bubble.tiny {
  min-width: 60px;
}

.bubble.tiny .num {
  font-size: 0.75rem;
}

.revenue-bar {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.revenue-bar .bar {
  height: 40px;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), #e1c000);
  border-radius: 8px;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 1.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.revenue-bar.revealed .bar {
  transform: scaleX(1);
}

.revenue-bar .bar-label {
  display: flex;
  justify-content: space-between;
  margin-top: 0.75rem;
  font-family: var(--mono);
  font-size: 0.9rem;
}

/* === Comparison bars === */
.compare-bars {
  margin: 2.5rem 0;
}

.compare-row {
  margin-bottom: 1.5rem;
}

.compare-row .label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.compare-row .track {
  height: 34px;
  background: var(--bg-elev-2);
  border-radius: 8px;
  overflow: hidden;
}

.compare-row .fill {
  height: 100%;
  border-radius: 8px;
  width: 0;
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  align-items: center;
  padding-left: 0.75rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  white-space: nowrap;
}

.compare-row .fill.data {
  background: var(--accent);
  color: #000;
}

.compare-row .fill.slots {
  background: var(--link);
  color: #000;
}

/* === Inventory === */
.inventory-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0;
  align-items: center;
}

.filter-btn, .sort-select {
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.filter-btn.active, .filter-btn:hover, .filter-btn:focus {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.sort-select {
  border-radius: var(--radius-sm);
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}

.search-input {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  min-width: 220px;
}

.search-input:focus {
  border-color: var(--accent);
  outline: none;
}

.inventory-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.95rem;
}

.inventory-table th,
.inventory-table td {
  text-align: left;
  padding: 0.9rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.inventory-table th {
  color: var(--muted-2);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.inventory-table tr:last-child td {
  border-bottom: none;
}

.inventory-table .count {
  font-family: var(--mono);
  color: var(--accent);
  white-space: nowrap;
}

.inventory-table .badge {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  margin-top: 0.35rem;
}

.inventory-table .badge.contested {
  border-color: var(--warning);
  color: var(--warning);
}

.inventory-table .badge.excluded {
  border-color: var(--danger);
  color: var(--danger);
}

.inventory-table .note {
  color: var(--muted);
  font-size: 0.85rem;
}

.inventory-total {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* === Referential integrity diagram === */
.ref-wrap {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr 1.2fr;
  align-items: start;
}

.ref-graph {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
}

.ref-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
}

.ref-btn {
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.ref-btn:hover, .ref-btn:focus, .ref-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.ref-legend {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.ref-legend li {
  margin-bottom: 0.5rem;
  padding-left: 1.25rem;
  position: relative;
}

.ref-legend li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* === Objection / economics === */
.quote {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 650;
  line-height: 1.35;
  color: var(--text);
  margin: 0;
}

.quote cite {
  display: block;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: normal;
  font-weight: 500;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

.econ-point {
  margin-bottom: 1.5rem;
}

.econ-point h3 {
  margin-bottom: 0.4rem;
}

/* === Sources === */
.sources-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
}

.sources-list li {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.sources-list li:last-child {
  border-bottom: none;
}

.sources-list .ref-num {
  display: inline-block;
  width: 1.6rem;
  height: 1.6rem;
  line-height: 1.6rem;
  text-align: center;
  border-radius: 50%;
  background: var(--bg-elev-2);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8rem;
  margin-right: 0.75rem;
}

/* === Reveal animations (only when JS is available) === */
html.js .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

html.js .reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

html:not(.js) .bid {
  opacity: 1 !important;
  transform: none !important;
}

html:not(.js) .reveal,
html:not(.js) .revenue-bar .bar,
html:not(.js) .compare-row .fill {
  opacity: 1 !important;
  transform: none !important;
}

/* === Responsive === */
@media (max-width: 900px) {
  .ref-wrap,
  .two-col {
    grid-template-columns: 1fr;
  }

  .bidding-timeline {
    grid-template-columns: 1fr 1fr;
  }

  .bubble-grid {
    gap: 0.8rem;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .bidding-timeline {
    grid-template-columns: 1fr;
  }

  .bidding-timeline::before {
    display: none;
  }

  .inventory-table thead {
    display: none;
  }

  .inventory-table,
  .inventory-table tbody,
  .inventory-table tr,
  .inventory-table td {
    display: block;
    width: 100%;
  }

  .inventory-table tr {
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .inventory-table td {
    border-bottom: none;
    padding: 0.35rem 0;
  }

  .inventory-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted-2);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.15rem;
  }

  .inventory-table .count {
    font-size: 1.1rem;
  }

  .bubble-grid {
    min-height: auto;
    gap: 0.6rem;
  }

  .bubble {
    min-width: 64px;
    padding: 0.4rem;
  }

  .bubble .num {
    font-size: 0.75rem;
  }

  .bubble .name {
    font-size: 0.62rem;
  }
}

@media (max-width: 480px) {
  .filter-btn, .search-input, .sort-select, .ref-btn {
    width: 100%;
  }

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