/* Canopy Cup v0 — Moore Works */

:root {
  --bg: #0f1410;
  --surface: #1a221c;
  --surface-2: #243028;
  --text: #e8f0ea;
  --muted: #9bb0a4;
  --accent: #3dd68c;
  --accent-dim: #2a9d63;
  --warn: #f0b429;
  --danger: #f07178;
  --border: #2f4036;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", monospace;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(ellipse 120% 80% at 50% -20%, #1e3d2a 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 16, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand h1 span {
  color: var(--accent);
}

.brand p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

nav a {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  text-decoration: none;
}

nav a:hover,
nav a.active {
  border-color: var(--accent-dim);
  background: var(--surface-2);
  text-decoration: none;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.hero {
  text-align: center;
  padding: 2rem 0 1.5rem;
}

.hero h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 650;
}

.hero p {
  margin: 0 auto;
  max-width: 42rem;
  color: var(--muted);
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

.live-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 700px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
}

.compare-result {
  margin-top: 1.5rem;
}

.headline {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1rem;
  line-height: 1.35;
}

.city-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.city-stat {
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.city-stat.winner {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 1px rgba(61, 214, 140, 0.15);
}

.city-stat h4 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
}

.city-stat .pct {
  font-size: 2.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  line-height: 1.1;
}

.city-stat .meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.bar-compare {
  margin: 1.25rem 0;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.bar-label {
  width: 7rem;
  font-size: 0.85rem;
  text-align: right;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 1.5rem;
  background: var(--surface-2);
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transition: width 0.6s ease;
}

.trend-up { color: var(--accent); }
.trend-down { color: var(--danger); }
.trend-flat { color: var(--muted); }

.trend-line {
  font-size: 0.85rem;
  font-family: var(--mono);
}

.bucket-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.leaderboard-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.tab-group {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.tab-group button {
  padding: 0.55rem 1rem;
  border: none;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.tab-group button.active {
  background: var(--accent-dim);
  color: #fff;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 0.75rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.rank {
  font-weight: 700;
  color: var(--muted);
  width: 2.5rem;
}

.rank-1 .rank { color: var(--warn); }
.rank-2 .rank { color: #c0c0c0; }
.rank-3 .rank { color: #cd7f32; }

.pct-cell {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.subscribe {
  margin-top: 2rem;
}

.subscribe form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.subscribe input[type="email"] {
  flex: 1;
  min-width: 200px;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.subscribe button {
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: var(--accent-dim);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.subscribe button:hover {
  background: var(--accent);
  color: #0f1410;
}

.subscribe .note {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.disclaimer {
  margin-top: 2rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2);
  border: 1px dashed var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

.site-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

.hidden { display: none !important; }

.momentum-badge {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.momentum-badge.hot {
  background: rgba(61, 214, 140, 0.2);
  color: var(--accent);
}

.momentum-badge.cool {
  background: rgba(240, 113, 120, 0.15);
  color: var(--danger);
}

.sources-compact {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  text-align: left;
}

.sources-compact h5 {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.sources-compact ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.sources-compact li {
  margin-bottom: 0.35rem;
}

.sources-compact a {
  color: var(--accent);
}

.sources-more {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.sources-footnote {
  margin: 1.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.methodology-block p {
  margin: 0 0 1rem;
  color: var(--text);
}

.methodology-block p:last-child {
  margin-bottom: 0;
}

.formula {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.9rem;
  overflow-x: auto;
  margin: 0 0 1rem;
}

.method-list {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  color: var(--muted);
}

.method-list li {
  margin-bottom: 0.5rem;
}

.note-block {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: rgba(61, 214, 140, 0.08);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
}

.rank-explainer {
  width: 100%;
  border-collapse: collapse;
}

.rank-explainer td,
.rank-explainer th {
  padding: 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.9rem;
}

.bucket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.bucket-card {
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.bucket-card h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.bucket-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.city-source-card {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

.city-source-card:last-child {
  border-bottom: none;
}

.city-source-card h3 {
  margin: 0 0 0.35rem;
}

.city-source-card.highlight-card {
  background: rgba(61, 214, 140, 0.06);
  margin: 0 -1.25rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  border-radius: var(--radius);
}

.source-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.9rem;
}

.source-facts dt {
  color: var(--muted);
  font-weight: 600;
}

.source-facts dd {
  margin: 0;
}

.snapshot-table {
  width: 100%;
  font-size: 0.85rem;
}

.snapshot-table a {
  word-break: break-word;
}
