/* Real installs, redesigned around what a customer checks:
   a car like mine -> before/after -> it works (video) -> which option and price -> next step. */
.install-gallery { background: var(--rf-graphite-2) !important; color: var(--rf-on-dark); }
.install-gallery h2, .install-gallery h3 { color: #F4F2EE; }
.install-gallery .section-head > p { color: var(--rf-on-dark-soft); }
.ig-intro { margin-bottom: 28px; }

/* Picker: every install visible at a glance, above the card. */
.ig-picker { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; scroll-margin-top: 96px; }
.ig-picker button {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 8px 12px 8px 8px;
  background: var(--rf-graphite-3); color: var(--rf-on-dark); border: 1px solid var(--rf-dark-line); border-radius: 6px;
  text-align: left; cursor: pointer; font: inherit;
}
.ig-picker button:hover { border-color: #4A525D; }
.ig-picker button[aria-pressed="true"] { border-color: var(--rf-red); background: #20242B; box-shadow: inset 0 0 0 1px var(--rf-red); }
.ig-picker img { flex: none; width: 64px; height: 48px; object-fit: cover; object-position: var(--pos, 50% 50%); border-radius: 3px; }
.ig-picker span { min-width: 0; }
.ig-picker strong, .ig-picker small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ig-picker strong { font-size: 14px; line-height: 1.35; }
.ig-picker small { margin-top: 3px; font-size: 12px; color: var(--rf-on-dark-soft); }
@media (min-width: 1081px) { .ig-picker button { gap: 10px; padding-right: 8px; } .ig-picker img { width: 52px; height: 40px; } .ig-picker strong { font-size: 13px; } }
/* Narrow desktops: let the short label wrap instead of cutting off "Kept factory screen". */
@media (min-width: 1081px) and (max-width: 1279px) { .ig-picker small { white-space: normal; line-height: 1.25; } }
/* Author display:flex beats the hidden attribute, so filtered-out chips need this. */
.ig-picker button[hidden], .ig-next[hidden] { display: none; }

/* Filters (built by install-gallery.js): narrow the picker by make and upgrade. Same chip style as the vehicles page. */
.ig-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; margin-bottom: 14px; }
.ig-filter { display: flex; gap: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.ig-filter::-webkit-scrollbar { display: none; }
.ig-filter button {
  flex-shrink: 0; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--rf-dark-line);
  background: transparent; color: #D5D8DC; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.ig-filter button span { margin-left: 2px; font-weight: 400; color: var(--rf-on-dark-soft); }
.ig-filter button:hover:not(:disabled) { border-color: #4A525D; }
.ig-filter button[aria-pressed="true"] { background: #2A3038; border-color: #626870; color: #F4F2EE; }
.ig-filter button:disabled { opacity: .4; cursor: default; }
.ig-filter-status { margin: 0 0 0 auto; font-size: 13px; color: var(--rf-on-dark-soft); }
@media (any-pointer: coarse) { .ig-filter button { min-height: 44px; } }
/* Phones: stack the rows and wrap the buttons. A wrapping column sized every row to its widest one,
   which pushed the page sideways, and with the scrollbar hidden a scrolling row looked cut off. */
@media (max-width: 760px) {
  .ig-filters { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 8px; }
  .ig-filter { flex-wrap: wrap; overflow: visible; }
  .ig-filter-status { margin-left: 0; }
}

/* Card: story on the left, the portrait video in its own column on the right.
   Both columns stretch to the same height; the action row sits on the card's bottom line. */
.ig-card {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(216px, 20vw, 272px); gap: clamp(32px, 3vw, 44px); align-items: stretch;
  padding: 32px; background: var(--rf-graphite-3); border: 1px solid var(--rf-dark-line); border-radius: 10px;
  scroll-margin-top: 96px;
}
.ig-ready .ig-card[hidden] { display: none; }
.ig-card + .ig-card { margin-top: 20px; }
.ig-ready .ig-card + .ig-card { margin-top: 0; }
.ig-main { display: flex; flex-direction: column; min-width: 0; }
.ig-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.ig-head h3 { font-size: 26px; line-height: 1.2; }
.ig-head h3 span { margin-left: 6px; font-weight: 400; color: var(--rf-on-dark-soft); }
.ig-option { display: inline-flex; align-items: center; min-height: 32px; padding: 5px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.ig-option b { margin-left: 4px; font-weight: 400; }
.ig-option.new { background: #F4F2EE; color: var(--rf-graphite); }
.ig-option.kept { border: 1px solid #626870; color: #F4F2EE; }
.ig-desc { margin-top: 10px; max-width: 60ch; color: var(--rf-on-dark-soft); font-size: 16px; line-height: 1.6; }

.ig-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.ig-toggle { display: none; }
.ig-shot { position: relative; margin: 0; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 6px; background: var(--rf-graphite); }
.ig-shot img {
  display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%);
  transform: scale(var(--zoom, 1)); transform-origin: var(--origin, 50% 50%);
}
.ig-shot figcaption {
  position: absolute; top: 10px; left: 10px; padding: 4px 9px; border-radius: 4px;
  background: #0E1013D9; color: #F4F2EE; font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.ig-shot[data-ig-shot="after"] figcaption { background: var(--rf-red); }

.ig-keep { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 22px 0 26px; padding: 0; list-style: none; font-size: 15px; color: var(--rf-on-dark); }
.ig-keep li { display: flex; align-items: center; gap: 8px; }
.ig-keep li::before {
  content: ''; flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--rf-red)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.ig-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: auto; padding-top: 22px; border-top: 1px solid var(--rf-dark-line); }
.ig-next { padding: 10px 2px; background: none; border: 0; color: #F4F2EE; font: inherit; font-size: 15px; cursor: pointer; text-decoration: underline; text-decoration-color: var(--rf-red); text-decoration-thickness: 2px; text-underline-offset: 6px; }
.ig-next:not([data-ready]) { display: none; }

.ig-video { margin: 0; }
.ig-video video { display: block; width: 100%; aspect-ratio: 9 / 16; height: auto; object-fit: cover; background: var(--rf-graphite); border-radius: 6px; }
.ig-video video[data-started="true"], .ig-video video:fullscreen { object-fit: contain; }
.ig-video figcaption { margin-top: 12px; color: var(--rf-on-dark-soft); font-size: 14px; line-height: 1.55; }
.ig-video figcaption b { display: block; margin-bottom: 2px; color: #F4F2EE; font-size: 14px; }
.install-gallery :focus-visible { outline: 2px solid #F4F2EE; outline-offset: 3px; }

/* Tablet: photos side by side, video centred underneath. */
@media (min-width: 761px) and (max-width: 1080px) {
  .ig-picker { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .ig-picker::-webkit-scrollbar { display: none; }
  .ig-picker button { flex: 0 0 200px; scroll-snap-align: start; }
  .ig-card { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 26px; }
  .ig-main { display: contents; }
  .ig-video { order: 1; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: center; margin-top: 24px; }
  .ig-main > .ig-keep { order: 2; }
  .ig-main > .ig-actions { order: 3; }
  .ig-video figcaption { margin-top: 0; font-size: 15px; }
}

/* Phone: one swipeable row of cars, then photo, video and action stacked. */
@media (max-width: 760px) {
  .ig-intro { margin-bottom: 20px; }
  .ig-picker {
    display: flex; gap: 8px; margin: 0 -20px 16px; padding: 0 20px 4px; overflow-x: auto; scroll-snap-type: x mandatory;
    scroll-padding-inline: 20px; scrollbar-width: none;
  }
  .ig-picker::-webkit-scrollbar { display: none; }
  .ig-picker button { flex: 0 0 auto; max-width: 190px; padding: 6px 12px 6px 6px; scroll-snap-align: start; }
  .ig-picker img { width: 52px; height: 40px; }
  .ig-picker strong { font-size: 13px; }
  .ig-card { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 18px 16px 20px; margin-inline: -4px; }
  .ig-head h3 { font-size: 21px; }
  .ig-option { min-height: 28px; font-size: 13px; }
  .ig-desc { font-size: 15px; }
  .ig-compare { grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 16px; }
  .ig-ready .ig-toggle { display: flex; gap: 8px; }
  .ig-toggle button {
    flex: 1; min-height: 44px; border: 1px solid #626870; border-radius: 4px; background: var(--rf-graphite-3);
    color: #F4F2EE; font: inherit; font-size: 14px; font-weight: 700;
  }
  .ig-toggle button[aria-pressed="true"] { background: #F4F2EE; color: var(--rf-graphite); border-color: #F4F2EE; }
  .ig-ready .ig-compare[data-show="after"] [data-ig-shot="before"],
  .ig-ready .ig-compare[data-show="before"] [data-ig-shot="after"] { display: none; }
  .ig-keep { flex-direction: column; gap: 10px; margin: 18px 0 0; font-size: 14px; }
  .ig-actions { margin-top: 20px; padding-top: 18px; }
  .ig-actions .btn { width: 100%; }
  .ig-next { margin-inline: auto; }
  .ig-main { display: contents; }
  .ig-video { order: 1; margin-top: 22px; }
  .ig-main > .ig-keep { order: 2; }
  .ig-main > .ig-actions { order: 3; }
  .ig-video video { width: min(100%, 270px); margin-inline: auto; }
  .ig-video figcaption { text-align: center; }
}

/* Hosts page: guest-guide callout under the gallery, on the dark background */
.install-gallery .guest-guide-callout { border-top-color: var(--rf-dark-line); }
.install-gallery .guest-guide-callout h3 { color: #F4F2EE; }
.install-gallery .guest-guide-callout p { color: var(--rf-on-dark-soft); }
.install-gallery .guest-guide-callout .btn, .install-gallery .guest-guide-callout .btn.secondary { background: transparent; color: #F4F2EE; border: 1px solid #626870; }
.install-gallery .guest-guide-callout .btn:hover { border-color: var(--rf-red); }
