:root {
  --bg: #0d0b08;
  --bg-elev: #17130e;
  --ink: #f2ead9;
  --ink-dim: #b9ac93;
  --gold: #d4af6a;
  --gold-bright: #f2cf8a;
  --parchment: #e8dcc0;
  --parchment-dark: #cbb98f;
  --bronze: #8a6a3c;
  --focus: #f6d98a;
  --safe: 4vw;
  --radius: 10px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Georgia", "Iowan Old Style", "Palatino Linotype", serif;
  height: 100%;
  overflow-x: hidden;
}

#app { min-height: 100%; display: flex; flex-direction: column; }

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* ---------- focus (TV/D-pad) ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}
.thumb:focus-visible {
  outline-offset: -3px;
  transform: scale(1.06);
  z-index: 2;
}
.tab:focus-visible,
.lb-nav:focus-visible,
.lb-close:focus-visible,
.lb-btn:focus-visible,
.lb-info-close:focus-visible,
.sheet-back:focus-visible,
.photo-popup-btn:focus-visible,
.thumb-pin:focus-visible,
.map-fab:focus-visible,
.landmark-item:focus-visible {
  outline-offset: 2px;
  transform: scale(1.05);
}

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4vh var(--safe);
  background: linear-gradient(to bottom, rgba(13,11,8,0.95), rgba(13,11,8,0.75));
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 0.5rem; }
.brand-glyph { color: var(--gold); font-size: 1.6rem; }
.brand-text {
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--parchment);
}
.tabs { display: flex; gap: 0.5rem; }
.tab {
  font-size: 1.05rem;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  color: var(--ink-dim);
  letter-spacing: 0.03em;
}
.tab[aria-selected="true"] {
  background: var(--gold);
  color: #1b1509;
  font-weight: 600;
}

.view { flex: 1; min-height: 0; }
.view[hidden] { display: none; }

/* ---------- gallery ---------- */
.view-gallery { padding: 0 var(--safe) 6vh; }
.day-group { margin-top: 2.2rem; }
.day-heading {
  font-size: 1.15rem;
  color: var(--gold-bright);
  margin: 0 0 0.8rem;
  letter-spacing: 0.04em;
}
.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.5rem;
}
.thumb {
  position: relative;
  display: block;
  padding: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 6px;
  background: var(--bg-elev);
  transition: transform 120ms ease;
}
.thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.thumb .thumb-video-badge {
  position: absolute; right: 6px; bottom: 6px;
  font-size: 1.2rem;
  filter: drop-shadow(0 1px 2px #000);
}
.thumb .thumb-pin {
  position: absolute; left: 6px; bottom: 6px;
  font-size: 0.85rem;
  padding: 3px 6px;
  background: rgba(13, 11, 8, 0.85);
  border: 1px solid rgba(212, 175, 106, 0.6);
  border-radius: 6px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.7));
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 2px;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
  z-index: 3;
}
.thumb .thumb-pin:hover, .thumb .thumb-pin:focus-visible {
  transform: scale(1.2);
  background: rgba(40, 32, 20, 0.95);
  border-color: var(--focus);
  outline: none;
}

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(6,5,3,0.97);
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.lightbox[hidden] { display: none; }

.lb-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--safe);
  background: linear-gradient(to bottom, rgba(6,5,3,0.95) 0%, rgba(6,5,3,0.75) 60%, transparent 100%);
  z-index: 10;
  pointer-events: none;
}
.lb-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  pointer-events: auto;
  font-size: 0.95rem;
}
.lb-counter {
  color: var(--gold-bright);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.lb-date {
  color: var(--parchment-dark);
}
.lb-place-badge {
  background: rgba(212,175,106,0.18);
  border: 1px solid rgba(212,175,106,0.45);
  color: var(--gold-bright);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.88rem;
}
.lb-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  pointer-events: auto;
}
.lb-btn {
  font-size: 0.95rem;
  padding: 0.5rem 1.05rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 120ms, transform 120ms, color 120ms;
  cursor: pointer;
}
.lb-btn[hidden] { display: none; }
.lb-map-btn {
  background: var(--gold);
  color: #1b1509;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.lb-map-btn:hover, .lb-map-btn:focus-visible {
  background: var(--gold-bright);
  transform: scale(1.05);
}
.lb-landmark-btn {
  background: rgba(23,19,14,0.85);
  border: 1px solid rgba(212,175,106,0.45);
  color: var(--parchment);
}
.lb-landmark-btn:hover, .lb-landmark-btn:focus-visible {
  background: rgba(212,175,106,0.22);
  color: var(--gold-bright);
  transform: scale(1.05);
}
.lb-close {
  font-size: 1.6rem;
  color: var(--parchment);
  padding: 0.4rem 0.8rem;
  border-radius: 50%;
  line-height: 1;
  transition: transform 120ms, color 120ms;
  cursor: pointer;
}
.lb-close:hover, .lb-close:focus-visible {
  color: #fff;
  transform: scale(1.15);
}

