/* =========================================================
   Carrera Hybrid Community — design system
   Palette: white / off-white / Carrera red / M-light blue / M-dark blue
   Fonts: Rajdhani (headings) + Inter (body) via Google Fonts
   ========================================================= */

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

:root {
  --white:       #ffffff;
  --surface:     #f5f7fa;
  --surface-2:   #edf0f5;
  --border:      #dde2ea;
  --red:         #e2231a;
  --red-dark:    #b91d15;
  --blue-light:  #5fb1e2;
  --blue-dark:   #0c2c52;
  --text:        #1a1a1a;
  --text-muted:  #5c6370;
  --text-faint:  #939aa5;
  --text-subtle: #a7afba;

  --radius:  6px;
  --nav-h:   58px;
  --max-w:   1100px;
  --gap:     1.5rem;
}

body {
  background: var(--white);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Rajdhani', 'Segoe UI', Arial, sans-serif;
  font-weight: 700;
}

a {
  color: var(--blue-dark);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

/* --- Site header & nav ---------------------------------- */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-stripe {
  height: 3px;
  background: linear-gradient(
    to right,
    var(--red) 0% 33.33%,
    var(--blue-light) 33.33% 66.66%,
    var(--blue-dark) 66.66% 100%
  );
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1rem;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* --- Logo ---------------------------------------------- */
.site-logo {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--blue-dark);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-decoration: none;
  line-height: 1.1;
}

.site-logo:hover { text-decoration: none; }

.site-logo .logo-text span {
  color: var(--red);
}

.site-logo .logo-stripe {
  display: flex;
  height: 2px;
  width: 100%;
  margin-top: 3px;
}

.site-logo .logo-stripe span:nth-child(1) { background: var(--red);        flex: 1; }
.site-logo .logo-stripe span:nth-child(2) { background: var(--blue-light); flex: 1; }
.site-logo .logo-stripe span:nth-child(3) { background: var(--blue-dark);  flex: 1; }

/* --- Primary navigation --------------------------------- */
.primary-nav {
  flex: 1;
  overflow: hidden;
}

.nav-list {
  list-style: none;
  display: flex;
  gap: 0.125rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0;
}

.nav-list::-webkit-scrollbar { display: none; }

.nav-list li a {
  display: block;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}

.nav-list li a:hover,
.nav-list li a:focus-visible {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

.nav-list li a.active {
  color: var(--blue-dark);
  background: var(--surface);
  border-bottom: 2px solid var(--red);
  font-weight: 600;
}

/* Hamburger (collapses below 960px) */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.4rem;
  flex-shrink: 0;
}

.nav-hamburger:hover { color: var(--text); }

.hamburger-icon { display: block; width: 22px; }
.hamburger-icon span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  margin: 5px 0;
  transition: transform 0.25s, opacity 0.2s;
}

/* Hamburger open animation */
.nav-hamburger[aria-expanded="true"] .hamburger-icon span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-hamburger[aria-expanded="true"] .hamburger-icon span:nth-child(2) {
  opacity: 0;
}
.nav-hamburger[aria-expanded="true"] .hamburger-icon span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Tablet/mobile breakpoint at 960px */
@media (max-width: 960px) {
  .primary-nav {
    display: none;
    position: absolute;
    top: calc(var(--nav-h) + 3px);
    left: 0; right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem;
    z-index: 99;
    animation: slideDown 0.2s ease;
  }

  .primary-nav.open {
    display: block;
  }

  .nav-hamburger {
    display: flex;
    align-items: center;
  }

  .nav-list {
    flex-direction: column;
    overflow: visible;
  }

  .nav-list li a {
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
  }

  .nav-list li a.active {
    border-bottom: none;
    border-left: 3px solid var(--red);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--surface);
  }
}

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

/* --- Language dropdown (desktop) ----------------------- */
.lang-dropdown {
  position: relative;
  flex-shrink: 0;
}

