:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --purple: #3F2A7E;
  --purple-dark: #2A1B5C;
  --purple-tint: #EEEAF7;
  --gold: #F4B223;
  --gold-light: #FCE7B2;
  --text: #1F1A2E;
  --muted: #6B6580;
  --border: #E2DDF0;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(63, 42, 126, 0.08);
  --header-h: 0px; /* set by app.js so sticky elements sit below the header */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

a { color: var(--purple); }
img { max-width: 100%; }
[hidden] { display: none !important; }
section[id] { scroll-margin-top: calc(var(--header-h) + 16px); }

.muted { color: var(--muted); margin-top: 0; }

/* ---------- Header / progress ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 4px solid var(--gold);
  box-shadow: 0 2px 12px rgba(63, 42, 126, 0.10);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand social"
    "progress progress";
  gap: 8px 16px;
  align-items: center;
}
.brand { grid-area: brand; display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.logo { width: 52px; height: auto; flex: 0 0 auto; }
.team-name {
  margin: 0;
  color: var(--purple);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.15;
}
.tagline { margin: 0; color: var(--muted); font-size: 0.85rem; }

.progress-block { grid-area: progress; }
.progress-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  font-size: 0.95rem;
  margin-bottom: 6px;
}
.progress-stats strong { color: var(--purple); }
#raised { font-size: 1.2rem; }
.progress-meta { color: var(--muted); }

.progress-track {
  height: 20px;
  background: var(--purple-tint);
  border: 2px solid var(--purple);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold) 0%, #FFCB4D 100%);
  border-radius: 999px;
  transition: width 1.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.goal-purpose { margin: 4px 0 0; font-size: 0.8rem; color: var(--muted); }

.header-social { grid-area: social; display: flex; gap: 8px; justify-self: end; }
.header-social a {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.header-social a:hover { background: var(--gold); color: var(--purple-dark); }
.header-social svg { width: 18px; height: 18px; fill: currentColor; }

@media (min-width: 900px) {
  .header-inner {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand progress social";
    gap: 24px;
    padding-block: 12px;
  }
  .logo { width: 68px; }
  .team-name { font-size: 1.6rem; }
}

/* ---------- Page layout: sidebar + content ---------- */
.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}
.content { container-type: inline-size; min-width: 0; }

/* Sidebar: horizontal nav bar on phones, sticky column on wider screens */
.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--purple);
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s;
}
.nav-link svg { width: 20px; height: 20px; fill: currentColor; flex: 0 0 auto; }
.nav-link:hover { background: var(--purple-tint); }
.nav-link[aria-current="page"] {
  background: var(--purple);
  color: #fff;
  box-shadow: inset 4px 0 0 var(--gold);
}
.sidebar-donate { padding-block: 8px; }

/* Left column = sidebar menu + Local Sponsors.
   Phones: the menu sits above the content and sponsors drop to the bottom of the page. */
.left-col { display: contents; }
.sidebar { order: 0; }
.content { order: 1; }
.sponsors-card { order: 2; }

@media (min-width: 900px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); gap: 24px; padding-top: 24px; }
  .left-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: calc(var(--header-h) + 24px);
    align-self: start;
    /* If the sponsor list gets long, the column scrolls on its own instead of being cut off. */
    max-height: calc(100vh - var(--header-h) - 48px);
    overflow-y: auto;
    padding: 0 6px 6px;
    margin: 0 -6px;
  }
  .sidebar { flex-direction: column; align-items: stretch; padding: 12px; }
  .nav-list { flex-direction: column; }
  .nav-link { padding: 10px 14px; }
  .sidebar-donate { margin-top: 8px; }

  /* Compact sponsor list for the narrow column */
  .sponsors-card { padding: 16px; }
  .sponsors-card h2 { font-size: 1.1rem; }
  .sponsors-card .sponsor-grid { grid-template-columns: 1fr; gap: 6px; }
  .sponsors-card .sponsor {
    flex-direction: row;
    justify-content: flex-start;
    min-height: 0;
    padding: 8px 10px;
    text-align: left;
    gap: 10px;
    font-size: 0.85rem;
  }
  .sponsors-card .sponsor img { max-height: 32px; max-width: 64px; }
  .sponsors-card .sponsor-initials { width: 32px; height: 32px; font-size: 0.75rem; flex: 0 0 auto; }
  .sponsors-card .tier { margin-bottom: 10px; }
}

