/* ============================================
   Components
   ============================================ */

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 0.85rem 2rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-base);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--white);
  background: var(--brand);
  border: 2px solid var(--brand);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
}
.btn:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: var(--white); transform: translateY(-1px); }
.btn--full { display: block; width: 100%; }
.btn--lg { padding: 1rem 2.5rem; font-size: var(--text-lg); }
.btn--dark { background: var(--ink); border-color: var(--ink); }
.btn--dark:hover { background: var(--ink-deep); border-color: var(--ink-deep); }
/* Small + ghost (cookie banner on the black strip); min-height keeps the 44px touch target */
.btn--sm { display: inline-flex; align-items: center; justify-content: center; padding: 0.5rem 1.25rem; font-size: var(--text-xs); min-height: 44px; }
.btn--ghost { background: transparent; color: var(--text-on-dark); border-color: var(--border-on-dark); }
.btn--ghost:hover { background: var(--wash-light); border-color: var(--border-on-dark-strong); color: var(--white); }

/* --- Checkered racing-flag divider (the signature motif) --- */
.checker {
  height: 30px;
  background-color: var(--white);
  background-image:
    linear-gradient(45deg, var(--ink) 25%, transparent 25%, transparent 75%, var(--ink) 75%),
    linear-gradient(45deg, var(--ink) 25%, transparent 25%, transparent 75%, var(--ink) 75%);
  background-size: 30px 30px;
  background-position: 0 0, 15px 15px;
}
.checker--sm { height: 20px; background-size: 20px 20px; background-position: 0 0, 10px 10px; }

/* --- Hero band (full-width event photo; logo is baked into the top-left of the
   image, so anchor the crop to the TOP — the bottom's baked-in checker is cropped
   and replaced by our own .checker divider) --- */
.hero-band { width: 100%; }
.hero-band img { width: 100%; height: clamp(240px, 34vw, 480px); object-fit: cover; object-position: left top; display: block; }

/* --- Event intro / heading block --- */
.event-intro { text-align: center; }
.event-intro .eyebrow { display: block; }
.event-intro h1 { margin-bottom: var(--space-md); }
.event-intro__lead { font-size: var(--text-lg); color: var(--text-secondary); max-width: 760px; margin: 0 auto var(--space-md); line-height: var(--leading-relaxed); }

/* --- CTA button row --- */
.cta-row { display: flex; flex-direction: column; gap: var(--space-md); max-width: 480px; margin: var(--space-xl) auto 0; }

/* --- Event highlights (two-column list) --- */
.highlights-list {
  columns: 2;
  column-gap: var(--space-3xl);
  max-width: 620px;
  margin: 0 auto;
  font-size: var(--text-xl);
}
.highlights-list li {
  position: relative;
  padding-left: 1.4em;
  margin-bottom: var(--space-sm);
  break-inside: avoid;
}
.highlights-list li::before { content: "•"; position: absolute; left: 0; color: var(--brand); font-weight: 700; }

/* --- Video band --- */
.video-embed { max-width: 860px; margin: var(--space-xl) auto 0; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-lg); background: var(--ink-deep); }
.video-embed video { width: 100%; display: block; }

/* --- Home recap teaser (brief summary + link; full galleries live on Past Events) --- */
.recap-teaser { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--space-2xl); align-items: center; }
.recap-teaser__media { position: relative; display: block; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-md); }
.recap-teaser__media img { width: 100%; aspect-ratio: 16 / 9; height: auto; object-fit: cover; display: block; transition: transform var(--transition-base); }
.recap-teaser__media:hover img { transform: scale(1.04); }
.recap-teaser__play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 66px; height: 66px; border-radius: 50%; background: var(--brand-veil);
  color: var(--white); display: grid; place-items: center; font-size: 1.6rem; padding-left: 4px;
}
.recap-teaser__text .eyebrow { display: block; }
.recap-teaser__text p { color: var(--text-secondary); margin: var(--space-md) 0; line-height: var(--leading-relaxed); }
/* --bp-lap: side-by-side teaser stacks before the columns get cramped. */
@media (max-width: 900px) { .recap-teaser { grid-template-columns: 1fr; text-align: center; } }

/* --- Event date line + "Date to be announced" state --- */
.event-intro__date { font-size: var(--text-lg); color: var(--text-secondary); margin-bottom: var(--space-md); }
.event-intro__tba {
  display: inline-block;
  font-family: var(--font-heading); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--brand);
  border: 2px dashed var(--brand); border-radius: var(--radius-sm);
  padding: 0.4rem 1rem;
}

