/* Gallery modal and compact homepage teaser. */
.nav-links .gallery-nav-button,
.mobile-menu .mobile-gallery-button {
  appearance: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}
.site-header .nav-links .gallery-nav-button {
  grid-column: 1;
  grid-row: 4;
  min-width: 142px;
  padding: 10px 17px;
  border: 1px solid rgba(126, 225, 242, .22);
  border-radius: 999px;
  background: rgba(3, 25, 46, .55);
  color: #effbff;
  font: inherit;
  font-weight: 750;
  letter-spacing: .03em;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 5px 14px rgba(0, 12, 25, .16);
}
.site-header .nav-links .gallery-nav-button:hover,
.site-header .nav-links .gallery-nav-button:focus-visible {
  color: #fff;
  border-color: rgba(126, 242, 250, .72);
  background: rgba(8, 69, 91, .66);
}
.mobile-menu .mobile-gallery-button {
  display: block;
  width: 100%;
  padding: 12px 14px;
  color: inherit;
  text-align: left;
  background: transparent;
  border-radius: 8px;
}
.mobile-menu .mobile-gallery-button:hover,
.mobile-menu .mobile-gallery-button:focus-visible { color: var(--aqua); }
.mobile-menu .mobile-gallery-button:focus-visible,
.gallery-close:focus-visible,
.gallery-slider:focus-visible {
  outline: 3px solid var(--aqua);
  outline-offset: 4px;
}

/* Keep the homepage Results block compact; detailed imagery lives in the dialog. */
.results-grid {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 18px;
  text-align: center;
}
.results-grid > div:first-child { max-width: 720px; }
.results h2 { font-size: clamp(2.2rem, 4vw, 3.4rem); }
.results-copy { max-width: 620px; margin: 0 auto 20px; }
.results-grid .button { justify-content: center; }
.results .benefits { margin-top: 32px; }

