:root {
  --ui-bg: rgba(0, 0, 0, 0.38);
  --ui-br: 1px solid rgba(255, 255, 255, 0.18);
  --ui-blur: blur(10px);
  --ui-size: 52px;
  --ui-gap: 10px;
  --fade-ms: 280ms;
  --hide-ui-ms: 1500ms;
  --topbar-height: 48px;
  --bottombar-height: 48px;
  --controls-reserved: 92px;
}

html,
body {
  height: 100%;
  min-height: 100%;
  min-height: -webkit-fill-available;
  margin: 0;
  background:
    radial-gradient(1300px 800px at 50% -25%, rgba(124, 145, 156, 0.10), transparent 60%),
    linear-gradient(180deg, #2A2A2E 0%, #1A1A1D 100%);
  overflow: hidden;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100svh;
  min-height: 100dvh;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
}

#slideshowStage {
  position: relative;
  flex: 1 1 auto;
  background:
    radial-gradient(1300px 800px at 50% -25%, rgba(124, 145, 156, 0.10), transparent 60%),
    linear-gradient(180deg, #2A2A2E 0%, #1A1A1D 100%);
  padding-top: 24px;
  padding-bottom: env(safe-area-inset-bottom);
  min-height: 0;
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 24px 0 0;
  width: 100%;
  height: calc(100% - 24px);
  object-fit: contain;
  background: transparent;
  opacity: 0;
  transition: opacity var(--fade-ms) ease;
  will-change: opacity;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 10;
}

.slide.show {
  opacity: 1;
}

#slideshowTopbar {
  position: sticky;
  top: 0;
  z-index: 9500;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(26, 26, 29, 0.85);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  flex: 1 1 auto;
}

.title {
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.is-fullscreen #slideshowTopbar {
  display: none;
}

body.is-fullscreen {
  --topbar-height: 0px;
  --bottombar-height: 0px;
}

#logoWrap {
  position: fixed;
  z-index: 9000;
  overflow: hidden;
  pointer-events: none;
  display: none;
}

#signature {
  position: absolute;
  top: 0;
  right: 0;
  width: min(24vw, 300px);
  height: auto;
  max-height: none;
  object-fit: contain;
  opacity: 0.7;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

body.logo-dh #signature {
  opacity: 1;
}

#gallerySignatureWrap {
  position: fixed;
  z-index: 9050;
  overflow: hidden;
  pointer-events: none;
  display: none;
}

#gallerySignature {
  position: absolute;
  left: auto;
  top: auto;
  right: 3.5%;
  bottom: 3.5%;
  width: auto;
  height: 22%;
  max-width: 60%;
  object-fit: contain;
  opacity: 0.75;
  pointer-events: none;
  display: none;
  z-index: 3;
  user-select: none;
  -webkit-user-drag: none;
  filter: var(--gallery-signature-shadow);
}

body.logo-always #logoWrap {
  display: block;
}

body.logo-fullscreen #logoWrap {
  display: none;
}

body.is-fullscreen.logo-fullscreen #logoWrap {
  display: block;
}

body.logo-hidden #logoWrap {
  display: none;
}

.public-share-overlay {
  z-index: 11000;
}

@media (max-width: 700px) {
  #slideshowTopbar .topbar-inner {
    flex-wrap: wrap;
    align-items: flex-start;
    row-gap: 8px;
  }

  #slideshowTopbar .topbar-left {
    width: 100%;
    min-width: 0;
  }

  #slideshowTopbar .topbar-left .app-nav {
    width: 100%;
    justify-content: flex-start;
  }

  #slideshowStage {
    padding-top: 0;
    padding-bottom: calc(var(--controls-reserved) + env(safe-area-inset-bottom));
  }

  #slideshowTopbar .share-icon-trigger {
    right: 72px;
  }

  .slide {
    inset: 0;
    height: 100%;
    object-position: center center;
  }

  #signature {
    width: min(30vw, 170px);
    top: 0;
    right: 0;
    opacity: 0.85;
  }
}

@media (pointer: coarse) and (max-width: 1024px) {
  #slideshowTopbar .topbar-inner {
    flex-wrap: wrap;
    align-items: flex-start;
    row-gap: 8px;
  }

  #slideshowTopbar .topbar-left {
    width: 100%;
    min-width: 0;
  }

  #slideshowTopbar .topbar-left .app-nav {
    position: static;
    transform: none;
    width: 100%;
    justify-content: flex-start;
  }
}

#slideshowTopbar .title.title-stacked {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#slideshowTopbar .title.title-stacked .title-client,
#slideshowTopbar .title.title-stacked .title-event {
  display: inline;
}

#slideshowTopbar .title.title-stacked .title-client::after {
  content: " - ";
}

#controls {
  position: relative;
  margin: 12px auto calc(18px + env(safe-area-inset-bottom));
  transform: translateY(0);
  display: flex;
  gap: var(--ui-gap);
  padding: 10px 12px;
  border-radius: 999px;
  border: var(--ui-br);
  background: var(--ui-bg);
  backdrop-filter: var(--ui-blur);
  -webkit-backdrop-filter: var(--ui-blur);
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 9999;
}

#fsBtn {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: var(--ui-br);
  background: var(--ui-bg);
  backdrop-filter: var(--ui-blur);
  -webkit-backdrop-filter: var(--ui-blur);
  color: #fff;
  display: grid;
  place-items: center;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 10000;
  cursor: pointer;
}

body.show-ui #controls {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

body.show-ui #fsBtn {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

body.is-fullscreen #slideshowStage {
  position: fixed;
  inset: 0;
  background: #000;
}

@media (pointer: fine) {
  body.is-fullscreen #fsBtn,
  body.is-fullscreen #controls {
    opacity: 0;
    pointer-events: none;
  }

  body.is-fullscreen.show-ui #fsBtn,
  body.is-fullscreen.show-ui #controls {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (pointer: coarse) {
  body.is-fullscreen #controls {
    opacity: 0;
    pointer-events: none;
  }

  body.is-fullscreen.show-ui #controls {
    opacity: 1;
    pointer-events: auto;
  }

  body.is-fullscreen:not(.show-ui) #controls {
    opacity: 0;
    pointer-events: none;
  }
}

body.is-fullscreen #controls {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(0);
}

body.is-fullscreen.show-ui #controls {
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 700px) {
  body:not(.is-fullscreen) #controls {
    position: fixed;
    left: 50%;
    bottom: calc(10px + env(safe-area-inset-bottom));
    margin: 0;
    transform: translateX(-50%);
  }
}

body.hide-cursor {
  cursor: none;
}

.btn {
  width: var(--ui-size);
  height: var(--ui-size);
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.18s ease;
  user-select: none;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn:active {
  transform: scale(0.98);
}

.btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  body.is-fullscreen #controls {
    bottom: 12px;
  }
}
