/* ================================================================
   Australian Motorsport Calendar — Main Stylesheet
   Speedcafe.com branding
   ================================================================ */

/* ── Variables ─────────────────────────────────────────────────── */
:root {
  --red:         #E52422;
  --red-dark:    #B91C1A;
  --red-light:   #FF4442;
  --black:       #0F0F0F;
  --dark:        #141414;
  --dark-2:      #1C1C1C;
  --dark-3:      #242424;
  --dark-4:      #2E2E2E;
  --mid:         #555555;
  --light:       #999999;
  --lighter:     #CCCCCC;
  --white:       #FFFFFF;
  --off-white:   #F5F5F5;
  --green:       #22C55E;
  --amber:       #F59E0B;
  --blue:        #3B82F6;

  --font-body:   'Barlow', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-cond:   'Barlow Condensed', 'Barlow', sans-serif;

  --radius:      6px;
  --radius-lg:   12px;
  --shadow:      0 2px 8px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.6);

  --container:   1280px;
  --sidebar-w:   320px;
  --header-h:    64px;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--white);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-light); }
img { max-width: 100%; height: auto; }

/* ── Layout ────────────────────────────────────────────────────── */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.layout-with-sidebar {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  gap: 32px;
  align-items: start;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary  { background: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-dark); color: var(--white); }
.btn-ghost    { background: transparent; color: var(--white); border: 1px solid var(--dark-4); }
.btn-ghost:hover { background: var(--dark-3); border-color: var(--mid); }
.btn-outline  { background: transparent; color: var(--lighter); border: 1px solid var(--dark-4); }
.btn-outline:hover { border-color: var(--red); color: var(--white); }
.btn-accent   { background: var(--dark-3); color: var(--white); border: 1px solid var(--red); }
.btn-accent:hover { background: var(--red); }
.btn-sm       { padding: 7px 14px; font-size: 13px; }
.btn-full     { width: 100%; }
.link-btn     { background: none; border: none; color: var(--red); cursor: pointer; font: inherit; padding: 0; }

/* ── Header ────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--dark);
  border-bottom: 2px solid var(--red);
  height: var(--header-h);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
}
.site-logo img { display: block; }
.header-title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.header-title-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
}
.header-title-main {
  font-family: var(--font-cond);
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.header-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--lighter);
  transition: all 0.15s;
}
.nav-link:hover, .nav-link.active { color: var(--white); background: var(--dark-3); }
.mobile-menu-btn { display: none; background: none; border: none; color: var(--white); font-size: 22px; cursor: pointer; margin-left: auto; }

/* ── GAM Ads ───────────────────────────────────────────────────── */
.ad-leaderboard {
  background: var(--dark-2);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 50px;
  border-bottom: 1px solid var(--dark-4);
}
.ad-mrec {
  background: var(--dark-2);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: var(--radius);
  min-height: 250px;
  margin-bottom: 24px;
  border: 1px solid var(--dark-4);
}

/* ── Hero ──────────────────────────────────────────────────────── */
.hero-strip {
  background: linear-gradient(135deg, var(--dark) 0%, #1a0a0a 100%);
  border-bottom: 1px solid var(--dark-4);
  padding: 40px 0 36px;
}
.hero-strip h1 {
  font-family: var(--font-cond);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
  line-height: 1.05;
}
.hero-strip h1 span { color: var(--red); }
.hero-strip p { color: var(--lighter); font-size: 16px; margin-bottom: 24px; max-width: 560px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Filters ───────────────────────────────────────────────────── */
.filters-section {
  background: var(--dark-2);
  border-bottom: 1px solid var(--dark-4);
  padding: 24px 0 16px;
  position: sticky;
  top: var(--header-h);
  z-index: 90;
}
.filters-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.filter-group { display: flex; flex-direction: column; gap: 8px; }
.filter-label { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mid); }
.filter-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  padding: 5px 12px;
  border-radius: 100px;
  border: 1px solid var(--dark-4);
  background: transparent;
  color: var(--lighter);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.12s;
  white-space: nowrap;
}
.pill:hover { border-color: var(--mid); color: var(--white); }
.pill.active { background: var(--red); border-color: var(--red); color: var(--white); }
.filter-select {
  background: var(--dark-3);
  border: 1px solid var(--dark-4);
  color: var(--white);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font-body);
  max-width: 280px;
  cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--red); }
.date-range { display: flex; align-items: center; gap: 8px; }
.date-input {
  background: var(--dark-3);
  border: 1px solid var(--dark-4);
  color: var(--white);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font-body);
  cursor: pointer;
}
.date-input:focus { outline: none; border-color: var(--red); }
.date-sep { color: var(--mid); }

