/* ── Invitational events ─────────────────────────────────────────────
   The event cards, the event page hero and its tabs. Built only from the
   shared tokens in css/tokens.css. Mobile first: one column at 320px,
   and every size below is fluid (clamp / min()), never a fixed width.

   Breakpoints are where the content needs them, not device names:
     36rem  two cards fit side by side
     48rem  the upcoming card has room to lay its flyer beside its text
     60rem  three past events fit in a row                                */

/* ── The page's front ────────────────────────────────────────────── */
.inv-home {
  /* The status bar and the sticky score ticker already sit above this in
     the page flow, below the fixed nav, so no nav offset is added here. */
  padding-block: calc(var(--inv-top-offset, 0px) + clamp(24px, 5vw, 56px)) var(--section-py);
}
.inv-home > .container { display: flex; flex-direction: column; gap: clamp(28px, 5vw, 48px); }
.inv-home-head { display: flex; flex-direction: column; gap: var(--sp-2); }
.inv-kicker {
  margin: 0; font-size: var(--txt-xs); font-weight: 700; color: var(--gold);
  letter-spacing: var(--track-label); text-transform: uppercase;
}
.inv-home-title {
  margin: 0; font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 900;
  line-height: var(--lh-tight); letter-spacing: -0.02em; color: var(--white); text-wrap: balance;
}
.inv-home-sub { margin: 0; color: var(--white-dim); font-size: var(--txt-base); max-width: 60ch; }

.inv-group { display: flex; flex-direction: column; gap: var(--sp-4); }
.inv-group[hidden] { display: none; }
.inv-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.inv-group-title { margin: 0; font-size: var(--txt-xl); font-weight: 800; color: var(--white); }
.inv-group-count { font-size: var(--txt-sm); color: var(--white-dim); }

.inv-event-grid { display: grid; gap: var(--grid-gap); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 36rem) { .inv-event-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* auto-fit, so two past events share the row instead of leaving a gap */
@media (min-width: 60rem) { .inv-event-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); } }
.inv-event-grid--upcoming { grid-template-columns: minmax(0, 1fr); }

/* ── An event card ───────────────────────────────────────────────── */
.inv-card {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  color: inherit; text-decoration: none;
  background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  box-shadow: var(--elev-2);
  transition: transform var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
  animation: invRise var(--dur-slow) var(--ease-out) backwards;
}
.inv-card:hover { transform: translateY(-3px); border-color: var(--card-border-hover); box-shadow: var(--elev-3), var(--glow-sm); }
.inv-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.inv-card:active { transform: translateY(-1px); }

.inv-card-art {
  position: relative; aspect-ratio: 16 / 9; max-width: 100%; overflow: hidden;
  background: radial-gradient(circle at 75% 25%, var(--gold-glow), transparent 55%), var(--gradient-hero, var(--navy-light));
  display: flex; align-items: flex-end; padding: var(--sp-3);
}
/* Flyers are posters: keep the top (the event's name) in view. */
.inv-card-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center;
  transition: transform var(--dur-slow) var(--ease-out); }
.inv-card:hover .inv-card-art img { transform: scale(1.04); }
.inv-card-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(10,14,26,0.85)); }
/* Over a busy flyer the badge needs its own solid ground to stay legible. */
.inv-card-art .inv-badge { position: relative; z-index: 1; background-color: rgba(10,14,26,0.82);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

.inv-card-body { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--pad-card); min-width: 0; flex: 1; }
.inv-card-title { margin: 0; font-size: var(--txt-lg); font-weight: 800; line-height: var(--lh-snug); color: var(--white); overflow-wrap: anywhere; }
.inv-card-meta { margin: 0; font-size: var(--txt-sm); color: var(--white-dim); }
.inv-card-cta { margin-top: auto; padding-top: var(--sp-2); font-size: var(--txt-sm); font-weight: 700; color: var(--gold); }

@media (min-width: 48rem) {
  .inv-card--featured { flex-direction: row; }
  .inv-card--featured .inv-card-art { flex: 0 0 46%; aspect-ratio: auto; min-height: clamp(220px, 24vw, 320px); }
  .inv-card--featured .inv-card-body { justify-content: center; padding: clamp(20px, 3vw, 36px); gap: var(--sp-3); }
  .inv-card--featured .inv-card-title { font-size: var(--txt-2xl); }
  .inv-card--featured .inv-card-cta { margin-top: var(--sp-2); }
}

