/* -----------------------------------------------------------------------------
 * Pics Around Me — responsive styles
 * Mobile-first (Pixel-class), with breakpoints for tablet (iPad) and desktop.
 * -------------------------------------------------------------------------- */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-mute: #64748b;
  --accent: #ea580c;
  --accent-ink: #ffffff;
  --me: #2563eb;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06),
    0 1px 1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.12),
    0 2px 6px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.2),
    0 8px 16px rgba(15, 23, 42, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --header-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #111827;
    --surface-2: #0f172a;
    --border: #1f2937;
    --ink: #f1f5f9;
    --ink-soft: #cbd5e1;
    --ink-mute: #94a3b8;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.5),
      0 2px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.6),
      0 8px 16px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family:
    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body {
  overflow: hidden;
}

.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;
}

#app {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
}

/* --- Header (floating, transparent over the map) ------------------------- */

.app-header {
  position: absolute;
  top: calc(8px + var(--safe-top));
  left: calc(12px + var(--safe-left));
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  max-width: calc(100vw - 24px - var(--safe-left) - var(--safe-right));
  pointer-events: auto;
}

.app-header.search-open {
  width: min(420px, calc(100vw - 24px - var(--safe-left) - var(--safe-right)));
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  line-height: 1;
}

.brand-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.search-form {
  flex: 1;
  min-width: 0;
}

.search-form[hidden],
.search-results[hidden] {
  display: none;
}

.search-input {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.search-input:focus {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent),
    inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.brand-search-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: none;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 140ms ease,
    transform 120ms ease;
}

.brand-search-btn:hover {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-2));
}

.brand-search-btn:active {
  transform: scale(0.94);
}

.brand-search-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.search-results {
  width: 100%;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 8px;
}

.search-result,
.search-empty {
  width: 100%;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.3;
}

.search-result {
  border: none;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.search-result:hover,
.search-result[aria-selected="true"] {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
}

.search-empty {
  color: var(--ink-mute);
}

.brand-tagline {
  margin: 0;
  font-size: 12px;
  color: var(--ink-mute);
  line-height: 1.3;
}

/* --- Map ----------------------------------------------------------------- */

#map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--surface-2);
}

/* Leaflet attribution polish */
.leaflet-control-attribution {
  background: color-mix(in srgb, var(--surface) 85%, transparent) !important;
  color: var(--ink-soft) !important;
  font-size: 11px !important;
  padding: 2px 6px !important;
  border-radius: 6px 0 0 0 !important;
}
.leaflet-control-attribution a {
  color: var(--ink) !important;
}

.leaflet-control-zoom {
  margin-top: calc(110px + var(--safe-top)) !important;
  margin-left: calc(12px + var(--safe-left)) !important;
  box-shadow: var(--shadow-sm) !important;
  border-radius: var(--radius-md) !important;
  overflow: hidden;
}
.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--ink) !important;
  border-color: var(--border) !important;
}

/* --- Photo markers (the thumbnails on the map) --------------------------- */

.photo-marker-wrap {
  background: transparent;
  border: none;
}

.photo-marker {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-2);
  border: 3px solid var(--surface);
  box-shadow:
    0 4px 12px rgba(15, 23, 42, 0.25),
    0 1px 2px rgba(15, 23, 42, 0.15);
  cursor: pointer;
  transition:
    transform 160ms cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 160ms;
  position: relative;
}

.photo-marker::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  pointer-events: none;
}

.photo-marker:hover,
.photo-marker:focus-visible {
  transform: scale(1.12);
  box-shadow:
    0 8px 24px rgba(15, 23, 42, 0.35),
    0 2px 6px rgba(15, 23, 42, 0.2);
}

.photo-marker.active {
  border-color: var(--accent);
  transform: scale(1.14);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent),
    0 10px 26px rgba(15, 23, 42, 0.4),
    0 2px 6px rgba(15, 23, 42, 0.25);
}

/* Wikipedia is secondary to photos: small, muted markers that stay in the
   background until the user explicitly taps one. */
.wikipedia-marker-wrap {
  background: transparent;
  border: none;
}