/* ---------- Home: main column + right column (Donate Now, Recent Activity) ---------- */
/* Phones/tablets: one column in this order: about, donate, activity, events */
.home-grid { display: flex; flex-direction: column; gap: 20px; }
.home-main, .home-aside { display: contents; }
.team-photo { order: 0; }
.about { order: 1; }
.order-donate { order: 2; }
.order-activity { order: 3; }
.order-events { order: 4; }

@media (min-width: 1200px) {
  .home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
  }
  .home-main, .home-aside { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
  .home-main { container-type: inline-size; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 2px solid var(--purple);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--purple-dark); border-color: var(--purple-dark); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--purple-dark); }
.btn-gold:hover { background: #E6A30F; border-color: #E6A30F; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible, button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--purple);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card h1, .card h2 {
  margin: 0 0 16px;
  color: var(--purple);
  font-size: 1.25rem;
  line-height: 1.3;
}
.card h1 { font-size: 1.4rem; }
.card h1::after, .card h2::after {
  content: "";
  display: block;
  width: 44px;
  height: 4px;
  margin-top: 6px;
  background: var(--gold);
  border-radius: 2px;
}
.empty { color: var(--muted); font-style: italic; }
.link-cta { display: inline-block; margin-top: 10px; font-weight: 700; }

/* ---------- Team photo ---------- */
.team-photo {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-top-color: var(--gold);
}
.team-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center 60%;
}
.team-photo figcaption {
  padding: 10px 16px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* ---------- About / tournament writeup ---------- */
.about {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  border-top-color: var(--gold);
}
.about-logo { width: 160px; height: auto; flex: 0 0 auto; }
.about-body p { margin: 0 0 12px; }
.about-body .btn { margin-top: 4px; }
@container (min-width: 640px) {
  .about { flex-direction: row; align-items: flex-start; gap: 28px; padding: 28px; }
  .about-logo { width: 190px; }
}

/* ---------- Events (home + schedule) ---------- */
.event-list, .activity-list { list-style: none; margin: 0; padding: 0; }
.event {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.event:last-child { border-bottom: 0; }
.event.past { opacity: 0.6; }
.date-badge {
  flex: 0 0 56px;
  height: 60px;
  border-radius: 10px;
  background: var(--gold);
  color: var(--purple-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}
.event.past .date-badge { background: var(--purple-tint); color: var(--purple); }
.date-badge .month { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.date-badge .day { font-size: 1.5rem; font-weight: 800; }
.event-title { font-weight: 700; color: var(--text); margin: 0; }
.event-title a { color: inherit; }
.event-meta { margin: 0; color: var(--muted); font-size: 0.875rem; }
.status-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--purple-tint);
  color: var(--purple);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  vertical-align: middle;
}

.month-heading {
  margin: 20px 0 4px;
  color: var(--purple);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.month-heading:first-child { margin-top: 0; }
.past-events { margin-top: 24px; }
.past-events summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--purple);
  padding: 8px 0;
}

/* ---------- Activity ---------- */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
}
.activity-item + .activity-item { margin-top: 4px; }
.activity-item.newest { background: var(--gold-light); }
.avatar {
  flex: 0 0 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.activity-text { margin: 0; }
.activity-text strong { color: var(--purple); }
.activity-message { margin: 2px 0 0; font-style: italic; color: var(--muted); font-size: 0.9rem; }
.activity-time { color: var(--muted); font-size: 0.8rem; }

/* ---------- Donate ---------- */
.card-donate { border-top-color: var(--gold); }
.donate-links { display: flex; flex-direction: column; gap: 10px; }
.donate-row { display: flex; gap: 8px; align-items: stretch; }
.donate-row .btn { flex: 1; justify-content: flex-start; padding-block: 12px; min-width: 0; }
.donate-row .btn svg { width: 22px; height: 22px; fill: currentColor; flex: 0 0 auto; }
.handle {
  margin-left: auto;
  font-weight: 400;
  font-size: 0.8rem;
  opacity: 0.85;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.donate-row .btn-copy { flex: 0 0 auto; }
.btn-copy {
  background: #fff;
  color: var(--purple);
  padding: 8px 12px;
  font-size: 0.85rem;
}
.btn-copy:hover { background: var(--purple-tint); }
.btn-copy.copied { background: var(--gold); border-color: var(--gold); color: var(--purple-dark); }
.donate-static {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 2px dashed var(--purple);
  color: var(--purple);
  font-weight: 700;
}
.donate-static svg { width: 22px; height: 22px; fill: currentColor; flex: 0 0 auto; }

/* ---------- Sponsors ---------- */
.tier { margin-bottom: 14px; }
.tier-chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.tier-gold .tier-chip { background: var(--gold); color: var(--purple-dark); }
.tier-silver .tier-chip { background: #E4E4EA; color: #3d3d4a; }
.tier-bronze .tier-chip { background: #EBCBA8; color: #5a3517; }
.tier-other .tier-chip { background: var(--purple-tint); color: var(--purple); }
.sponsor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.sponsor {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 90px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
a.sponsor:hover { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-light); }
.sponsor img { max-height: 48px; object-fit: contain; }
.sponsor-initials {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--purple-tint);
  color: var(--purple);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
}

/* ---------- Players ---------- */
.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}
.player {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.player:hover { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-light); }
.player-photo, .player-number {
  width: 96px; height: 96px;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 4px solid var(--gold);
}
.player-photo { object-fit: cover; display: block; }
.player-number {
  background: var(--purple);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  font-weight: 800;
}
.player-name { margin: 0; font-weight: 700; color: var(--text); }
.player-meta { margin: 2px 0 0; color: var(--muted); font-size: 0.875rem; }
.player-meta strong { color: var(--purple); }

/* ---------- Swag ---------- */
.swag-intro { margin: 0 0 18px; color: var(--muted); }
.swag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.swag-item {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.swag-item:hover { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-light); }
.swag-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--purple-tint);
}
.swag-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--purple);
}
.swag-placeholder svg { width: 45%; height: 45%; fill: var(--gold); }
.swag-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  padding: 14px 16px 16px;
}
.swag-name { margin: 0; font-weight: 700; color: var(--text); }
.swag-price { margin: 0; font-weight: 800; font-size: 1.2rem; color: var(--purple); }
.swag-desc { margin: 0 0 4px; color: var(--muted); font-size: 0.9rem; }
.swag-label { margin-top: auto; font-size: 0.8rem; font-weight: 700; color: var(--purple); }
.swag-select {
  width: 100%;
  padding: 9px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}
