/* --------------------------------------------------------
   Base
-------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #ffffff;
  --surface: #111111;
  --surface-2: #1c1c1c;
  --border: #2e2e2e;
  --text: #000000;
  --text-muted: #777777;
  --red: #ef4345;
  --radius: 4px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Oswald', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------
   Header
-------------------------------------------------------- */
header {
  background: var(--bg);
  border-bottom: 3px solid var(--red);
  padding: 18px 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ner-title {
  font-family: 'Anton', sans-serif;
  font-size: clamp(1.5rem, 3.5vw, 2.6rem);
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--text);
  text-transform: uppercase;
  line-height: 1;
}

.giving-day-sub {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(0.65rem, 1.2vw, 0.8rem);
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
}

.grand-total-wrap {
  text-align: right;
}

.grand-total-label {
  display: block;
  font-family: 'Oswald', sans-serif;
  font-size: 0.65rem;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

#grand-total {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--red);
}

/* --------------------------------------------------------
   Main / Bar Chart
-------------------------------------------------------- */
main {
  flex: 1;
  padding: 0 28px 0;
  display: flex;
  flex-direction: column;
  overflow-x: auto;
  overflow-y: hidden;
}

#leaderboard {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  min-height: 320px;
  min-width: 600px;
}

/* --------------------------------------------------------
   Team Column
-------------------------------------------------------- */
.team-card {
  flex: 1;
  min-width: 52px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Vertical bar container — fills full height of the column */
.bar-track {
  width: 100%;
  flex: 1;
  background: #ffffff;
  border-radius: var(--radius) var(--radius) 0 0;
  position: relative;
  overflow: hidden;
}

/* The fill — absolutely pinned to the bottom, grows upward */
.bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0%;
  background: var(--red);
  transition: height 0.85s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-fill.has-amount {
  min-height: 4px;
}


/* Amount + crown overlay — sits at the top of the bar track */
.bar-label {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  z-index: 2;
  pointer-events: none;
}

/* Crown (visible only on leader) */
.card-crown {
  font-size: 1.2rem;
  line-height: 1;
  visibility: hidden;
  animation: crownBounce 1.4s ease-in-out infinite alternate;
}

.team-card.is-leader .card-crown {
  visibility: visible;
}

@keyframes crownBounce {
  from { transform: translateY(0) rotate(-5deg); }
  to   { transform: translateY(-4px) rotate(5deg); }
}

/* Dollar amount above bar */
.card-total {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(0.6rem, 1.1vw, 0.85rem);
  font-weight: 600;
  color: var(--red);
  text-align: center;
  white-space: nowrap;
  letter-spacing: 0.02em;
  padding: 6px 2px 4px;
  flex-shrink: 0;
}

/* Divider between bar and label */
.bar-divider {
  width: 100%;
  height: 3px;
  background: var(--red);
  flex-shrink: 0;
}

/* Team name below divider */
.card-name {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(0.5rem, 0.85vw, 0.7rem);
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 3px 2px;
  line-height: 1.25;
  word-break: break-word;
  hyphens: auto;
  width: 100%;
  min-height: calc(2 * 1.25em + 8px); /* reserve 2 lines + padding so bar baselines align */
}

.team-card.is-leader .card-name {
  color: var(--text);
}

/* Rank number */
.card-rank {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(0.5rem, 0.75vw, 0.65rem);
  font-weight: 300;
  color: var(--text-muted);
  text-align: center;
  padding-bottom: 8px;
  letter-spacing: 0.05em;
}

.team-card.is-leader .card-rank {
  color: var(--red);
}

/* Pulse on new donation */
@keyframes cardPulse {
  0%   { box-shadow: 0 0 0 0 rgba(239, 67, 69, 0.7); }
  50%  { box-shadow: 0 0 16px 6px rgba(239, 67, 69, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(239, 67, 69, 0); }
}

.card-pulse .bar-track {
  animation: cardPulse 0.9s ease-out forwards;
}

/* --------------------------------------------------------
   Footer / Ticker
-------------------------------------------------------- */
footer {
  background: var(--surface);
  border-top: 3px solid var(--red);
  padding: 12px 32px;
  max-height: 130px;
  overflow-y: auto;
  flex-shrink: 0;
}

.ticker-label {
  font-family: 'Oswald', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--red);
  margin-bottom: 6px;
}

#ticker {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ticker-item {
  font-family: 'Oswald', sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  animation: fadeSlideIn 0.5s ease forwards;
  opacity: 0;
}

.ticker-item .ticker-team {
  color: #ffffff;
  font-weight: 500;
}

.ticker-item .ticker-amount {
  color: var(--red);
  font-weight: 600;
}

.ticker-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------
   Scrollbar
-------------------------------------------------------- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--red); border-radius: 100px; }