.wikipedia-marker {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  color: var(--ink-mute);
  border: 1px solid color-mix(in srgb, var(--ink-mute) 35%, transparent);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.72;
  cursor: pointer;
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

.wikipedia-marker:hover,
.wikipedia-marker:focus-visible {
  opacity: 0.95;
  transform: scale(1.12);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.22);
}

.wikipedia-popup {
  color: #0f172a;
}

.wikipedia-popup h3 {
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.25;
}

.wikipedia-popup p {
  margin: 0 0 8px;
  color: #334155;
  font-size: 13px;
  line-height: 1.4;
}

.wikipedia-popup .wikipedia-popup-kicker {
  margin-bottom: 4px;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

.wikipedia-popup a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.wikipedia-popup a:hover {
  text-decoration: underline;
}

/* "You are here" pulse */
.leaflet-marker-icon.user-here {
  filter: drop-shadow(0 0 0 rgba(37, 99, 235, 0.4));
}

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

.floating-controls {
  position: absolute;
  z-index: 600;
  right: calc(12px + var(--safe-right));
  bottom: calc(16px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform 120ms, box-shadow 120ms, background 120ms;
  min-height: 44px; /* touch target */
}

.control-btn:hover {
  background: var(--surface-2);
}

.control-btn:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-sm);
}

.control-btn svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
  stroke: currentColor;
}

/* --- Loader bar (top of viewport) ---------------------------------------- */

.loader-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 1100;
  pointer-events: none;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.loader-bar.active {
  opacity: 1;
  transform: translateY(0);
}

.loader-bar::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--loader-progress, 0%);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--accent) 70%, white) 0%,
    var(--accent) 55%,
    color-mix(in srgb, var(--accent) 80%, black) 100%
  );
  box-shadow:
    0 0 10px var(--accent),
    0 0 18px color-mix(in srgb, var(--accent) 60%, transparent);
  transition: width 260ms ease-out;
}

.loader-bar.indeterminate::before {
  width: 35%;
  transition: none;
  animation: loader-indeterminate 1.3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes loader-indeterminate {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(285%);
  }
}

/* --- Status chip --------------------------------------------------------- */