.lb-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4.8rem var(--safe) 2rem;
  min-width: 0;
  min-height: 0;
}
.lb-stage img, .lb-stage video {
  max-width: 100%;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 10px 60px rgba(0,0,0,0.7);
}
.lb-nav {
  position: absolute;
  font-size: 3.2rem;
  color: var(--parchment);
  padding: 0.6rem 1rem;
  z-index: 5;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 120ms, color 120ms;
}
.lb-prev { left: 1vw; }
.lb-next { right: 1vw; }
.lb-prev:hover, .lb-prev:focus-visible,
.lb-next:hover, .lb-next:focus-visible {
  transform: translateY(-50%) scale(1.15);
  color: var(--gold-bright);
}

.lb-info {
  position: absolute;
  top: 4.4rem; right: var(--safe); bottom: 2rem;
  width: min(440px, 90vw);
  background: rgba(23,19,14,0.96);
  border: 1px solid rgba(212,175,106,0.45);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  overflow-y: auto;
  z-index: 25;
  box-shadow: 0 10px 40px rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
}
.lb-info[hidden] { display: none; }
.lb-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(212,175,106,0.3);
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
}
.lb-info-header h3 {
  color: var(--gold-bright);
  font-size: 1.25rem;
  margin: 0;
}
.lb-info-close {
  font-size: 1.3rem;
  color: var(--ink-dim);
  padding: 0.2rem 0.5rem;
  line-height: 1;
  border-radius: 4px;
}
.lb-info-close:hover, .lb-info-close:focus-visible {
  color: var(--gold-bright);
  background: rgba(212,175,106,0.15);
}
.lb-article { font-size: 0.95rem; line-height: 1.6; color: var(--ink-dim); }
.lb-article h4 { color: var(--gold-bright); font-size: 1rem; margin: 1.1rem 0 0.35rem; }
.lb-article p { margin: 0 0 0.75rem; }

/* ---------- map ---------- */
.view-map { position: relative; }
.map-shell { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; background: #cbb98f; }

/* antique parchment tint over standard OSM tiles */
#map .leaflet-tile-pane {
  filter: sepia(0.55) saturate(1.5) hue-rotate(-8deg) contrast(1.05) brightness(1.04);
}
#map .leaflet-control-attribution {
  background: rgba(232,220,192,0.85);
  color: #4a3a1e;
}

.map-panel {
  position: absolute;
  top: 1.5vh; left: 1.5vw;
  width: min(280px, 26vw);
  max-height: 80vh;
  background: rgba(23,19,14,0.92);
  border: 1px solid rgba(212,175,106,0.35);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-y: auto;
  z-index: 10;
}
.map-panel-title {
  margin: 0 0 0.6rem;
  color: var(--gold-bright);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}
.map-panel-list { display: flex; flex-direction: column; gap: 0.15rem; }
.landmark-item {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  font-size: 0.95rem;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.landmark-item:hover, .landmark-item:focus-visible { background: rgba(212,175,106,0.16); }
.landmark-item .count { color: var(--ink-dim); font-size: 0.85rem; }

/* bottom "place sheet" — otevře se při kliknutí na památku */
.map-sheet {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
}
.map-sheet[hidden] { display: none; }
.sheet-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.6rem 0.6rem;
  border-bottom: 1px solid rgba(212,175,106,0.2);
}
.sheet-top .sheet-title {
  margin: 0;
  font-size: 1.4rem;
  color: var(--gold-bright);
}
.sheet-top .sheet-back {
  padding: 0.45rem 0.9rem;
  font-size: 1rem;
  color: var(--parchment);
  border: 1px solid rgba(212,175,106,0.4);
  border-radius: 6px;
  background: rgba(212,175,106,0.12);
  cursor: pointer;
  transition: all 120ms ease;
}
.sheet-top .sheet-back:hover, .sheet-top .sheet-back:focus-visible {
  background: var(--gold);
  color: #1b1509;
  font-weight: 600;
}
.sheet-filmstrip-wrap {
  flex: 0 0 auto;
  border-bottom: 1px solid rgba(212,175,106,0.3);
  background: rgba(0,0,0,0.35);
  padding: 0.8rem 1.6rem 1rem;
}
.sheet-filmstrip-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.sheet-filmstrip-title {
  color: var(--gold-bright);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sheet-filmstrip-count {
  color: var(--ink-dim);
  font-size: 0.9rem;
}
.sheet-filmstrip {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
}
.sheet-filmstrip .thumb {
  flex: 0 0 auto;
  width: 150px;
  aspect-ratio: 1/1;
  border-radius: 6px;
}
@media (min-width: 1400px) {
  .sheet-filmstrip .thumb { width: 190px; }
}
.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.2rem 1.8rem 2rem;
}
.sheet-article[hidden] { display: none; }
.sheet-article h4 { color: var(--gold-bright); font-size: 1.05rem; margin: 1.2rem 0 0.4rem; }
.sheet-article p { color: var(--ink-dim); line-height: 1.65; margin: 0 0 0.85rem; font-size: 1rem; }