.swag-select:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--purple); }
.swag-note { margin: 0; color: #B3261E; font-size: 0.85rem; font-weight: 600; }
.swag-order { margin-top: 6px; width: 100%; }

/* "Email didn't open?" fallback row (swag Order, Become a sponsor) */
.email-alt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}
.email-alt[hidden] { display: none; }
.email-alt span { flex-basis: 100%; }
.email-alt .btn-copy { padding: 5px 10px; font-size: 0.8rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--purple-dark);
  color: #fff;
  border-top: 4px solid var(--gold);
  padding: 28px 16px;
  text-align: center;
}
.site-footer a { color: var(--gold); }
.footer-logo { width: 56px; }
.site-footer p { margin: 6px 0; }
.tax-note { font-size: 0.85rem; opacity: 0.8; }
.footer-social { display: flex; justify-content: center; gap: 12px; margin-top: 12px; }
.footer-social a {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.footer-social a:hover { background: var(--gold); color: var(--purple-dark); }
.footer-social svg { width: 18px; height: 18px; fill: currentColor; }

/* ---------- Error ---------- */
.error {
  background: #FDECEC;
  border: 1px solid #F3B7B7;
  color: #8A1C1C;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
}

@media (prefers-reduced-motion: reduce) {
  .progress-fill { transition: none; }
}

/* ---------- Phone refinements ---------- */
.card .month-heading::after { display: none; }

@media (max-width: 899px) {
  .nav-list { flex: 1 1 100%; justify-content: space-between; }
  .sidebar-donate { flex: 1 1 100%; }
}
@media (max-width: 599px) {
  .tagline { display: none; }
  .team-name { font-size: 1.1rem; }
  .logo { width: 44px; }
  .header-social { gap: 6px; }
  .header-social a { width: 32px; height: 32px; }
  .header-social svg { width: 16px; height: 16px; }
}