.lang-current {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.28rem 0.55rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
  font-family: inherit;
}

.section-header--split,
.event-actions,
.event-grid,
.detail-grid,
.detail-list,
.detail-tags,
.event-form {
  display: flex;
}

.section-header--split,
.detail-grid {
  justify-content: space-between;
  gap: 1rem;
}

.section-header--split {
  align-items: flex-start;
}

.event-actions,
.detail-tags,
.event-form {
  gap: 0.75rem;
}

.event-actions {
  flex-wrap: wrap;
}

.event-grid,
.detail-grid,
.event-form {
  flex-wrap: wrap;
}

.event-grid {
  gap: 1rem;
  margin-top: 1rem;
}

.event-card,
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.event-card {
  flex: 1 1 280px;
}

.event-card--muted {
  opacity: 0.9;
}

.event-card__eyebrow,
.event-meta,
.detail-note,
.empty-state {
  color: var(--text-muted);
}

.event-card__eyebrow,
.section-kicker {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.event-title {
  margin: 0.25rem 0 0.5rem;
}

.event-badges,
.detail-tags {
  list-style: none;
  margin-top: 0.75rem;
}

.event-badge,
.detail-tags li,
.button-link {
  border-radius: 999px;
}

.event-badge,
.detail-tags li {
  display: inline-block;
  background: var(--white);
  border: 1px solid var(--border);
  padding: 0.2rem 0.65rem;
  font-size: 0.85rem;
}

.detail-card {
  flex: 1 1 320px;
}

.detail-card--cta {
  margin-top: 1rem;
}

.detail-list {
  flex-direction: column;
  gap: 0.75rem;
}

.detail-list dt {
  font-weight: 600;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--blue-dark);
  color: var(--blue-dark);
  padding: 0.55rem 1rem;
  text-decoration: none;
}

.button-link--primary {
  background: var(--blue-dark);
  color: var(--white);
}

.event-form {
  flex-direction: column;
  margin-top: 1rem;
}

.event-form p {
  margin-bottom: 0.85rem;
}

.event-form input,
.event-form select,
.event-form textarea {
  width: 100%;
  margin-top: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  font: inherit;
}

.lang-current:hover,
.lang-current[aria-expanded="true"] {
  border-color: var(--blue-light);
  color: var(--text);
}

.lang-code { font-weight: 500; }

.lang-caret {
  font-size: 0.6rem;
  margin-left: 0.1rem;
  transition: transform 0.15s;
}

.lang-current[aria-expanded="true"] .lang-caret {
  transform: rotate(180deg);
}

.lang-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 90px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.09);
  z-index: 200;
  list-style: none;
  padding: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.lang-panel[hidden] { display: none; }

.lang-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.38rem 0.6rem;
  background: none;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}

.lang-opt:hover {
  background: var(--surface);
  color: var(--text);
}

.lang-opt--cur {
  color: var(--blue-dark);
  font-weight: 600;
}

.lang-check {
  font-size: 0.72rem;
  color: var(--red);
  margin-left: 0.4rem;
}

/* --- Mobile language buttons (inside hamburger nav) ---- */
.mobile-lang {
  display: none;
}

@media (max-width: 960px) {
  /* Hide the desktop dropdown on mobile */
  .lang-dropdown { display: none; }

  /* Show language row at the bottom of the mobile nav */
  .mobile-lang {
    display: flex;
    gap: 0.4rem;
    padding: 0.5rem 0.5rem 0.25rem;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
  }

  .mobile-lang-btn {
    flex: 1;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.45rem 0.5rem;
    font-size: 0.82rem;
    font-family: inherit;
    color: var(--text-muted);
    cursor: pointer;
    text-align: center;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
  }

  .mobile-lang-btn:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--blue-light);
  }

  .mobile-lang-btn.active {
    color: var(--blue-dark);
    border-color: var(--red);
    font-weight: 600;
    background: var(--surface);
  }
}

