/* ============================================================
   ride-page-modern.css
   Modern styling for user-rides.php
   Blue theme, white background.
   All classes prefixed rpm- so nothing overrides existing CSS.
   Requires Bootstrap 5 (already on page).
   Requires Tabler Icons in <head> (pinned to major version 3):
     <link rel="stylesheet"
       href="https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@3/dist/tabler-icons.min.css">
   ============================================================ */

/* Fonts (Barlow, Barlow Condensed) are loaded with <link> tags in user-rides.php. */


/* ----------------------------------------------------------
   CSS CUSTOM PROPERTIES
---------------------------------------------------------- */
:root {
  --rpm-blue-darkest: #0a2f6e;
  --rpm-blue-dark:    #0d47a1;
  --rpm-blue-mid:     #1565c0;
  --rpm-blue-light:   #1976d2;
  --rpm-blue-pale:    #e3f2fd;
  --rpm-blue-accent:  #90caf9;
  --rpm-white:        #ffffff;
  --rpm-border:       rgba(0, 0, 0, 0.08);
  --rpm-border-hover: rgba(0, 0, 0, 0.18);
  --rpm-text-main:    #1e293b;
  --rpm-text-muted:   #64748b;
  --rpm-text-hint:    #64748b; /* 4.8:1 on white */
  --rpm-radius-sm:    6px;
  --rpm-radius-md:    8px;
  --rpm-radius-lg:    12px;
  --rpm-shadow-hover: 0 6px 24px rgba(21, 101, 192, 0.14);
  --rpm-transition:   0.18s ease;
}

/* ----------------------------------------------------------
   ACCESSIBILITY UTILITIES
---------------------------------------------------------- */
.rpm-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ----------------------------------------------------------
   SKIP TO CONTENT (accessibility)
---------------------------------------------------------- */
.rpm-skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--rpm-blue-dark);
  color: var(--rpm-white);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 var(--rpm-radius-md) 0;
  z-index: 9999;
  transition: top 0.15s;
}
.rpm-skip-link:focus {
  top: 0;
  color: var(--rpm-white);
}

/* ----------------------------------------------------------
   BREADCRUMB
---------------------------------------------------------- */
.rpm-breadcrumb {
  padding: 0.6rem 0 0.4rem;
  font-size: 13px;
}
.rpm-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}
.rpm-breadcrumb li {
  display: flex;
  align-items: center;
  color: var(--rpm-text-muted);
}
.rpm-breadcrumb li + li::before {
  content: "/";
  margin: 0 7px;
  color: var(--rpm-text-hint);
  font-size: 12px;
}
.rpm-breadcrumb a {
  color: var(--rpm-blue-mid);
  text-decoration: none;
}
.rpm-breadcrumb a:hover {
  text-decoration: underline;
}
.rpm-breadcrumb li[aria-current="page"] span {
  color: var(--rpm-text-main);
  font-weight: 500;
}

/* ----------------------------------------------------------
   CAROUSEL WRAPPER
   Rounds top corners only so it sits flush above the HUD.
---------------------------------------------------------- */
.rpm-carousel-wrap {
  border-radius: var(--rpm-radius-lg) var(--rpm-radius-lg) 0 0;
  overflow: hidden;
  line-height: 0;
}
.rpm-carousel-wrap .carousel {
  border-radius: var(--rpm-radius-lg) var(--rpm-radius-lg) 0 0;
  overflow: hidden;
}
/* The site-wide stylesheet.css sets .carousel and .carousel-item to height: 500px
   (with flex centering). The photo is 16:9 and shrinks on phones, so the fixed 500px
   box left a big blank gap above the stats bar. Let the box size itself to the photo. */
.rpm-carousel-wrap .carousel,
.rpm-carousel-wrap .carousel-item {
  height: auto;
}
.rpm-carousel-wrap .carousel-item img {
  aspect-ratio: 16 / 9;
  max-height: 500px;
  width: 100%;
  object-fit: cover;
  cursor: zoom-in;
}

/* ----------------------------------------------------------
   HUD — stats bar flush under carousel
---------------------------------------------------------- */
.rpm-hud {
  display: flex;
  align-items: stretch;
  background: var(--rpm-blue-mid);
  border-radius: 0 0 var(--rpm-radius-lg) var(--rpm-radius-lg);
  overflow: hidden;
  margin-bottom: 1.75rem;
}

/* Dark left identity panel */
.rpm-hud__identity {
  background: var(--rpm-blue-dark);
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 200px;
  flex-shrink: 0;
}
.rpm-hud__nickname {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 4px;
}
.rpm-hud__car-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--rpm-white);
  margin: 0;
  line-height: 1.25;
}

