/* ============================================================
   GRID+CLUB home: the race gallery (11), the wall (16) and the
   3D phone (14). Rebuilt 28 Sep 2026.
   ============================================================ */

/* ---------- 11 · the race gallery ---------- */
.rg { padding-block: var(--space-section); }
.rg__head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: clamp(1.4rem, 3vw, 2.2rem); }
.rg__all { color: var(--ink-invert, #0a0a0a); text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 0.2rem; }
.rg__tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: clamp(1.2rem, 2.5vw, 1.8rem); }
.rg__tab {
  padding: 0.55rem 0.95rem; border: 1px solid currentColor; border-radius: 999px;
  background: transparent; color: inherit; cursor: pointer;
  transition: background var(--d2) var(--ease-out), color var(--d2) var(--ease-out);
}
.rg__tab[aria-selected="true"], .rg__tab:hover { background: #0a0a0a; color: #d4ff00; border-color: #0a0a0a; }
.rg__grid {
  display: grid; gap: clamp(0.5rem, 1vw, 0.9rem);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: clamp(9rem, 16vw, 15rem);
}
.rg__tile { margin: 0; position: relative; overflow: hidden; background: #111;
  clip-path: inset(100% 0 0 0);
  transition: clip-path var(--d4) var(--ease-out) calc(var(--i) * 70ms);
}
.rg__grid.is-in .rg__tile { clip-path: inset(0 0 0 0); }
.rg__tile--0 { grid-column: span 2; grid-row: span 2; }
.rg__tile--3 { grid-row: span 2; }
.rg__open { all: unset; display: block; width: 100%; height: 100%; cursor: zoom-in; }
.rg__open img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.08);
  transition: transform var(--d4) var(--ease-out); filter: saturate(0.94) contrast(1.08); }
.rg__grid.is-in .rg__open img { transform: scale(1); }
.rg__open:hover img, .rg__open:focus-visible img { transform: scale(1.05); }
.rg__open:focus-visible { outline: 2px solid #d4ff00; outline-offset: -2px; }
.rg__tile figcaption {
  position: absolute; left: 0.7rem; bottom: 0.6rem; color: #f4f4ed; pointer-events: none;
  text-shadow: 0 1px 8px rgba(0,0,0,0.7);
}
.rg__box { border: 0; padding: 0; background: transparent; max-width: 92vw; max-height: 90vh; }
.rg__box::backdrop { background: rgba(10,10,10,0.9); }
.rg__box img { display: block; max-width: 92vw; max-height: 86vh; object-fit: contain; }
.rg__close { position: absolute; top: 0.6rem; right: 0.6rem; padding: 0.4rem 0.7rem; background: #0a0a0a; color: #f4f4ed; border: 1px solid #333; cursor: pointer; }
@media (max-width: 720px) {
  .rg__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 11rem; }
  .rg__tile--3 { grid-row: span 1; }
}
@media (prefers-reduced-motion: reduce) {
  .rg__tile, .rg__open img { transition: none; }
}

/* ---------- 16 · the wall reel ---------- */
.wreel { position: relative; z-index: 2; display: grid; gap: clamp(0.6rem, 1.2vw, 1rem); padding-block: clamp(1.5rem, 3vw, 2.5rem) var(--space-section); overflow: hidden; }
.wreel__row { overflow: hidden; }
.wreel__track {
  display: flex; gap: clamp(0.6rem, 1.2vw, 1rem); width: max-content;
  animation: wreel 70s linear infinite;
}
.wreel__row--rev .wreel__track { animation-direction: reverse; animation-duration: 84s; }
.wreel__row:hover .wreel__track { animation-play-state: paused; }
/* Grabbable (racegallery.js): JS drives the track, so the CSS loop stops. */
.wreel__row.is-js { cursor: grab; touch-action: pan-y; user-select: none; }
.wreel__row.is-js.is-held { cursor: grabbing; }
.wreel__row.is-js .wreel__track { animation: none; will-change: transform; }
.wreel__fig {
  position: relative; margin: 0; flex: none;
  height: clamp(12rem, 22vw, 20rem); aspect-ratio: 4 / 5; overflow: hidden; background: #111;
}
.wreel__fig--wide { aspect-ratio: 3 / 2; }
.wreel__fig img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.94) contrast(1.08);
  transition: transform var(--d4) var(--ease-out), filter var(--d3) var(--ease-out); }
.wreel__fig:hover img { transform: scale(1.06); filter: saturate(1.05) contrast(1.1); }
.wreel__fig figcaption { position: absolute; left: 0.7rem; bottom: 0.6rem; color: #f4f4ed; text-shadow: 0 1px 8px rgba(0,0,0,0.8); }
@keyframes wreel { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .wreel__track { animation: none; } .wreel__row { overflow-x: auto; } }

/* ---------- 14 · the 3D phone (scripts/phone3d.js) ---------- */
/* The CSS phone stays in the markup as the fallback; once the 3D one
   has mounted it takes its place. */
.phonerig--3d { width: min(92vw, 480px); aspect-ratio: 0.6; perspective: none; position: relative; }
.phonerig--3d .phone { display: none; }
.phone3d { display: block; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
.phone3d:active { cursor: grabbing; }
