.window:has(.photo-app) { --window-bg: #10171d; --hover: #24313a; }
.window:has(.photo-app) .window-titlebar { color: #d7e7ef; }
.window:has(.photo-app) .window-title { font-size: 12px; }
.photo-app {
  --photo-surface: #10171d;
  --photo-surface-raised: #17232c;
  --photo-surface-hover: #21313d;
  --photo-border: rgba(181, 210, 224, 0.16);
  --photo-text: #edf6fa;
  --photo-muted: #9aadb8;
  --photo-accent: #4cd6c0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--photo-text);
  background:
    radial-gradient(circle at 50% 28%, rgba(31, 84, 89, 0.2), transparent 42%),
    var(--photo-surface);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.photo-app [hidden] { display: none !important; }

.photo-toolbar,
.photo-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border-color: var(--photo-border);
  background: rgba(16, 23, 29, 0.88);
  backdrop-filter: blur(14px);
}

.photo-toolbar {
  min-height: 52px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--photo-border);
}

.photo-toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.photo-toolbar-group:last-child { margin-left: auto; }

.photo-app-label { font-weight: 650; }
.photo-fullscreen-name {
  display: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photo-app:fullscreen .photo-fullscreen-name { display: block; }
.photo-toolbar-group:first-child .photo-button { flex-shrink: 0; }

.photo-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 34px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--photo-text);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 620;
  line-height: 1;
  cursor: pointer;
  transition: background-color 130ms ease, border-color 130ms ease, color 130ms ease, transform 130ms ease;
}

.photo-button:hover {
  border-color: rgba(130, 220, 210, 0.28);
  background: var(--photo-surface-hover);
}

.photo-button:active { transform: scale(0.96); }

.photo-button:focus-visible,
.photo-tile:focus-visible,
.photo-zoom input:focus-visible {
  outline: 2px solid var(--photo-accent);
  outline-offset: 2px;
}

.photo-button:disabled { opacity: 0.45; cursor: default; }

.photo-stage {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  padding: 14px;
  isolation: isolate;
  background: #10191f;
}

.photo-stage::before {
  position: absolute;
  z-index: -1;
  width: min(72vw, 900px);
  height: min(70vh, 640px);
  border-radius: 50%;
  background: rgba(39, 130, 128, 0.14);
  content: '';
  filter: blur(80px);
  pointer-events: none;
}

.photo-media {
  display: block;
  max-width: none;
  max-height: none;
  min-width: 1px;
  min-height: 1px;
  border: 1px solid rgba(220, 243, 248, 0.17);
  border-radius: 4px;
  background: #071015;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
  object-fit: contain;
  transform-origin: center center;
  transition: box-shadow 140ms ease;
  user-select: none;
  -webkit-user-drag: none;
}

.photo-image { grid-area: 1 / 1; touch-action: none; }
.photo-video {
  grid-area: 1 / 1;
  max-width: 100%;
  max-height: 100%;
  outline: 1px solid rgba(96, 216, 204, 0.17);
}

.photo-stage.is-zoomed .photo-media { box-shadow: 0 24px 56px rgba(0, 0, 0, 0.58); }
.photo-stage.is-zoomed { cursor: grab; }
.photo-stage.is-panning { cursor: grabbing; }

.photo-empty {
  display: grid;
  max-width: 350px;
  gap: 10px;
  place-items: center;
  color: var(--photo-muted);
  text-align: center;
}

.photo-nav {
  position: absolute;
  z-index: 2;
  top: calc(50% - 26px);
  display: grid;
  width: 39px;
  height: 52px;
  place-items: center;
  border: 1px solid rgba(221, 246, 247, 0.16);
  border-radius: 12px;
  color: var(--photo-text);
  background: rgba(14, 25, 32, 0.76);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  font-size: 22px;
  opacity: 0.72;
  transition: opacity 150ms ease, background-color 150ms ease;
}

.photo-stage:hover .photo-nav,
.photo-nav:focus-visible { opacity: 1; }
@media (hover: none) { .photo-nav { opacity: 1; } }
.photo-nav:hover { background: #28404a; }
.photo-nav:active { transform: none; }
.photo-nav-prev { left: 18px; }
.photo-nav-next { right: 18px; }

.photo-footer {
  min-height: 46px;
  padding: 6px 13px;
  border-top: 1px solid var(--photo-border);
}

.photo-metadata {
  min-width: 0;
  overflow: hidden;
  color: var(--photo-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-metadata span + span::before { content: ' · '; padding-inline: 6px; }

.photo-info {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  display: grid;
  max-width: min(290px, 85%);
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--photo-border);
  border-radius: 10px;
  color: var(--photo-muted);
  background: var(--photo-surface-raised);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.photo-info strong { color: var(--photo-text); }

.photo-zoom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 3px 4px 3px 8px;
  border: 1px solid var(--photo-border);
  border-radius: 9px;
  background: rgba(30, 47, 57, 0.72);
}

.photo-zoom .photo-zoom-value {
  min-width: 40px;
  color: var(--photo-text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.photo-zoom input {
  width: clamp(72px, 10vw, 130px);
  accent-color: var(--photo-accent);
  cursor: pointer;
}

.photo-gallery { overflow: auto; padding: 18px; }
.photo-gallery-title { margin: 0 0 12px; font-size: 15px; }
.photo-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 10px;
}

.photo-tile {
  display: grid;
  grid-template-rows: 110px auto;
  gap: 8px;
  min-width: 0;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--photo-text);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.photo-tile:hover {
  border-color: rgba(76, 214, 192, 0.48);
  background: rgba(67, 153, 148, 0.14);
}

.photo-tile-thumbnail {
  width: 100%;
  height: 110px;
  border-radius: 8px;
  background: var(--photo-surface-raised);
  object-fit: cover;
}

.photo-tile-placeholder {
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--photo-accent);
  background: var(--photo-surface-raised);
}
.photo-tile-label {
  overflow: hidden;
  color: var(--photo-text);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@container (max-width: 540px) {
  .photo-toolbar { gap: 5px; padding-inline: 7px; }
  .photo-toolbar-group { gap: 1px; }
  .photo-button { min-width: 31px; min-height: 31px; padding: 6px 7px; }
  .photo-button .photo-button-label { display: none; }
  .photo-nav { top: calc(50% - 22px); width: 34px; height: 44px; }
  .photo-nav-prev { left: 8px; }
  .photo-nav-next { right: 8px; }
  .photo-footer { gap: 7px; padding-inline: 8px; }
  .photo-metadata { max-width: 42%; }
  .photo-zoom input { width: 60px; }
  .photo-gallery { padding: 10px; }
  .photo-tiles { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
}