/* Stats row — use a <dl> for semantics */
.rpm-hud__stats {
  display: flex;
  flex: 1;
  align-items: stretch;
  list-style: none;
  margin: 0;
  padding: 0;
}
.rpm-hud__stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  margin: 0;
}
.rpm-hud__stat:first-child { border-left: 0; }
.rpm-hud__stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.86);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
  display: block;
}
.rpm-hud__stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--rpm-white);
  display: block;
  line-height: 1;
  margin: 0;
}
.rpm-hud__stat-value--sm {
  font-size: 13px;
}
.rpm-hud__stat--accent .rpm-hud__stat-value {
  color: #bbdefb;
}

/* ----------------------------------------------------------
   BUTTON GROUP — Follow + Share + owner actions
---------------------------------------------------------- */
.rpm-button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 1.25rem;
  align-items: center;
}

/* ----------------------------------------------------------
   CAR TITLE + DESCRIPTION
---------------------------------------------------------- */
.rpm-car-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--rpm-text-main);
  margin: 0 0 0.5rem;
  line-height: 1.2;
}
.rpm-description-text {
  font-size: 15px;
  color: var(--rpm-text-muted);
  line-height: 1.75;
}

/* ----------------------------------------------------------
   SECTION HEADINGS
   WCAG AA: #0f1623 on white = 18:1 ✅ | #475569 on white = 7:1 ✅
---------------------------------------------------------- */
.rpm-section-heading {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0f1623;
  margin: 0 0 0.15rem;
}
.rpm-section-sub {
  font-family: 'Barlow', sans-serif;
  font-size: 0.85rem;
  color: #475569;
  margin: 0 0 1.25rem;
  line-height: 1.55;
}

/* ----------------------------------------------------------
   BUILD LOG CARDS GRID
   Featured (first pinned) spans full width as a hero.
   Remaining cards fill a standard 2-col grid.
   The .row/#buildsContainer wrapper is kept so JS still works.
---------------------------------------------------------- */
#buildsContainer {
  display: block;
}

.rpm-builds-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 0;
}

/* Strip Bootstrap column padding from JS-injected cards */
.rpm-builds-grid .col-lg-6 {
  padding: 0;
  width: 100%;
  max-width: 100%;
  flex: none;
}

/* ── Base card ── */
.rpm-build-card {
  background: #0f1623;
  border: none;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.14);
  position: relative;
}
.rpm-build-card { cursor: pointer; }
.rpm-build-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.22);
}
.rpm-build-card:focus-within {
  outline: 3px solid #7dd3fc;
  outline-offset: 3px;
}

/* ── Pinned: gold top-stripe ── */
.rpm-build-card--pinned {
  box-shadow: 0 2px 10px rgba(0,0,0,0.18), inset 0 3px 0 #f59e0b;
}

/* ── Featured (first pinned): full-width landscape hero ── */
.rpm-build-card--featured {
  grid-column: 1 / -1;
  flex-direction: row;
  min-height: 220px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18), inset 0 3px 0 #f59e0b;
}
.rpm-build-card--featured .rpm-build-card__img-wrap {
  width: 58%;
  height: 220px;
  flex-shrink: 0;
}
.rpm-build-card--featured .rpm-build-card__img-wrap::after {
  background: linear-gradient(
    to right,
    transparent 60%,
    rgba(15,22,35,0.6) 85%,
    rgba(15,22,35,1) 100%
  );
}
/* Hide overlay title in hero — it moves to the body panel */
.rpm-build-card--featured .rpm-build-card__title-overlay {
  display: none;
}
.rpm-build-card--featured .rpm-build-card__title-panel {
  display: block;
}
.rpm-build-card--featured .rpm-build-card__body {
  flex: 1;
  padding: 28px 24px 16px;
  justify-content: center;
}
.rpm-build-card--featured .rpm-build-card__footer {
  padding: 14px 24px;
}

/* ── Card image wrapper ── */
.rpm-build-card__img-wrap {
  position: relative;
  width: 100%;
  height: 210px;
  overflow: hidden;
  background: #1e293b;
  flex-shrink: 0;
}
.rpm-build-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.rpm-build-card:hover .rpm-build-card__img-wrap img {
  transform: scale(1.05);
}
/* Gradient so overlay title is legible */
.rpm-build-card__img-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 35%,
    rgba(15,22,35,0.5) 65%,
    rgba(15,22,35,0.93) 100%
  );
  pointer-events: none;
}

