/* =====================================================================
   WhereRide — livello di design (caricato dopo style.css)
   Mobile first: barra in basso, hero, schede compatte, sezioni a scorrimento.
   ===================================================================== */

:root {
  /* Accessibilità: arancio del marchio scurito quanto basta per contrasto AA (5:1 su bianco).
     L'arancio acceso originale resta in --brand-bright per elementi decorativi. */
  --brand: #d13300;
  --brand-bright: #ff3e00;
  --muted-foreground: #66666f;
  --ink: #0d0d10;
  --ink-2: #17171c;
  --ink-3: #24242b;
  --r-lg: 1.1rem;
  --r-xl: 1.5rem;
  --tabbar-h: 64px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.05), 0 6px 20px rgba(15, 23, 42, 0.06);
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: #f6f6f8;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--brand);
  color: #fff;
}

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- header ---------- */
.site-nav {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.nav-links a[aria-current="page"]:not(.btn) {
  color: var(--brand);
}

/* ---------- barra in basso (solo mobile) ---------- */
.tabbar {
  display: none;
}

@media (max-width: 899px) {
  body {
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  }

  .nav-toggle {
    display: none !important;
  }

  .site-nav-inner {
    justify-content: center;
  }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: saturate(1.6) blur(18px);
    -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
  }

  .tabbar a,
  .tabbar button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    background: none;
    color: #55555f;
    font: inherit;
    font-size: 0.6875rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    position: relative;
  }

  .tabbar a[aria-current="page"] {
    color: var(--brand);
  }

  .tabbar a[aria-current="page"]::before {
    content: "";
    position: absolute;
    top: 0;
    width: 28px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--brand);
  }

  .tabbar a:active,
  .tabbar button:active {
    transform: scale(0.94);
  }

  .sheet-backdrop {
    z-index: 80;
  }

  /* la barra sticky del calendario e degli eventi non deve finire sotto la tabbar */
  .ag-sheet {
    z-index: 90;
  }
}

/* ---------- HERO home ---------- */
.hx {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255, 62, 0, 0.28) 0%, rgba(255, 62, 0, 0) 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(255, 62, 0, 0.12) 0%, rgba(255, 62, 0, 0) 60%),
    linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
}

.hx-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hx-track {
  position: absolute;
  opacity: 0.09;
  filter: drop-shadow(0 0 18px rgba(255, 62, 0, 0.5));
}

.hx-track--a {
  width: min(78vw, 680px);
  right: -12%;
  top: 6%;
  transform: rotate(-8deg);
}

.hx-track--b {
  width: min(55vw, 460px);
  left: -14%;
  bottom: -6%;
  transform: rotate(12deg);
  opacity: 0.06;
}

.hx-inner {
  position: relative;
  padding-top: clamp(2.25rem, 7vw, 5rem);
  padding-bottom: clamp(2rem, 6vw, 4rem);
}

.hx-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.hx-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-bright);
  box-shadow: 0 0 0 4px rgba(255, 62, 0, 0.25);
  animation: hx-pulse 2s infinite;
}

@keyframes hx-pulse {
  50% {
    box-shadow: 0 0 0 7px rgba(255, 62, 0, 0);
  }
}

.hx-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.35rem, 9.5vw, 4.75rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

.hx-title span {
  background: linear-gradient(90deg, var(--brand-bright) 0%, #ff7a3d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hx-sub {
  max-width: 36rem;
  margin: 1rem 0 1.5rem;
  font-size: clamp(1rem, 3.6vw, 1.15rem);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.72);
}

.hx-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 38rem;
  padding: 0.35rem 0.35rem 0.35rem 1rem;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.hx-search svg {
  flex: none;
  color: #8a8a94;
}

.hx-search input {
  flex: 1;
  min-width: 0;
  height: 48px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
}

.hx-search input:focus {
  outline: none;
}