.gallery-modal {
  width: min(980px, calc(100vw - 32px));
  max-width: none;
  max-height: min(92dvh, 980px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: #f8fbfc;
  border: 1px solid #d9e8ec;
  border-radius: 24px;
  box-shadow: 0 30px 90px #00132666;
}
.gallery-modal[open] { display: block; }
.gallery-modal::backdrop {
  background: rgb(2 19 38 / 78%);
  backdrop-filter: blur(6px);
}
.gallery-modal-panel {
  max-height: min(92dvh, 980px);
  overflow: auto;
  overscroll-behavior: contain;
}
.gallery-modal-header {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 25px 30px 18px;
  background: linear-gradient(#f8fbfc 88%, rgb(248 251 252 / 94%));
}
.gallery-modal-header .section-kicker {
  margin-bottom: 7px;
  color: #078bb6;
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .15em;
}
.gallery-modal-header h2 {
  margin: 0;
  color: var(--navy);
  font: 500 clamp(1.8rem, 4vw, 2.7rem)/1.08 var(--serif);
  letter-spacing: -.035em;
}
.gallery-modal-header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .98rem;
}
.gallery-close {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  margin: 0;
  padding: 0 0 4px;
  color: #fff;
  font: 400 2rem/1 var(--sans);
  cursor: pointer;
  background: var(--navy);
  border: 0;
  border-radius: 50%;
}
.gallery-close:hover { background: #0b7599; }
.gallery-modal-content {
  display: grid;
  justify-items: center;
  padding: 2px 28px 26px;
}
.gallery-transformation { width: min(100%, 500px); margin: 0; }
.gallery-comparison {
  position: relative;
  width: auto;
  height: clamp(320px, 58vh, 560px);
  aspect-ratio: 2 / 3;
  margin: 0 auto;
  overflow: hidden;
  background: #e8f1f3;
  border: 1px solid #d7e5e9;
  border-radius: 18px;
  box-shadow: 0 16px 38px #09233e24;
  isolation: isolate;
}
.gallery-image-layer {
  position: absolute;
  inset: 0;
  background-image: url('/assets/gallery-house-before-after-source.webp');
  background-repeat: no-repeat;
  background-size: 200% 100%;
}
.gallery-image-after { background-position: right center; }
.gallery-comparison-separate .gallery-image-after {
  background-image: url('/assets/driveway-after.png');
  background-position: center;
  background-size: cover;
}
.gallery-image-before {
  z-index: 1;
  background-position: left center;
  clip-path: inset(0 calc(100% - var(--split)) 0 0);
}
.gallery-comparison-separate .gallery-image-before {
  background-image: url('/assets/driveway-before.png');
  background-position: center;
  background-size: cover;
}
.gallery-slider-instruction {
  margin: 0 auto 10px;
  padding: 9px 14px;
  color: #294b5c;
  background: #e8f5f7;
  border: 1px solid #c4e2e7;
  border-radius: 999px;
  font-size: .84rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}
.gallery-comparison-label {
  position: absolute;
  z-index: 3;
  top: 12px;
  padding: 7px 10px;
  color: #fff;
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .1em;
  background: rgb(3 25 46 / 88%);
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: 7px;
}
.gallery-before-label { left: 12px; }
.gallery-after-label { right: 12px; }
.gallery-divider {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: var(--split);
  border-left: 2px solid #fff;
  pointer-events: none;
}
.gallery-divider span {
  position: absolute;
  top: 50%;
  left: 0;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--navy);
  font-size: 1.35rem;
  font-weight: 800;
  background: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 4px 15px #00132655;
  transform: translate(-50%, -50%);
}
.gallery-comparison:focus-within .gallery-divider span { outline: 3px solid var(--aqua); outline-offset: 3px; }
.gallery-slider {
  position: absolute;
  z-index: 4;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: .001;
  cursor: ew-resize;
  touch-action: pan-y;
}
.gallery-caption {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 13px 4px 0;
  text-align: center;
}
.gallery-caption strong { color: var(--navy); font-size: 1.04rem; }
.gallery-caption span,
.gallery-caption a { color: var(--muted); font-size: .79rem; }
.gallery-caption a { color: #087fa5; text-decoration: underline; text-underline-offset: 2px; }
.gallery-disclosure {
  max-width: 620px;
  margin: 20px auto 0;
  color: #657989;
  font-size: .8rem;
  line-height: 1.45;
  text-align: center;
}
.gallery-source-note { margin: 6px auto 0; color: #748793; font-size: .72rem; text-align: center; }
.gallery-source-note a { color: #087fa5; text-decoration: underline; text-underline-offset: 2px; }
.gallery-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 520px) {
  .gallery-modal {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .gallery-modal-panel { height: 100%; max-height: 100dvh; }
  .gallery-modal-header { gap: 12px; padding: 20px 16px 15px; }
  .gallery-modal-header h2 { font-size: clamp(1.65rem, 7vw, 2.15rem); }
  .gallery-modal-header p { max-width: 270px; font-size: .86rem; }
  .gallery-close { flex-basis: 46px; width: 46px; height: 46px; }
  .gallery-modal-content { padding: 3px 16px 22px; }
  .gallery-comparison { height: clamp(300px, 54dvh, 470px); }
  .gallery-disclosure { margin-top: 16px; font-size: .76rem; }
  .gallery-slider-instruction { max-width: 100%; font-size: .78rem; }
}
@media (prefers-reduced-motion: reduce) {
  .gallery-modal, .gallery-modal * { scroll-behavior: auto; }
}

/* Photo-viewer layout: one active result beside its existing result selector. */
.gallery-modal {
  width: min(1280px, calc(100vw - 40px));
  max-height: min(96dvh, 1040px);
}
.gallery-modal-panel {
  display: flex;
  flex-direction: column;
  max-height: min(96dvh, 1040px);
  overflow: auto;
}
.gallery-modal-header { padding: 12px 30px 7px; }
.gallery-modal-content {
  display: block;
  min-height: 0;
  padding: 0 28px 0;
}
.gallery-viewer-grid {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  align-items: stretch;
  gap: 24px;
  min-height: 0;
}
.gallery-main-area { min-width: 0; }
.gallery-selected-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin: 0 0 9px;
}
.gallery-selected-heading h3 {
  margin: 0;
  color: var(--navy);
  font: 600 clamp(1.05rem, 1.7vw, 1.35rem)/1.2 var(--sans);
}
.gallery-item-kind {
  color: #087fa5;
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.gallery-slider-instruction {
  width: fit-content;
  max-width: 100%;
  margin: 0 0 10px;
  padding: 8px 12px;
}
.gallery-main-media {
  display: grid;
  width: 100%;
  min-height: 260px;
  max-height: 72dvh;
  max-height: min(72dvh, 650px);
  place-items: center;
  overflow: hidden;
  background: #e8f1f3;
  border: 1px solid #d7e5e9;
  border-radius: 16px;
  box-shadow: 0 16px 38px #09233e24;
}
.gallery-main-image {
  display: block;
  width: 100%;
  height: min(72dvh, 650px);
  object-fit: contain;
  background: #e8f1f3;
}
.gallery-main-image[hidden],
.gallery-comparison[hidden],
.gallery-slider-instruction[hidden] { display: none !important; }
.gallery-comparison {
  width: auto;
  max-width: 100%;
  height: min(72dvh, 650px);
  min-height: 260px;
  aspect-ratio: 2 / 3;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.gallery-comparison[data-pair-layout="separate"] { aspect-ratio: 0.447; }
.gallery-comparison[data-pair-layout="separate-wide"] { aspect-ratio: 0.74; }
.gallery-comparison-separate-wide .gallery-image-before,
.gallery-comparison-separate-wide .gallery-image-after {
  background-image: none;
  background-position: center;
  background-size: cover;
}
.gallery-image-layer { background-image: none; background-size: cover; }
.gallery-comparison[data-pair-layout="composite"] .gallery-image-layer { background-size: 200% 100%; }
.gallery-comparison[data-pair-layout="composite"] .gallery-image-before { background-position: left center; }
.gallery-comparison[data-pair-layout="composite"] .gallery-image-after { background-position: right center; }
.gallery-disclosure {
  margin: 10px 0 0;
  text-align: left;
}
.gallery-source-note[data-gallery-source] { margin: 4px 0 0; text-align: left; }
.gallery-selector {
  display: flex;
  min-width: 0;
  max-height: 68dvh;
  flex-direction: column;
  padding: 0 0 0 17px;
  border-left: 1px solid #d9e8ec;
}
.gallery-selector h3 {
  flex: 0 0 auto;
  margin: 0 0 10px;
  color: var(--navy);
  font: 600 1rem/1.3 var(--sans);
}
.gallery-thumb-list {
  display: grid;
  min-height: 0;
  gap: 9px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 5px 4px 2px;
}
.gallery-thumb {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 76px;
  padding: 7px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  background: #fff;
  border: 1px solid #d6e4e9;
  border-radius: 12px;
  box-shadow: 0 3px 10px #09233e0d;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.gallery-thumb:hover { border-color: #73c9d9; background: #f4fbfc; }
.gallery-thumb.is-selected,
.gallery-thumb[aria-pressed="true"] {
  background: #eef9fb;
  border-color: #35abc2;
  box-shadow: 0 0 0 2px #35abc233;
}
.gallery-thumb:focus-visible { outline: 3px solid var(--aqua); outline-offset: 2px; }
.gallery-thumb img {
  display: block;
  width: 92px;
  height: 60px;
  object-fit: cover;
  border-radius: 7px;
  background: #e8f1f3;
}
.gallery-thumb-copy { display: grid; gap: 3px; min-width: 0; }
.gallery-thumb-title { font-size: .82rem; font-weight: 750; line-height: 1.2; }
.gallery-thumb-badge {
  width: fit-content;
  padding: 2px 6px;
  color: #236174;
  background: #e4f4f7;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 750;
  line-height: 1.35;
}
.gallery-global-disclosure { margin: 8px 0 0; color: #657989; font-size: .76rem; text-align: center; }
.gallery-source-record { margin-top: 0; }

@media (max-width: 700px) {
  .gallery-modal {
    width: 100vw;
    max-height: 100dvh;
  }
  .gallery-modal-panel { max-height: 100dvh; }
  .gallery-modal-header { flex: 0 0 auto; padding: 17px 16px 12px; }
  .gallery-modal-content { padding: 2px 16px 16px; }
  .gallery-viewer-grid { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .gallery-main-area { display: flex; flex-direction: column; }
  .gallery-selected-heading { order: 0; }
  .gallery-main-media { order: 1; max-height: 44dvh; min-height: 220px; }
  .gallery-slider-instruction { order: 2; align-self: flex-start; margin: 8px 0 0; }
  .gallery-disclosure { order: 3; }
  .gallery-source-note[data-gallery-source] { order: 4; }
  .gallery-main-image, .gallery-comparison { height: min(44dvh, 390px); min-height: 220px; }
  .gallery-selector { max-height: none; min-width: 0; padding: 0; border: 0; }
  .gallery-selector h3 { margin-bottom: 7px; }
  .gallery-thumb-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 3px 2px 8px;
    scroll-snap-type: x proximity;
    touch-action: pan-x;
  }
  .gallery-thumb {
    flex: 0 0 min(172px, calc(50vw - 24px));
    grid-template-columns: 64px minmax(0, 1fr);
    min-height: 66px;
    padding: 6px;
    scroll-snap-align: start;
  }
  .gallery-thumb img { width: 68px; height: 50px; }
  .gallery-thumb-title { font-size: .75rem; }
  .gallery-slider-instruction { margin-bottom: 8px; font-size: .78rem; }
  .gallery-global-disclosure { margin-top: 6px; }
}
