:root {
  color-scheme: light;
  --ink: #181510;
  --muted: #665e52;
  --line: #ded7ca;
  --paper: #fbf8f2;
  --panel: #ffffff;
  --ember: #d84d2a;
  --gold: #d9a441;
  --teal: #188f8b;
  --plum: #623b73;
  --night: #101010;
  --shadow: 0 18px 55px rgba(40, 28, 14, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
input {
  font: inherit;
}

.app-header {
  position: relative;
  min-height: 92vh;
  overflow: hidden;
  background: var(--night);
  color: white;
}

.hero-media {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 8, 8, 0.86), rgba(8, 8, 8, 0.38) 54%, rgba(8, 8, 8, 0.74)),
    linear-gradient(180deg, rgba(8, 8, 8, 0.14), rgba(8, 8, 8, 0.88)),
    url("assets/toronto-events-hero.png") center / cover;
  transform: scale(1.01);
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0;
}

.brand,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 850;
  font-size: 1.05rem;
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.13);
  backdrop-filter: blur(14px);
}

.topbar-actions a {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
}

.topbar-actions a:hover {
  color: white;
}

.category-dock {
  position: sticky;
  top: 0;
  z-index: 4;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 10px;
}

.category-dock-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(16, 16, 16, 0.62);
  padding: 10px;
  backdrop-filter: blur(18px);
}

.dock-label {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hero {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  width: min(1180px, calc(100% - 32px));
  min-height: calc(92vh - 146px);
  margin: 0 auto;
  padding: 54px 0 110px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(3rem, 9vw, 7.5rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 660px;
  margin: 26px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.55;
}

.hero-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.primary-action,
.secondary-action,
.ticket-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 800;
}

.primary-action {
  padding: 0 18px;
  background: var(--gold);
  color: #201307;
}

.secondary-action {
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.33);
  background: rgba(255, 255, 255, 0.08);
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(1180px, calc(100% - 32px));
  margin: -54px auto 0;
  position: relative;
  z-index: 2;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.stats-strip div {
  min-width: 0;
  padding: 22px;
  border-right: 1px solid var(--line);
}

.stats-strip div:last-child {
  border-right: 0;
}

.stats-strip strong {
  display: block;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  line-height: 1;
}

.stats-strip span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.section-shell,
.method-band {
  width: min(1180px, calc(100% - 32px));
  margin: 72px auto 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.section-subtitle {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.ranking-tools,
.category-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-dock .category-rail {
  flex: 1;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 1px;
  scrollbar-width: thin;
}

.segmented,
.category-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
  color: var(--muted);
  cursor: pointer;
  font-weight: 750;
}

.segmented {
  padding: 0 13px;
}

.category-button {
  flex: 0 0 auto;
  padding: 0 12px;
}

.category-dock .category-button {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.84);
}

.segmented.active,
.category-button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.category-dock .category-button.active {
  border-color: var(--gold);
  background: var(--gold);
  color: #211409;
}

.top-list {
  display: grid;
  gap: 10px;
}

.top-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1.35fr) minmax(220px, 0.8fr) 110px;
  gap: 16px;
  align-items: center;
  min-height: 82px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.rank {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #f0eadf;
  font-weight: 900;
}

.top-row h3,
.event-card h3 {
  margin: 0;
  line-height: 1.12;
}

.top-row p,
.event-card p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.score-stack {
  display: grid;
  gap: 5px;
}

.mini-score {
  display: grid;
  grid-template-columns: 82px 1fr 32px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee4d6;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.ticket-link {
  padding: 0 14px;
  background: var(--ember);
  color: white;
  text-align: center;
}

.search-box {
  display: grid;
  gap: 7px;
  min-width: min(360px, 100%);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.search-box input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: white;
  color: var(--ink);
  outline: 0;
  text-transform: none;
  font-weight: 600;
}

.search-box input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(24, 143, 139, 0.15);
}

.database-section {
  scroll-margin-top: 96px;
}

.database-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 0 0 20px;
}

.database-stats div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 16px;
}

.database-stats strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.database-stats span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.86rem;
}

