/* Georgian fonts — მხოლოდ ქართული ასოებისთვის (unicode-range).
   ლათინური / ციფრები / IMG_… → Segoe UI (იგივე სტილი რაც თარიღებს) */
@font-face {
  font-family: "Sylfaen";
  src: local("Sylfaen"), url("/fonts/sylfaen.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+10A0-10FF, U+1C90-1CBF;
}

@font-face {
  font-family: "Anastasia Geo";
  src:
    local("LGV Anastasia 2025 Geo Bold"),
    local("LGVAnastasia2025Geo-Bold"),
    url("/fonts/anastasia-geo-bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+10A0-10FF, U+1C90-1CBF;
}

:root {
  --bg: #0f1419;
  --surface: rgba(18, 22, 28, 0.92);
  --surface-solid: #161b22;
  --text: #f2f4f7;
  --muted: #9aa3af;
  --accent: #e8a54b;
  --accent-2: #3d9b8f;
  --danger: #e85d5d;
  /* Time-of-day borders */
  --time-day: #34c759;
  --time-afternoon: #ff6b9d;
  --time-evening: #007aff;
  --time-night: #ff3b30;
  --photo-border-color: var(--time-day);
  --marker-scale: 1;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  /* KA → Sylfaen/Anastasia; EN/ციფრები → Segoe UI */
  --font-latin: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font: "Sylfaen", var(--font-latin);
  --display: "Anastasia Geo", "Sylfaen", var(--font-latin);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

.photo-time--day { --photo-border-color: var(--time-day); }
.photo-time--afternoon { --photo-border-color: var(--time-afternoon); }
.photo-time--evening { --photo-border-color: var(--time-evening); }
.photo-time--night { --photo-border-color: var(--time-night); }

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(232, 165, 75, 0.18), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(61, 155, 143, 0.16), transparent 50%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #1a2230;
}

.leaflet-container {
  font: inherit;
  background: #1a2230;
}

.top-bar {
  position: absolute;
  top: calc(10px + var(--safe-top));
  right: 10px;
  left: auto;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
}

.top-actions {
  pointer-events: auto;
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  background: var(--surface);
  backdrop-filter: blur(12px);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background 0.15s ease;
}

.icon-btn:hover {
  transform: scale(1.05);
  background: rgba(30, 36, 44, 0.95);
}

.icon-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status-bar {
  position: absolute;
  top: calc(54px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 6px 14px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--muted);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.06);
  max-width: calc(100% - 24px);
  white-space: nowrap;
}

.status-bar[hidden] {
  display: none;
}

.status-bar.error {
  color: #ffb4b4;
  border-color: rgba(232, 93, 93, 0.35);
}

#status-count {
  color: var(--accent);
  font-weight: 600;
}

.zoom-panel {
  position: absolute;
  left: 6px;
  bottom: calc(108px + var(--safe-bottom));
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: center;
  padding: 2px;
  background: rgba(18, 22, 28, 0.45);
  backdrop-filter: blur(6px);
  border-radius: 6px;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.06);
  opacity: 0.85;
}

.zoom-btn {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.65rem;
  font-weight: 500;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.zoom-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  opacity: 1;
}

.km-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0;
}

#km-slider {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 10px;
  height: 36px;
  accent-color: rgba(232, 165, 75, 0.75);
  cursor: pointer;
  opacity: 0.85;
}

#km-step-label {
  font-size: 0.45rem;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-family: var(--font-latin);
  line-height: 1.2;
}

.view-height {
  margin-top: 0;
  padding: 1px 3px;
  font-size: 0.45rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-latin);
  color: rgba(232, 165, 75, 0.85);
  background: rgba(232, 165, 75, 0.08);
  border-radius: 3px;
  min-width: 0;
  text-align: center;
  line-height: 1.3;
}

.layer-toggle {
  position: absolute;
  top: calc(52px + var(--safe-top));
  right: 10px;
  bottom: auto;
  left: auto;
  z-index: 1000;
  display: flex;
  padding: 2px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: auto;
}

.layer-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 4px 9px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
}

.layer-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* Photo markers — Leaflet owns transform on .photo-marker-wrap (do not override) */
.photo-marker-wrap.leaflet-marker-icon,
.photo-marker-wrap {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.photo-marker {
  position: relative;
  width: 42px;
  height: 64px; /* 54 card + 10 pointer */
  cursor: pointer;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.22));
  /* Scale vs map @100კმ: closer = fixed; higher = shrink with map */
  transform: scale(var(--marker-scale, 1));
  transform-origin: bottom center;
  will-change: transform;
  transition: opacity 0.25s ease, filter 0.25s ease, transform 0.25s ease;
}