/* ── Title overlay (standard cards) ──
   #fff on gradient ≥ 18:1 ✅ */
.rpm-build-card__title-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 16px 14px;
  z-index: 2;
}
.rpm-build-card__title-overlay h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  margin: 0;
  line-height: 1.25;
  text-shadow: 0 1px 5px rgba(0,0,0,0.6);
}
.rpm-build-card__title-overlay h3 a {
  color: inherit;
  text-decoration: none;
}
.rpm-build-card__title-overlay h3 a:hover {
  text-decoration: underline;
}

/* ── Title panel (hero/featured card only) ──
   #e2e8f0 on #0f1623 = 14:1 ✅ */
.rpm-build-card__title-panel {
  display: none;
}
.rpm-build-card__title-panel h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #e2e8f0;
  margin: 0 0 10px;
  line-height: 1.2;
}
.rpm-build-card__title-panel h3 a {
  color: inherit;
  text-decoration: none;
}
.rpm-build-card__title-panel h3 a:hover {
  color: #7dd3fc;
}

/* ── Badge row: stacks vertically from top-left of card image ── */
.rpm-card-badge-row {
  position: absolute;
  top: 8px;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  z-index: 3;
  pointer-events: none;
}
.rpm-card-badge-row > * {
  pointer-events: auto;
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
}

/* ── Shared badge base ── */
.rpm-img-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px 5px 9px;
  border-left: 3px solid;
  border-radius: 0 4px 4px 0;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
}
.rpm-img-badge i { font-size: 14px; flex-shrink: 0; }

