.capture-thumb-btn {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  position: relative;
  display: block;
  color: inherit;
  text-decoration: none;
}

.capture-thumb-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.variant-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--panel-2);
}

.variant-block:last-child {
  margin-bottom: 0;
}

.variant-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.variant-footer .variant-actions {
  margin-left: auto;
}

.variant-comparisons {
  flex: 1 1 auto;
  min-width: 0;
}

.variant-captures {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.variant-captures[hidden] {
  display: none;
}

.variant-captures-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 8px;
}

.variant-captures-tab {
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  border-radius: 0;
}

.variant-captures-tab:hover:not(.is-active) {
  color: var(--text);
}

.variant-captures-tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent, #6ea8ff);
}

.variant-captures-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.variant-captures-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 88px;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.variant-captures-row::-webkit-scrollbar {
  height: 6px;
}

.variant-captures-row::-webkit-scrollbar-track {
  background: transparent;
}

.variant-captures-row::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.variant-captures-row:hover {
  scrollbar-color: var(--muted) transparent;
}

.variant-captures-row:hover::-webkit-scrollbar-thumb {
  background: var(--muted);
}

.variant-captures-row[hidden] {
  display: none;
}

.variant-captures-row img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--panel-2);
  display: block;
}

.variant-comparisons-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.variant-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.variant-head strong {
  font-size: 14px;
  color: var(--text);
}

.variant-head .years {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.variant-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.share-btn.variant-add-capture {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.share-btn.variant-add-capture:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: #fff;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge.na,
.badge.flat,
.badge.high-rev,
.badge.rwd,
.badge.manual,
.badge.social,
.badge.convertible {
  color: var(--good);
  border-color: #2d5a33;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  transition: border-color 120ms ease, transform 120ms ease;
  cursor: pointer;
}

.card-head,
.card .engine-line,
.card .badges,
.card .stats {
  position: relative;
  z-index: 1;
}

.card-stock-img {
  position: absolute;
  top: 0;
  right: 0;
  width: 55%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 600ms ease, transform 600ms ease;
  -webkit-mask-image: linear-gradient(to right, transparent 30%, black 100%);
  mask-image: linear-gradient(to right, transparent 30%, black 100%);
}

.card-stock-img.loaded {
  opacity: 1;
  transform: translateX(0);
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.card-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.card-title .make {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}

.card-year {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.card:has(.card-stock-img.loaded) .card-year {
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.gen-code {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.75em;
}

.engine-line {
  font-size: 13px;
  color: var(--text);
}

.engine-code {
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 40px;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.intro {
  text-align: left;
  max-width: 720px;
  margin: 0 auto;
}

.intro h2 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--text);
  text-align: center;
}

.intro > p {
  margin: 0 0 20px;
  text-align: center;
  font-size: 13px;
}

.intro-suggestions {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: grid;
  gap: 8px;
}

.intro-suggestions li {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow: hidden;
  font-size: 13px;
  min-height: 120px;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}

.intro-suggestion-img {
  position: absolute;
  top: 0;
  right: 0;
  width: 55%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  opacity: 0;
  transition: opacity 500ms ease;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.5) 35%, black 75%);
  mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.5) 35%, black 75%);
}

.intro-suggestion-img.loaded {
  opacity: 1;
}

.intro-suggestion-body {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.intro-suggestions li:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.intro-suggestions li:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.intro-suggestions strong {
  color: var(--accent);
}

.intro-filter-line {
  color: var(--text);
  font-size: 12px;
}

.intro-why {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.intro-personality {
  display: block;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 24px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 120ms ease, transform 120ms ease;
}

.intro-personality:hover,
.intro-personality:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
  outline: none;
}

.intro-personality strong {
  color: var(--accent);
  font-size: 13px;
  display: block;
  margin-bottom: 4px;
}

.intro-personality span {
  color: var(--muted);
  font-size: 12px;
}

.intro-filters {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  font-size: 12px;
}

.intro-filters dt {
  color: var(--text);
  font-weight: 500;
}

.intro-filters dd {
  margin: 0;
  color: var(--muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 28px 0 0;
}

.pagination[hidden] {
  display: none;
}

.page-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.page-btn:hover:not(:disabled),
.page-btn:focus-visible:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-indicator {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  min-width: 120px;
  text-align: center;
}

.error {
  background: #3a1212;
  border: 1px solid #5a1d1d;
  color: #ffb3a8;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin: 0 0 12px;
}

.detail-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-group-label {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(max(220px, calc((100% - 32px) / 3)), 1fr));
  gap: 10px 16px;
  margin: 0;
  font-size: 13px;
}

.detail-grid > div {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  white-space: nowrap;
}

.detail-grid dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
}

