/* ── component-photo-gallery — centered photo gallery modal ── */

.photo-gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 470;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.photo-gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.photo-gallery-modal.is-open {
  opacity: 1;
  pointer-events: all;
}

.photo-gallery-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 220px;
  grid-template-rows: 56px minmax(0, 1fr) 112px;
  grid-template-areas:
    "topbar topbar topbar"
    "albums stage meta"
    "film film film";
  width: 80vw;
  height: 80vh;
  max-width: 100%;
  max-height: 100%;
  background: #141414;
  color: #f5f5f5;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.photo-gallery-panel.is-grid-view {
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: 56px minmax(0, 1fr);
  grid-template-areas:
    "topbar topbar"
    "albums grid";
}

.photo-gallery-modal.is-open .photo-gallery-panel {
  transform: scale(1) translateY(0);
}

/* ── Top bar ── */

.photo-gallery-topbar {
  grid-area: topbar;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: #1a1a1a;
}

.photo-gallery-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: start;
}

.photo-gallery-view-toggles {
  display: flex;
  align-items: center;
  gap: 6px;
}

.photo-gallery-view-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(245, 245, 245, 0.45);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.photo-gallery-view-btn:hover {
  color: rgba(245, 245, 245, 0.85);
  background: rgba(255, 255, 255, 0.06);
}

.photo-gallery-view-btn.is-active {
  background: #2a2a2a;
  color: #3b82f6;
}

.photo-gallery-total-count {
  font-family: var(--font-main, 'Karla', sans-serif);
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(245, 245, 245, 0.5);
  font-variant-numeric: tabular-nums;
}

