.project-gallery { min-width: 0; }
.project-gallery .house-media { width: 100%; }
.house-media > a { display: block; position: relative; height: 100%; }
.house-media[data-fit="contain"] { background: var(--white, var(--paper)); border: 1px solid var(--line); }
.house-media[data-fit="contain"] img { object-fit: contain; }
.image-enlarge { position: absolute; right: 12px; bottom: 12px; background: #ffffffed; color: var(--green); font-size: 12px; line-height: 1.4; padding: 9px 12px; border-radius: 3px; box-shadow: 0 2px 10px #20302012; }
.house-media a:focus-visible, .floor-plan a:focus-visible { outline-offset: -4px; }
.gallery-caption { display: flex; justify-content: space-between; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
[data-gallery-count] { white-space: nowrap; font-variant-numeric: tabular-nums; }
.gallery-thumbnails { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.gallery-thumb { min-width: 0; display: block; padding: 4px; text-decoration: none; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.gallery-thumb img { display: block; width: 100%; aspect-ratio: 1.3; height: auto; object-fit: cover; }
.gallery-thumb[data-fit="contain"] img { object-fit: contain; }
.gallery-thumb span { display: block; font-size: 11px; line-height: 1.4; padding: 7px 3px 4px; overflow-wrap: anywhere; }
.gallery-thumb[aria-current="true"] { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); background: var(--soft); }
.gallery-thumb:hover { border-color: var(--green); }
.floor-plan { margin: 0 0 22px; }
.floor-plan > a { display: block; position: relative; background: #fff; border: 1px solid var(--line); border-radius: 3px; padding: 7px 7px 42px; }
.floor-plan img { display: block; width: 100%; height: auto; max-height: 330px; object-fit: contain; }
.floor-plan .image-enlarge { bottom: 6px; right: 6px; box-shadow: none; }
.floor-plan figcaption { font-size: 11px; line-height: 1.5; color: var(--muted); margin-top: 8px; }
.image-viewer { width: min(1180px, calc(100% - 32px)); max-width: none; padding: 22px; }
.image-viewer::backdrop { background: #101910e8; }
.viewer-header { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 16px; }
.viewer-header h2 { font-size: 26px; margin: 0 0 6px; }
.viewer-header p { font-size: 14px; }
.viewer-close { flex-shrink: 0; background: var(--soft); border: 1px solid var(--line); border-radius: 3px; color: var(--ink); min-height: 44px; padding: 8px 15px; font-size: 14px; }
.viewer-stage { background: #f6f7f4; border: 1px solid var(--line); overflow: auto; height: min(66vh, 780px); display: flex; align-items: center; justify-content: center; }
.viewer-stage img { width: 100%; height: 100%; object-fit: contain; }
.viewer-stage.is-zoomed { display: block; }
.viewer-stage.is-zoomed img { width: 200%; max-width: none; height: auto; min-height: 100%; object-fit: contain; }
.viewer-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.viewer-controls button, .viewer-controls a { min-height: 44px; font-size: 13px; }
.viewer-controls .btn { padding: 10px 16px; }
.viewer-counter { color: var(--muted); font-size: 13px; margin-right: auto; white-space: nowrap; }
.viewer-zoom[aria-pressed="true"] { background: var(--soft); }
@media (max-width: 1000px) and (min-width: 601px) {
  .house-overview > .project-gallery { grid-row: 1 / 3; }
}
@media (max-width: 600px) {
  .gallery-thumb span { font-size: 12px; }
  .gallery-thumbnails { gap: 8px; }
  .image-viewer { padding: 16px; width: calc(100% - 20px); }
  .viewer-header h2 { font-size: 23px; }
  .viewer-stage { height: 53vh; }
  .viewer-controls { gap: 8px; }
  .viewer-counter { margin-right: 0; }
  .viewer-controls .btn { padding: 10px 12px; }
}
@media print {
  .gallery-thumbnails, .gallery-caption, .image-enlarge { display: none; }
  .floor-plan { break-inside: avoid; }
  .floor-plan > a { padding-bottom: 7px; }
  .image-viewer { display: none !important; }
}