.status-bar {
  position: absolute;
  z-index: 600;
  left: 50%;
  bottom: calc(16px + var(--safe-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(92vw, 420px);
  pointer-events: none;
}

.status-chip {
  flex: 1 1 auto;
  min-width: 0;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-chip[data-type="loading"] {
  color: var(--ink);
  font-weight: 600;
}

.status-chip[data-type="loading"]::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 9px;
  vertical-align: -2px;
  border: 2px solid color-mix(in srgb, var(--ink) 18%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: status-spin 700ms linear infinite;
}

@keyframes status-spin {
  to {
    transform: rotate(360deg);
  }
}
.status-chip[data-type="error"] {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}
.status-chip[data-type="empty"] {
  color: var(--ink-mute);
}

.status-chip[data-author-mode="1"] {
  color: var(--ink);
  font-weight: 600;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

.status-chip[data-author-mode="1"]::before {
  content: attr(data-filter-label);
  display: inline-block;
  margin-right: 8px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 1px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}

.author-exit-btn {
  flex: 0 0 auto;
  pointer-events: auto;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  white-space: nowrap;
}

.author-exit-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  color: var(--accent);
}

.author-exit-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-color-scheme: dark) {
  .status-chip[data-type="error"] {
    background: #3f1212;
    border-color: #7f1d1d;
    color: #fecaca;
  }
}

/* On mobile, lift the status chip above the floating "Locate me" button */
@media (max-width: 480px) {
  .status-bar {
    bottom: calc(74px + var(--safe-bottom));
  }
}

/* --- Detail panel -------------------------------------------------------- */

.detail-backdrop {
  position: absolute;
  inset: 0;
  z-index: 800;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 220ms ease;
  pointer-events: none;
}
.detail-backdrop.open {
  opacity: 1;
  /* Visual dim only — map markers stay clickable while the panel is open. */
  pointer-events: none;
}

.detail-panel {
  position: absolute;
  z-index: 900;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Mobile (Pixel-class): bottom sheet that slides up */
@media (max-width: 767px) {
  .detail-panel {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 88dvh;
    height: auto;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
    padding-bottom: var(--safe-bottom);
  }
  .detail-panel.open {
    transform: translateY(0);
  }
  .detail-panel::before {
    content: "";
    display: block;
    width: 44px;
    height: 5px;
    margin: 8px auto 4px;
    border-radius: 999px;
    background: var(--border);
  }
}

/* Tablet & desktop: slide-in side panel from the right */
@media (min-width: 768px) {
  .detail-panel {
    top: calc(16px + var(--safe-top));
    right: calc(16px + var(--safe-right));
    bottom: calc(16px + var(--safe-bottom));
    width: min(580px, 54vw);
    border-radius: var(--radius-lg);
    transform: translateX(calc(100% + 24px));
    transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .detail-panel.open {
    transform: translateX(0);
  }
}

@media (min-width: 1280px) {
  .detail-panel {
    width: min(760px, 50vw);
  }
}

@media (min-width: 1600px) {
  .detail-panel {
    width: min(900px, 48vw);
  }
}

.detail-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms;
}
.detail-close:hover {
  background: rgba(15, 23, 42, 0.75);
}

.detail-content {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  height: 100%;
}

.detail-image-wrap {
  position: relative;
  background: #0a0a0a;
  width: 100%;
  /* Fixed aspect ratio so the image area is the same shape regardless of the
     photo's orientation. This keeps the prev/next arrows (positioned at top:
     50%) in a stable on-screen spot across navigations, so the user can click
     them with muscle memory. Images letterbox via object-fit: contain. */
  aspect-ratio: 3 / 2;
  flex-shrink: 0;
  overflow: hidden;
  touch-action: pan-y; /* allow vertical scroll, intercept horizontal swipes */
  user-select: none;
}

/* Counter chip: "3 / 42" */
.detail-counter {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.detail-counter[hidden] {
  display: none;
}

/* Prev / next buttons */
.detail-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition:
    background 140ms ease,
    transform 120ms ease,
    opacity 160ms ease;
}
.detail-nav-prev {
  left: 10px;
}
.detail-nav-next {
  right: 10px;
}
.detail-nav:hover {
  background: rgba(15, 23, 42, 0.78);
}
.detail-nav:active {
  transform: translateY(-50%) scale(0.94);
}
.detail-nav[hidden] {
  display: none;
}
.detail-nav svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* On non-touch desktops, fade nav buttons in on hover for a cleaner look. */
@media (hover: hover) and (pointer: fine) {
  .detail-nav {
    opacity: 0;
  }
  .detail-image-wrap:hover .detail-nav,
  .detail-nav:focus-visible {
    opacity: 1;
  }
}

/* Fullscreen toggle (bottom-right corner of the detail image) */
.detail-fullscreen-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition:
    background 140ms ease,
    transform 120ms ease,
    opacity 160ms ease;
}
.detail-fullscreen-btn:hover {
  background: rgba(15, 23, 42, 0.78);
}
.detail-fullscreen-btn:active {
  transform: scale(0.94);
}
.detail-fullscreen-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}
@media (hover: hover) and (pointer: fine) {
  .detail-fullscreen-btn {
    opacity: 0;
  }
  .detail-image-wrap:hover .detail-fullscreen-btn,
  .detail-fullscreen-btn:focus-visible {
    opacity: 1;
  }
}

/* --- Lightbox (full screen viewer) --------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  opacity: 0;
  transition: opacity 220ms ease;
  user-select: none;
  touch-action: pan-y;
  /* When in native fullscreen the browser strips parent padding/margins,
   * which is exactly what we want. */
}