.hx-search button {
  flex: none;
  height: 48px;
  padding: 0 1.35rem;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.hx-search button:active {
  transform: scale(0.97);
}

.hx-chips {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  overflow-x: auto;
  scrollbar-width: none;
  margin-left: -1rem;
  margin-right: -1rem;
  padding: 0 1rem 0.2rem;
}

.hx-chips::-webkit-scrollbar {
  display: none;
}

.hx-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-weight: 700;
  font-size: 0.9375rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.hx-chip svg {
  color: var(--brand-bright);
}

.hx-chip:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
}

.hx-stats {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  gap: 1.75rem;
  margin: 1.75rem 0 0;
}

.hx-stats div {
  display: flex;
  flex-direction: column-reverse;
}

.hx-stats dt {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
}

.hx-stats dd {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.6rem, 6vw, 2.25rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

/* ---------- titoli di sezione ---------- */
.soon-head h2,
.hs-head h2 {
  font-size: clamp(1.5rem, 6vw, 2.25rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.section-kicker,
.section-kicker-tight {
  color: var(--brand) !important;
}

/* ---------- carosello "prossimi giorni" ---------- */
.home-owl-section {
  padding-top: 2.25rem;
}


/* ---------- sezioni a scorrimento della home ---------- */
.hs {
  padding: 2.25rem 0 0.5rem;
}

.hs--orgs {
  padding-bottom: 2.5rem;
}

.hs-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.hs-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
}

.hs-more {
  flex: none;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0 0.9rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--ink);
  font-weight: 800;
  font-size: 0.875rem;
  text-decoration: none;
}

.hs-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(72vw, 270px);
  gap: 0.85rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin: 0 -1rem;
  padding: 0.25rem 1rem 1rem;
  scrollbar-width: none;
}

.hs-row::-webkit-scrollbar {
  display: none;
}

.hs-card {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  color: inherit;
  text-decoration: none;
}

.hs-card-img {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-lg);
  overflow: hidden;
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-card);
  margin-bottom: 0.45rem;
}

.hs-card-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.72) 100%);
}

.hs-card-img img {
  position: absolute;
  z-index: 1;
  right: 10px;
  bottom: 10px;
  width: 42%;
  max-height: 46%;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
}

.hs-card-count {
  position: absolute;
  z-index: 1;
  left: 10px;
  bottom: 10px;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}

.hs-card-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.hs-card-place {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.hs-logos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.6rem;
}

.hs-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 2;
  padding: 0.6rem;
  border-radius: var(--r-lg);
  background: #fff;
  border: 1px solid var(--border);
  transition: border-color 0.15s, transform 0.15s;
}

.hs-logo:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
}

.hs-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ---------- "Perché WhereRide" più compatto ---------- */
.why-section {
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}

@media (max-width: 767px) {
  .why-grid {
    gap: 0.75rem !important;
  }

  .why-card {
    padding: 1.15rem !important;
  }

  .why-card h3 {
    font-size: 1.05rem !important;
  }
}

/* ---------- pagine interne: testata più asciutta ---------- */
@media (max-width: 767px) {
  .page-top {
    padding-top: 1.25rem !important;
    padding-bottom: 1rem !important;
  }

  .page-title {
    font-size: 2rem !important;
    letter-spacing: -0.04em;
  }

  .page-tagline {
    font-size: 0.9375rem !important;
    margin-top: 0.35rem !important;
  }
}

/* ---------- EVENTI: barra risultati e filtri ---------- */
.result-pill {
  font-family: var(--font-sans) !important;
  font-size: 0.8125rem !important;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  color: var(--muted-foreground);
}

/* mostra solo "N visibili · M in archivio" */
.result-pill > span {
  display: none;
}

.result-pill > .result-pill-strong,
.result-pill > span:last-child,
.result-pill > .result-pill-sep:nth-last-child(2) {
  display: inline;
}

.result-pill-strong {
  color: var(--ink);
  font-weight: 800;
}

.filters-box {
  border-radius: var(--r-lg) !important;
  box-shadow: none !important;
}

