/* Slideshow review. Tokens follow the homepage light and dark themes. */
html.slideshow-open,
html.slideshow-open body {
  overflow: hidden !important;
  height: 100%;
}

.slideshow-root {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg, #121212);
  color: var(--text, #f3f3f3);
  font-family: var(--font, Montserrat, sans-serif);
}

.slideshow-root[hidden] {
  display: none !important;
}

.slideshow-setup,
.slideshow-show {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: max(12px, env(safe-area-inset-top, 0px))
    max(12px, env(safe-area-inset-right, 0px))
    max(12px, env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left, 0px));
}

.slideshow-setup {
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.slideshow-card {
  width: min(560px, 100%);
  margin: 0 auto;
  box-sizing: border-box;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--b16-line, var(--border));
  border-radius: 12px;
  background: var(--b16-panel, var(--card-bg));
  color: var(--b16-ink, var(--text));
}

.slideshow-card h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.slideshow-note,
.slideshow-count,
.slideshow-email,
.slideshow-loading,
.slideshow-empty p {
  margin: 0;
}

.slideshow-note,
.slideshow-empty-option {
  color: var(--b16-muted, var(--text-muted));
  font-size: 13px;
}

.slideshow-count {
  font-weight: 600;
}

.slideshow-field {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.slideshow-field legend,
.slideshow-field > label {
  padding: 0;
  font-size: 13px;
  font-weight: 700;
}

.slideshow-field input[type="search"],
.slideshow-field select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--b16-line, var(--border));
  border-radius: 8px;
  background: var(--input-bg, var(--b16-panel));
  color: inherit;
  font: inherit;
  font-size: 16px;
}

.slideshow-options {
  max-height: min(140px, 18vh);
  overflow: auto;
  border: 1px solid var(--b16-line, var(--border));
  border-radius: 8px;
}

.slideshow-options label,
.slideshow-chip,
.slideshow-btn,
.slideshow-seg label {
  min-height: 44px;
  min-width: 44px;
}

.slideshow-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  cursor: pointer;
}

.slideshow-options input {
  width: 20px;
  height: 20px;
  flex: none;
}

.slideshow-empty-option {
  margin: 0;
  padding: 12px;
}

.slideshow-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.slideshow-chips:empty {
  display: none;
}

.slideshow-chip,
.slideshow-btn,
.slideshow-seg label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0 12px;
  border: 1px solid var(--b16-line, var(--border));
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.slideshow-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.slideshow-seg label {
  position: relative;
}