/* --- Main content --------------------------------------- */
main {
  flex: 1;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: var(--gap) 1rem;
}

.page-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--gap);
  color: var(--blue-dark);
}

/* --- Hero section (news page) --------------------------- */
.news-hero {
  width: 100%;
  margin-bottom: var(--gap);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.news-hero img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
}

.news-hero-caption {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  background: linear-gradient(to top, rgba(12,44,82,0.85) 0%, transparent 100%);
  color: #fff;
  padding: 1.5rem 1.25rem 1rem;
  font-size: 0.75rem;
}

/* --- News feed ------------------------------------------ */
.news-feed {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* --- News item card ------------------------------------- */
.news-card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.news-card:hover {
  box-shadow: 0 4px 20px rgba(12, 44, 82, 0.09);
  border-color: var(--blue-light);
}

.news-card-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.news-meta {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.news-source-link {
  color: var(--red);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}

.news-source-link:hover {
  color: var(--red-dark);
  text-decoration: underline;
}

.news-source-link::before { content: "· "; }

.news-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--blue-dark);
  line-height: 1.3;
}

.news-byline {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  text-align: right;
  white-space: nowrap;
}

.news-excerpt {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.news-body {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.news-body p,
.news-body ul {
  margin: 0 0 0.9rem;
}

.news-body ul {
  padding-left: 1.2rem;
}

.news-body a {
  color: var(--red);
  font-weight: 600;
}

.news-body a:hover {
  color: var(--red-dark);
}

.news-card-footer {
  margin-top: auto;
  padding-top: 0.2rem;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.75rem;
}

.news-source-link--static {
  pointer-events: none;
}

.news-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  background: var(--blue-dark);
}

.news-embed iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}

.news-card-image img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.news-share-button {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(12, 44, 82, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--blue-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.news-share-button:hover,
.news-share-button:focus-visible {
  border-color: var(--blue-light);
  box-shadow: 0 4px 12px rgba(12, 44, 82, 0.12);
  transform: translateY(-1px);
}

.news-share-button:focus-visible {
  outline: 2px solid var(--blue-light);
  outline-offset: 2px;
}

.share-toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translate(-50%, -140%);
  background: var(--blue-dark);
  color: var(--white);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(12, 44, 82, 0.2);
  z-index: 220;
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.share-toast--visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.share-modal-open {
  overflow: hidden;
}

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 210;
}

.share-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 44, 82, 0.48);
}

.share-modal__dialog {
  position: relative;
  width: min(92vw, 32rem);
  margin: 12vh auto 0;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 24px 48px rgba(12, 44, 82, 0.24);
  padding: 1rem;
}

.share-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.share-modal__title {
  font-size: 1.1rem;
  color: var(--blue-dark);
}

.share-modal__close {
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.share-modal__copy {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.share-modal__input {
  width: 100%;
  margin-top: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
}

.news-card--flash {
  animation: newsCardFlash 1.8s ease-in-out 3;
}

@keyframes newsCardFlash {
  0%, 100% {
    border-color: var(--border);
    box-shadow: 0 0 0 rgba(226, 35, 26, 0);
  }

  35% {
    border-color: var(--red);
    box-shadow: 0 0 0 4px rgba(226, 35, 26, 0.18);
  }
}

@media (prefers-reduced-motion: reduce) {
  .share-toast,
  .news-share-button,
  .news-card {
    transition: none;
  }

  .news-card--flash {
    animation: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(226, 35, 26, 0.12);
  }
}

/* --- Section cards (static pages) ---------------------- */
.section-header {
  margin-bottom: 1.5rem;
}

.section-header .page-title {
  margin-bottom: 0.25rem;
}

.section-tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
}

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

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(12, 44, 82, 0.08);
  border-color: var(--blue-light);
}

.card-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  margin-bottom: 0.6rem;
}