.inv-badge {
  display: inline-flex; align-items: center; align-self: flex-start;
  font-size: var(--txt-xs); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--radius-pill); border: 1px solid transparent;
}
.inv-badge--upcoming { background: rgba(96,165,250,0.16); color: #93c5fd; border-color: rgba(96,165,250,0.4); }
.inv-badge--live     { background: var(--green-soft); color: var(--green); border-color: rgba(34,197,94,0.45); }
.inv-badge--done     { background: rgba(255,255,255,0.08); color: var(--white-dim); border-color: var(--border-subtle); }

.inv-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.inv-chips span {
  font-size: var(--txt-xs); font-weight: 600; color: var(--white-dim);
  background: rgba(255,255,255,0.05); border: 1px solid var(--border-subtle);
  padding: 3px 10px; border-radius: var(--radius-pill);
}

.inv-countdown { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.inv-countdown[hidden] { display: none; }
.inv-countdown > div {
  display: flex; flex-direction: column; align-items: center; min-width: 3.6rem;
  padding: 6px 12px; border-radius: var(--radius-md);
  background: rgba(96,165,250,0.08); border: 1px solid rgba(96,165,250,0.28);
}
.inv-countdown b { font-size: var(--txt-xl); font-weight: 900; color: var(--white); font-variant-numeric: tabular-nums; line-height: 1.1; }
.inv-countdown span { font-size: 0.62rem; color: var(--white-dim); text-transform: uppercase; letter-spacing: 0.1em; }

/* Loading, empty and failed states */
.inv-state[hidden] { display: none; }
.inv-state { display: grid; gap: var(--grid-gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.inv-skeleton-card {
  min-height: 14rem; border-radius: var(--radius-lg); border: 1px solid var(--border-subtle);
  background: linear-gradient(100deg, rgba(255,255,255,0.03) 30%, rgba(255,255,255,0.07) 50%, rgba(255,255,255,0.03) 70%);
  background-size: 200% 100%; animation: invShimmer 1.4s linear infinite;
}
.inv-empty {
  grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  text-align: center; padding: clamp(28px, 6vw, 48px) var(--sp-4);
  border: 1px dashed var(--border); border-radius: var(--radius-lg); background: var(--glass-bg-sub);
}
.inv-empty b { color: var(--white); font-size: var(--txt-lg); }
.inv-empty span { color: var(--white-dim); font-size: var(--txt-sm); max-width: 46ch; }

/* ── One event ───────────────────────────────────────────────────── */
/* --inv-top-offset: what the sticky ticker covers; measured in js/invitationals.js */
.inv-event { padding-top: calc(var(--inv-top-offset, 0px) + clamp(12px, 3vw, 28px)); }
.inv-event[hidden], .inv-event-body[hidden], #inv-events-home[hidden] { display: none; }
.inv-event > .container:first-child { display: flex; flex-direction: column; gap: var(--sp-3); }

.inv-back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: var(--control-h); padding: 0 var(--sp-2); margin-left: calc(var(--sp-2) * -1);
  color: var(--white-dim); font-size: var(--txt-sm); font-weight: 600; text-decoration: none;
  border-radius: var(--radius-sm); transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.inv-back:hover { color: var(--gold); background: rgba(245,197,24,0.06); }
.inv-back:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.inv-event-hero {
  display: grid; gap: clamp(16px, 3vw, 32px); grid-template-columns: minmax(0, 1fr);
  padding: clamp(18px, 4vw, 36px); border-radius: var(--radius-xl);
  background: radial-gradient(circle at 85% 10%, var(--gold-glow), transparent 50%), var(--glass-bg);
  border: 1px solid var(--glass-border); box-shadow: var(--elev-2);
  animation: invRise var(--dur-slow) var(--ease-out) backwards;
}
@media (min-width: 48rem) { .inv-event-hero { grid-template-columns: minmax(0, 1fr) clamp(160px, 22vw, 260px); align-items: center; } }
.inv-event-hero-text { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.inv-event-title {
  margin: 0; font-size: clamp(1.5rem, 4.4vw, 2.6rem); font-weight: 900; line-height: var(--lh-tight);
  letter-spacing: -0.015em; color: var(--white); overflow-wrap: anywhere; text-wrap: balance;
}
.inv-event-meta { margin: 0; color: var(--white-dim); font-size: var(--txt-base); }
.inv-event-desc { margin: 0; color: var(--white-dim); font-size: var(--txt-sm); line-height: var(--lh-normal); max-width: 65ch; white-space: pre-line; }
.inv-event-desc[hidden] { display: none; }
.inv-event-desc.is-clamped { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; line-clamp: 5; overflow: hidden; }
.inv-more {
  align-self: flex-start; min-height: var(--control-h); padding: 0 var(--sp-3); margin-top: calc(var(--sp-2) * -1);
  font: 600 var(--txt-sm) var(--font-body); color: var(--gold); background: transparent;
  border: 1px solid var(--border-gold); border-radius: var(--radius-pill); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.inv-more:hover { background: rgba(245,197,24,0.08); }
.inv-more:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.inv-more[hidden] { display: none; }

.inv-event-flyer {
  padding: 0; border: 1px solid var(--glass-border); border-radius: var(--radius-lg); overflow: hidden; cursor: zoom-in;
  background: var(--navy-light); width: min(100%, 260px); justify-self: center; box-shadow: var(--elev-3);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.inv-event-flyer[hidden] { display: none; }
.inv-event-flyer:hover { transform: translateY(-2px) rotate(-0.4deg); box-shadow: var(--elev-4), var(--glow-sm); }
.inv-event-flyer:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.inv-event-flyer img { display: block; width: 100%; height: auto; max-height: 60vh; object-fit: contain; }

/* Tabs: pinned under the nav, swipe sideways on a phone. */
.inv-tabs-bar {
  position: sticky; top: var(--nav-height); z-index: 50; margin-top: clamp(16px, 3vw, 28px);
  background: rgba(10,14,26,0.9); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border-subtle);
}
.inv-tabs-bar[hidden] { display: none; }
.inv-tabs {
  display: flex; gap: var(--sp-1); overflow-x: auto; scrollbar-width: none;
  padding-block: var(--sp-2); scroll-padding-inline: var(--container-pad);
}
.inv-tabs::-webkit-scrollbar { display: none; }
.inv-tabs button {
  flex: 0 0 auto; min-height: var(--control-h); padding: 0 clamp(14px, 2vw, 20px);
  font: 600 var(--txt-sm) var(--font-body); color: var(--white-dim); white-space: nowrap;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-pill); cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.inv-tabs button:hover { color: var(--white); background: rgba(255,255,255,0.05); }
.inv-tabs button[aria-selected="true"] { color: var(--navy); background: var(--gold); box-shadow: var(--glow-sm); }
.inv-tabs button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

#inv-event-empty { padding-block: clamp(20px, 4vw, 40px) var(--section-py); }

/* One section at a time. The sections keep their own markup and renderers;
   only the one whose tab is open is shown. */
.inv-event-body > section { display: none; }
.inv-event-body > section.inv-tab-active:not([style*="display: none"]) {
  display: block; padding-top: clamp(20px, 4vw, 36px);
  animation: invRise var(--dur-base) var(--ease-out) backwards;
}

/* The nav's section links belong to an event; on the list there is none. */
/* On the list, Events is the page you are on. */
body.inv-mode-list .official-nav-links a.inv-nav-events { color: var(--gold); background: rgba(245,197,24,0.08); }
body.inv-mode-list .official-nav-links a[href^="#inv-"],
body.inv-mode-list .nav-mobile-links a[href^="#inv-"] { display: none !important; }

@keyframes invRise   { from { opacity: 0; transform: translateY(8px); } }
@keyframes invShimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  .inv-card, .inv-event-hero, .inv-event-body > section.inv-tab-active, .inv-skeleton-card { animation: none; }
  .inv-card, .inv-card-art img, .inv-event-flyer { transition: none; }
}