.detail-icon {
  display: inline-flex;
  vertical-align: -2px;
  color: var(--muted);
}

.stat-empty,
.detail-grid > div.is-empty {
  opacity: 0.15;
}

.ig-embeds {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ig-embeds iframe {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  aspect-ratio: 4 / 5;
  width: 100%;
  height: auto;
  min-height: 326px;
  min-width: 150px;
}

@media (max-width: 700px) {

  /* Tighter side padding so the card content (badges, captures row,
     comparisons label) gets ~12-16px more horizontal real estate per
     row on narrow phones. Stack variant cards flush so they read as a
     continuous list rather than separated tiles; collapse the top
     border on subsequent cards so adjacent borders don't double up. */
  .variant-block {
    padding: 12px 8px;
    margin-bottom: 0;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  .variant-block + .variant-block {
    border-top: none;
  }

  /* The grid breaks out of <main>'s 16px side padding so single-column
     cards span the full screen width on phones, and stack flush so the
     list reads as one continuous feed instead of disconnected tiles. */
  .grid {
    grid-template-columns: 1fr;
    gap: 0;
    margin-left: -16px;
    margin-right: -16px;
  }

  .card {
    padding: 14px 10px;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  /* Collapse the doubled border between stacked cards. */
  .card + .card {
    border-top: none;
  }

  /* Suppress the 1px hover-lift on phones — with cards flush the lift
     overlaps the previous card and hides its bottom border. Keep the
     accent-color border swap from the base rule for hover feedback. */
  .card:hover {
    transform: none;
  }

  /* With no gap and no side borders, adjacent model cards bleed into
     one another. Alternate the background so every other card uses
     the slightly lighter panel-2 shade — gives the eye a clear band
     for each model when scrolling. */
  #grid .card:nth-child(even) {
    background: var(--panel-2);
  }

  /* Browse detail modal: let variant cards span edge-to-edge while
     keeping the title and section headers indented for readability.
     Scoped to #modal so other modals (lightbox, drive, upload) are
     unaffected. */
  #modal {
    padding: 0;
  }

  /* Zero padding-top here so the sticky .variant-head pins flush with
     the very top of the modal-panel. The title block re-adds the
     breathing room so the modal still doesn't look cramped on open. */
  #modal .modal-panel {
    padding: 0 0 16px;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  #modal .modal-title-block {
    padding: 16px 48px 0 12px;
  }

  /* The sticky variant-head sits at z-index 1; bump the close button
     above it so users can still tap it once a trim head is pinned. */
  #modal .modal-close {
    z-index: 2;
  }

  #modal .modal-section > h3,
  #modal .modal-section > .link-row,
  #modal .modal-section > .ig-embeds {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Make each trim's heading stick to the top of the modal scroll so
     the user always knows which trim they're scrolling through, and
     bleed it edge-to-edge with a stronger title and a divider so the
     transition between trims registers at a glance. */
  #modal .variant-head {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: -12px -8px 12px;
    padding: 12px 16px;
    background: var(--panel-2);
    border-bottom: 1px solid var(--border);
  }

  #modal .variant-head strong {
    font-size: 16px;
    font-weight: 700;
  }

  /* Trim-card striping: mirror the model-card banding on /browse/ so
     stacked-flush trims get a clear band per card. Every other
     variant-block (and its sticky head, which would otherwise show
     the default --panel-2 against an alternate body) drops to the
     darker --panel shade. nth-child counts from the modal-section's
     h3, so the first variant-block is index 2 and gets the alternate
     shade — still alternating, just starting darker. */
  #modal .variant-block:nth-child(even),
  #modal .variant-block:nth-child(even) .variant-head {
    background: var(--panel);
  }

  /* Allow long detail labels ("Power-to-weight ratio") to wrap rather
     than push values off the row at narrow widths. */
  .detail-grid dt {
    white-space: normal;
  }

  .empty {
    padding: 24px 16px;
  }

  .intro-suggestions li {
    min-height: 100px;
    padding: 12px 14px;
  }

  .intro-suggestion-img {
    width: 50%;
  }

  .intro-filters {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }

  .intro-filters dt {
    margin-top: 8px;
  }

  .intro-filters dt:first-child {
    margin-top: 0;
  }

  .ig-embeds {
    grid-template-columns: 1fr;
  }

  .ig-embeds iframe {
    min-width: 0;
    min-height: 0;
  }
}