.lightbox.open {
  opacity: 1;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-image {
  max-width: 100vw;
  max-height: 100dvh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  cursor: zoom-out;
  background: #000;
}

.lightbox-counter {
  position: absolute;
  top: calc(20px + var(--safe-top));
  left: calc(20px + var(--safe-left));
  z-index: 2;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.lightbox-counter[hidden] {
  display: none;
}

.lightbox-close {
  position: absolute;
  top: calc(16px + var(--safe-top));
  right: calc(16px + var(--safe-right));
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition:
    background 140ms ease,
    transform 120ms ease;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}
.lightbox-close:active {
  transform: scale(0.94);
}
.lightbox-close svg {
  width: 22px;
  height: 22px;
  display: block;
}

.lightbox-playpause {
  position: absolute;
  top: calc(16px + var(--safe-top));
  right: calc(72px + var(--safe-right));
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition:
    background 140ms ease,
    transform 120ms ease;
}
.lightbox-playpause:hover {
  background: rgba(255, 255, 255, 0.22);
}
.lightbox-playpause:active {
  transform: scale(0.94);
}
.lightbox-playpause[hidden] {
  display: none;
}
.lightbox-playpause .lightbox-playpause-icon {
  width: 22px;
  height: 22px;
  display: none;
}
.lightbox-playpause[data-playing="1"] .lightbox-playpause-icon-pause {
  display: block;
}
.lightbox-playpause[data-playing="0"] .lightbox-playpause-icon-play {
  display: block;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition:
    background 140ms ease,
    transform 120ms ease,
    opacity 160ms ease;
}
.lightbox-nav-prev {
  left: calc(16px + var(--safe-left));
}
.lightbox-nav-next {
  right: calc(16px + var(--safe-right));
}
.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.22);
}
.lightbox-nav:active {
  transform: translateY(-50%) scale(0.94);
}
.lightbox-nav[hidden] {
  display: none;
}
.lightbox-nav svg {
  width: 24px;
  height: 24px;
  display: block;
}

@media (hover: hover) and (pointer: fine) {
  .lightbox-nav {
    opacity: 0;
  }
  .lightbox:hover .lightbox-nav,
  .lightbox-nav:focus-visible {
    opacity: 1;
  }
}

.lightbox-caption {
  position: absolute;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  max-width: min(90vw, 720px);
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  pointer-events: none;
  word-break: break-word;
}
.lightbox-caption[hidden] {
  display: none;
}

.detail-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  transition: opacity 200ms ease;
}

.detail-body {
  padding: 16px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  word-break: break-word;
}

.detail-meta {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  align-items: center;
}

.detail-meta a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.detail-meta .detail-dot {
  color: var(--ink-mute);
}

.detail-license {
  font-size: 12px;
  color: var(--ink-mute);
  margin: 0;
}

.detail-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-height: 30vh;
  overflow-y: auto;
}
.detail-desc img,
.detail-desc figure {
  display: none; /* keep descriptions text-only */
}
.detail-desc a {
  color: var(--ink);
}

.detail-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-category {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-soft);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition:
    background 120ms,
    color 120ms,
    border-color 120ms;
}
.detail-category:hover,
.detail-category:focus-visible {
  color: var(--ink);
  border-color: var(--ink-mute);
  text-decoration: none;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
}

.detail-link {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition:
    transform 120ms,
    box-shadow 120ms,
    filter 120ms;
}
.detail-link:hover {
  filter: brightness(1.05);
  box-shadow: var(--shadow-md);
}
.detail-link:active {
  transform: translateY(1px);
}

.detail-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  border-radius: 999px;
  cursor: pointer;
  transition:
    background 120ms,
    transform 120ms,
    box-shadow 120ms,
    border-color 120ms;
}
.detail-action-btn:hover {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--ink-mute) 35%, var(--border));
  box-shadow: var(--shadow-sm);
}
.detail-action-btn:active {
  transform: translateY(1px);
}
.detail-action-btn svg {
  width: 16px;
  height: 16px;
  display: block;
  color: var(--accent);
}

@media (max-width: 1024px) {
  .detail-action-btn {
    width: 38px;
    height: 38px;
    justify-content: center;
    padding: 0;
  }

  .detail-action-btn span {
    display: none;
  }
}

/* --- Reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}

.leaflet-control-attribution>a:first-child {
  display: none;
}