.database-panels {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.watchlist-panel {
  display: none;
  margin: 0 0 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
  padding: 16px;
}

.watchlist-panel.active {
  display: block;
}

.watchlist-panel h3 {
  margin: 0 0 10px;
}

.watchlist-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.watchlist-chip {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border-radius: 999px;
  background: #e8f5f2;
  color: #0a6e69;
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 900;
}

.filter-panel {
  position: sticky;
  top: 76px;
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 16px;
}

.filter-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.filter-panel select,
.filter-panel input[type="search"] {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
  color: var(--ink);
  padding: 0 10px;
  outline: 0;
  font-weight: 650;
  text-transform: none;
}

.toggle-grid {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.toggle-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-transform: none;
}

.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.database-tab {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  padding: 0 12px;
}

.database-tab.active {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.database-grid {
  display: grid;
  gap: 12px;
}

.posting-section {
  scroll-margin-top: 96px;
}

.posting-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
}

.compact-select select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 800;
}

.posting-filter {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  padding: 0 12px;
}

.posting-filter.active {
  border-color: var(--plum);
  background: var(--plum);
  color: white;
}

.recommended-order {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 18px;
  margin-bottom: 18px;
}

.recommended-order h3 {
  margin: 0 0 10px;
}

.recommended-order ol {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.55;
}

.posting-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.posting-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(40, 28, 14, 0.06);
}

.posting-card h3 {
  margin: 0;
}

.posting-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.posting-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.database-card,
.database-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(40, 28, 14, 0.06);
}

.database-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
}

.database-card h3 {
  margin: 8px 0 0;
  font-size: 1.25rem;
  line-height: 1.15;
}

.database-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.database-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.database-meta span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  background: #f0eadf;
  color: #4b4135;
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 900;
}

.database-actions {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 122px;
}

.watch-button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: var(--gold);
  color: #211409;
  cursor: pointer;
  font-weight: 900;
  padding: 0 12px;
}

.watch-button.watched {
  background: #e8f5f2;
  color: #0a6e69;
}

.source-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 850;
  padding: 0 12px;
}

.database-empty {
  color: var(--muted);
  line-height: 1.55;
}

.database-empty strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 1.2rem;
}

.category-rail {
  margin-bottom: 20px;
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.event-card {
  display: grid;
  min-height: 260px;
  align-content: start;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(40, 28, 14, 0.07);
}

.card-topline,
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.category-pill,
.tier-pill {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.73rem;
  font-weight: 900;
}

.category-pill {
  background: #e8f5f2;
  color: #0a6e69;
}

.tier-pill {
  background: #f8ecd2;
  color: #8a5511;
}

.tier-pill.hidden {
  background: #f0e8f6;
  color: var(--plum);
}

.signal-bars {
  display: grid;
  gap: 7px;
  margin-top: auto;
}

.score {
  color: var(--muted);
  font-weight: 900;
}

.method-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 28px;
  align-items: start;
  margin-bottom: 80px;
  padding: 42px;
  border-radius: 8px;
  background: #191611;
  color: white;
}

.method-copy p:last-child {
  max-width: 680px;
  color: rgba(255, 255, 255, 0.74);
  line-height: 1.65;
}

.score-card {
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
}

.score-card div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

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

.empty-state {
  grid-column: 1 / -1;
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .category-dock-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .category-dock .category-rail {
    width: 100%;
  }

  .hero {
    min-height: calc(90vh - 186px);
  }

  .stats-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-strip div:nth-child(2) {
    border-right: 0;
  }

  .stats-strip div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .section-heading,
  .method-band,
  .database-panels {
    grid-template-columns: 1fr;
  }

  .filter-panel {
    position: static;
  }

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

  .top-row {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .top-row .score-stack,
  .top-row .ticket-link {
    grid-column: 2;
  }

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

  .posting-grid,
  .posting-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .hero h1 {
    font-size: clamp(2.65rem, 18vw, 4.6rem);
  }

  .stats-strip,
  .database-stats,
  .posting-grid,
  .listing-grid {
    grid-template-columns: 1fr;
  }

  .database-card {
    grid-template-columns: 1fr;
  }

  .stats-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stats-strip div:last-child {
    border-bottom: 0;
  }

  .method-band {
    padding: 26px 18px;
  }

  .mini-score {
    grid-template-columns: 74px 1fr 28px;
  }
}