/* --- Photo thumbnail grid (per-year; opens the lightbox) --- */
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-sm);
  max-width: 1000px;
  margin: var(--space-xl) auto 0;
}
.thumb {
  display: block; width: 100%; padding: 0; border: none; cursor: pointer;
  background: none; border-radius: var(--radius-sm); overflow: hidden;
}
.thumb img {
  width: 100%; aspect-ratio: 4 / 3; height: auto; object-fit: cover; display: block;
  transition: transform var(--transition-fast), filter var(--transition-fast);
}
.thumb:hover img, .thumb:focus-visible img { transform: scale(1.05); filter: brightness(1.05); }
.thumb:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.thumb-grid__item[hidden] { display: none; }

/* Thumbnail pager (client-side pagination; hidden until JS enables it) */
.thumb-pager { display: flex; align-items: center; justify-content: center; gap: var(--space-lg); max-width: 1000px; margin: var(--space-lg) auto 0; }
.thumb-pager[hidden] { display: none; }
.thumb-pager__status { font-family: var(--font-heading); font-weight: 700; font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-secondary); min-width: 8em; text-align: center; }
.thumb-pager__btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0.5rem 1.25rem;
  font-family: var(--font-heading); font-weight: 700; font-size: var(--text-sm);
  text-transform: uppercase; letter-spacing: 0.03em; cursor: pointer;
  color: var(--ink); background: transparent; border: 2px solid var(--ink); border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.thumb-pager__btn:hover:not(:disabled) { background: var(--ink); color: var(--white); }
.thumb-pager__btn:disabled { opacity: 0.35; cursor: default; }

/* --- Lightbox (native <dialog>) --- */
.lightbox {
  border: none; padding: 0; background: transparent;
  max-width: 100vw; max-height: 100vh; width: 100%; height: 100%;
  margin: 0; overflow: hidden;
}
.lightbox::backdrop { background: var(--scrim-deep); }
.lightbox__img {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  max-width: 92vw; max-height: 86vh; width: auto; height: auto;
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.lightbox__close, .lightbox__nav {
  position: absolute; z-index: 2; border: none; cursor: pointer; color: var(--white);
  background: var(--scrim); display: grid; place-items: center;
  transition: background var(--transition-fast);
}
.lightbox__close:hover, .lightbox__nav:hover { background: var(--brand); }
.lightbox__close { top: 16px; right: 16px; width: 46px; height: 46px; border-radius: 50%; font-size: 1.9rem; line-height: 1; }
.lightbox__nav { top: 50%; transform: translateY(-50%); width: 54px; height: 54px; border-radius: 50%; font-size: 2rem; line-height: 1; }
.lightbox__nav--prev { left: 16px; }
.lightbox__nav--next { right: 16px; }
.lightbox__count { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: var(--white); font-size: var(--text-sm); margin: 0; }
/* --bp-phone: keep the lightbox arrows clear of the image on a phone. */
@media (max-width: 640px) {
  .lightbox__nav { width: 44px; height: 44px; }
  .lightbox__nav--prev { left: 6px; } .lightbox__nav--next { right: 6px; }
}

/* --- Year-jump nav (Past Events archive) --- */
.year-jump { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-sm); margin-top: var(--space-xl); }
.year-jump__link {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--font-heading); font-weight: 700; font-size: var(--text-sm);
  text-transform: uppercase; letter-spacing: 0.03em;
  padding: 0.4rem 1.1rem; border: 2px solid var(--ink); border-radius: var(--radius-sm);
  color: var(--ink); transition: all var(--transition-fast);
}
.year-jump__link:hover { background: var(--ink); color: var(--white); }

/* --- Sponsor band --- */
.sponsor-band { background: var(--cream); }
.sponsor-band__banner { max-width: min(720px, 100%); margin: 0 auto var(--space-2xl); }
.sponsor-tier { margin-bottom: var(--space-2xl); }
.sponsor-tier__bar { display: block; max-width: min(560px, 100%); margin: 0 auto var(--space-lg); }
.sponsor-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xl);
}
.sponsor-grid img {
  max-height: 90px;
  max-width: 200px;
  width: auto;
  object-fit: contain;
  filter: none;
  transition: transform var(--transition-fast);
}
.sponsor-grid--sm img { max-height: 64px; max-width: 150px; }
.sponsor-grid img:hover { transform: scale(1.05); }

/* --- Contact / info blocks --- */
.info-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: var(--space-xl);
  max-width: 520px;
  margin: 0 auto;
}
.info-card p + p { margin-top: var(--space-sm); }

