/* CGI Detroit Photos — a full-screen shuffling photo frame.
   Deliberately dark-only: this is a picture frame, so anything that isn't the
   photograph stays out of the way. */

:root {
  --fade: 1100ms;          /* crossfade between photos */
  --ui-fade: 240ms;
  --ink: rgba(255, 255, 255, 0.96);
  --ink-dim: rgba(255, 255, 255, 0.62);
  --glass: rgba(14, 14, 16, 0.52);
  --glass-line: rgba(255, 255, 255, 0.14);
  --shadow: 0 2px 18px rgba(0, 0, 0, 0.85);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.idle { cursor: none; }

/* ── stage ───────────────────────────────────────────────────────────────── */
.stage { position: fixed; inset: 0; }

.layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--fade) ease-in-out;
}
.layer.on { opacity: 1; }

/* A heavily blurred, dimmed copy of the same photo fills the letterbox gaps,
   so a portrait shot on a landscape screen still looks composed. It is fetched
   at thumbnail size — the blur makes the resolution irrelevant. */
.backdrop {
  position: absolute;
  inset: -8%;
  width: 116%;
  height: 116%;
  object-fit: cover;
  filter: blur(56px) saturate(1.25) brightness(0.42);
  transform: translateZ(0);
}

.photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;   /* never crop — see also the =w-h rendition request */
  object-position: center;
}

/* ── caption ─────────────────────────────────────────────────────────────── */
.caption {
  position: fixed;
  left: max(28px, env(safe-area-inset-left));
  bottom: max(26px, env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: min(62vw, 720px);
  padding: 13px 20px 14px;
  border: 1px solid var(--glass-line);
  border-radius: 15px;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  color: var(--ink);
  text-decoration: none;
  text-shadow: var(--shadow);
  transition: opacity var(--ui-fade) ease, transform var(--ui-fade) ease, background var(--ui-fade) ease;
}
.caption:hover { background: rgba(22, 22, 26, 0.72); transform: translateY(-1px); }
.caption.hide { opacity: 0; pointer-events: none; }

.caption-name {
  font-size: clamp(17px, 2.1vw, 27px);
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.18;
}
.caption-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: clamp(11.5px, 1.1vw, 14px);
  font-weight: 500;
  color: var(--ink-dim);
  letter-spacing: 0.035em;
  text-transform: uppercase;
}
.caption-out {
  width: 12px; height: 12px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.75;
}

/* ── controls ────────────────────────────────────────────────────────────── */
.controls {
  position: fixed;
  right: max(28px, env(safe-area-inset-right));
  bottom: max(26px, env(safe-area-inset-bottom));
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 9px;
  border: 1px solid var(--glass-line);
  border-radius: 15px;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  transition: opacity var(--ui-fade) ease, transform var(--ui-fade) ease;
}
.controls.hide { opacity: 0; transform: translateY(6px); pointer-events: none; }

.controls button {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 140ms ease;
}
.controls button:hover { background: rgba(255, 255, 255, 0.14); }
.controls button:active { background: rgba(255, 255, 255, 0.22); }
.controls svg {
  width: 21px; height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#icoPlay { fill: currentColor; stroke: none; }

.ctl-sep { width: 1px; height: 22px; margin: 0 4px; background: var(--glass-line); }

.ctl-speed {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-left: 4px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.ctl-speed select {
  padding: 5px 7px;
  border: 1px solid var(--glass-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.ctl-count {
  padding: 0 10px 0 8px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── progress hairline ───────────────────────────────────────────────────── */
.progress {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 7;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  transition: opacity var(--ui-fade) ease;
}
.progress.hide { opacity: 0; }
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: rgba(255, 255, 255, 0.75);
}

/* ── boot ────────────────────────────────────────────────────────────────── */
.boot {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  gap: 11px;
  justify-items: center;
  background: #000;
  transition: opacity 620ms ease;
}
.boot.gone { opacity: 0; pointer-events: none; }
.boot-mark {
  font-size: clamp(20px, 3vw, 34px);
  font-weight: 300;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
}
.boot-msg {
  font-size: 12.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}
.boot-msg.error { color: #ff8b7a; text-transform: none; letter-spacing: 0.02em; font-size: 14px; max-width: 30rem; text-align: center; line-height: 1.5; }

@media (max-width: 640px) {
  .caption { max-width: calc(100vw - 32px); left: 16px; bottom: 74px; }
  .controls { right: 16px; bottom: 16px; left: 16px; justify-content: center; }
  .ctl-count { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  :root { --fade: 1ms; }
  .layer { transition: none; }
}
