/* ── reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:   #7c6af7;
  --accent-d: #5a49d6;
  --bg:       #0f0f13;
  --bg2:      #18181f;
  --bg3:      #222230;
  --border:   #2e2e3e;
  --text:     #e2e2f0;
  --muted:    #888899;
  --radius:   10px;
  --gap:      1.25rem;
}

html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

h1 { font-size: 1.8rem; margin-bottom: 1rem; }
h2 { font-size: 1.1rem; margin-bottom: .75rem; color: var(--text); }

/* ── nav ──────────────────────────────────────────────────────────────────── */
nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 64px;
  padding: 0 2rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-left { display: flex; align-items: center; gap: .6rem; margin-right: auto; }

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  text-decoration: none;
}

/* ── dev mode indicator ──────────────────────────────────────────────────── */
.dev-badge {
  background: #ffb300;
  color: #1a1a1a;
  font-weight: 700;
  font-size: .7rem;
  letter-spacing: .05em;
  padding: .2rem .5rem;
  border-radius: 4px;
}
body.dev-mode nav { border-bottom: 3px solid #ffb300; }
body.dev-mode { background-image: repeating-linear-gradient(135deg, rgba(255, 179, 0, .05) 0 12px, transparent 12px 24px); }

.search-form { display: flex; gap: .5rem; }
.search-form input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: .35rem .75rem;
  font-size: .9rem;
  width: 220px;
}
.search-form input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.search-form button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: .35rem .9rem;
  cursor: pointer;
  font-size: .9rem;
}
.search-form button:hover { background: var(--accent-d); }

/* ── layout body (sidebar + main) ────────────────────────────────────────── */
.layout-body { flex: 1; display: flex; width: 100%; }

.sidebar {
  width: 210px;
  flex-shrink: 0;
  align-self: flex-start;
  position: sticky;
  top: 64px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
}
.side-nav { display: flex; flex-direction: column; gap: .15rem; }
.side-link {
  display: block;
  width: 100%;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: .9rem;
  padding: .5rem .75rem;
  text-align: left;
  text-decoration: none;
}
.side-link:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.side-link.active { background: var(--bg3); color: var(--accent); font-weight: 600; }
.side-sep { border: none; border-top: 1px solid var(--border); margin: .6rem 0; }

@media (max-width: 760px) {
  .layout-body { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: .75rem 1rem; }
  .side-nav { flex-direction: row; flex-wrap: wrap; gap: .4rem; }
  .side-sep { display: none; }
}

/* ── main ─────────────────────────────────────────────────────────────────── */
main { flex: 1; padding: 2rem; max-width: 1400px; margin: 0 auto; width: 100%; }

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

/* ── cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card-wide { grid-column: 1 / -1; }

/* ── convention grid (index) ──────────────────────────────────────────────── */
.year-heading { margin-top: 1.5rem; }
.year-heading:first-child { margin-top: 0; }

.convention-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.conv-card {
  display: block;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, transform .15s;
}
.conv-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--text);
}