/* --- Contact form --- */
.contact-form { max-width: 640px; margin: 0 auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.form-group { margin-bottom: var(--space-lg); }
.form-group label {
  display: block; font-weight: 700; font-size: var(--text-sm);
  margin-bottom: var(--space-xs); color: var(--text-primary);
}
.form-row--3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 0.7rem 0.9rem;
  font-family: var(--font-body); font-size: var(--text-base);
  color: var(--text-primary); background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--brand); box-shadow: var(--focus-halo);
}
/* Keyboard focus keeps the global 2px outline on top of the halo; mouse focus shows only the halo */
.form-group textarea { resize: vertical; min-height: 140px; }
.form-required { color: var(--brand); }
.form-optional { color: var(--text-light); font-weight: 400; font-size: var(--text-xs); }
.contact-form__note { font-size: var(--text-sm); color: var(--text-light); margin-top: var(--space-md); }
.contact-form .btn { margin-top: var(--space-sm); }

/* Honeypot — off-screen, NOT display:none (bots skip display:none fields) */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Form alert (?sent=invalid|error redirects from contact-submit.php) */
.form-alert { padding: var(--space-md) var(--space-lg); border-radius: var(--radius-sm); margin-bottom: var(--space-lg); font-weight: 600; }
.form-alert--error { background: var(--brand-wash); border: 1px solid var(--brand); color: var(--brand-deep); }
.form-alert[hidden] { display: none; }

/* Map embed */
.map-embed { border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-md); }
.map-embed iframe { border: 0; display: block; width: 100%; }

/* --- Cookie consent banner (rendered only when GA is enabled; shown until a choice is stored) --- */
.cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: var(--ink-deep);
  border-top: 1px solid var(--hairline-faint);
  padding: var(--space-md) 0;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  flex-wrap: wrap;
}
.cookie-banner__text { font-size: var(--text-sm); color: var(--text-on-dark); margin: 0; }
/* White underlined link — brand red fails contrast on the black banner */
.cookie-banner__text a { color: var(--white); text-decoration: underline; }
.cookie-banner__text a:hover { opacity: 0.85; }
.cookie-banner__actions { display: flex; gap: var(--space-sm); flex-shrink: 0; }

/* --bp-phone: every multi-column form row becomes one column. */
@media (max-width: 640px) { .form-row, .form-row--3 { grid-template-columns: 1fr; } }

/* --bp-phone: the highlights list drops to a single column. */
@media (max-width: 640px) {
  .highlights-list { columns: 1; font-size: var(--text-lg); max-width: 340px; }
}

/* --- Past-event meta line (date + charity) + "to be added" / media placeholders --- */
.event-meta {
  display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-sm) var(--space-lg);
  margin-top: var(--space-sm);
  font-family: var(--font-heading); font-weight: 700; font-size: var(--text-sm);
  text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-secondary);
}
.event-meta__item--todo {
  color: var(--brand-deep); border: 1px dashed var(--brand-deep); border-radius: var(--radius-sm);
  padding: 0.05rem 0.55rem; text-transform: none; font-weight: 600; font-style: italic; letter-spacing: 0;
}
.media-todo {
  margin: var(--space-xl) auto 0; max-width: 480px; padding: var(--space-lg);
  border: 2px dashed var(--border); border-radius: var(--radius-md);
  color: var(--text-light); font-style: italic;
}

/* --- Competition winners block (Past Events; placeholder rows until filled) --- */
.winners {
  max-width: 540px; margin: var(--space-xl) auto 0; text-align: left;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-xl); box-shadow: var(--shadow-md);
}
.winners__row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-md); padding: var(--space-sm) 0; }
.winners__row + .winners__row { border-top: 1px solid var(--border-light); }
.winners dt { margin: 0; font-family: var(--font-heading); font-weight: 700; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); flex-shrink: 0; }
.winners dd { margin: 0; text-align: right; font-weight: 600; color: var(--text-primary); }
.winners dd.winners__todo { color: var(--brand-deep); font-style: italic; font-weight: 500; }

/* --- Registration "list my car" checkbox --- */
.form-check { display: flex; align-items: flex-start; gap: var(--space-sm); }
.form-check input[type="checkbox"] { flex-shrink: 0; width: 20px; height: 20px; margin-top: 0.15rem; accent-color: var(--brand); }
.form-check label { font-weight: 400; font-size: var(--text-sm); line-height: var(--leading-normal); }

/* --- The Lineup: confirmed-car cards (home) --- */
/* Grid cells stretch to the tallest in their row, and the nickname line is always
   rendered (blank when absent), so every card is the same height with or without a name. */
.car-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-md); max-width: 900px; margin: var(--space-xl) auto 0;
  list-style: none; text-align: left; padding: 0;
}
.car-card {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--space-sm) var(--space-md); background: var(--cream);
  border-left: 3px solid var(--brand); border-radius: var(--radius-sm);
}
.car-card__main { font-weight: 700; line-height: var(--leading-tight, 1.2); }
.car-card__nick {
  display: block; min-height: 1.25em;   /* reserved even when empty → equal card heights */
  color: var(--brand); font-style: italic; font-size: var(--text-sm);
}