/* ---------- EVENTI: schede compatte su mobile ---------- */
@media (max-width: 639px) {
  #track-grid {
    gap: 0.65rem;
  }

  #track-grid .card {
    display: grid !important;
    grid-template-columns: 112px 1fr;
    grid-template-rows: auto;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-card);
    border-color: transparent;
  }

  #track-grid .card .card-img-wrap {
    width: 112px !important;
    min-width: 112px !important;
    height: 100% !important;
    min-height: 132px !important;
    aspect-ratio: auto;
    align-self: stretch !important;
  }

  #track-grid .card .event-date-badge {
    left: 6px;
    top: 6px;
    right: 6px;
    padding: 0.35rem 0.4rem;
    font-size: 0.75rem;
    text-align: center;
    border-radius: 0.6rem;
  }

  #track-grid .card .event-circuit-badge,
  #track-grid .card .card-badges,
  #track-grid .card .weather-badge {
    display: none;
  }

  #track-grid .card .event-bottom-left {
    left: 6px !important;
    right: 6px !important;
    bottom: 6px !important;
  }

  #track-grid .card .event-track-map {
    width: 100% !important;
    height: 44px !important;
    padding: 4px !important;
  }

  #track-grid .card .card-header-row {
    padding: 0.7rem 0.75rem 0.15rem !important;
  }

  #track-grid .card .card-header-row h3 {
    font-size: 0.95rem !important;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  #track-grid .card .event-organizer-logo {
    display: none;
  }

  #track-grid .card .card-price-badge {
    font-size: 0.8125rem;
    white-space: nowrap;
  }

  #track-grid .card .card-body {
    padding: 0.15rem 0.75rem 0.25rem !important;
    gap: 0.15rem !important;
  }

  #track-grid .card .card-meta {
    display: block !important;
    font-size: 0.8125rem !important;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
  }

  #track-grid .card .card-meta svg {
    display: none !important;
  }

  /* "Circuito: X · Come arrivare" -> solo il nome del circuito */
  #track-grid .card .card-meta--circuit {
    font-size: 0 !important;
  }

  #track-grid .card .card-meta--circuit .card-circuit-link:first-of-type {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
  }

  #track-grid .card .card-meta--circuit .card-circuit-link:not(:first-of-type) {
    display: none;
  }

  /* "Organizzatore: X" -> solo X */
  #track-grid .card .card-meta:not(.card-meta--circuit) {
    font-size: 0 !important;
  }

  #track-grid .card .card-meta:not(.card-meta--circuit) .card-org {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--muted-foreground);
  }

  #track-grid .card .card-desc {
    display: none;
  }

  #track-grid .card .card-footer {
    padding: 0.35rem 0.75rem 0.7rem !important;
  }

  #track-grid .card .card-footer .btn {
    min-height: 38px;
    font-size: 0.8125rem;
    border-radius: 999px;
  }
}

/* ---------- CIRCUITI ---------- */
.circuits-near {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--ink);
  cursor: pointer;
}

.circuits-near svg {
  color: var(--brand);
}

.circuits-near.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.circuit-km {
  color: var(--brand);
}

.circuit-card {
  border-radius: var(--r-lg) !important;
  border-color: transparent !important;
  box-shadow: var(--shadow-card) !important;
}

@media (max-width: 639px) {
  .circuits-grid {
    gap: 0.75rem !important;
  }

  .circuit-card-photo {
    aspect-ratio: 16 / 8 !important;
  }

  .circuit-card-body {
    padding: 0.85rem 0.9rem 0.95rem !important;
    gap: 0.4rem !important;
  }

  .circuit-card-desc {
    -webkit-line-clamp: 2 !important;
    font-size: 0.875rem !important;
  }

  .circuit-card-opening {
    font-size: 0.8125rem !important;
  }

  .circuits-filters {
    gap: 0.5rem !important;
  }
}

/* ---------- ORGANIZZATORI: griglia a 2 colonne su mobile ---------- */
.promoter-card {
  border-radius: var(--r-lg) !important;
  border-color: transparent !important;
  box-shadow: var(--shadow-card) !important;
}