.conv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
}
.short-name {
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  padding: .1rem .45rem;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.year { color: var(--muted); font-size: .85rem; }

.conv-card h2 { font-size: 1rem; margin-bottom: .5rem; }

.conv-meta {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: .75rem;
}
.location::before { content: '📍 '; }
.dates::before    { content: '📅 '; }

.conv-stat { font-size: .85rem; color: var(--muted); }
.conv-stat strong { color: var(--text); font-size: 1.3rem; margin-right: .25rem; }

/* ── convention hero ──────────────────────────────────────────────────────── */
.conv-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem 2rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.conv-hero-title { display: flex; align-items: center; gap: .75rem; }
.conv-hero-title h1 { margin: 0; }
.badge-pill {
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: .2rem .6rem;
  font-size: .85rem;
  font-weight: 700;
}
.conv-hero-meta {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .9rem;
  color: var(--muted);
}
.conv-hero-stat { margin-left: auto; text-align: right; }
.big-number { display: block; font-size: 2.5rem; font-weight: 700; color: var(--accent); }

/* ── dashboard grid ───────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.dashboard-grid canvas { max-height: 300px; }

.chart-tall { position: relative; width: 100%; }
.chart-tall canvas { max-height: none; }

/* ── leaderboard ──────────────────────────────────────────────────────────── */
ol.leaderboard {
  list-style: none;
  counter-reset: rank;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
ol.leaderboard li {
  counter-increment: rank;
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
ol.leaderboard li > ul.change-list {
  flex: 0 0 100%;
  margin-left: 1.8rem;
  margin-top: .1rem;
}
ol.leaderboard li::before {
  content: counter(rank);
  color: var(--muted);
  font-size: .8rem;
  width: 1.2rem;
  text-align: right;
  flex-shrink: 0;
}
.count { margin-left: auto; color: var(--muted); font-size: .82rem; }

/* ── status changes ───────────────────────────────────────────────────────── */
ul.change-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
ul.change-list li {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  font-size: .88rem;
}
.change-date  { color: var(--muted); font-size: .78rem; min-width: 6rem; }
.change-field {
  background: var(--bg3);
  border-radius: 4px;
  padding: .1rem .35rem;
  font-size: .75rem;
  color: var(--muted);
}
.arrow { color: var(--muted); }
.change-value { font-weight: 600; }

/* ── chart header ─────────────────────────────────────────────────────────── */
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}
.chart-header h2 { margin-bottom: 0; }

.btn-reset {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: .78rem;
  padding: .25rem .65rem;
}
.btn-reset:hover { border-color: var(--accent); color: var(--text); }

.chart-note {
  color: var(--muted);
  font-size: .78rem;
  margin: .5rem 0 0;
}
.chart-note.hidden { display: none; }

/* ── attendee grid ────────────────────────────────────────────────────────── */
#att-filter {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: .35rem .75rem;
  font-size: .9rem;
  width: 100%;
  max-width: 360px;
  margin-bottom: 1rem;
  display: block;
}
#att-filter:focus { outline: 2px solid var(--accent); border-color: transparent; }

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

.att-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .5rem;
  text-decoration: none;
  color: var(--text);
  text-align: center;
  transition: border-color .15s;
  overflow: hidden;
}
.att-card:hover { border-color: var(--accent); text-decoration: none; color: var(--text); }

