/* Fotodrop – live slideshow. Always dark: it runs on a projector or TV. */

html.ss-root {
  color-scheme: dark;
  --bg: #0d0b0a;
  --bg-elevated: #1d1916;
  --bg-sunken: #0a0908;
  --text: #f4ede4;
  --text-muted: #b9ad9f;
  --border: #3a332c;
  --accent: #c9a56d;
  --accent-strong: #ddbb84;
  --accent-contrast: #1b1612;
  --accent-soft: #3a2f22;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .5), 0 18px 48px rgba(0, 0, 0, .5);
  --fade: 1.2s;
  --kb: 9.2s;
  --edge-x: max(3.2vw, 20px);
  --edge-y: max(3.4vh, 18px);
  height: 100%;
  background: #000;
}

body.ss {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #000;
  color: var(--text);
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* ------------------------------------------------------------------ stage */

.stage {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  overflow: hidden;
  background: #000;
}

.layer {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  overflow: hidden;
  opacity: 0;
  transition: none;
  will-change: opacity;
  pointer-events: none;
}
.layer.is-visible {
  opacity: 1;
  transition: opacity var(--fade) ease-in-out;
}

/* Blurred, darkened fill behind the sharp photo (made from the small thumb). */
.layer-bg {
  position: absolute;
  top: -8%; right: -8%; bottom: -8%; left: -8%;
  background: #000 center / cover no-repeat;
  filter: blur(38px) brightness(.48) saturate(1.15);
  transform: translateZ(0);
}
.ss.no-blur .layer-bg { display: none; }

.layer-fg {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}
.ss.kb .layer-fg { will-change: transform; }
.ss.kb .layer.is-visible .layer-fg { animation: ss-kenburns var(--kb) linear both; }
.ss.is-paused .layer-fg,
.ss.is-hidden-tab .layer-fg { animation-play-state: paused !important; }

@keyframes ss-kenburns {
  from { transform: scale3d(1, 1, 1); }
  to { transform: scale3d(1.06, 1.06, 1); }
}

/* Soft gradient at the bottom so captions and the QR card stay readable. */
.shade {
  position: absolute;
  z-index: 3;
  left: 0; right: 0; bottom: 0;
  height: 34%;
  background: linear-gradient(to top, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, .22) 45%, rgba(0, 0, 0, 0) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .6s ease;
}
.ss[data-view="show"] .shade { opacity: 1; }
.ss.no-overlays .shade { opacity: 0; }

/* ------------------------------------------------------------------ caption */

.caption {
  position: absolute;
  z-index: 4;
  left: max(var(--edge-x), env(safe-area-inset-left));
  bottom: max(var(--edge-y), env(safe-area-inset-bottom));
  max-width: 46vw;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.1vh;
  opacity: 1;
  transition: opacity .45s ease, transform .45s var(--ease);
  pointer-events: none;
}
.caption.is-out {
  opacity: 0;
  transform: translateY(6px);
}

.caption-name {
  display: flex;
  align-items: baseline;
  gap: .45em;
  max-width: 100%;
  font-family: var(--font-display);
  font-size: clamp(18px, 3.3vh, 44px);
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55), 0 2px 18px rgba(0, 0, 0, .5);
}
.caption-icon {
  flex: none;
  font-size: .8em;
}
#caption-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-new {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  padding: .32em .9em .34em;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font: 700 clamp(13px, 2.1vh, 26px) / 1 var(--font-body);
  letter-spacing: .16em;
  text-transform: uppercase;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .35);
  animation: ss-badge-in .7s var(--ease) both;
}
.badge-new::before {
  content: "";
  width: .5em;
  height: .5em;
  border-radius: 50%;
  background: currentColor;
  opacity: .75;
}
@keyframes ss-badge-in {
  from { opacity: 0; transform: scale(.85); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ QR card */

.qr-card {
  position: absolute;
  z-index: 4;
  right: max(var(--edge-x), env(safe-area-inset-right));
  bottom: max(var(--edge-y), env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .9vh;
  padding: clamp(8px, 1.3vh, 16px) clamp(8px, 1.3vh, 16px) clamp(8px, 1.1vh, 14px);
  border-radius: clamp(12px, 1.8vh, 22px);
  background: #fffdf9;
  color: #2b2520;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .45);
  pointer-events: none;
}
.qr-card .qr-code {
  width: clamp(92px, 17vh, 240px);
  height: clamp(92px, 17vh, 240px);
}
.qr-caption {
  font-family: var(--font-display);
  font-size: clamp(13px, 1.9vh, 26px);
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  padding: 0 .3em;
}

.qr-image {
  background: #fff center / contain no-repeat;
}
.ss.has-qr .qr-image { background-image: url("/api/qr.svg"); }

/* ------------------------------------------------------------------ chips */

.chip {
  position: absolute;
  z-index: 4;
  top: max(var(--edge-y), env(safe-area-inset-top));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(15, 12, 10, .62);
  color: rgba(255, 255, 255, .88);
  font-size: clamp(13px, 1.6vh, 18px);
  font-weight: 600;
  pointer-events: none;
}
.chip svg { width: 1.1em; height: 1.1em; }
.chip-paused { left: max(var(--edge-x), env(safe-area-inset-left)); }
.chip-offline { right: max(var(--edge-x), env(safe-area-inset-right)); }
.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e0aa4f;
  animation: ss-pulse 2s ease-in-out infinite;
}
@keyframes ss-pulse {
  50% { opacity: .35; }
}

/* ------------------------------------------------------------------ full screens (empty, message, loading) */

.screen {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: max(var(--space-5), env(safe-area-inset-top)) max(var(--space-4), env(safe-area-inset-right)) max(var(--space-5), env(safe-area-inset-bottom)) max(var(--space-4), env(safe-area-inset-left));
  text-align: center;
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(201, 165, 109, .16) 0%, rgba(201, 165, 109, 0) 70%),
    radial-gradient(70% 60% at 50% 110%, rgba(201, 165, 109, .08) 0%, rgba(201, 165, 109, 0) 70%),
    #0d0b0a;
  animation: ss-screen-in .8s var(--ease) both;
}
@keyframes ss-screen-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.screen-inner {
  width: 100%;
  max-width: 900px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.eyebrow {
  margin-bottom: 1.4vh;
  font-size: clamp(11px, 1.5vh, 16px);
  font-weight: 600;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--accent);
}

.screen-title {
  font-size: clamp(2rem, 7vh, 5rem);
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.screen-title-sm { font-size: clamp(1.6rem, 5vh, 3.2rem); }

.screen-subtitle {
  margin-top: 1vh;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1rem, 2.6vh, 1.9rem);
  color: var(--text-muted);
}

.screen .ornament {
  width: 260px;
  max-width: 60vw;
  margin: 2.6vh auto;
}

.empty-qr {
  padding: clamp(10px, 2vh, 22px);
  border-radius: clamp(16px, 2.6vh, 28px);
  background: #fff;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(201, 165, 109, .35);
}
.empty-qr .qr-image {
  width: clamp(170px, 40vh, 440px);
  height: clamp(170px, 40vh, 440px);
  max-width: 72vw;
  max-height: 72vw;
}

.empty-text {
  max-width: 24em;
  margin-top: 3.2vh;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 3vh, 2.1rem);
  line-height: 1.3;
  color: var(--text);
  text-wrap: balance;
}