/* Turning Wrenches — blue accent, white text */
.rpm-img-badge--noticed   { background: #0a2850; color: #ffffff; border-left-color: #3B82F6; }
/* Show Ready — green accent, white text */
.rpm-img-badge--popular   { background: #052010; color: #ffffff; border-left-color: #22C55E; }
/* Full Send — amber accent, white text */
.rpm-img-badge--viral     { background: #3a1500; color: #ffffff; border-left-color: #F59E0B; }
/* Legend Build — gold accent, white text */
.rpm-img-badge--legendary { background: #3a0a00; color: #ffffff; border-left-color: #F59E0B; }
/* Trending — purple accent, white text */
.rpm-img-badge--trending  { background: #1e0f4a; color: #ffffff; border-left-color: #7C3AED; }

/* ── Pinned badge — gold "owner's pick" ── */
.rpm-pin-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px 5px 9px;
  border-left: 3px solid #D97706;
  border-radius: 0 4px 4px 0;
  background: #3a2000;
  color: #ffffff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
}
.rpm-pin-badge i { font-size: 14px; flex-shrink: 0; }

/* ── Card body ── */
.rpm-build-card__body {
  padding: 12px 16px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0f1623;
}
/* Fallback title (used by JS-injected cards without overlay) ──
   #e2e8f0 on #0f1623 = 14:1 ✅ */
.rpm-build-card__title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #e2e8f0;
  line-height: 1.25;
  margin: 0 0 6px;
}
.rpm-build-card__title a { color: inherit; text-decoration: none; }
.rpm-build-card__title a:hover { color: #7dd3fc; }

/* #94a3b8 on #0f1623 = 7.4:1 ✅ */
.rpm-build-card__date {
  font-family: 'Barlow', sans-serif;
  font-size: 0.78rem;
  color: #94a3b8;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.rpm-build-card__date i { font-size: 13px; color: #64748b; }

/* #cbd5e1 on #0f1623 = 11.6:1 ✅ */
.rpm-build-card__excerpt {
  font-family: 'Barlow', sans-serif;
  font-size: 0.83rem;
  color: #cbd5e1;
  line-height: 1.65;
  margin: 0;
  flex: 1;
}

/* ── Card footer ── */
.rpm-build-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #1e293b;
  padding: 10px 16px;
  background: #0f1623;
  gap: 8px;
}
.rpm-build-card__stats { display: flex; gap: 14px; }

/* #94a3b8 on #0f1623 = 7.4:1 ✅ */
.rpm-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Barlow', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
}
.rpm-stat-pill i { font-size: 14px; color: #64748b; }

/* #7dd3fc on #0f1623 = 8.2:1 ✅ */
.rpm-stat-pill--before-after { color: #7dd3fc; }
.rpm-stat-pill--before-after i { color: #7dd3fc; }

.rpm-view-link {
  font-family: 'Barlow', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #7dd3fc;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  white-space: nowrap;
  padding: 6px 13px;
  border: 1.5px solid #334155;
  border-radius: 100px;
  transition: background 0.13s ease, border-color 0.13s ease;
  min-height: 32px;
}
.rpm-view-link:hover { background: #1e3a5f; border-color: #7dd3fc; }
.rpm-view-link i { font-size: 14px; }

/* ── Owner controls ──
   #64748b border on #0f1623 = 4.4:1 ✅ (3:1 UI component req.) */
.rpm-card-owner-controls {
  display: flex;
  gap: 8px;
  padding: 0 16px 14px;
  justify-content: flex-end;
  background: #0f1623;
}
.rpm-card-owner-controls .btn-outline-primary {
  border-color: #64748b;
  color: #7dd3fc;
  font-family: 'Barlow', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 100px;
  min-height: 32px;
}
.rpm-card-owner-controls .btn-outline-primary:hover {
  background: #1e3a5f;
  border-color: #7dd3fc;
  color: #bfdbfe;
}
.rpm-card-owner-controls .btn-outline-danger {
  border-color: #64748b;
  color: #fca5a5;
  font-family: 'Barlow', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 100px;
  min-height: 32px;
}
.rpm-card-owner-controls .btn-outline-danger:hover {
  background: #450a0a;
  border-color: #ef4444;
}

/* ----------------------------------------------------------
   LOAD MORE BUTTON
   #0f1623 on white = 18:1 ✅
---------------------------------------------------------- */
.rpm-load-more {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0 2rem;
  clear: both;
}
.rpm-load-more-btn {
  background: #fff;
  border: 1.5px solid #0f1623;
  color: #0f1623;
  font-family: 'Barlow', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 11px 40px;
  border-radius: 100px;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.13s ease, color 0.13s ease;
}
.rpm-load-more-btn:hover { background: #0f1623; color: #fff; }
.rpm-load-more-btn:focus-visible {
  outline: 3px solid #0f1623;
  outline-offset: 3px;
}

/* ----------------------------------------------------------
   IMAGE MANAGEMENT LIST (owner edit section)
---------------------------------------------------------- */
#image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 1rem;
}
#image-list li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
#image-list .car-image {
  border-radius: var(--rpm-radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--rpm-transition);
  object-fit: cover;
  width: 100px;
  height: 100px;
}
#image-list .car-image:hover {
  border-color: var(--rpm-blue-light);
}
#image-list li.primary-image .car-image {
  border-color: var(--rpm-blue-dark);
  box-shadow: 0 0 0 3px var(--rpm-blue-pale);
}

/* ----------------------------------------------------------
   EXPLORE MORE RIDES SECTION
---------------------------------------------------------- */
.rpm-explore-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--rpm-text-main);
  margin: 0.5rem 0 1rem;
}
.rpm-explore-grid .card {
  border: 0.5px solid var(--rpm-border);
  border-radius: var(--rpm-radius-lg);
  overflow: hidden;
  transition: box-shadow var(--rpm-transition), transform var(--rpm-transition);
}
.rpm-explore-grid .card:hover {
  box-shadow: var(--rpm-shadow-hover);
  transform: translateY(-2px);
}
.rpm-explore-grid .car-img-container {
  height: 160px;
  overflow: hidden;
}
.rpm-explore-grid .car-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.rpm-explore-grid .card:hover .car-img {
  transform: scale(1.04);
}
.rpm-explore-grid .card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--rpm-text-main);
  margin-bottom: 4px;
}
.rpm-explore-grid .card-text {
  font-size: 12px;
  color: var(--rpm-text-muted);
  margin-bottom: 10px;
}
.rpm-explore-grid .car-btn {
  background: var(--rpm-blue-mid) !important;
  border-color: var(--rpm-blue-mid) !important;
  color: var(--rpm-white) !important;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--rpm-radius-sm);
  transition: background var(--rpm-transition);
}
.rpm-explore-grid .car-btn:hover {
  background: var(--rpm-blue-dark) !important;
  border-color: var(--rpm-blue-dark) !important;
}

/* ----------------------------------------------------------
   COMMENTS SECTION
---------------------------------------------------------- */
.rpm-comments-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--rpm-text-main);
  margin: 1.5rem 0 0.2rem;
}
.rpm-comments-sub {
  font-size: 13px;
  color: var(--rpm-text-muted);
  margin-bottom: 1rem;
}

/* ----------------------------------------------------------
   BUILD SEARCH + SORT CONTROLS
   Borders: #334155 on white = 9:1 ✅ (3:1 UI component req.)
   Text:    #334155 on white = 9:1 ✅
---------------------------------------------------------- */
.rpm-build-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