.card-label.red   { background: #fde8e7; color: var(--red); }
.card-label.blue  { background: #e7f3fb; color: var(--blue-dark); }
.card-label.green { background: #e7f5ee; color: #1a7a40; }
.card-label.gold  { background: #fdf5e0; color: #7a5c00; }

.card-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

.card-meta {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-bottom: 0.5rem;
}

.card-body {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.card-footer {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-faint);
  display: flex;
  gap: 1rem;
}

.btn {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--red);
  color: #fff;
  border: 1px solid var(--red);
}

.btn-primary:hover {
  background: var(--red-dark);
  border-color: var(--red-dark);
  text-decoration: none;
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--blue-dark);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--surface);
  border-color: var(--blue-light);
  text-decoration: none;
}

.section-actions {
  margin-bottom: 1.25rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Leaderboard table */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.leaderboard-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  border-bottom: 2px solid var(--border);
}

.leaderboard-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--surface-2);
  color: var(--text);
}

.leaderboard-table tr:hover td { background: var(--surface); }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
}

.rank-badge.gold   { background: #fdf5e0; color: #7a5c00; }
.rank-badge.silver { background: var(--surface-2); color: var(--text-muted); }
.rank-badge.bronze { background: #fdf0e8; color: #8b4e1e; }
.rank-badge.plain  { background: var(--surface); color: var(--text-muted); font-size: 0.75rem; }

/* Events */
.event-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.event-card {
  display: flex;
  gap: 1rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.event-grid .event-card {
  flex-direction: column;
  gap: 0.35rem;
}

.event-card:hover {
  box-shadow: 0 4px 16px rgba(12, 44, 82, 0.08);
  border-color: var(--blue-light);
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.event-card__eyebrow,
.event-meta,
.participant-meta,
.event-detail-copy,
.empty-state {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.event-card__eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.event-badges,
.event-actions,
.participant-actions,
.event-cta-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.event-badges {
  margin-top: 0.75rem;
}

.event-badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.event-badge,
.status-pill--waitlisted {
  background: #e7f3fb;
  color: var(--blue-dark);
}

.status-pill--requested {
  background: #fdf5e0;
  color: #7a5c00;
}

.status-pill--approved {
  background: #e7f5ee;
  color: #1d6a3f;
}

.status-pill--declined {
  background: #fde8e7;
  color: var(--red-dark);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.button-link:hover {
  text-decoration: none;
  border-color: var(--blue-light);
}

.button-link--primary {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
  color: var(--white);
}

.button-link--primary:hover {
  color: var(--white);
}

.participants-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  border-bottom: 2px solid var(--border);
}

.participants-table--results select {
  min-width: 140px;
}

.field-error {
  margin-top: 0.35rem;
  color: var(--red-dark);
  font-size: 0.82rem;
}

.results-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.flag-icon,
.flag-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  background: var(--white);
}

.flag-icon {
  object-fit: cover;
}

.car-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.event-date-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  text-align: center;
}

.event-date-block .month {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--red);
}

.event-date-block .day {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--blue-dark);
  line-height: 1;
}

.event-details { flex: 1; }

.event-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 0.2rem;
}

.event-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.event-tags {
  margin-top: 0.4rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface);
  color: var(--text-muted);
}

/* Creative gallery */
.creative-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.creative-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.creative-card:hover {
  box-shadow: 0 4px 16px rgba(12, 44, 82, 0.08);
  border-color: var(--blue-light);
}

.creative-thumb-placeholder {
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.creative-info {
  padding: 0.75rem 1rem;
}

.creative-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 0.2rem;
}

.creative-author {
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* Marketplace */
.marketplace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.listing-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.listing-card:hover {
  box-shadow: 0 4px 16px rgba(12, 44, 82, 0.08);
  border-color: var(--blue-light);
}

.listing-price {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 0.4rem;
}

.listing-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 0.3rem;
}