.message-mark {
  width: clamp(52px, 8vh, 80px);
  height: clamp(52px, 8vh, 80px);
  margin-bottom: 2vh;
  color: var(--accent);
}

.screen-text {
  max-width: 30em;
  font-size: clamp(1rem, 2.2vh, 1.35rem);
  color: var(--text-muted);
  text-wrap: pretty;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
}
.message-actions:empty { display: none; }

.screen-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: 4vh;
  font-size: clamp(11px, 1.4vh, 15px);
  letter-spacing: .04em;
  color: var(--text-muted);
  opacity: .75;
}
.screen-brand .wordmark {
  width: auto;
  height: 2.2em;
  aspect-ratio: 332 / 142;
}

.screen-loading {
  color: var(--accent);
  animation-delay: .3s;
}
.screen-loading .spinner {
  width: 34px;
  height: 34px;
  border-width: 2px;
}

/* ------------------------------------------------------------------ controls */

.controls {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: max(var(--edge-y), calc(env(safe-area-inset-bottom) + 12px));
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(22, 19, 16, .78);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .08);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 14px);
  transition: opacity .35s ease, transform .35s var(--ease), visibility 0s linear .35s;
}
.ss.controls-visible .controls {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity .25s ease, transform .25s var(--ease), visibility 0s;
}