/* Search input wrapper */
.rpm-build-search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
}
.rpm-build-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: #64748b;
  pointer-events: none;
}
.rpm-build-search {
  width: 100%;
  padding: 9px 12px 9px 36px;
  font-family: 'Barlow', sans-serif;
  font-size: 0.875rem;
  color: #0f1623;
  background: #fff;
  border: 1.5px solid #334155;
  border-radius: 100px;
  transition: box-shadow 0.15s ease;
  outline: none;
  appearance: none;
  min-height: 38px;
}
.rpm-build-search::placeholder { color: #64748b; }
.rpm-build-search:focus {
  box-shadow: 0 0 0 3px rgba(15,22,35,0.15);
}

/* Sort button group */
.rpm-sort-group {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}
.rpm-sort-btn {
  background: #fff;
  border: 1.5px solid #334155;
  color: #334155;
  font-family: 'Barlow', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 8px 14px;
  border-radius: 100px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.13s ease;
  white-space: nowrap;
  min-height: 38px;
}
.rpm-sort-btn i { font-size: 14px; }
.rpm-sort-btn:hover { background: #f1f5f9; }
.rpm-sort-btn--active {
  background: #0f1623;
  border-color: #0f1623;
  color: #fff;
}
.rpm-sort-btn--active:hover { background: #1e293b; border-color: #1e293b; }
.rpm-sort-btn:focus-visible {
  outline: 3px solid #0f1623;
  outline-offset: 2px;
  z-index: 1;
}

/* No results message — #475569 on white = 7:1 ✅ */
.rpm-build-no-results {
  font-family: 'Barlow', sans-serif;
  font-size: 0.9rem;
  color: #475569;
  text-align: center;
  padding: 2rem 0;
  grid-column: 1 / -1;
}

/* ----------------------------------------------------------
   RESPONSIVE
---------------------------------------------------------- */
@media (max-width: 767px) {
  .rpm-hud {
    flex-direction: column;
  }
  .rpm-hud__identity {
    min-width: unset;
    padding: 10px 16px;
  }
  .rpm-hud__stats {
    flex-wrap: wrap;
  }
  .rpm-hud__stat {
    flex: 0 0 33.333%;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 6px;
  }
  .rpm-hud__stat-value {
    font-size: 15px;
  }
  .rpm-builds-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  /* Featured collapses to stacked on mobile */
  .rpm-build-card--featured {
    flex-direction: column;
  }
  .rpm-build-card--featured .rpm-build-card__img-wrap {
    width: 100%;
    height: 200px;
  }
  .rpm-build-card--featured .rpm-build-card__img-wrap::after {
    background: linear-gradient(
      to bottom,
      transparent 35%,
      rgba(15,22,35,0.5) 65%,
      rgba(15,22,35,0.93) 100%
    );
  }
  .rpm-build-card--featured .rpm-build-card__title-overlay { display: block; }
  .rpm-build-card--featured .rpm-build-card__title-panel   { display: none; }
  .rpm-build-card--featured .rpm-build-card__body { padding: 12px 16px 10px; }
  .rpm-build-card__img-wrap {
    height: 180px;
  }
  .rpm-car-title {
    font-size: 1.3rem;
  }
  .rpm-build-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .rpm-build-search-wrap {
    min-width: unset;
  }
  .rpm-sort-group {
    width: 100%;
  }
  .rpm-sort-btn {
    flex: 1;
    justify-content: center;
    padding: 8px 8px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .rpm-hud__stat {
    flex: 0 0 50%;
  }
}
/* ----------------------------------------------------------
   INFINITE SCROLL LOADING INDICATOR
   (was inline <style> in PHP — moved here for maintainability)
---------------------------------------------------------- */
.rpm-builds-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 1.5rem;
  font-family: 'Barlow', sans-serif;
  font-size: 0.875rem;
  color: #475569; /* ✅ 7:1 on white */
}
.rpm-builds-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #e2e8f0;
  border-top-color: #0f1623;
  border-radius: 50%;
  animation: rpm-spin 0.7s linear infinite;
}
@keyframes rpm-spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------
   EMPTY STATE
   #334155 on white = 9:1 ✅  |  #475569 on white = 7:1 ✅
---------------------------------------------------------- */
.rpm-builds-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
}
.rpm-builds-empty__icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.75rem;
  color: #94a3b8;
  opacity: 0.5;
}
.rpm-builds-empty__heading {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
  color: #334155;
}
.rpm-builds-empty__sub {
  font-family: 'Barlow', sans-serif;
  font-size: 0.9rem;
  max-width: 38ch;
  margin: 0 auto;
  line-height: 1.6;
  color: #475569;
}