.listing-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.75rem;
}

/* --- Section page shared -------------------------------- */
.section-page { }

.section-header--split {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-kicker {
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-lead {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.subsection-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 1.75rem 0 0.75rem;
}

.flash-stack {
  max-width: var(--max-w);
  margin: 1rem auto 0;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.flash-message {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  background: var(--surface);
}

.flash-message--success {
  background: #e7f5ee;
  border-color: #8fd3ab;
}

.flash-message--info {
  background: #e7f3fb;
  border-color: #98ccec;
}

.event-detail-card,
.participant-column {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.event-detail-grid,
.participant-board {
  display: grid;
  gap: 1rem;
}

.event-detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.event-cta-row {
  margin-top: 1.5rem;
  align-items: center;
}

.participant-board {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 1.5rem;
}

.participant-card {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--surface-2);
}

.participant-card:first-of-type {
  border-top: 0;
  padding-top: 0;
}

@media (max-width: 640px) {
  .participant-card {
    flex-direction: column;
  }
}

/* --- Discussion threads --------------------------------- */
.thread-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.thread-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.thread-card:hover {
  box-shadow: 0 4px 16px rgba(12, 44, 82, 0.08);
  border-color: var(--blue-light);
}

.thread-pinned { border-left: 3px solid var(--red); }

.thread-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.thread-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
}

.badge-pinned { background: #fde8e7; color: var(--red); }
.badge-general { background: var(--surface-2); color: var(--text-muted); }
.badge-setups  { background: #e7f3fb; color: var(--blue-dark); }
.badge-tech    { background: #e7f5ee; color: #1a7a40; }

.thread-new {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #1a7a40;
}

.thread-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.thread-excerpt {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.6rem;
}

.thread-footer {
  font-size: 0.78rem;
  color: var(--text-faint);
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.thread-author { font-weight: 500; color: var(--text-muted); }

/* --- Marketplace listings ------------------------------- */
.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.listing-sell { border-left: 3px solid var(--red); }
.listing-buy  { border-left: 3px solid var(--blue-light); }
.listing-free { border-left: 3px solid #1a7a40; }

.listing-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-bottom: 0.5rem;
  background: #fde8e7;
  color: var(--red);
}

.listing-badge.badge-buy  { background: #e7f3fb; color: var(--blue-dark); }
.listing-badge.badge-free { background: #e7f5ee; color: #1a7a40; }

.listing-body {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0.4rem 0 0.75rem;
}

.listing-footer {
  font-size: 0.78rem;
  color: var(--text-faint);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.listing-location { color: var(--text-faint); }
.listing-seller   { font-weight: 500; color: var(--text-muted); }

/* --- Creative ------------------------------------------- */
.creative-winner { border: 1px solid var(--red); }

.creative-swatch {
  width: 100%;
  height: 120px;
}

.creative-body {
  padding: 0.75rem 1rem 1rem;
}

.creative-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.creative-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0.3rem 0 0.5rem;
}

.creative-votes {
  font-size: 0.78rem;
  color: var(--red);
  font-weight: 600;
}

/* --- Competitions --------------------------------------- */
.comp-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.comp-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.comp-card:hover {
  box-shadow: 0 4px 16px rgba(12, 44, 82, 0.08);
  border-color: var(--blue-light);
}

.comp-active { border-left: 3px solid #1a7a40; }
.comp-past   { opacity: 0.75; }

.comp-status {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-bottom: 0.5rem;
}

.status-open  { background: #e7f5ee; color: #1a7a40; }
.status-ended { background: var(--surface-2); color: var(--text-faint); }

.comp-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 0.3rem;
}

.comp-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.75rem;
}

.comp-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.75rem;
  font-size: 0.8rem;
}

.comp-details dt { color: var(--text-faint); font-weight: 500; }
.comp-details dd { color: var(--text); margin: 0; }

/* --- Leaderboard ---------------------------------------- */
.leaderboard-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.rank-1 td { background: #fdf5e0; }
.rank-2 td { background: #f5f7fa; }
.rank-3 td { background: #fdf0e8; }

.rank-num {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-faint);
}

.rank-1 .rank-num { color: #7a5c00; }
.rank-2 .rank-num { color: var(--text-muted); }
.rank-3 .rank-num { color: #8b4e1e; }

.driver-name { font-weight: 600; color: var(--blue-dark); }

/* --- Events (extended from base .event-* styles) -------- */
.event-upcoming { border-left: 3px solid #1a7a40; }
.event-past     { opacity: 0.72; }

.event-day {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--blue-dark);
  line-height: 1;
}

.event-month {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--red);
}

.event-date-past .event-day   { color: var(--text-faint); }
.event-date-past .event-month { color: var(--text-faint); }

.event-body { flex: 1; }

.event-meta {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 0.4rem;
}

/* --- Footer --------------------------------------------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.footer-stripe {
  height: 3px;
  background: linear-gradient(
    to right,
    var(--red) 0% 33.33%,
    var(--blue-light) 33.33% 66.66%,
    var(--blue-dark) 66.66% 100%
  );
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1rem 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-faint);
}

@media (max-width: 480px) {
  .news-card-image img { height: 160px; }
  .event-card { flex-direction: column; gap: 0.5rem; }
}

/* --- Auth forms (signup / login / password-change) ------- */
.auth-page {
  display: flex;
  justify-content: center;
  padding: 2.5rem 1rem;
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 440px;
}

.auth-title {
  font-size: 1.6rem;
  margin-bottom: 1rem;
  color: var(--blue-dark);
}

.auth-note {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.auth-warning {
  font-size: 0.85rem;
  background: #fdf5e0;
  border-left: 3px solid #c89a00;
  padding: 0.6rem 0.75rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: #5c4500;
  margin-bottom: 1.25rem;
}

.auth-errors {
  list-style: none;
  background: #fde8e7;
  border-left: 3px solid var(--red);
  padding: 0.6rem 0.75rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.875rem;
  color: var(--red-dark);
  margin-bottom: 1rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.auth-field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"] {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  width: 100%;
  background: var(--white);
  color: var(--text);
  transition: border-color 0.15s;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--blue-light);
}

.auth-field--error input {
  border-color: var(--red);
}

.auth-field-errors {
  list-style: none;
  font-size: 0.8rem;
  color: var(--red-dark);
}

.auth-field-help {
  font-size: 0.8rem;
  color: var(--text-faint);
}

.auth-submit {
  margin-top: 0.5rem;
  align-self: flex-start;
}

.auth-actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

/* --- User nav (header auth state) ----------------------- */
.user-nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.user-nav--anon {
  gap: 0.5rem;
}

.user-nav-toggle {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0.3rem 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.user-nav-toggle:hover,
.user-nav-toggle[aria-expanded="true"] {
  color: var(--text);
  border-color: var(--border);
}

.user-nav-caret {
  font-size: 0.7rem;
}

.user-nav-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-nav-dropdown[hidden] { display: none; }

.user-nav-item,
.user-nav-dropdown form { display: contents; }

.user-nav-item {
  display: block;
  padding: 0.55rem 1rem;
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: background 0.1s;
}

.user-nav-item:hover {
  background: var(--surface-alt);
  color: var(--text);
  text-decoration: none;
}

.user-nav-item--logout {
  color: var(--red-dark);
}

/* --- Small button variant ------------------------------- */
.btn-sm {
  font-size: 0.8rem;
  padding: 0.25rem 0.65rem;
}

/* --- Profile page --------------------------------------- */
.profile-fields {
  margin: 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.profile-field {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.profile-field dt {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.875rem;
  min-width: 120px;
}

.profile-field dd {
  margin: 0;
  color: var(--text);
}