.slideshow-seg input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.slideshow-seg label:has(input:checked),
.slideshow-btn-primary {
  background: var(--wire-fill, var(--wire-accent, var(--b16-accent-bg)));
  color: var(--wire-on-fill, #fff);
  border-color: transparent;
}

body:not(.wireframe-shell) .slideshow-seg label:has(input:checked),
body:not(.wireframe-shell) .slideshow-btn-primary {
  background: var(--b16-accent-bg, #111);
  color: var(--b16-accent-text, #fff);
}

.slideshow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.slideshow-actions .slideshow-btn {
  flex: 1 1 120px;
}

.slideshow-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.slideshow-root :focus-visible,
.slideshow-seg label:has(input:focus-visible) {
  outline: 2px solid var(--b16-ink, currentColor);
  outline-offset: 2px;
}

.slideshow-show {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.slideshow-stage {
  flex: 1 1 auto;
  display: grid;
  gap: 4px;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.slideshow-tile {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--b16-soft, var(--card-bg));
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.slideshow-tile:focus-visible {
  outline-offset: -3px;
}

.slideshow-root button.slideshow-tile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  height: 100%;
}

.slideshow-photo {
  position: relative;
  display: block;
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

/* Preserve the whole profile photo in every slideshow layout. */
html.slideshow-open #slideshowRoot .slideshow-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain !important;
  object-position: center !important;
  background: var(--b16-soft, #222);
}

.slideshow-name {
  flex: 0 0 auto;
  padding: 4px 6px 6px;
  font-size: clamp(12px, 2vw, 16px);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slideshow-tile.is-swap .slideshow-photo img {
  animation: slideshow-fade 120ms linear;
}

@keyframes slideshow-fade {
  from {
    opacity: 0.72;
  }
  to {
    opacity: 1;
  }
}

.slideshow-detail {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.62);
}

.slideshow-detail .slideshow-card {
  width: min(420px, 100%);
}

.slideshow-email {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.slideshow-empty,
.slideshow-loading {
  display: grid;
  place-items: center;
  gap: 12px;
  text-align: center;
}

@media (max-height: 760px) {
  .slideshow-setup {
    padding: max(8px, env(safe-area-inset-top, 0px))
      max(8px, env(safe-area-inset-right, 0px))
      max(8px, env(safe-area-inset-bottom, 0px))
      max(8px, env(safe-area-inset-left, 0px));
  }
  .slideshow-card {
    gap: 8px;
    padding: 12px;
  }
  .slideshow-options {
    max-height: 84px;
  }
}

@media (min-width: 768px) {
  .slideshow-stage {
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .slideshow-root,
  .slideshow-root * {
    transition: none !important;
    animation: none !important;
  }
}

.slideshow-detail {
  overflow: auto;
}
.slideshow-detail .slideshow-card {
  max-height: 100%;
  overflow: auto;
}
.slideshow-detail h2,
.slideshow-review-status {
  overflow-wrap: anywhere;
}
.slideshow-review-status {
  font-size: 14px;
  line-height: 1.5;
}
.slideshow-detail button[aria-pressed="true"] {
  border-color: var(--primary, #e87920);
}

.slideshow-playback-notice {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--b16-line, var(--border));
  border-radius: 8px;
  background: var(--b16-panel, var(--card-bg, #222));
  font-size: 13px;
}
.slideshow-playback-notice[hidden] {
  display: none;
}
.slideshow-playback-notice span {
  flex: 1;
  min-width: 0;
}
.slideshow-playback-notice button {
  flex: none;
}

.slideshow-playlists {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.slideshow-playlists p,
.slideshow-playlists label {
  width: 100%;
}
.slideshow-playlists input,
.slideshow-playlists select {
  min-height: 44px;
  max-width: 100%;
}
.slideshow-show {
  position: relative;
}
/* Top corner: X closes the slideshow; the dots open the photo list. */
.slideshow-close,
.slideshow-navigation summary {
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #fff6;
  border-radius: 8px;
  background: #000a;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.slideshow-close {
  position: absolute;
  z-index: 6;
  top: max(12px, env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
}
.slideshow-navigation {
  position: absolute;
  z-index: 6;
  top: max(12px, env(safe-area-inset-top, 0px));
  right: calc(max(12px, env(safe-area-inset-right, 0px)) + 52px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  max-width: calc(100% - 88px);
  color: #fff;
}
.slideshow-navigation[open] {
  width: min(640px, calc(100% - 88px));
  max-height: 70vh;
  overflow: auto;
  background: #111e;
  padding: 8px;
  border-radius: 8px;
}
.slideshow-navigation summary {
  list-style: none;
  flex: 0 0 auto;
  align-self: flex-end;
}
.slideshow-navigation .slideshow-thumbnails {
  min-width: 0;
}
.slideshow-navigation summary::-webkit-details-marker {
  display: none;
}
.slideshow-thumbnails {
  display: flex;
  gap: 8px;
  overflow: auto;
}
.slideshow-thumbnails > div {
  flex: 0 0 110px;
}
.slideshow-thumbnails img {
  display: block;
  width: 90px;
  height: 90px;
  object-fit: contain;
}
.slideshow-navigation button {
  min-height: 44px;
  max-width: 130px;
  white-space: normal;
  margin: 3px;
}
.slideshow-show:has(.slideshow-detail) .slideshow-navigation {
  display: none;
}

.slideshow-place-field legend {
  width: 100%;
}
.slideshow-place-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--b16-line, var(--border));
  border-radius: 8px;
  background: var(--input-bg, var(--b16-panel));
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.slideshow-place-toggle:focus-visible {
  outline: 2px solid var(--accent, #f7931a);
  outline-offset: 2px;
}
.slideshow-place-panel:not([hidden]) {
  display: grid;
  gap: 8px;
}
.slideshow-place-panel[hidden] {
  display: none;
}
.slideshow-place-field > div:empty {
  display: none;
}

.slideshow-place-arrow {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  margin-right: 3px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}
.slideshow-place-toggle[aria-expanded="true"] .slideshow-place-arrow {
  transform: rotate(45deg);
}

/* Keep the existing named deletion confirmation above the fullscreen show. */
.slideshow-open .modal-overlay.confirm-sheet {
  z-index: 2200;
}
.slideshow-btn-danger {
  border-color: #c44343;
}

/* Setup hierarchy: primary choices first, optional saved tools on demand. */
.slideshow-setup .slideshow-card {
  width: min(760px, 100%);
  gap: 24px;
  padding: clamp(16px, 3vw, 28px);
}
.slideshow-setup-group {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding-top: 20px;
  border-top: 1px solid var(--b16-line, var(--border));
}
.slideshow-setup-group > h3,
.slideshow-playlist-group > h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}
.slideshow-setup .slideshow-note,
.slideshow-playlist-group p {
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
  overflow-wrap: anywhere;
}
.slideshow-playback-options,
.slideshow-location-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.slideshow-setup .slideshow-field {
  gap: 12px;
}
.slideshow-setup .slideshow-field legend {
  margin-bottom: 10px;
}
.slideshow-playlists {
  display: grid;
  gap: 16px;
  min-width: 0;
  margin: 0;
}
.slideshow-playlists .slideshow-btn {
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
  justify-content: flex-start;
  padding: 10px 14px;
  line-height: 1.4;
}
.slideshow-playlists .slideshow-presentation {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: auto;
  line-height: 1.5;
  font-size: 14px;
  min-height: 44px;
}
.slideshow-playlists .slideshow-presentation input {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 1px 0 0;
}
.slideshow-saved {
  border: 1px solid var(--b16-line, var(--border));
  border-radius: 10px;
  min-width: 0;
}
.slideshow-saved > summary {
  cursor: pointer;
  padding: 14px;
  min-height: 44px;
  box-sizing: border-box;
  font-weight: 600;
  line-height: 1.5;
}
.slideshow-playlist-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 14px;
  padding: 18px 0;
  border-top: 1px solid var(--b16-line, var(--border));
  min-width: 0;
}
.slideshow-playlist-group > h3,
.slideshow-playlist-group > p {
  grid-column: 1 / -1;
}
.slideshow-playlist-group > p:empty {
  display: none;
}
.slideshow-playlist-group > input,
.slideshow-playlist-group > select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--b16-line, var(--border));
  border-radius: 8px;
  color: inherit;
  background: var(--input-bg, var(--card-bg));
  font: inherit;
  font-size: 16px;
}
.slideshow-setup .slideshow-actions {
  gap: 12px;
}
.slideshow-setup .slideshow-count {
  line-height: 1.5;
}
@media (max-width: 540px) {
  .slideshow-playback-options,
  .slideshow-location-options,
  .slideshow-playlist-group {
    grid-template-columns: minmax(0, 1fr);
  }
}
.slideshow-playlist-group > select {
  height: 44px;
}

/* Initial selection reuses the collapsed place control, with wrapping letters. */
.slideshow-name-field .slideshow-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  max-height: min(220px, 35vh);
}
.slideshow-name-field .slideshow-place-toggle {
  flex-wrap: wrap;
}
#slideshowNameClear[hidden] {
  display: none;
}