/* ----------------------------------------------------------
   END-OF-BUILDS MARKER
   #475569 on white = 7:1 ✅
---------------------------------------------------------- */
.rpm-builds-end {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0 1rem;
  color: #475569;
  font-family: 'Barlow', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.rpm-builds-end__line {
  flex: 1;
  height: 1px;
  background: #cbd5e1;
}
.rpm-builds-end__label {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
/* ------------------------------------------------------
   Sold status banner + Mark/Unmark as Sold toggle
   (added for the "mark as sold" locking feature)
------------------------------------------------------ */
.rpm-sold-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffe69c;
  border-radius: 8px;
  padding: 10px 16px;
  margin: 12px 0;
  font-size: 0.95rem;
}
.rpm-sold-toggle-wrap {
  margin: 8px 0 16px;
}

/* ============================================================
   ===== ADDED: ride header, owner tools, buttons =====
   ============================================================ */

/* ----- Ride header: title + owner + actions ----- */
.rpm-ride-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin: 0.25rem 0 1rem;
}
.rpm-ride-head__info { flex: 1 1 320px; min-width: 0; }
.rpm-ride-head__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.rpm-car-title__nick { color: var(--rpm-blue-mid); font-weight: 600; }

.rpm-owner-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #475569;
  text-decoration: none;
}
.rpm-owner-chip:hover { color: var(--rpm-blue-dark); }
.rpm-owner-chip:hover strong { text-decoration: underline; }
.rpm-owner-chip strong { color: var(--rpm-text-main); }
.rpm-owner-chip__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--rpm-blue-pale);
  flex-shrink: 0;
}