/* Antique Leaflet Popup for photo on map */
.antique-photo-popup .leaflet-popup-content-wrapper {
  background: rgba(23,19,14,0.96);
  border: 1px solid rgba(212,175,106,0.5);
  border-radius: var(--radius);
  color: var(--ink);
  box-shadow: 0 8px 30px rgba(0,0,0,0.75);
  padding: 0;
  overflow: hidden;
  backdrop-filter: blur(8px);
}
.antique-photo-popup .leaflet-popup-content {
  margin: 0;
  padding: 0.8rem;
  line-height: 1.4;
}
.antique-photo-popup .leaflet-popup-tip {
  background: rgba(23,19,14,0.96);
  border: 1px solid rgba(212,175,106,0.5);
}
.antique-photo-popup a.leaflet-popup-close-button {
  color: var(--gold-bright) !important;
  font-size: 1.4rem;
  padding: 6px 10px;
}
.photo-popup {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.photo-popup-img-wrap {
  width: 100%;
  height: 160px;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}
.photo-popup-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.photo-popup-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gold-bright);
}
.photo-popup-date {
  font-size: 0.85rem;
  color: var(--ink-dim);
}
.photo-popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.3rem;
}
.photo-popup-btn {
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(212,175,106,0.4);
  background: rgba(212,175,106,0.12);
  color: var(--parchment);
  cursor: pointer;
  transition: all 120ms ease;
}
.photo-popup-btn:hover, .photo-popup-btn:focus-visible {
  background: var(--gold);
  color: #1b1509;
  font-weight: 600;
}
.photo-popup-btn.btn-open {
  background: var(--gold);
  color: #1b1509;
  font-weight: 600;
}
.photo-popup-btn.btn-open:hover, .photo-popup-btn.btn-open:focus-visible {
  background: var(--gold-bright);
}

/* leaflet marker overrides — antique look */
.landmark-marker {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-bright), var(--bronze));
  border: 2px solid #3a2a10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  font-size: 1.3rem;
}
.landmark-label {
  color: #2a2008;
  background: rgba(232,220,192,0.92);
  border: 1px solid var(--bronze);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.78rem;
  white-space: nowrap;
  font-weight: 600;
}
.photo-marker {
  width: 54px; height: 54px;
  border-radius: 3px;
  border: 3px solid #f4ecd8;
  box-shadow: 0 2px 8px rgba(0,0,0,0.55);
  background-size: cover;
  background-position: center;
  background-color: #333;
}
.marker-cluster-antique {
  background: rgba(138,106,60,0.55);
}
.marker-cluster-antique div {
  background: radial-gradient(circle at 30% 30%, var(--gold-bright), var(--bronze));
  color: #2a1f0a;
  font-weight: 700;
  border: 2px solid #3a2a10;
}

.map-fab {
  position: absolute;
  bottom: 2vh; right: 1.5vw;
  width: 3rem; height: 3rem;
  border-radius: 50%;
  background: rgba(23,19,14,0.92);
  border: 1px solid rgba(212,175,106,0.4);
  color: var(--gold-bright);
  font-size: 1.3rem;
  z-index: 10;
}

@media (max-width: 720px) {
  .map-panel { width: min(220px, 60vw); }
  .map-info { width: 100%; }
  .lb-info { width: 100%; position: absolute; inset: 0; border-radius: 0; padding-top: 4rem; }
  .lb-bar { height: auto; padding: 0.6rem var(--safe); flex-wrap: wrap; gap: 0.5rem; }
  .lb-meta { order: 1; width: 100%; justify-content: space-between; font-size: 0.85rem; }
  .lb-actions { order: 2; width: 100%; justify-content: flex-end; }
  .lb-stage { padding-top: 5.5rem; }
  .lb-nav { display: none; }
}

/* 10-foot / TV tuning: larger safe margins, bigger focus rings on big screens */
@media (min-width: 1400px) {
  :root { --safe: 5vw; font-size: 18px; }
  .day-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