.filters-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--dark-4);
  flex-wrap: wrap;
}
.results-count { color: var(--light); font-size: 13px; margin-right: auto; }
.view-toggle { display: flex; gap: 4px; }
.view-btn {
  padding: 6px 10px;
  background: var(--dark-3);
  border: 1px solid var(--dark-4);
  color: var(--lighter);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.12s;
}
.view-btn.active { background: var(--red); border-color: var(--red); color: var(--white); }

/* ── Main Content ──────────────────────────────────────────────── */
.main-content { padding: 32px 0 64px; }

/* ── Event Cards ───────────────────────────────────────────────── */
.events-list { display: flex; flex-direction: column; gap: 0; }
.events-list.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

/* Month divider */
.month-divider {
  font-family: var(--font-cond);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--mid);
  padding: 24px 0 10px;
  border-bottom: 1px solid var(--dark-4);
  margin-bottom: 0;
}
.month-divider:first-child { padding-top: 0; }

.event-card {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 0;
  border-bottom: 1px solid var(--dark-3);
  transition: background 0.12s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.event-card:hover { background: var(--dark-2); }
.event-card.featured { border-left: 3px solid var(--red); }
.event-card.cancelled { opacity: 0.5; }

/* Date column */
.event-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  min-width: 80px;
  text-align: center;
  border-right: 1px solid var(--dark-3);
}
.event-date-day {
  font-family: var(--font-cond);
  font-size: 28px;
  font-weight: 800;
  color: var(--white);
  line-height: 1;
}
.event-date-month {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mid);
  margin-top: 2px;
}
.event-date-end {
  font-size: 10px;
  color: var(--mid);
  margin-top: 4px;
}
.event-date-multi {
  font-family: var(--font-cond);
  font-size: 13px;
  font-weight: 700;
  color: var(--light);
  margin-top: 2px;
}

/* Body column */
.event-body {
  padding: 14px 16px;
  min-width: 0;
}
.event-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.event-category {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 4px;
}
.event-level {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mid);
  background: var(--dark-3);
  padding: 2px 6px;
  border-radius: 3px;
}
.event-status-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
}
.event-status-badge.cancelled { background: #7f1d1d; color: #fca5a5; }
.event-status-badge.postponed { background: #78350f; color: #fde68a; }

.event-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-subtitle {
  font-size: 12px;
  color: var(--mid);
  margin-bottom: 6px;
}
.event-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.event-info-item {
  font-size: 13px;
  color: var(--light);
  display: flex;
  align-items: center;
  gap: 4px;
}
.event-info-item svg, .event-info-item .icon { opacity: 0.6; }

/* Actions column */
.event-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 14px 16px;
  gap: 8px;
  min-width: 120px;
}
.event-cost {
  font-family: var(--font-cond);
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
}
.event-cost.free { color: var(--green); }
.event-ticket-btn {
  font-size: 12px;
  padding: 6px 12px;
}

/* Grid view variant */
.grid-view .event-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--dark-3);
  border-radius: var(--radius);
  overflow: hidden;
}
.grid-view .event-date {
  border-right: none;
  border-bottom: 1px solid var(--dark-3);
  flex-direction: row;
  justify-content: flex-start;
  padding: 12px 16px;
  gap: 8px;
}
.grid-view .event-actions {
  flex-direction: row;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--dark-3);
}

/* In-feed ad */
.infeed-ad {
  display: flex;
  justify-content: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--dark-3);
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar { position: sticky; top: calc(var(--header-h) + 180px); }
.sidebar-widget {
  background: var(--dark-2);
  border: 1px solid var(--dark-4);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}
.sidebar-widget--cta { border-color: var(--red); }
.widget-title {
  font-family: var(--font-cond);
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  color: var(--white);
}
.sidebar-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.sidebar-links a { font-size: 14px; color: var(--lighter); }
.sidebar-links a:hover { color: var(--white); }
.sidebar-widget p { font-size: 14px; color: var(--light); margin-bottom: 12px; }

/* ICS options */
.ics-options { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.ics-link {
  display: block;
  padding: 8px 12px;
  background: var(--dark-3);
  border: 1px solid var(--dark-4);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--lighter);
  text-align: center;
}
.ics-link:hover { border-color: var(--red); color: var(--white); }
.ics-url-input {
  width: 100%;
  background: var(--dark-3);
  border: 1px solid var(--dark-4);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 12px;
  color: var(--light);
  font-family: monospace;
}

/* Next event widget */
.next-event-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.next-event-date { font-family: var(--font-cond); font-size: 22px; font-weight: 800; color: var(--red); }
.next-event-venue { font-size: 13px; color: var(--light); margin-top: 4px; }
.countdown { font-size: 12px; color: var(--mid); margin-top: 8px; }