.att-badge {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.att-name {
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.2;
  word-break: break-word;
}
.att-extra {
  font-size: .7rem;
  color: var(--muted);
  line-height: 1.3;
  word-break: break-word;
}

/* ── search ───────────────────────────────────────────────────────────────── */
.empty { color: var(--muted); }

.search-results { display: flex; flex-direction: column; gap: 1.5rem; margin-top: 1rem; }
.search-person {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.person-header {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin-bottom: .75rem;
}
.person-header h2 { font-size: 1.1rem; margin: 0; }
.conv-count { color: var(--muted); font-size: .82rem; margin-left: auto; }

ul.person-convs {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
ul.person-convs li {
  background: var(--bg3);
  border-radius: 6px;
  padding: .25rem .6rem;
  font-size: .82rem;
  display: flex;
  gap: .4rem;
  align-items: center;
}
ul.person-convs li a { color: var(--text); }
ul.person-convs li .year { color: var(--muted); }

/* ── name-match warning ───────────────────────────────────────────────────── */
.name-match-warning {
  background: rgba(255, 180, 0, 0.1);
  border: 1px solid rgba(255, 180, 0, 0.45);
  border-radius: var(--radius);
  color: #d4a843;
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  padding: .85rem 1.25rem;
}

/* ── attendee page ────────────────────────────────────────────────────────── */
.conv-section {
  margin-bottom: 2rem;
}
.conv-section h3 {
  font-size: 1.05rem;
  margin-bottom: .6rem;
}
.conv-section h3 a { color: var(--text); }
.conv-section h3 a:hover { color: var(--accent); text-decoration: none; }

.ambiguity-note {
  font-size: .9rem;
  font-weight: 500;
  color: #d4a843;
  margin-bottom: .6rem;
}

.profile-row {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: .6rem;
}
.profile-chip {
  font-size: .85rem;
  color: var(--text);
  margin-bottom: .6rem;
}
.profile-chip .muted { color: var(--muted); font-style: italic; }
.profile-row .att-badge-grid { margin-top: .5rem; }

.att-badge-grid { margin-top: .5rem; }

.attendee-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.attendee-hero h1 { margin: 0; }

ul.conv-timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: 2rem;
}
ul.conv-timeline li {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.conv-link {
  display: flex;
  gap: .5rem;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}
.conv-link:hover .conv-name { text-decoration: underline; }
.conv-link .short-name { flex-shrink: 0; }
.conv-link .dates { color: var(--muted); font-size: .82rem; }
.extra-meta { color: var(--muted); font-size: .82rem; }

/* ── badge grid ───────────────────────────────────────────────────────────── */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .75rem;
}
.badge-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s;
}
.badge-item:hover { border-color: var(--accent); }
.badge-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.badge-meta {
  padding: .35rem .5rem;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.badge-conv { font-size: .72rem; font-weight: 700; color: var(--accent); }
.badge-date { font-size: .68rem; color: var(--muted); }

/* ── badge lightbox ───────────────────────────────────────────────────────── */
.badge-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bm-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .9);
  cursor: pointer;
}
.bm-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.bm-img-wrap { text-align: center; }
.bm-img-wrap img {
  display: block;
  max-width: min(80vw, 640px);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
}
.bm-meta {
  margin-top: .65rem;
  color: #c8c8dc;
  font-size: .88rem;
}
.bm-nav {
  background: rgba(255, 255, 255, .12);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1.4rem;
  height: 48px;
  line-height: 1;
  transition: background .15s;
  width: 48px;
}
.bm-nav:hover { background: rgba(255, 255, 255, .25); }
.bm-close {
  position: absolute;
  top: -2.75rem;
  right: 0;
  background: rgba(255, 255, 255, .12);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  font-size: 1.2rem;
  height: 36px;
  line-height: 1;
  transition: background .15s;
  width: 36px;
}
.bm-close:hover { background: rgba(255, 255, 255, .25); }
.lb-item { cursor: pointer; }
.lb-item:hover { border-color: var(--accent); }

/* ── avatars ──────────────────────────────────────────────────────────────── */
.avatar    { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-lg { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-xl { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

/* ── nav login/logout button ──────────────────────────────────────────────── */
.btn-login {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: .88rem;
  padding: .3rem .85rem;
  text-decoration: none;
  flex-shrink: 0;
}
.btn-login:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* ── login modal ──────────────────────────────────────────────────────────── */
.login-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-modal .lm-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .75);
  cursor: pointer;
}
.login-modal .lm-inner {
  position: relative;
  z-index: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 360px;
}
.login-modal h2 {
  margin-bottom: 1.25rem;
}
.lm-close {
  position: absolute;
  top: .75rem;
  right: .75rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  padding: .1rem .4rem;
}
.lm-close:hover { color: var(--text); }

.about-stats {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .35rem 1rem;
  font-size: .9rem;
  margin: 1.25rem 0;
}
.about-stats dt { color: var(--muted); }
.about-stats dd { color: var(--text); font-weight: 600; text-align: right; }

.login-error {
  background: rgba(220, 60, 60, .15);
  border: 1px solid rgba(220, 60, 60, .4);
  border-radius: 6px;
  color: #e07070;
  font-size: .88rem;
  margin-bottom: 1rem;
  padding: .5rem .75rem;
}

.lm-form {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.lm-form label {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font-size: .88rem;
  color: var(--muted);
}
.lm-form input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: .95rem;
  padding: .45rem .75rem;
}
.lm-form input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.lm-form button[type="submit"] {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: .95rem;
  margin-top: .25rem;
  padding: .55rem;
}
.lm-form button[type="submit"]:hover { background: var(--accent-d); }
