/* Lucian UX/UI Prompt #061 · MIT License (c) 2026 Seokwoooo · https://lucianlabs.dev/uxui-prompt/#061 */
/* Lucian UX/UI Prompt #048 · MIT License (c) 2026 Seokwoooo · https://lucianlabs.dev/uxui-prompt/#048 */
/* Lucian UX/UI Prompt #079 · MIT License (c) 2026 Seokwoooo · https://lucianlabs.dev/uxui-prompt/#079 */
.gallery-filters { position: relative; padding-bottom: 2px; }
.gallery-filters button[aria-pressed="true"] { border-bottom-color: transparent; }
.gallery-filter-indicator { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--brand); pointer-events: none; transition: transform 300ms cubic-bezier(.22,1,.36,1), width 300ms cubic-bezier(.22,1,.36,1); }
.gallery-filters.can-scroll-right { mask-image: linear-gradient(to right, #000 calc(100% - 14px), transparent); }
.gallery-filters.can-scroll-left { mask-image: linear-gradient(to right, transparent, #000 14px); }
.gallery-filters.can-scroll-left.can-scroll-right { mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent); }
.gallery-grid.is-filter-changing { will-change: opacity; }
.gallery-grid.is-filter-changing .gallery-card { will-change: opacity, transform; }
.gallery-photo { position: relative; }
.gallery-photo picture { display: block; width: 100%; height: 100%; }
.gallery-photo img { opacity: 0; filter: blur(5px); transition: opacity 240ms ease, filter 280ms ease; }
.gallery-photo.is-loaded img { opacity: 1; filter: none; }
.gallery-photo.is-loading::after, .photo-viewport.is-loading::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(100deg, transparent 28%, #ffffff42 45%, transparent 62%) -100% 0 / 200% 100% no-repeat; animation: villa-photo-shimmer 1.6s linear infinite; }
@keyframes villa-photo-shimmer { to { background-position: 200% 0; } }
.gallery-image-status { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; font-size: 12px; line-height: 1.7; text-align: center; color: var(--muted); }
.gallery-photo.is-loading .gallery-image-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); padding: 0; }
.gallery-photo.image-error img { visibility: hidden; }
.photo-dialog-header .photo-dialog-tools { display: flex; align-items: center; gap: 12px; }
.photo-dialog-header #photoZoom { width: auto; min-width: 88px; height: 44px; padding: 0 12px; border: 1px solid #f8f5ef50; font-size: 12px; letter-spacing: 0; }
.photo-dialog button:disabled { opacity: .35; cursor: default; }
.photo-dialog button:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }
.photo-viewport { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; min-height: min(240px, 40svh); max-height: calc(90svh - 180px); overflow: hidden; touch-action: none; background: #342d28; }
.photo-stage .photo-viewport img { display: block; max-width: 100%; max-height: calc(90svh - 180px); width: auto; height: auto; object-fit: contain; transform-origin: center; transition: transform 240ms ease, opacity 200ms ease; cursor: zoom-in; user-select: none; -webkit-user-drag: none; }
.photo-viewport.is-loading img, .photo-viewport.image-error img { opacity: 0; }
.photo-viewport.is-zoomed img { cursor: grab; }
.photo-viewport.is-dragging img { cursor: grabbing; transition: none; }
.photo-load-status { position: absolute; left: 20px; right: 20px; bottom: 20px; z-index: 1; padding: 10px 14px; background: #28221fe8; color: var(--paper); text-align: center; font-size: 12px; line-height: 1.7; }
.photo-stage > button { min-width: 44px; min-height: 44px; }
.photo-dialog-caption p { font-size: 12px; line-height: 1.7; }
.photo-dialog:has(.photo-thumbnails) { --photo-max-height: calc(94svh - 236px); }
/* Keep controls still while portrait, landscape and loading photos share one frame. */
.photo-dialog:has(.photo-thumbnails) .photo-viewport { height: var(--photo-max-height); min-height: 0; max-height: var(--photo-max-height); }
.photo-dialog:has(.photo-thumbnails) .photo-viewport img { max-height: 100%; }
.photo-thumbnails { position: relative; display: flex; gap: 8px; margin-top: 12px; padding: 4px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; touch-action: pan-x; scrollbar-width: thin; scrollbar-color: #f8f5ef60 transparent; }
.photo-thumbnail { flex: 0 0 76px; min-width: 44px; min-height: 44px; height: 56px; padding: 3px; border: 1px solid #f8f5ef50; background: #342d28; opacity: .65; cursor: pointer; transition: opacity 180ms ease; }
.photo-thumbnail img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.photo-thumbnail:hover, .photo-thumbnail:focus-visible, .photo-thumbnail[aria-pressed="true"] { opacity: 1; }
.photo-thumbnail[aria-pressed="true"] { border-color: var(--paper); }
.photo-dialog .photo-thumbnail:focus-visible { outline-offset: 1px; }
@media (max-width: 600px) {
  .photo-viewport { max-height: calc(100svh - 172px); min-height: min(300px, 50svh); }
  .photo-stage .photo-viewport img { max-height: calc(100svh - 172px); }
  .photo-stage > button { width: 44px; height: 48px; }
  .photo-dialog:has(.photo-thumbnails) .photo-stage > button { top: 50%; bottom: auto; transform: translateY(-50%); }
  .photo-dialog-caption { align-items: flex-start; }
  .photo-dialog-caption h2 { font-size: 14px; line-height: 1.5; }
  .photo-dialog-caption p { white-space: normal; max-width: 150px; text-align: right; }
  .photo-dialog:has(.photo-thumbnails) { height: 100svh; }
  .photo-dialog:has(.photo-thumbnails) .photo-dialog-caption { display: grid; grid-template-columns: 1fr; gap: 5px; margin-top: 12px; }
  .photo-dialog:has(.photo-thumbnails) .photo-dialog-caption p { max-width: none; text-align: left; }
  .photo-thumbnail { flex-basis: 64px; height: 48px; }
}
@media (max-height: 500px) and (min-width: 601px) {
  .photo-dialog:has(.photo-thumbnails) { height: calc(100svh - 16px); width: min(1100px, calc(100vw - 24px)); max-height: calc(100svh - 16px); padding: 12px 16px; }
  .photo-dialog:has(.photo-thumbnails) .photo-dialog-header { margin-bottom: 8px; }
  .photo-dialog:has(.photo-thumbnails) .photo-viewport { min-height: 0; }
  .photo-thumbnails { margin-top: 8px; }
  .photo-thumbnail { flex-basis: 64px; height: 44px; }
  .photo-dialog:has(.photo-thumbnails) .photo-dialog-caption { margin-top: 8px; }
  .photo-dialog:has(.photo-thumbnails) .photo-dialog-caption h2 { font-size: 13px; }
  .photo-dialog:has(.photo-thumbnails) .photo-dialog-caption p { font-size: 11px; }
}
/* Let the photo use the space left by real controls and native scrollbars. */
@media (max-width: 600px), (max-height: 500px) and (min-width: 601px) {
  .photo-dialog[open]:has(.photo-thumbnails) { display: flex; flex-direction: column; }
  .photo-dialog:has(.photo-thumbnails) > :is(.photo-dialog-header, .photo-thumbnails, .photo-dialog-caption) { flex-shrink: 0; min-width: 0; }
  .photo-dialog:has(.photo-thumbnails) .photo-stage { flex: 1; min-height: 0; }
  .photo-dialog:has(.photo-thumbnails) .photo-viewport { height: 100%; min-height: 0; max-height: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .gallery-filter-indicator, .gallery-photo img, .photo-stage .photo-viewport img, .photo-thumbnail { transition: none; }
  .gallery-photo.is-loading::after, .photo-viewport.is-loading::after { animation: none; background: #ffffff0b; }
}

@media (hover: none), (max-width: 850px) {
  .photo-keyboard-help { display: none; }
}