/* ── Loading / Empty ───────────────────────────────────────────── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--mid);
  gap: 16px;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--dark-4);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: var(--mid);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 20px; color: var(--lighter); margin-bottom: 8px; }

.load-more-wrap { display: flex; justify-content: center; padding: 32px 0; }

/* ── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--dark-2);
  border: 1px solid var(--dark-4);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  position: relative;
}
.modal h2 { font-size: 22px; margin-bottom: 8px; }
.modal p { color: var(--light); font-size: 14px; margin-bottom: 20px; }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--light);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.modal-option { margin-bottom: 10px; }
.modal-option .btn {
  background: var(--dark-3);
  border: 1px solid var(--dark-4);
  color: var(--white);
  text-align: left;
  justify-content: flex-start;
}
.modal-option .btn:hover { border-color: var(--red); background: var(--dark-4); }
.modal-divider {
  font-size: 12px;
  color: var(--mid);
  text-align: center;
  margin: 16px 0;
  position: relative;
}
.modal-divider::before, .modal-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 36%;
  height: 1px;
  background: var(--dark-4);
}
.modal-divider::before { left: 0; }
.modal-divider::after { right: 0; }
.url-copy-row { display: flex; gap: 8px; }
.url-copy-input {
  flex: 1;
  background: var(--dark-3);
  border: 1px solid var(--dark-4);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--light);
  font-family: monospace;
}
.btn-copy { flex-shrink: 0; }
.modal-note { font-size: 12px; color: var(--mid); margin-top: 12px; margin-bottom: 0; }

/* ── Footer ────────────────────────────────────────────────────── */
.site-footer {
  background: var(--dark);
  border-top: 1px solid var(--dark-4);
  padding: 48px 0 0;
}
.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
}
.footer-brand img { margin-bottom: 12px; }
.footer-brand p { font-size: 14px; color: var(--light); }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links h4 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 4px;
}
.footer-links a { font-size: 14px; color: var(--lighter); }
.footer-links a:hover { color: var(--white); }
.footer-affiliate { display: flex; flex-direction: column; gap: 10px; }
.footer-affiliate h4 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 4px;
}
.affiliate-link { font-size: 14px; color: var(--lighter); }
.affiliate-link:hover { color: var(--white); }
.footer-bottom {
  border-top: 1px solid var(--dark-4);
  padding: 16px 0;
}
.footer-bottom .container {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--mid);
}
.footer-bottom a { color: var(--light); }

/* ── Timezone Toggle ────────────────────────────────────────────── */
.tz-toggle {
  display: flex;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.tz-btn {
  background: none;
  border: none;
  color: var(--light);
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.tz-btn:hover { background: var(--darker); color: var(--white); }
.tz-btn.active { background: var(--red); color: var(--white); }

/* ── Session Schedule ───────────────────────────────────────────── */
.sessions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.sessions-header .section-heading { margin-bottom: 0; }
.sessions-list { display: flex; flex-direction: column; gap: 2px; }
.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--dark);
  border-radius: 6px;
  border-left: 3px solid var(--border);
}
.session-row:first-child { border-left-color: var(--red); }
.session-name { font-weight: 600; font-size: 14px; color: var(--white); }
.session-time-col { font-size: 13px; color: var(--lighter); text-align: right; }
.sess-day { color: var(--light); margin-right: 6px; font-size: 12px; }
.sess-time { color: var(--white); font-weight: 500; }
.session-label {
  display: inline-block;
  background: var(--darker);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--lighter);
  margin-right: 4px;
}

/* ── Support / Child Events ──────────────────────────────────────── */
.support-event {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--dark);
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}
.support-event:hover { border-color: var(--mid); }
.support-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 4px; }
.support-info { flex: 1; min-width: 0; }
.support-name { font-weight: 600; font-size: 14px; color: var(--white); }
.support-cat { font-size: 12px; color: var(--light); margin-top: 2px; }
.support-arrow { color: var(--mid); font-size: 16px; }

/* filters-actions: ensure tz-toggle sits comfortably in row */
.filters-actions { align-items: center; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .layout-with-sidebar {
    grid-template-columns: 1fr;
  }
  .sidebar { position: static; }
  .ad-mrec { display: none; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --header-h: 56px; }
  .header-nav { display: none; }
  .mobile-menu-btn { display: block; }
  .header-title-main { font-size: 15px; }

  .hero-strip { padding: 28px 0 24px; }
  .hero-cta { flex-direction: column; }

  .filters-section { position: relative; top: 0; }
  .filters-grid { gap: 14px; }
  .filter-pills { gap: 4px; }
  .pill { font-size: 12px; padding: 4px 10px; }
  .filter-select { max-width: 100%; }

  .event-card { grid-template-columns: 64px 1fr; }
  .event-actions { display: none; }
  .event-title { font-size: 14px; white-space: normal; }
  .event-date-day { font-size: 22px; }

  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom .container { flex-direction: column; gap: 8px; text-align: center; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .event-card { grid-template-columns: 56px 1fr; }
  .event-body { padding: 12px; }
  .event-info { gap: 8px; }
  .event-info-item { font-size: 12px; }
}
