/* Fit the gallery to the content column, even beside a theme sidebar. */
.ngi-compare-frame {
  container: ngi-compare-frame / inline-size;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 20px 0;
}
.ngi-compare {
  --ngi-accent: #5238f6;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-width: 0;
  font: 14px/1.4 system-ui, sans-serif;
}
.ngi-compare-main { display: contents; }
.ngi-compare .ngi-compare-list {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding: 4px;
  scrollbar-color: var(--ngi-accent) #eeeef4;
}
.ngi-compare .ngi-compare-list button {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  flex: 0 0 88px;
  min-width: 0;
  height: auto;
  padding: 3px 3px 6px;
  white-space: normal;
  overflow-wrap: anywhere;
  overflow: hidden;
  border: 2px solid #dedee5;
  border-radius: 9px;
  background: white;
  color: #222;
  text-align: center;
  cursor: pointer;
  font: inherit;
}
.ngi-compare .ngi-compare-list button[aria-pressed="true"] { border-color: var(--ngi-accent); }
.ngi-compare-list button img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 5px;
  margin-bottom: 4px;
}
.ngi-compare-stage {
  --split: 50%;
  position: relative;
  aspect-ratio: 16 / 9;
  isolation: isolate;
  overflow: hidden;
  border-radius: 10px;
  background: #e8e8ed;
}
.ngi-compare-stage > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}
.ngi-compare-before { clip-path: inset(0 calc(100% - var(--split)) 0 0); }
.ngi-compare-label {
  position: absolute;
  top: 10px;
  padding: 5px 10px;
  border-radius: 30px;
  color: white;
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}
.ngi-compare-label-before { left: 10px; background: #262626; }
.ngi-compare-label-after { right: 10px; background: var(--ngi-accent); }
.ngi-compare-line {
  position: absolute;
  left: var(--split);
  top: 0;
  bottom: 0;
  width: 3px;
  transform: translateX(-50%);
  background: white;
  box-shadow: 0 0 4px #0006;
  pointer-events: none;
}
.ngi-compare-line span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: white;
  color: #343b4c;
  font-size: 21px;
  white-space: nowrap;
}
.ngi-compare .ngi-compare-stage > input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  touch-action: pan-y;
  direction: ltr;
  appearance: none;
  -webkit-appearance: none;
}
.ngi-compare-stage > input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1px;
  height: 36px;
}
.ngi-compare-stage > input::-moz-range-thumb {
  width: 1px;
  height: 36px;
  border: 0;
}
.ngi-compare-stage:focus-within .ngi-compare-line span,
.ngi-compare-list button:focus-visible { outline: 3px solid var(--ngi-accent); outline-offset: 2px; }
.ngi-compare .ngi-compare-note, .ngi-compare .ngi-compare-status { margin: 8px 0 0; font-size: 13px; }
.ngi-compare-status { color: #8a2626; }
@container ngi-compare-frame (min-width: 601px) {
  .ngi-compare {
    grid-template-columns: 128px minmax(0, 1fr);
    gap: 0 14px;
  }
  .ngi-compare-stage { grid-column: 2; grid-row: 1; }
  .ngi-compare-status, .ngi-compare-note { grid-column: 2; }
  .ngi-compare .ngi-compare-list {
    display: grid;
    grid-column: 1;
    grid-row: 1;
    grid-auto-rows: max-content;
    align-self: stretch;
    align-content: start;
    contain: size;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: scroll;
    scrollbar-gutter: stable;
    padding: 0 4px 0 0;
  }
}
@supports selector(::-webkit-scrollbar) {
  .ngi-compare .ngi-compare-list { scrollbar-color: auto; }
  .ngi-compare-list::-webkit-scrollbar { width: 12px; height: 10px; }
  .ngi-compare-list::-webkit-scrollbar-track {
    background: #eeeef4;
    border-radius: 8px;
  }
  .ngi-compare-list::-webkit-scrollbar-thumb {
    background: var(--ngi-accent);
    border: 2px solid #eeeef4;
    border-radius: 8px;
  }
}
