/*
Filename:      sponsor.css
Created by:    Kris Korsmo
Organization:  Leading Edge Digital Media - www.leadingedge.net
Purpose:       Sponsor slots rendered by api/sponsorshipDisplay.cfc
Last Updated:  10/20/2026

Loaded by common/template.cfm and by the standalone entity templates
(index-rally, index-event, index-article, index-car), so it cannot rely on
style.css or eg-premium.css being present - colours are spelled out with the
eg-premium accent as a fallback.

A slot is <aside class="eg-sp eg-sp--{format} eg-sp--{tier} [eg-sp--{variant}]">.
Formats: banner (4:1, full width), tile (6:5, grid), logo (2:1, strip).
Every slot carries a visible "Sponsored" label (FTC disclosure) - do not hide it.
*/

.eg-sp {
  --eg-sp-accent: var(--accent, #c9a96a);
  --eg-sp-accent-rgb: var(--accent-rgb, 201, 169, 106);
  margin: 2rem 0;
  position: relative;
}

.eg-sp__label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin: 0 0 0.4rem;
}

.eg-sp__grid {
  display: grid;
  gap: 1rem;
}

.eg-sp__item {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0f1114;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

a.eg-sp__item:hover,
a.eg-sp__item:focus-visible {
  border-color: rgba(var(--eg-sp-accent-rgb), 0.6);
}

a.eg-sp__item:focus-visible {
  outline: 2px solid var(--eg-sp-accent);
  outline-offset: 2px;
}

.eg-sp__item picture,
.eg-sp__item img {
  display: block;
  width: 100%;
  height: 100%;
}

.eg-sp__item img {
  object-fit: cover;
}

.eg-sp__cta {
  position: absolute;
  right: 0.6rem;
  bottom: 0.6rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
}

/* ---- Formats ------------------------------------------------------------ */

/* Banner: one wide ad; several stack. */
.eg-sp--banner .eg-sp__grid { grid-template-columns: 1fr; }
.eg-sp--banner .eg-sp__item { aspect-ratio: 4 / 1; }

/* Tiles: at most three across, never narrower than 260px. auto-fill keeps
   the empty tracks, so two tiles take two thirds of the row instead of
   stretching to half each; a 4-wide sidebar gets one per row. */
.eg-sp--tile .eg-sp__grid { grid-template-columns: repeat(auto-fill, minmax(max(260px, calc((100% - 2rem) / 3)), 1fr)); }
.eg-sp--sidebar.eg-sp--tile .eg-sp__grid,
.eg-sp--card.eg-sp--tile .eg-sp__grid,
.eg-sp--inline.eg-sp--tile .eg-sp__grid { grid-template-columns: 1fr; }
.eg-sp--inline.eg-sp--tile .eg-sp__item { max-width: 420px; }
.eg-sp--tile .eg-sp__item { aspect-ratio: 6 / 5; }

/* Logos: a strip of small marks; the art is contained, never cropped. */
.eg-sp--logo .eg-sp__grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.75rem; }
.eg-sp--logo .eg-sp__item { aspect-ratio: 2 / 1; background: rgba(255, 255, 255, 0.04); padding: 0.6rem; }
.eg-sp--logo .eg-sp__item img { object-fit: contain; }

/* In a narrow sidebar, logos sit two to a row. */
.eg-sp--sidebar.eg-sp--logo .eg-sp__grid { grid-template-columns: repeat(2, 1fr); }

/* A rally's Title Sponsor (one big logo) and Supporting Partners (a centred
   row under it) - common/rally.cfm, db/042. */
.eg-sp--title,
.eg-sp--partners { margin: 0; text-align: center; }
.eg-sp--title .eg-sp__label,
.eg-sp--partners .eg-sp__label { text-align: center; }
.eg-sp--title .eg-sp__grid { grid-template-columns: minmax(0, 360px); justify-content: center; }
.eg-sp--title .eg-sp__item { padding: 1rem 1.25rem; border-color: rgba(var(--eg-sp-accent-rgb), 0.35); }
.eg-sp--partners .eg-sp__grid { grid-template-columns: repeat(auto-fit, minmax(140px, 190px)); justify-content: center; }

/* A single ad inside a Fomantic card grid (listings) or a feed (news). */
.eg-sp--card,
.eg-sp--inline { margin: 0; }
.eg-sp--card { height: 100%; display: flex; flex-direction: column; }
.eg-sp--card .eg-sp__label { padding: 0.6rem 0.75rem 0; }
.eg-sp--card .eg-sp__grid { padding: 0 0.75rem 0.75rem; flex: 1; }
.eg-sp--inline { padding: 1rem 0; border-top: 1px solid rgba(255, 255, 255, 0.06); border-bottom: 1px solid rgba(255, 255, 255, 0.06); }

/* ---- Empty premium slot: "Sponsor this page" --------------------------- */
.eg-sp--cta { margin: 1.5rem 0; }

.eg-sp__ctalink {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
  padding: 0.85rem 1.1rem;
  border: 1px dashed rgba(var(--eg-sp-accent-rgb), 0.4);
  border-radius: 0.5rem;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.eg-sp__ctalink:hover,
.eg-sp__ctalink:focus-visible {
  border-color: rgba(var(--eg-sp-accent-rgb), 0.8);
  background: rgba(var(--eg-sp-accent-rgb), 0.06);
  color: #fff;
}

.eg-sp__ctatitle {
  color: var(--eg-sp-accent);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.eg-sp__ctasub {
  font-size: 0.88rem;
}

@media (prefers-reduced-motion: reduce) {
  .eg-sp__item,
  .eg-sp__ctalink { transition: none; }
}

@media only screen and (max-width: 640px) {
  .eg-sp { margin: 1.5rem 0; }
  /* A 4:1 banner is a sliver on a phone. When the sponsor supplied mobile
     artwork (2:1), <picture> swaps it in and the box follows; without it the
     desktop art keeps its own shape rather than being cropped. */
  .eg-sp--banner .eg-sp__item--m { aspect-ratio: 2 / 1; }
}

/* ---- Sponsorship report chart (common/library/sponsor-chart.js) ----------
   Used by the admin reports and the sponsor dashboard. One series, the site
   accent; grid and axes stay recessive. */
.eg-chart { position: relative; }
.eg-chart svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.eg-chart__grid { stroke: rgba(255, 255, 255, 0.07); stroke-width: 1; }
.eg-chart__base { stroke: rgba(255, 255, 255, 0.22); stroke-width: 1; }
.eg-chart__axis { fill: rgba(255, 255, 255, 0.5); font-size: 11px; font-variant-numeric: tabular-nums; }
.eg-chart__bar { fill: var(--accent, #c9a96a); }
.eg-chart__hit { fill: transparent; }
.eg-chart__hit.is-on { fill: rgba(255, 255, 255, 0.06); }
.eg-chart__tip {
  position: absolute; pointer-events: none; z-index: 2; white-space: nowrap;
  padding: 0.45rem 0.6rem; border-radius: 0.35rem; font-size: 0.85em; line-height: 1.45;
  color: #f2efe8; background: #1c1c1f; border: 1px solid rgba(255, 255, 255, 0.16); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
