/* Desktop hero grid layout (#1706). The var() fallbacks equal the pre-#1706 layout
   (two equal columns, 8px gap, every tile rounded), so a feed that sets none of
   --hrg-main-share / --hrg-gap / --hrg-radius renders exactly as before; the
   component stamps a variable only when its setting differs from the default.
   Layout only: no colour literals, so dark first paint is untouched. The
   two-class selectors out-rank the Tailwind grid-cols-2 / gap-2 utilities. */
.homerunner-gallery-two-by-five-grid .homerunner-gallery-two-by-five-grid-container {
  grid-template-columns: calc((100% - var(--hrg-gap, 0.5rem)) * var(--hrg-main-share, 0.5)) minmax(0, 1fr);
  gap: var(--hrg-gap, 0.5rem);
}

.homerunner-gallery-two-by-five-grid .homerunner-gallery-two-by-five-thumbnails {
  gap: var(--hrg-gap, 0.5rem);
}

/* radiusMode "outer": the container rounds and clips as one block, the tiles stay square. */
.homerunner-gallery-two-by-five-grid[data-hr-radius-mode="outer"] .homerunner-gallery-two-by-five-grid-container {
  border-radius: var(--hrg-radius, 0px);
  overflow: hidden;
}

.homerunner-gallery-two-by-five-grid[data-hr-radius-mode="outer"] .gallery-image-container {
  border-radius: 0;
}

/* Gallery hover overlay effects */
.gallery-image-container {
    position: relative;
    overflow: hidden;
    cursor: pointer;
  }
  
  .gallery-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .gallery-hover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0);
    transition: background-color 300ms ease-in-out;
    pointer-events: none;
  }
  
  .gallery-image-container:hover .gallery-hover-overlay {
    background-color: rgba(0, 0, 0, 0.2);
  }
  
  /* Carousel navigation arrows */
  .homerunner-carousel-arrow {
    color: rgba(0, 0, 0, 0.8);
    opacity: 0.5;
    background-color: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(229, 231, 235, 0.3);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  }
  
  .homerunner-carousel-arrow:hover {
    opacity: 1;
    /* background-color: rgba(255, 255, 255, 1); */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  }
  
  .homerunner-carousel-arrow:disabled {
    background-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  }
  
  /* Full screen modal animations */
  .fullscreen-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    transform: translateY(100%);
    transition: transform 400ms cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .fullscreen-modal.open {
    transform: translateY(0);
  }
  
  .fullscreen-modal.closing {
    transform: translateY(100%);
  }
  
  /* Lightbox image transition animations */
  .homerunner-gallery-lightbox-image-container {
    position: relative;
    overflow: hidden;
  }
  
  .homerunner-gallery-lightbox-image {
    transition: opacity 300ms ease-in-out, transform 300ms ease-in-out;
    will-change: opacity, transform;
  }
  
  .homerunner-gallery-lightbox-image.fade-out {
    opacity: 0;
    /* transform: scale(0.95); */
  }
  
  .homerunner-gallery-lightbox-image.fade-in {
    opacity: 1;
    /* transform: scale(1); */
  }
  
  /* Counter and caption animations */
  .homerunner-gallery-lightbox-counter,
  .homerunner-gallery-lightbox-caption {
    transition: opacity 200ms ease-in-out;
  }
  
  .homerunner-gallery-lightbox-counter.updating,
  .homerunner-gallery-lightbox-caption.updating {
    opacity: 0.7;
  }
  
  /* Skeleton loading animations - React Loading Skeleton style */
  @keyframes homerunner-skeleton-slide {
    100% {
      transform: translateX(100%);
    }
  }
  
  .homerunner-gallery-skeleton {
    --base-color: #ebebeb;
    --highlight-color: #f5f5f5;
    --animation-duration: 1.5s;
    --animation-direction: normal;
    --pseudo-element-display: block;
  
    background-color: var(--base-color);
    width: 100%;
    border-radius: 0.25rem;
    display: inline-flex;
    line-height: 1;
    position: relative;
    user-select: none;
    overflow: hidden;
  }
  
  .homerunner-gallery-skeleton::after {
    content: ' ';
    display: var(--pseudo-element-display);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background-repeat: no-repeat;
    background-image: linear-gradient(
      90deg,
      var(--base-color) 0%,
      var(--highlight-color) 50%,
      var(--base-color) 100%
    );
    transform: translateX(-100%);
    animation-name: homerunner-skeleton-slide;
    animation-direction: var(--animation-direction);
    animation-duration: var(--animation-duration);
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
  }
  
  /* Dark mode skeleton */
  .dark .homerunner-gallery-skeleton {
    --base-color: #374151;
    --highlight-color: #4b5563;
  }

  /* Dark-mode skeleton — host-marker + auto first-paint variants (#900).
     Append-only siblings of the `.dark` rule above, reusing its exact values.
     `:host([data-hr-theme="dark"])` covers the runtime marker (explicit dark +
     post-hydration auto); the @media block repaints a server-stamped auto
     widget on a dark OS AT PARSE, dropped by `:not([data-hr-theme])` the instant
     the runtime stamps the marker at hydration. Both auto conditions stay
     INSIDE `:host(...)` — a `:not` after the parens silently never matches. */
  :host([data-hr-theme="dark"]) .homerunner-gallery-skeleton {
    --base-color: #374151;
    --highlight-color: #4b5563;
  }

  @media (prefers-color-scheme: dark) {
    :host([data-hr-scheme="auto"]:not([data-hr-theme])) .homerunner-gallery-skeleton {
      --base-color: #374151;
      --highlight-color: #4b5563;
    }
  }

  /* Respect user's motion preferences */
  @media (prefers-reduced-motion) {
    .homerunner-gallery-skeleton {
      --pseudo-element-display: none;
    }
  }
  
  /* Skeleton pulse animation for buttons and text */
  .homerunner-gallery-skeleton-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  }
  
  @keyframes pulse {
    0%, 100% {
      opacity: 1;
    }
    50% {
      opacity: 0.5;
    }
  }
  