@media (max-width: 639px) {
  .promoters-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.6rem !important;
  }

  .promoters-grid .promoter-card {
    padding: 0.85rem 0.6rem 0.75rem !important;
  }

  .promoters-grid .promoter-logo-wrap {
    height: 48px !important;
    margin: 0.2rem auto 0.55rem !important;
  }

  .promoters-grid .promoter-logo-wrap img {
    max-height: 48px !important;
    max-width: 85% !important;
  }

  .promoters-grid .promoter-card h3,
  .promoters-grid .promoter-card .promoter-title {
    font-size: 0.8125rem !important;
    line-height: 1.2;
  }

  .promoters-grid .promoter-contact {
    font-size: 0.6875rem !important;
    word-break: break-all;
  }

  .promoters-grid .promoter-contact:nth-of-type(n + 2) {
    display: none;
  }

  .promoters-grid .promoter-link {
    font-size: 0.75rem !important;
  }
}

/* ---------- calendario home: niente sbordature ---------- */
.ag-home .ag-bar {
  margin-left: 0;
  margin-right: 0;
}

.ag-home .ag-bar-inner {
  padding-left: 0;
  padding-right: 0;
}

.ag-card {
  min-width: 0;
}

.ag-card-main {
  overflow: hidden;
}

/* ---------- footer ---------- */
@media (max-width: 767px) {
  .site-footer {
    padding: 2rem 0 1.25rem !important;
  }

  .site-footer .footer-inner {
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
  }

  .footer-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1.25rem 1rem !important;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .footer-brand p {
    font-size: 0.875rem;
    margin-top: 0.5rem;
  }

  .footer-col h4 {
    margin-bottom: 0.4rem !important;
    font-size: 0.6875rem !important;
  }

  .footer-col ul li a {
    display: inline-block;
    padding: 0.3rem 0;
    font-size: 0.9375rem !important;
  }

  .footer-col ul li {
    margin: 0 !important;
  }

  .footer-sep {
    margin: 1.25rem 0 0.75rem !important;
  }

  .footer-bottom {
    padding: 0 !important;
  }

  .footer-bottom p {
    font-size: 0.75rem !important;
    margin: 0.25rem 0 !important;
    text-align: left !important;
  }
}

/* ---------- pulsanti: feedback al tocco ---------- */
.btn:active,
.ag-pill:active,
.hx-chip:active,
.hs-card:active,
.circuits-near:active {
  transform: scale(0.97);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hx-dot {
    animation: none;
  }
}

/* =====================================================================
   Pagine pista / organizzatore (pista.php, organizzatore.php) — prefisso sp-
   ===================================================================== */
.sp-hero {
  position: relative;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(13, 13, 16, 0.55) 0%, rgba(13, 13, 16, 0.92) 70%, var(--ink) 100%),
    var(--sp-img, none) center / cover no-repeat,
    var(--ink);
}

.sp-hero--org {
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255, 62, 0, 0.25) 0%, rgba(255, 62, 0, 0) 55%),
    linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
}

.sp-hero-inner {
  padding-top: 1rem;
  padding-bottom: 2rem;
}

.sp-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.6);
}

.sp-crumbs li + li::before {
  content: "›";
  margin-right: 0.35rem;
  opacity: 0.6;
}

.sp-crumbs a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

.sp-hero-grid {
  display: grid;
  gap: 1.25rem;
  align-items: end;
}

@media (min-width: 900px) {
  .sp-hero-grid {
    grid-template-columns: 1fr 380px;
  }

  .sp-hero-inner {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
  }
}

.sp-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.9rem, 7vw, 3.25rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.sp-where {
  margin: 0.6rem 0 0.75rem;
  color: rgba(255, 255, 255, 0.75);
  font-size: 1rem;
}

.sp-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.1rem;
}

.sp-badge {
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.75rem;
  font-weight: 800;
}