.photo-marker.is-dimmed {
  opacity: 0.28;
  filter: grayscale(0.55) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.12));
  pointer-events: none;
}

.photo-marker.is-highlighted {
  opacity: 1;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.45));
  transform: scale(calc(var(--marker-scale, 1) * 1.18));
  z-index: 2;
}

.photo-marker-wrap.is-dimmed-wrap {
  z-index: 1 !important;
}

.photo-marker-wrap.is-highlighted-wrap {
  z-index: 1200 !important;
}

.photo-marker.is-cluster {
  width: 55px;
  height: 71px;
  transform: scale(var(--marker-scale, 1));
  transform-origin: bottom center;
}

.photo-marker .card {
  position: relative;
  z-index: 2;
  width: 42px;
  height: 54px;
  margin: 0 auto;
  border-radius: 7px;
  overflow: hidden;
  border: 2.5px solid var(--photo-border-color, var(--time-day));
  background: #222;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.photo-marker.is-cluster .card {
  width: 48px;
  height: 56px;
}

.photo-marker .card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: linear-gradient(135deg, #2a3140, #1a2030);
}

.photo-marker .date-chip {
  position: absolute;
  left: 3px;
  bottom: 3px;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.photo-marker .pointer {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 1;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 10px solid var(--photo-border-color, var(--time-day));
}

.photo-marker .stack-deck {
  position: absolute;
  top: 2px;
  left: 50%;
  z-index: 0;
  width: 48px;
  height: 56px;
  margin-left: -20px;
  border-radius: 7px;
  border: 2.5px solid var(--photo-border-color, var(--time-day));
  background: #1a1f28;
  opacity: 0.85;
  transform: rotate(-6deg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.photo-marker .stack-deck--2 {
  margin-left: -28px;
  transform: rotate(7deg);
  opacity: 0.7;
  z-index: 0;
}

.photo-marker .count-badge {
  position: absolute;
  top: -4px;
  right: 0;
  z-index: 3;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
}

/* Simple hour legend — top left */
.time-legend {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 8px;
  z-index: 1000;
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(18, 22, 28, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.time-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-latin);
  font-size: 0.52rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.time-legend-item i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
}

/* Bottom moving photo strip */
.photo-strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  height: calc(78px + var(--safe-bottom));
  padding: 8px 0 calc(8px + var(--safe-bottom));
  background: linear-gradient(
    to top,
    rgba(8, 10, 14, 0.92) 40%,
    rgba(8, 10, 14, 0.55) 85%,
    transparent
  );
  pointer-events: auto;
}

.photo-strip[hidden] {
  display: none;
}

.photo-strip-track {
  display: flex;
  gap: 8px;
  height: 100%;
  overflow: hidden;
  padding: 0 10px;
  scroll-behavior: auto;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.photo-strip-track::-webkit-scrollbar {
  display: none;
}

.photo-strip-track:active {
  cursor: grabbing;
}

.strip-card {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 2.5px solid var(--photo-border-color, var(--time-day));
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background: #1a1f28;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.strip-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}

.strip-card .strip-date {
  position: absolute;
  left: 3px;
  bottom: 3px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-family: var(--font-latin);
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 1.2;
  pointer-events: none;
}

/* Sheets */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet[hidden] {
  display: none;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  animation: fadeIn 0.2s ease;
}

.sheet-panel {
  position: relative;
  width: min(480px, 100%);
  max-height: min(70vh, 560px);
  overflow: auto;
  background: var(--surface-solid);
  border-radius: 20px 20px 0 0;
  padding: 12px 20px calc(20px + var(--safe-bottom));
  box-shadow: var(--shadow);
  animation: slideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: none;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 auto 14px;
}

.sheet-panel h2 {
  margin: 0 0 16px;
  font-family: var(--display);
  font-size: 1.25rem;
}

/* Instagram-style archive calendar — vertical scroll, no arrows */
.sheet-panel--calendar {
  height: min(82dvh, 680px);
  max-height: min(82dvh, 680px);
  padding-bottom: calc(12px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex: 0 0 auto;
}

.cal-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.cal-clear-btn {
  border: none;
  background: transparent;
  color: #3897f0;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 2px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 8px;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  font-family: var(--font);
  flex: 0 0 auto;
}

.cal-scroll {
  /* height:0 + flex-grow forces scroll inside fixed panel */
  flex: 1 1 auto;
  height: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  margin: 0 -4px;
  padding: 0 4px 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cal-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.cal-month {
  margin-bottom: 22px;
}

.cal-month:last-child {
  margin-bottom: 8px;
}

.cal-month-title {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 10px;
  padding-left: 2px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px 4px;
}

.cal-day {
  position: relative;
  aspect-ratio: 1;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 50%;
  padding: 0;
  cursor: default;
  display: grid;
  place-items: center;
  font-family: var(--font-latin);
  font-size: 0.78rem;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

.cal-day.is-empty {
  visibility: hidden;
  pointer-events: none;
}

.cal-day.has-photos {
  cursor: pointer;
}

.cal-day-num {
  position: relative;
  z-index: 1;
}

.cal-day:not(.has-photos) .cal-day-num {
  color: rgba(255, 255, 255, 0.28);
}

.cal-day-ring {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid transparent;
  background:
    linear-gradient(#161b22, #161b22) padding-box,
    linear-gradient(45deg, #f58529, #dd2a7b, #8134af, #515bd4) border-box;
  z-index: 0;
}

.cal-day-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.92;
}

.cal-day.has-photos .cal-day-num {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.cal-day.has-photos:not(:has(.cal-day-ring)) {
  background: rgba(255, 255, 255, 0.08);
}

.cal-day.is-today:not(.is-selected) .cal-day-num {
  color: #3897f0;
}

.cal-day.is-selected {
  box-shadow: inset 0 0 0 2px #fff;
}

.cal-day.is-selected .cal-day-ring {
  border-width: 2.5px;
}

.cal-selected-label {
  margin: 10px 0 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  flex: 0 0 auto;
}

.icon-btn.is-active {
  color: #3897f0;
  border-color: rgba(56, 151, 240, 0.35);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--muted);
}

.field input,
.field select {
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #d4893a);
  color: #1a1208;
  flex: 1;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  flex: 1;
}

.btn.sm {
  padding: 8px 12px;
  font-size: 0.8rem;
  border-radius: 10px;
}

.btn.full {
  width: 100%;
  margin-top: 12px;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 16px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.95rem;
  cursor: pointer;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.meta-line {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 12px 0 0;
}

.cluster-list,
.cluster-grid {
  list-style: none;
  margin: 0;
  padding: 4px 0 8px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px 8px;
}

.cluster-list li,
.cluster-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0;
  margin: 0;
  background: transparent;
  border-radius: 0;
  cursor: pointer;
  min-width: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.cluster-list li:hover,
.cluster-cell:hover {
  background: transparent;
  transform: translateY(-2px);
  opacity: 0.92;
}

.cluster-list img,
.cluster-list .sheet-thumb,
.cluster-cell .sheet-thumb {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  object-fit: cover;
  border-radius: 10px;
  border: 2.5px solid var(--photo-border-color, var(--time-day));
  display: block;
  background: #1a1f28;
}

.cluster-list .cluster-date,
.cluster-cell .cluster-date {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--photo-border-color, var(--muted));
  font-variant-numeric: tabular-nums;
}

@media (max-width: 380px) {
  .cluster-list,
  .cluster-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px 6px;
  }

  .cluster-list .cluster-date,
  .cluster-cell .cluster-date {
    font-size: 0.62rem;
  }
}

/* Viewer — responsive fullscreen */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 3000;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: #050608;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
  --photo-border-color: var(--time-day);
  overscroll-behavior: none;
  touch-action: none;
}

.viewer[hidden] {
  display: none !important;
}

.viewer-top {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  padding: calc(8px + var(--safe-top)) 96px 0 56px;
}

.viewer-progress {
  display: flex;
  gap: 3px;
}

.viewer-progress .seg {
  flex: 1;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.viewer-progress .seg .fill {
  height: 100%;
  width: 0;
  background: #fff;
  border-radius: inherit;
}

.viewer-progress .seg.done .fill {
  width: 100%;
}

.viewer-progress .seg.active .fill {
  animation: progressFill 5s linear forwards;
}

@keyframes progressFill {
  from { width: 0; }
  to { width: 100%; }
}

.viewer-counter {
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
  font-variant-numeric: tabular-nums;
}

.viewer-actions-left {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 10px;
  z-index: 6;
}

.viewer-actions {
  position: absolute;
  top: calc(10px + var(--safe-top));
  right: 10px;
  z-index: 6;
  display: flex;
  gap: 8px;
}

.viewer-circle-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.viewer-info-btn {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 1.25rem;
  font-weight: 700;
}

.viewer-info-btn.is-active {
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 44px;
  height: 64px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 2.25rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.viewer-nav.prev { left: 0; }
.viewer-nav.next { right: 0; }

.viewer-stage {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
  padding: 8px 40px 64px;
  box-sizing: border-box;
}

.viewer-frame {
  position: relative;
  box-sizing: border-box;
  width: min(100%, 560px);
  height: min(68dvh, 720px);
  max-height: calc(100dvh - 140px - var(--safe-top) - var(--safe-bottom));
  border-radius: 25px;
  border: 3px solid var(--photo-border-color, var(--time-day));
  overflow: hidden;
  background: #0a0a0c;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

#viewer-img {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#viewer-img.ready {
  opacity: 1;
}

.viewer-skeleton {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 22px;
  background-color: #1a1f28;
  background-size: cover;
  background-position: center;
  filter: blur(12px);
  transform: scale(1.06);
  opacity: 0.9;
}

.viewer-skeleton[hidden] {
  display: none;
}

.viewer-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.08) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease infinite;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

.spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--photo-border-color, var(--accent));
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  z-index: 2;
}

.spinner[hidden] {
  display: none;
}

.viewer-date-pill {
  position: absolute;
  left: 50%;
  bottom: calc(12px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 6;
  max-width: calc(100% - 24px);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

@media (max-width: 640px) {
  .viewer-stage {
    padding: 4px 8px 56px;
  }

  .viewer-frame {
    width: calc(100vw - 16px);
    height: min(72dvh, calc(100dvh - 128px));
    border-radius: 20px;
  }

  .viewer-nav {
    width: 36px;
    font-size: 1.75rem;
  }

  .viewer-circle-btn {
    width: 38px;
    height: 38px;
  }

  .viewer-top {
    padding: calc(8px + var(--safe-top)) 88px 0 52px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .viewer-frame {
    height: calc(100dvh - 88px);
    width: min(70vw, 640px);
  }

  .viewer-date-pill {
    font-size: 0.72rem;
    padding: 5px 10px;
  }

  .viewer-counter {
    display: none;
  }
}

/* Metadata overlay on photo frame */
.viewer-meta-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.viewer-meta-overlay[hidden] {
  display: none;
}

.viewer-meta-bg {
  position: absolute;
  inset: -16%;
  background-size: cover;
  background-position: center;
  filter: blur(22px) saturate(1.05);
  transform: scale(1.08);
  z-index: 0;
}

.viewer-meta-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1;
}

.viewer-meta-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
}

.viewer-meta-scroll {
  position: relative;
  z-index: 2;
  flex: 1;
  overflow: auto;
  padding: 52px 20px 20px;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .viewer-meta-scroll {
    padding: 56px 24px 24px;
  }
}

.viewer-meta-title {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  /* ფაილის სახელები / ლათინური — Segoe UI (როგორც თარიღები) */
  font-family: var(--font-latin);
}

.viewer-meta-list {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.viewer-meta-row {
  display: grid;
  grid-template-columns: minmax(92px, 34%) 1fr;
  gap: 12px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.viewer-meta-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.viewer-meta-row dt {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--font); /* ქართული ლეიბლები */
}

.viewer-meta-row dd {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  word-break: break-word;
  font-family: var(--font-latin); /* IMG_…, ციფრები, კოორდინატები */
}

.user-location-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3b82f6;
  border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.25);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(40%);
  }
  to {
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .zoom-panel {
    bottom: calc(118px + var(--safe-bottom));
  }

  #km-slider {
    height: 32px;
  }
}

/* Hide default leaflet attribution slightly quieter */
.leaflet-control-attribution {
  font-size: 10px !important;
  background: rgba(255, 255, 255, 0.7) !important;
  max-width: 50vw;
  margin-bottom: calc(82px + var(--safe-bottom)) !important;
}

/* Hide Netlify “Powered by Netlify” badge (injected by host) */
#netlify-badge,
.netlify-badge,
[data-netlify-badge],
[data-nf-badge],
a[href*="netlify.com"][id*="badge" i],
a[href*="netlify.com"] img[alt*="Netlify" i],
a[href="https://www.netlify.com/"][style*="position"],
body > a[href*="netlify.com"]:has(img),
iframe[src*="netlify"][title*="badge" i] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