/* ----------------------------------------------------------------------------
 * Section heading (shared across content widgets)
 * Bold title on the left + horizontal divider line filling remaining width.
 * -------------------------------------------------------------------------- */

.hr-widget-section {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  width: 100%;
}

.hr-widget-section-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
  white-space: nowrap;
  flex-shrink: 0;
}

.hr-widget-section-line {
  flex: 1;
  height: 1px;
  background-color: currentColor;
  opacity: 0.18;
  display: block;
}

@media (max-width: 640px) {
  .hr-widget-section-title { font-size: 1.25rem; }
  .hr-widget-section { gap: 1rem; margin-bottom: 1.5rem; }
}

/* ----------------------------------------------------------------------------
 * Photo tour (#1694): the "Show all photos" browser grouped by room. Port of
 * the toolkit's pg-tour / pg-lb-room layout. No theme literal here: text is
 * currentColor over the modal's own bg-card / text-card-foreground, the chip
 * and divider greys are mid-grey alphas that read in both schemes, and the
 * active chip inverts the theme pair. Nothing to dual-emit.
 * -------------------------------------------------------------------------- */

.homerunner-gallery-fullscreen-modal--tour {
  --hr-gallery-tour-head: 56px;
  --hr-gallery-tour-bar: 52px;
  padding: var(--hr-gallery-tour-head) 0 0;
  align-items: stretch;
  justify-content: stretch;
}

.homerunner-gallery-fullscreen-modal--tour .homerunner-gallery-fullscreen-content {
  height: 100%;
  max-height: none;
}

.homerunner-gallery-tour {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 32px 96px;
}

/* Index: one tile per room (cover photo + name); a tile scrolls to its section. */
.homerunner-gallery-tour-index {
  margin: 0 0 48px;
}

.homerunner-gallery-tour-heading {
  margin: 0 0 24px;
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.2;
}