.sp-badge--pit {
  background: #2563eb;
}

.sp-badge--muted {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.75);
}

.sp-badge--hot {
  background: var(--brand);
}

.sp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sp-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 800;
  font-size: 0.9375rem;
  text-decoration: none;
}

.sp-btn--brand {
  background: var(--brand);
  border-color: var(--brand);
}

.sp-track {
  margin: 0;
  padding: 1rem;
  border-radius: var(--r-xl);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}

.sp-track img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: contain;
}

@media (max-width: 899px) {
  .sp-track {
    order: -1;
    max-width: 260px;
    padding: 0.6rem;
  }
}

.sp-org-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.sp-org-logo {
  flex: none;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  padding: 0.6rem;
  border-radius: var(--r-lg);
  background: #fff;
}

.sp-org-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sp-body {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

.sp-section {
  margin-bottom: 2rem;
}

.sp-section h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.25rem, 5vw, 1.6rem);
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.sp-intro p {
  max-width: 48rem;
  line-height: 1.6;
}

.sp-opening {
  max-width: 48rem;
  padding: 0.85rem 1rem;
  border-radius: var(--r-lg);
  background: #fff;
  border: 1px solid var(--border);
  line-height: 1.5;
}

.sp-events {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 900px) {
  .sp-events {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.sp-event {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.sp-event.is-sold {
  opacity: 0.6;
}

.sp-date {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 52px;
  padding: 0.35rem 0;
  border-radius: 0.8rem;
  background: var(--ink);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.1;
}

.sp-date b {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
}

.sp-event-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sp-event-title {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  line-height: 1.25;
}

.sp-event-title:hover {
  color: var(--brand);
}

.sp-event-meta {
  display: block;
  min-width: 0;
  max-width: 100%;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-event-meta a {
  color: inherit;
  font-weight: 700;
}

.sp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.sp-tag {
  font-style: normal;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--secondary);
}

.sp-tag--pit {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.sp-tag--both {
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
}

.sp-price {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--brand);
  font-size: 1.05rem;
  line-height: 1.1;
}

.sp-price small {
  font-family: var(--font-sans);
  font-size: 0.625rem;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.sp-price--na {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  text-align: right;
}

.sp-sold {
  flex: none;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--secondary);
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sp-empty {
  padding: 1rem;
  border-radius: var(--r-lg);
  background: #fff;
  color: var(--muted-foreground);
}

.sp-orgs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sp-orgs a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 0.6rem;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow-card);
  color: var(--ink);
  text-decoration: none;
  text-align: center;
  font-weight: 800;
  font-size: 0.8125rem;
}

.sp-orgs img {
  height: 40px;
  max-width: 85%;
  object-fit: contain;
}

.sp-orgs small {
  font-weight: 600;
  color: var(--brand);
}

.sp-faq details {
  margin-bottom: 0.5rem;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.sp-faq summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.sp-faq summary::after {
  content: "+";
  margin-left: auto;
  font-size: 1.25rem;
  color: var(--brand);
}

.sp-faq details[open] summary::after {
  content: "–";
}

.sp-faq p {
  margin: 0;
  padding: 0 1rem 1rem;
  line-height: 1.55;
}

.sp-faq a {
  color: var(--brand);
}

.sp-near {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sp-near a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow-card);
  color: var(--ink);
  text-decoration: none;
}

.sp-near-map {
  flex: none;
  display: grid;
  place-items: center;
  width: 64px;
  height: 52px;
  border-radius: 0.7rem;
  background: radial-gradient(circle at 30% 20%, #34343b, #141417);
}

.sp-near-map img {
  max-width: 82%;
  max-height: 72%;
  object-fit: contain;
}

.sp-near-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sp-near-txt b {
  font-size: 0.9375rem;
  line-height: 1.2;
}

.sp-near-txt small {
  color: var(--muted-foreground);
}

.sp-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sp-contacts a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 0.9rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.sp-credit {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.sp-404 {
  padding: 4rem 1rem;
  text-align: center;
}

.circuit-card-title {
  color: inherit;
  text-decoration: none;
}

.circuit-card-title:hover {
  color: var(--brand);
}

/* ---------- pagina evento (evento.php) ---------- */
.ev-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.ev-date {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 78px;
  padding: 0.5rem 0;
  border-radius: 1rem;
  background: var(--brand);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.1;
  box-shadow: 0 10px 30px rgba(255, 62, 0, 0.35);
}

.ev-date b {
  font-family: var(--font-display);
  font-size: 2rem;
}

.ev-title {
  font-size: clamp(1.5rem, 6vw, 2.6rem) !important;
}

.sp-where a {
  color: #fff;
}

.ev-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 900px) {
  .ev-grid {
    grid-template-columns: 1fr 360px;
    align-items: start;
  }

  .ev-side {
    position: sticky;
    top: calc(var(--nav-height) + 1rem);
  }
}

.ev-alert {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--r-lg);
  background: #fff4ef;
  border: 1px solid var(--brand-25);
  font-weight: 600;
}

.ev-alert a {
  color: var(--brand);
}

.ev-facts {
  display: grid;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

@media (min-width: 560px) {
  .ev-facts {
    grid-template-columns: 1fr 1fr;
  }
}

.ev-facts div {
  padding: 0.8rem 1rem;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.ev-facts dt {
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.ev-facts dd {
  margin: 0.15rem 0 0;
  font-weight: 700;
}

.ev-facts dd a {
  color: var(--ink);
}

.ev-facts small {
  font-weight: 500;
  color: var(--muted-foreground);
}

.ev-desc {
  line-height: 1.6;
  max-width: 46rem;
}

.ev-note,
.sp-muted {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.ev-card {
  display: grid;
  gap: 0.6rem;
  padding: 1rem;
  border-radius: var(--r-xl);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.ev-track {
  display: grid;
  place-items: center;
  height: 150px;
  border-radius: var(--r-lg);
  background: radial-gradient(circle at 30% 20%, #34343b, #141417);
}

.ev-track img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
}

.ev-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.ev-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  font-size: 0.8125rem;
  text-align: center;
  text-decoration: none;
}

.ev-btn--brand {
  min-height: 52px;
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-size: 1rem;
}

/* barra "Prenota" fissa su mobile, sopra la tabbar */
.ev-sticky {
  display: none;
}

@media (max-width: 899px) {
  .ev-sticky {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 0.6rem);
    z-index: 55;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  }

  .ev-sticky span {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
  }

  .ev-sticky b {
    font-family: var(--font-display);
    font-size: 1.1rem;
  }

  .ev-sticky small {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.75rem;
  }

  .ev-sticky a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0 1.25rem;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    text-decoration: none;
  }

  .ev .sp-body {
    padding-bottom: 6rem;
  }
}

/* ---------- regioni ---------- */
.sp-regions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.sp-regions a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 38px;
  padding: 0 0.85rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.875rem;
  text-decoration: none;
}

.sp-regions a small {
  color: var(--brand);
  font-weight: 800;
}

.sp-regions--list {
  margin-bottom: 1rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 0.2rem;
}

.sp-regions--list::-webkit-scrollbar {
  display: none;
}

.sp-regions--list a {
  flex: none;
}

/* ---------- home: prossimi track day (fila da scorrere) ---------- */
.hs--next {
  padding-top: 2rem;
}

.hs-row--events {
  grid-auto-columns: min(78vw, 290px);
}

.nx {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow-card);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.nx:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.nx.is-sold {
  opacity: 0.7;
}

.nx-img {
  position: relative;
  aspect-ratio: 16 / 9;
  background-color: var(--ink-3);
  background-size: cover;
  background-position: center;
}

.nx-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 30%, rgba(0, 0, 0, 0.65) 100%);
}

.nx-date {
  position: absolute;
  z-index: 1;
  left: 10px;
  top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 46px;
  padding: 0.25rem 0;
  border-radius: 0.7rem;
  background: var(--brand);
  color: #fff;
  line-height: 1.05;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.nx-date small {
  font-size: 0.625rem;
  font-weight: 800;
  text-transform: uppercase;
}

.nx-date b {
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.nx-map {
  position: absolute;
  z-index: 1;
  right: 10px;
  bottom: 10px;
  width: 38%;
  max-height: 50%;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
}

.nx-type {
  position: absolute;
  z-index: 1;
  right: 10px;
  top: 10px;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-style: normal;
  font-size: 0.6875rem;
  font-weight: 800;
}

.nx-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  padding: 0.7rem 0.85rem 0.8rem;
}

.nx-circuit {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nx-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nx-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.35rem;
}

.nx-org {
  min-width: 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nx-price {
  flex: none;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--brand);
}

.nx-sold {
  flex: none;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--secondary);
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
}

@media (min-width: 900px) {
  .hs-row,
  .hs-row--events {
    margin: 0;
    padding-left: 0;
    padding-right: 0;
  }
}

.card-title-link {
  color: inherit;
  text-decoration: none;
}

.card-title-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
}

