/* The garage (/designs, #3758): helmets standing on a shelf, the driver card, the news strip.
   Plain CSS beside the Tailwind build (tokens: app/assets/tailwind/application.css @theme). */

.garage-shelf {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem 1.625rem;
  padding: 0;
  list-style: none;
}
@media (min-width: 640px) { .garage-shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .garage-shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .garage-shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.garage-item { position: relative; min-width: 0; }

/* The place a helmet stands: a studio-tone tile, lit from above. */
.garage-stage {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 12px 12px 2px 2px;
  background: radial-gradient(ellipse 80% 70% at 50% 30%, #2b303b 0%, #171a21 62%, #101216 100%);
}
.garage-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.garage-item:hover .garage-stage img { transform: scale(1.03); }
.garage-stage-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 11px/1 var(--font-mono, ui-monospace, monospace);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-dim, #5d6474);
}

/* Shared / Private, on the tile's corner. */
.garage-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--color-line-2, #3a4150);
  border-radius: 999px;
  background: rgba(14, 16, 20, 0.78);
  color: var(--color-muted, #8b93a3);
  font-size: 10.5px;
  line-height: 1;
  pointer-events: none;
  backdrop-filter: blur(6px);
}
.garage-pill-shared { border-color: rgba(62, 207, 142, 0.4); color: var(--color-ok, #3ecf8e); }

/* Rename / Stop sharing / Delete: quiet, under the helmet's details. */
.garage-quiet {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 6px;
  border-radius: 4px;
  color: var(--color-muted, #8b93a3);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s;
}
.garage-quiet:hover { color: var(--color-fg, #e8eaee); }
.garage-quiet-danger:hover { color: var(--color-err, #ff5b5b); }
@media (hover: none) { .garage-quiet { min-height: 36px; } }

/* Rename / Delete popovers: as wide as the helmet's own place (.garage-item is the positioned
   ancestor), so one in the last column never pushes the page sideways. */
.garage-pop {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 20;
  min-width: min(15rem, 100%);
  margin-top: 4px;
  border: 1px solid var(--color-line-2, #3a4150);
  border-radius: 8px;
  background: var(--color-panel-2, #1d2129);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55);
}
.garage-pop-danger { border-color: rgba(255, 91, 91, 0.4); }

/* The shelf edge under every place. */
.garage-edge {
  height: 10px;
  margin: 0 -6px;
  border-radius: 2px;
  background: linear-gradient(#3a4150, #1b1f27);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.6);
}

/* Open / Unveil / Duplicate / Share. A row of buttons under the shelf by default (touch, phones);
   where there is a real pointer and room, they sit over the helmet and show on hover or focus. */
.garage-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 14px;
}
.garage-actions form { display: contents; }
.garage-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid var(--color-line-2, #3a4150);
  border-radius: 6px;
  background: rgba(22, 25, 32, 0.92);
  color: var(--color-fg, #e8eaee);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.garage-act:hover { border-color: rgba(232, 234, 238, 0.6); background: #1d2129; }
.garage-act-primary { border-color: var(--color-accent, #ff3b1f); background: var(--color-accent, #ff3b1f); color: #fff; }
.garage-act-primary:hover { border-color: var(--color-accent-2, #ff6a4f); background: var(--color-accent-2, #ff6a4f); }
.garage-act .badge-pro { font-size: 8.5px; padding: 1px 3px; letter-spacing: 0.04em; }

@media (hover: hover) and (pointer: fine) and (min-width: 640px) {
  .garage-actions {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    aspect-ratio: 1 / 1;
    margin: 0;
    padding: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: end;
    border-radius: 12px 12px 2px 2px;
    background: linear-gradient(rgba(10, 12, 15, 0) 42%, rgba(10, 12, 15, 0.88));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
  }
  .garage-actions .garage-act { pointer-events: auto; min-height: 32px; padding: 0 4px; gap: 4px; font-size: 11.5px; backdrop-filter: blur(6px); }
  .garage-item:hover .garage-actions,
  .garage-item:focus-within .garage-actions { opacity: 1; }
}

/* An empty free space, and the Pro place after the last one. */
.garage-space {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  aspect-ratio: 1 / 1;
  padding: 16px;
  border: 1.5px dashed var(--color-line-2, #3a4150);
  border-radius: 12px 12px 2px 2px;
  text-align: center;
  color: var(--color-muted, #8b93a3);
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
/* One per row on a phone: a place is a band, not a full-width square. */
@media (max-width: 639px) { .garage-space { aspect-ratio: auto; min-height: 190px; } }
a.garage-space:hover { border-color: rgba(232, 234, 238, 0.55); background: rgba(255, 255, 255, 0.02); color: var(--color-fg, #e8eaee); }
.garage-space-pro { border-color: rgba(245, 197, 66, 0.45); background: rgba(245, 197, 66, 0.04); }
.garage-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 6px;
  background: var(--color-pro, #f5c542);
  color: #14110a;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 22px -10px rgba(245, 197, 66, 0.7);
  transition: filter 0.15s;
}
.garage-gold:hover { filter: brightness(1.08); }
.garage-gold:focus-visible, .garage-act:focus-visible, .garage-quiet:focus-visible, .garage-stage:focus-visible,
a.garage-space:focus-visible, [data-driver-form] > summary:focus-visible { outline: 2px solid var(--color-accent, #ff3b1f); outline-offset: 2px; }

/* Colourway dots and the colour swatches on the driver card. */
.garage-dot {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}
.garage-dot-lg { width: 16px; height: 16px; }

/* Driver card: the form's colour wells. */
.garage-well {
  width: 100%;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--color-line-2, #3a4150);
  border-radius: 6px;
  background: var(--color-ink-2, #0a0c0f);
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .garage-stage img, .garage-actions, .garage-act, .garage-space, .garage-gold { transition: none; }
  .garage-item:hover .garage-stage img { transform: none; }
}

/* "Duplicate" at the free limit links here (#garage-pro): the Pro tile says where the copy would go. */
#garage-pro { scroll-margin-top: 96px; }
#garage-pro:target .garage-space-pro { border-color: var(--color-pro, #f5c542); box-shadow: 0 0 0 3px rgba(245, 197, 66, 0.22); }
@media (prefers-reduced-motion: no-preference) {
  #garage-pro:target .garage-space-pro { animation: garage-pro-nudge 0.9s ease-out 1; }
  @keyframes garage-pro-nudge { 0% { box-shadow: 0 0 0 0 rgba(245, 197, 66, 0.6); } 100% { box-shadow: 0 0 0 3px rgba(245, 197, 66, 0.22); } }
}