.photo-gallery-title {
  margin: 0;
  justify-self: center;
  font-family: var(--font-main, 'Karla', sans-serif);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(245, 245, 245, 0.85);
  text-align: center;
  max-width: min(60vw, 420px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-gallery-close {
  justify-self: end;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease;
}

.photo-gallery-close:hover {
  color: rgba(255, 255, 255, 0.9);
}

/* ── Albums sidebar ── */

.photo-gallery-albums {
  grid-area: albums;
  padding: 20px 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
}

.photo-gallery-albums-heading {
  margin: 0 0 14px;
  font-family: var(--font-main, 'Karla', sans-serif);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(245, 245, 245, 0.4);
}

.photo-gallery-albums-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.photo-gallery-album-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(245, 245, 245, 0.72);
  font-family: var(--font-main, 'Karla', sans-serif);
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.photo-gallery-album-btn-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.photo-gallery-album-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.photo-gallery-album-btn-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-gallery-album-btn-count {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: rgba(245, 245, 245, 0.4);
  font-size: 0.85rem;
  font-weight: 500;
}

.photo-gallery-album-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f5f5f5;
}

.photo-gallery-album-btn:hover .photo-gallery-album-btn-count {
  color: rgba(245, 245, 245, 0.55);
}

.photo-gallery-album-btn.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.photo-gallery-album-btn.is-active .photo-gallery-album-btn-count {
  color: rgba(245, 245, 245, 0.65);
}

/* ── Center stage ── */

.photo-gallery-stage {
  grid-area: stage;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 0;
  background:
    radial-gradient(ellipse at center, #1c1c1c 0%, #101010 70%);
}

.photo-gallery-main {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  user-select: none;
  -webkit-user-drag: none;
}

/* ── Metadata sidebar ── */

.photo-gallery-meta {
  grid-area: meta;
  padding: 24px 20px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
}

.photo-gallery-meta-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.photo-gallery-meta-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.photo-gallery-meta-row dt {
  margin: 0;
  font-family: var(--font-main, 'Karla', sans-serif);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(245, 245, 245, 0.4);
}

.photo-gallery-meta-row dd {
  margin: 0;
  font-family: var(--font-main, 'Karla', sans-serif);
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(245, 245, 245, 0.92);
  word-break: break-word;
}

/* ── Filmstrip ── */

.photo-gallery-filmstrip {
  grid-area: film;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  overflow-x: auto;
  overflow-y: hidden;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: #1a1a1a;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.photo-gallery-thumb {
  flex: 0 0 auto;
  width: 84px;
  height: 84px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #0e0e0e;
  overflow: hidden;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    transform 0.15s ease,
    opacity 0.15s ease;
  opacity: 0.72;
}

.photo-gallery-thumb:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.photo-gallery-thumb.is-active {
  border-color: #3b82f6;
  opacity: 1;
}

.photo-gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* ── Grid view ── */

.photo-gallery-grid {
  grid-area: grid;
  display: none;
  align-content: start;
  gap: 20px 16px;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(ellipse at center, #1c1c1c 0%, #101010 70%);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.photo-gallery-panel.is-grid-view .photo-gallery-stage,
.photo-gallery-panel.is-grid-view .photo-gallery-meta,
.photo-gallery-panel.is-grid-view .photo-gallery-filmstrip {
  display: none;
}

.photo-gallery-panel.is-grid-view .photo-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.photo-gallery-grid-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.photo-gallery-grid-item:hover .photo-gallery-grid-thumb {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.photo-gallery-grid-thumb {
  aspect-ratio: 1;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #0e0e0e;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  margin-bottom: 2px;
}

.photo-gallery-grid-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.photo-gallery-grid-title {
  margin: 0;
  font-family: var(--font-main, 'Karla', sans-serif);
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(245, 245, 245, 0.92);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.photo-gallery-grid-album {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-family: var(--font-main, 'Karla', sans-serif);
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(245, 245, 245, 0.45);
  line-height: 1.2;
}

/* ── Mobile ── */

@media (max-width: 768px) {
  .photo-gallery-modal {
    padding: 0;
  }

  .photo-gallery-panel {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    grid-template-columns: 1fr;
    grid-template-rows: 52px auto minmax(0, 1fr) auto 96px;
    grid-template-areas:
      "topbar"
      "albums"
      "stage"
      "meta"
      "film";
  }

  .photo-gallery-panel.is-grid-view {
    grid-template-columns: 1fr;
    grid-template-rows: 52px auto minmax(0, 1fr);
    grid-template-areas:
      "topbar"
      "albums"
      "grid";
  }

  .photo-gallery-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 10px;
    min-width: 0;
    position: relative;
  }

  .photo-gallery-topbar-left {
    flex: 0 0 auto;
    gap: 0;
    min-width: 0;
    z-index: 1;
  }

  .photo-gallery-view-btn {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
  }

  .photo-gallery-total-count {
    display: none;
  }

  .photo-gallery-title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    max-width: calc(100% - 120px);
    flex: none;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
    text-align: center;
    pointer-events: none;
  }

  .photo-gallery-close {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    z-index: 1;
  }

  .photo-gallery-albums {
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .photo-gallery-albums-heading {
    display: none;
  }

  .photo-gallery-albums-nav {
    flex-direction: row;
    gap: 8px;
    width: max-content;
  }

  .photo-gallery-album-btn {
    width: auto;
    white-space: nowrap;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
    gap: 8px;
  }

  .photo-gallery-album-btn.is-active {
    background: rgba(255, 255, 255, 0.14);
  }

  .photo-gallery-stage {
    padding: 16px;
  }

  .photo-gallery-meta {
    padding: 14px 16px 10px;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .photo-gallery-meta-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
  }

  .photo-gallery-filmstrip {
    padding: 10px 12px;
  }

  .photo-gallery-thumb {
    width: 72px;
    height: 72px;
  }

  .photo-gallery-panel.is-grid-view .photo-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    padding: 16px;
    gap: 14px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .photo-gallery-modal,
  .photo-gallery-panel,
  .photo-gallery-thumb,
  .photo-gallery-grid-thumb {
    transition: none;
  }

  .photo-gallery-panel {
    transform: none;
  }
}