.ctrl {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #f4ede4;
  cursor: pointer;
  transition: background-color .2s ease, transform .1s ease;
}
.ctrl svg { width: 26px; height: 26px; }
.ctrl:hover { background: rgba(255, 255, 255, .1); }
.ctrl:active { transform: scale(.94); }
.ctrl:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.ctrl-main {
  width: 60px;
  height: 60px;
  background: var(--accent);
  color: var(--accent-contrast);
}
.ctrl-main:hover { background: var(--accent-strong); }

.icon-play { display: none; }
.ss.is-paused .icon-play { display: block; }
.ss.is-paused .icon-pause { display: none; }
.icon-shrink { display: none; }
.ss.is-fullscreen .icon-shrink { display: block; }
.ss.is-fullscreen .icon-expand { display: none; }

.ctrl-sep {
  width: 1px;
  height: 28px;
  margin: 0 4px;
  background: rgba(255, 255, 255, .16);
}

.ctrl-info {
  padding: 0 10px 0 4px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
}
.ctrl-info:empty { display: none; }

/* Nothing to navigate when there are no photos. */
.ss:not([data-view="show"]) #btn-prev,
.ss:not([data-view="show"]) #btn-play,
.ss:not([data-view="show"]) #btn-next,
.ss:not([data-view="show"]) .ctrl-sep { display: none; }

.ss.is-idle,
.ss.is-idle * { cursor: none !important; }

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed;
  z-index: 12;
  top: max(var(--edge-y), calc(env(safe-area-inset-top) + 12px));
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(22, 19, 16, .86);
  color: var(--text);
  font-size: 15px;
  box-shadow: var(--shadow);
  text-align: center;
}

.noscript {
  position: fixed;
  top: 50%; left: 0; right: 0;
  z-index: 20;
  padding: 0 var(--space-4);
  text-align: center;
  color: #f4ede4;
}

/* ------------------------------------------------------------------ small / portrait screens */

@media (max-width: 899px) {
  .controls {
    top: max(var(--edge-y), calc(env(safe-area-inset-top) + 12px));
    bottom: auto;
    transform: translate(-50%, -14px);
  }
  .chip { top: auto; bottom: calc(max(var(--edge-y), env(safe-area-inset-bottom)) + 8px); }
  .chip-paused { display: none; }
  .chip-offline { left: 50%; right: auto; transform: translateX(-50%); top: max(var(--edge-y), env(safe-area-inset-top)); bottom: auto; }
  .ss.controls-visible .chip-offline { visibility: hidden; }
}

@media (max-width: 560px) {
  .ctrl { width: 46px; height: 46px; }
  .ctrl-main { width: 52px; height: 52px; }
  .ctrl-info { display: none; }
  .ctrl-sep { display: none; }
  .caption { max-width: 52vw; }
  .qr-card .qr-code { width: 84px; height: 84px; }
  .qr-caption { font-size: 12px; white-space: normal; max-width: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  .chip-dot { animation: none; }
}
