/* Keep the compact mobile size and give the comparison more room on desktop. */
.project-comparison-wrap { width: min(400px, calc((100% - 88px) / 3)); margin-inline: auto; }
.project-comparisons { display: grid; gap: 32px; margin-top: 32px; }
.project-reveal {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 4px;
  background: #e8ede8;
  --comparison-position: 50%;
}
.project-reveal > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.project-reveal-before { clip-path: inset(0 calc(100% - var(--comparison-position)) 0 0); }
.project-reveal::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset-block: 0;
  left: var(--comparison-position);
  width: 2px;
  background: #fff;
  transform: translateX(-50%);
  pointer-events: none;
}
.project-reveal-label {
  position: absolute;
  z-index: 3;
  top: 16px;
  display: inline-block;
  padding: 5px 10px;
  border-radius: 2px;
  background: #fff;
  color: #525b76;
  font: 700 16px/1.5 'Lato', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: normal;
  text-transform: none;
  text-decoration: none;
}
.project-reveal-label:first-of-type { left: 16px; }
.project-reveal-label:last-of-type { right: 16px; }
/* Keep photo links easy to tap without enlarging the homepage-style labels. */
.project-reveal-label::before { content: ""; position: absolute; inset: -8px 0; }
.project-reveal-label:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.project-reveal-handle {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: clamp(24px, var(--comparison-position), calc(100% - 24px));
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid #d5dbd7;
  border-radius: 50%;
  background: #fff;
  color: var(--forest, #2e5b47);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.project-reveal-handle svg { width: 24px; height: 24px; }
.project-reveal-range {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: clamp(24px, var(--comparison-position), calc(100% - 24px));
  width: 48px;
  height: 48px;
  margin: 0;
  opacity: 0;
  transform: translate(-50%, -50%);
  touch-action: none;
  cursor: ew-resize;
}
.project-reveal-range:focus-visible + .project-reveal-handle { outline: 2px solid var(--forest); outline-offset: 3px; }
.project-reveal-range[hidden], .project-reveal-handle[hidden] { display: none; }
@media (min-width: 761px) and (max-width: 1000px) {
  .project-comparison-wrap { width: calc((100% - 68px) / 2); }
}
@media (max-width: 760px) {
  .project-comparison-wrap { width: min(480px, calc(100% - 48px)); }
  .project-comparisons { gap: 24px; margin-top: 24px; }
  .project-reveal-label { top: 12px; font-size: 13px; }
  .project-reveal-label:first-of-type { left: 12px; }
  .project-reveal-label:last-of-type { right: 12px; }
}

/* The same one-at-a-time navigation as the homepage, with three comparisons. */
.project-comparison-carousel { position: relative; margin-top: 32px; }
.project-comparison-carousel .project-comparisons { margin-top: 0; }
.project-comparisons.is-carousel {
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  grid-template-columns: none;
  grid-template-rows: auto;
  gap: 0;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  border-radius: 4px;
}
.project-comparisons.is-carousel::-webkit-scrollbar { display: none; }
.project-comparisons.is-carousel > .project-reveal { min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; }
.project-comparisons:focus-visible { outline: 2px solid var(--forest); outline-offset: 4px; }
.comparison-counter { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.comparison-indicators:not([hidden]) { display: flex; justify-content: center; gap: 7px; height: 6px; margin-top: 10px; pointer-events: none; }
.comparison-indicator { flex: 0 0 6px; height: 6px; border-radius: 50%; background: #c3c9c4; }
.comparison-indicator.is-active { background: var(--forest); }
.comparison-navigation { display: none; }
@media (min-width: 1024px) {
  .project-comparison-wrap { width: min(640px, calc(100% - 48px)); }
  .comparison-navigation:not([hidden]) { position: absolute; inset: 0 auto auto 0; display: flex; align-items: center; justify-content: space-between; width: 100%; aspect-ratio: 4 / 5; pointer-events: none; }
  .comparison-arrow { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 1px solid rgba(46,91,71,.25); border-radius: 50%; background: #fff; color: var(--forest); cursor: pointer; pointer-events: auto; }
  [data-comparison-previous] { margin-left: -60px; }
  [data-comparison-next] { margin-right: -60px; }
  .comparison-arrow svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
  .comparison-arrow:hover { border-color: var(--forest); }
  .comparison-arrow:focus-visible { outline: 2px solid var(--forest); outline-offset: 4px; }
}
@media (max-width: 760px) { .project-comparison-carousel { margin-top: 24px; } }