.card {
  position: relative;
}

.card a:not(.card-title-link),
.card .card-footer {
  position: relative;
  z-index: 4;
}

/* ---------- correzioni layout responsive ---------- */
@media (max-width: 899px) {
  .nav-links {
    display: none !important;
  }
}

/* file da scorrere: allineate al contenuto, sbordano solo a destra */
.hs-row {
  margin: 0 calc(-1 * var(--gutter, 1rem)) 0 0;
  padding: 0.25rem var(--gutter, 1rem) 1rem 0;
  scroll-padding-left: 0;
}

/* su computer: griglia ordinata invece dello scorrimento */
@media (min-width: 900px) {
  .hs-row,
  .hs-row--events {
    grid-auto-flow: row;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-columns: auto;
    overflow: visible;
    margin: 0;
    padding: 0.25rem 0 0.5rem;
    gap: 1rem;
  }

  .hs-row > :nth-child(n + 9) {
    display: none;
  }
}

@media (min-width: 1200px) {
  .hs-row--events {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* testo arancio su sfondo scuro: torna acceso (contrasto alto su nero) */
.hx .section-kicker,
.why-section .section-kicker,
.why-section h2 span,
.why-card svg {
  color: var(--brand-bright) !important;
}

.card-price-badge {
  background: #fff1ec !important;
  color: #b82d00 !important;
}

/* sold out: niente trasparenza sul testo (leggibilità), si distingue da data grigia ed etichetta */
.sp-event.is-sold,
.nx.is-sold,
.ag-card.is-soldout .ag-circuit,
.ag-card.is-soldout .ag-track {
  opacity: 1 !important;
}

.sp-event.is-sold .sp-date {
  background: #5c5c66;
}

.sp-event.is-sold .sp-event-title {
  color: #44444b;
}

.nx.is-sold .nx-img {
  filter: grayscale(0.8);
}

.ag-card.is-soldout .ag-track {
  filter: grayscale(1);
}

.footer-credits {
  opacity: 1 !important;
  color: #a1a1aa !important;
}

.footer-credits a {
  color: #fff !important;
  text-decoration: underline;
}

.promoter-upcoming {
  color: #0f6b32 !important;
  background: #dcf5e6 !important;
}

.ev-more {
  color: var(--brand);
  font-weight: 800;
}

/* pulsanti arancioni: il testo resta bianco anche al passaggio del mouse (anche nel menu) */
.btn-brand,
.btn-brand:hover,
.btn-brand:focus-visible,
.nav-links a.btn-brand:hover,
.nav-links a.btn-brand[aria-current="page"] {
  color: #fff !important;
}

.btn-brand {
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.btn-brand:hover {
  background: #a82900 !important;
  box-shadow: 0 6px 18px rgba(209, 51, 0, 0.35);
}

.btn-nav-cta:hover {
  transform: translateY(-1px);
}