/* ----- Buttons ----- */
.rpm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 18px;
  border: 1.5px solid transparent;
  border-radius: 100px;
  font-family: 'Barlow', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.13s ease, border-color 0.13s ease, color 0.13s ease, opacity 0.13s ease;
}
.rpm-btn:focus-visible { outline: 3px solid #0f1623; outline-offset: 2px; }
.rpm-btn[disabled], .rpm-btn[aria-busy="true"] { opacity: 0.6; cursor: progress; }
.rpm-btn--sm { min-height: 34px; padding: 6px 14px; font-size: 0.82rem; }
.rpm-btn--icon { width: 40px; padding: 0; }

.rpm-btn--primary, .rpm-btn--follow { background: var(--rpm-blue-mid); color: #fff; border-color: var(--rpm-blue-mid); }
.rpm-btn--primary:hover, .rpm-btn--follow:hover { background: var(--rpm-blue-dark); border-color: var(--rpm-blue-dark); color: #fff; }
.rpm-btn--dark { background: #0f1623; color: #fff; border-color: #0f1623; }
.rpm-btn--dark:hover { background: #1e293b; border-color: #1e293b; color: #fff; }
.rpm-btn--ghost { background: #fff; color: #334155; border-color: #334155; }
.rpm-btn--ghost:hover { background: #f1f5f9; color: #0f1623; }

/* Follow states: Follow -> Following (check) -> Unfollow on hover/focus */
.rpm-follow__txt--on, .rpm-follow__txt--hover, .rpm-follow__icon--on { display: none; }
.rpm-btn--follow.is-following { background: #fff; color: var(--rpm-blue-dark); border-color: var(--rpm-blue-mid); }
.rpm-btn--follow.is-following .rpm-follow__txt--off,
.rpm-btn--follow.is-following .rpm-follow__icon--off { display: none; }
.rpm-btn--follow.is-following .rpm-follow__txt--on,
.rpm-btn--follow.is-following .rpm-follow__icon--on { display: inline; }
.rpm-btn--follow.is-following:hover,
.rpm-btn--follow.is-following:focus-visible { background: #fef2f2; color: #b91c1c; border-color: #b91c1c; }
.rpm-btn--follow.is-following:hover .rpm-follow__txt--on,
.rpm-btn--follow.is-following:focus-visible .rpm-follow__txt--on,
.rpm-btn--follow.is-following:hover .rpm-follow__icon--on,
.rpm-btn--follow.is-following:focus-visible .rpm-follow__icon--on { display: none; }
.rpm-btn--follow.is-following:hover .rpm-follow__txt--hover,
.rpm-btn--follow.is-following:focus-visible .rpm-follow__txt--hover { display: inline; }

.rpm-share-fallback { gap: 8px; flex-wrap: wrap; align-items: center; }

/* ----- Owner tools bar ----- */
.rpm-owner-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 14px;
  margin: 0 0 1rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--rpm-radius-lg);
}
.rpm-owner-bar__label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rpm-blue-dark);
}
.rpm-owner-bar__locked { font-size: 14px; color: #475569; }
.rpm-owner-bar__sold { margin: 0 0 0 auto; }

/* ----- Edit panel (owner) ----- */
.rpm-edit-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.25rem;
  margin: 0 0 1.5rem;
  scroll-margin-top: 16px;
}
.rpm-edit-panel__title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0f1623;
  margin: 0 0 1rem;
}
.rpm-edit-panel__subtitle { font-size: 1.05rem; font-weight: 700; margin: 1.5rem 0 0.25rem; color: var(--rpm-text-main); }
.rpm-edit-panel__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.25rem; }
.rpm-help { font-size: 0.85rem; color: #475569; margin: 0 0 0.5rem; }

#image-list li { position: relative; }
#image-list li.primary-image::after {
  content: "Cover";
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--rpm-blue-dark);
  color: #fff;
  font: 700 11px/1 'Barlow', sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 7px;
  border-radius: 4px;
  pointer-events: none;
}
#image-list .car-image:focus-visible { outline: 3px solid #0f1623; outline-offset: 2px; }

/* ============================================================
   ===== ADDED: carousel extras, photo viewer, HUD links =====
   ============================================================ */
.rpm-expand-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 22, 35, 0.72);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.rpm-expand-btn:hover { background: rgba(15, 22, 35, 0.9); }
.rpm-expand-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.rpm-photo-count {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  padding: 5px 11px;
  border-radius: 100px;
  background: rgba(15, 22, 35, 0.72);
  color: #fff;
  font: 600 12px/1.2 'Barlow', sans-serif;
  letter-spacing: 0.04em;
}
.rpm-carousel-empty {
  min-height: 220px;
  background: #f1f5f9;
  color: #475569;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 1.5rem;
}
.rpm-carousel-empty i { font-size: 2.2rem; color: #64748b; }
.rpm-carousel-empty p { margin: 0; }
.carousel-thumbnails .thumbnail:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* HUD: stats that link somewhere */
.rpm-hud__stat--link:hover { background: rgba(255, 255, 255, 0.1); }
.rpm-hud__stat-value a { color: inherit; text-decoration: none; }
.rpm-hud__stat-value a::after { content: ""; position: absolute; inset: 0; }
.rpm-hud__stat-value a:focus-visible { outline: none; }
.rpm-hud__stat-value a:focus-visible::after { outline: 3px solid #fff; outline-offset: -4px; border-radius: 4px; }
.rpm-hud__stat-value i { font-size: 20px; }

/* Photo viewer (lightbox) */
.rpm-lightbox .modal-content {
  background: rgba(8, 12, 20, 0.97);
  border: 0;
  border-radius: 0;
  align-items: center;
  justify-content: center;
}
.rpm-lightbox__img { max-width: 100vw; max-height: calc(100vh - 90px); object-fit: contain; }
.rpm-lightbox__close { position: absolute; top: 16px; right: 16px; z-index: 5; width: 1.5em; height: 1.5em; }
.rpm-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.rpm-lightbox__nav:hover { background: rgba(255, 255, 255, 0.3); }
.rpm-lightbox__nav:focus-visible, .rpm-lightbox__close:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.rpm-lightbox__nav--prev { left: 16px; }
.rpm-lightbox__nav--next { right: 16px; }
.rpm-lightbox__count { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; color: #e2e8f0; font-size: 14px; margin: 0; }

/* ============================================================
   ===== ADDED: build section header, misc =====
   ============================================================ */
.rpm-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px 16px;
}
.rpm-jump-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--rpm-blue-mid);
  text-decoration: none;
}
.rpm-jump-link:hover { text-decoration: underline; }
.rpm-build-card__title a:focus-visible,
.rpm-build-card__title-overlay a:focus-visible,
.rpm-build-card__title-panel a:focus-visible,
.rpm-view-link:focus-visible { outline: 3px solid #7dd3fc; outline-offset: 2px; }

.rpm-comments-anchor { scroll-margin-top: 84px; }  /* clears the site's fixed header */
.rpm-comments-anchor:focus { outline: none; }
#rpm-tabs { scroll-margin-top: 84px; }
#rpm-main-content { scroll-margin-top: 84px; }
.rpm-ad-slot { clear: both; margin-top: 1.5rem; min-height: 280px; }

/* "Read more" is pointless when the description already fits (fadetext.js adds .no-clamp) */
.text-container.no-clamp .read-more-description,
.text-container.no-clamp .read-less-description { display: none !important; }
.text-container.no-clamp::after,
.text-container.no-clamp .description-text::after { display: none !important; }
.text-container.no-clamp .description-text { max-height: none !important; -webkit-mask-image: none !important; mask-image: none !important; }

/* ----- Map panel: fallbacks for markup that used to be inline styles ----- */
.rpm-map-log__icon { display: flex; }
.rpm-map-legend__dot--show   { background: #185FA5; }
.rpm-map-legend__dot--trip   { background: #3B6D11; }
.rpm-map-legend__dot--track  { background: #993C1D; }
.rpm-map-legend__dot--moment { background: #854F0B; }
.rpm-map-legend__dot--other  { background: #5F5E5A; }
.rpm-photo-preview { display: none; margin-top: 0.5rem; }
.rpm-photo-thumb { display: block; max-width: 100%; max-height: 120px; border-radius: 6px; border: 1px solid #e0e0e0; margin-bottom: 0.3rem; }
.rpm-photo-thumb--lg { max-height: 160px; }
.rpm-link-danger { display: block; margin-top: 0.3rem; padding: 0; background: none; border: 0; color: #b42318; font-size: 12px; text-decoration: underline; cursor: pointer; }
.rpm-check { display: flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; }
.rpm-map-suggestion.is-active, .rpm-map-suggestion[aria-selected="true"] { background: var(--rpm-blue-pale); }

/* ----- Toasts, back to top ----- */
.rpm-toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.rpm-toast {
  max-width: min(92vw, 440px);
  padding: 11px 18px;
  border-radius: 10px;
  background: #0f1623;
  color: #fff;
  font: 600 0.9rem/1.35 'Barlow', sans-serif;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  pointer-events: auto;
  animation: rpm-toast-in 0.2s ease;
}
.rpm-toast--error { background: #991b1b; }
@keyframes rpm-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.rpm-back-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1500;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #0f1623;
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.rpm-back-top[hidden] { display: none; }
.rpm-back-top:focus-visible { outline: 3px solid #7dd3fc; outline-offset: 2px; }

/* ----- Mobile tweaks for the new pieces ----- */
@media (max-width: 767px) {
  .rpm-ride-head { align-items: stretch; }
  .rpm-ride-head__actions { width: 100%; }
  .rpm-ride-head__actions .rpm-btn--follow,
  .rpm-ride-head__actions .rpm-btn--dark:not(.rpm-btn--icon) { flex: 1 1 0; }
  .rpm-owner-bar__sold { margin-left: 0; width: 100%; }
  .rpm-owner-bar__sold .rpm-btn { width: 100%; }
  .rpm-hud__stat:first-child { border-left: 0; }
  .rpm-hud__stat-value { font-size: 18px; }
  .rpm-lightbox__nav { width: 40px; height: 40px; }

  /* Keep the photo full width and in proportion no matter what other site CSS says */
  .rpm-carousel-wrap .carousel,
  .rpm-carousel-wrap .carousel-inner {
    display: block !important;
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
  }
  .rpm-carousel-wrap .carousel-item img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    max-height: 60vh;
    object-fit: cover;
  }

  /* Thumbnails: a scrolling strip under the photo instead of covering it */
  .rpm-carousel-wrap .carousel-indicators.carousel-thumbnails {
    position: static;
    display: flex;
    justify-content: flex-start;
    gap: 6px;
    margin: 0;
    padding: 8px;
    background: #0f1623;
    overflow-x: auto;
    line-height: 0;
    width: 100% !important;
    box-sizing: border-box;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    transform: none !important;
    bottom: auto !important;
    background: #0f1623 !important;
  }
  .rpm-carousel-wrap .carousel-indicators.carousel-thumbnails .thumbnail {
    flex: 0 0 auto;
    width: 56px;
    height: 42px;
    margin: 0;
    object-fit: cover;
    text-indent: 0;
    width: 56px !important;
    height: 42px !important;
    min-width: 0 !important;
    opacity: 1;
    border: 0;
    visibility: visible;
  }
  .rpm-carousel-wrap .carousel-indicators.carousel-thumbnails .thumbnail.active { outline: 2px solid #4da3ff; }
}

/* ----- Respect reduced-motion settings ----- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .rpm-build-card:hover,
  .rpm-explore-grid .card:hover { transform: none; }
  .rpm-build-card:hover .rpm-build-card__img-wrap img,
  .rpm-explore-grid .card:hover .car-img { transform: none; }
}