.homerunner-gallery-tour-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 24px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.homerunner-gallery-tour-tiles li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.homerunner-gallery-tour-tile {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.35;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.homerunner-gallery-tour-thumb {
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.homerunner-gallery-tour-tile:hover .homerunner-gallery-tour-thumb {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.homerunner-gallery-tour-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.homerunner-gallery-tour-collage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
}

.homerunner-gallery-tour-label {
  display: block;
  margin-top: 8px;
  font-weight: 500;
}

/* One section per room: the name holds in the left column (sticky under the
   header, and under the bar while it shows) while the photos scroll in the
   right one. */
.homerunner-gallery-tour-room {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  column-gap: 40px;
  align-items: start;
}

.homerunner-gallery-tour-room + .homerunner-gallery-tour-room {
  margin-top: 64px;
}

.homerunner-gallery-tour-room-head {
  position: sticky;
  top: 0;
  /* Above the photo cells (positioned, later in tree order), or they paint
     over the heading as they scroll under it in the one-column layout. */
  z-index: 1;
  padding: 4px 0 8px;
  transition: top 0.2s ease;
}

.homerunner-gallery-fullscreen-modal--bar .homerunner-gallery-tour-room-head {
  top: var(--hr-gallery-tour-bar);
}

.homerunner-gallery-tour-room-title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.homerunner-gallery-tour-room-photos {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* Mosaic blocks: one photo full width (3:2), two side by side (4:3), three as
   two stacked beside one tall; `flip` puts the tall photo on the left. */
.homerunner-gallery-mosaic {
  display: grid;
  gap: 8px;
}

.homerunner-gallery-mosaic-full {
  grid-template-columns: 1fr;
}

.homerunner-gallery-mosaic-pair,
.homerunner-gallery-mosaic-trio {
  grid-template-columns: 1fr 1fr;
}

.homerunner-gallery-mosaic-cell {
  aspect-ratio: 4 / 3;
  border-radius: 8px;
}

.homerunner-gallery-mosaic-full .homerunner-gallery-mosaic-cell {
  aspect-ratio: 3 / 2;
}

.homerunner-gallery-mosaic-trio .homerunner-gallery-mosaic-cell {
  grid-column: 1;
}

.homerunner-gallery-mosaic-trio .homerunner-gallery-mosaic-tall {
  grid-column: 2;
  grid-row: 1 / span 2;
  aspect-ratio: auto;
}

.homerunner-gallery-mosaic-trio.homerunner-gallery-mosaic-flip .homerunner-gallery-mosaic-cell {
  grid-column: 2;
}

.homerunner-gallery-mosaic-trio.homerunner-gallery-mosaic-flip .homerunner-gallery-mosaic-tall {
  grid-column: 1;
}

/* Pinned room index (toolkit#806): a bar of room chips held under the header
   once the full index has scrolled away; the room in view is marked. */
.homerunner-gallery-tour-bar {
  position: absolute;
  top: var(--hr-gallery-tour-head, 56px);
  left: 0;
  right: 0;
  z-index: 11;
  height: var(--hr-gallery-tour-bar, 52px);
  box-sizing: border-box;
  margin: 0;
  padding: 0 32px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.25);
}

.homerunner-gallery-tour-bar[hidden] {
  display: none;
}

.homerunner-gallery-tour-bar-list {
  display: flex;
  gap: 8px;
  align-items: center;
  height: 100%;
  max-width: 1056px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.homerunner-gallery-tour-bar-list::-webkit-scrollbar {
  display: none;
}

.homerunner-gallery-tour-bar-list li {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.homerunner-gallery-tour-chip {
  display: inline-block;
  margin: 0;
  padding: 6px 12px;
  background: none;
  border: 1px solid rgba(128, 128, 128, 0.45);
  border-radius: 999px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  color: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.homerunner-gallery-tour-chip:hover {
  background: rgba(128, 128, 128, 0.14);
}

.homerunner-gallery-tour-chip[aria-current="true"] {
  background: var(--foreground);
  border-color: var(--foreground);
  color: var(--background);
}

.homerunner-gallery-tour-chip:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .homerunner-gallery-tour {
    padding: 16px 16px 72px;
  }
  .homerunner-gallery-tour-index {
    margin-bottom: 32px;
  }
  .homerunner-gallery-tour-tiles {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px 12px;
  }
  .homerunner-gallery-tour-room {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 12px;
  }
  .homerunner-gallery-tour-room + .homerunner-gallery-tour-room {
    margin-top: 40px;
  }
  /* One column: the sticky name is a full-width band over the photos. */
  .homerunner-gallery-tour-room-head {
    margin: 0 -16px;
    padding: 8px 16px;
  }
  .homerunner-gallery-tour-room-title {
    font-size: 1.125rem;
  }
  .homerunner-gallery-tour-bar {
    padding: 0 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .homerunner-gallery-tour-thumb,
  .homerunner-gallery-tour-room-head {
    transition: none;
  }
}

/* ----------------------------------------------------------------------------
 * Lightbox zoom (#1694, toolkit#823). The surface never scrolls, so taking
 * touch handling away from the browser there is safe; the photo pans under a
 * grab cursor while zoomed and the arrows and caption step back so they stop
 * reading as part of the photo. The button shows one of its two magnifiers
 * by the zoom state.
 * -------------------------------------------------------------------------- */

.homerunner-gallery-lightbox--zoomable .homerunner-gallery-lightbox-image-container {
  touch-action: none;
}

.homerunner-gallery-lightbox--zoomable .homerunner-gallery-lightbox-image {
  transform-origin: center center;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}

.homerunner-gallery-lightbox--zoomed .homerunner-gallery-lightbox-image {
  cursor: grab;
}

.homerunner-gallery-lightbox--zoomed .homerunner-gallery-lightbox-image:active {
  cursor: grabbing;
}

.homerunner-gallery-lightbox--zoomed .homerunner-gallery-lightbox-nav,
.homerunner-gallery-lightbox--zoomed .homerunner-gallery-lightbox-caption {
  opacity: 0.35;
  transition: opacity 0.2s ease;
}

.homerunner-gallery-lightbox-zoom .homerunner-gallery-zoom-out {
  display: none;
}

.homerunner-gallery-lightbox-zoom--out .homerunner-gallery-zoom-in {
  display: none;
}

.homerunner-gallery-lightbox-zoom--out .homerunner-gallery-zoom-out {
  display: block;
}
