:root {
  --espresso: #241b14;
  --espresso-2: #33271d;
  --espresso-3: #46372a;
  --paper: #f7f1e6;
  --paper-2: #efe6d6;
  --paper-3: #e4d8c3;
  --line: #d8c9b0;
  --ink: #2b2118;
  --ink-2: #5b4a3a;
  --muted: #8a7764;
  --accent: #b9542b;
  --accent-2: #e09a45;
  --accent-soft: #f4dcc4;
  --aerial: #2f6f73;
  --aerial-soft: #d3e6e4;
  --cream: #f3e7d0;
  --surface: #fff;
  --chip-bg: #fffaf2;
  --glass: rgba(247, 241, 230, .96);
  --tl-bg: rgba(36, 27, 20, .84);
  --shadow: 0 6px 24px rgba(36, 27, 20, .18), 0 1px 3px rgba(36, 27, 20, .12);
  --radius: 12px;
  --topbar-h: 58px;
  --panel-w: 372px;
  --timeline-h: 66px;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
/* mod intunecat: aceeasi paleta de cafea, cu luminile stinse */
:root[data-theme="dark"] {
  --paper: #1f1914;
  --paper-2: #272019;
  --paper-3: #392e25;
  --line: #43372c;
  --ink: #efe4d2;
  --ink-2: #cdbca4;
  --muted: #9a8873;
  --accent: #d9693a;
  --accent-2: #e8a75a;
  --accent-soft: #4a2a1a;
  --aerial: #5cb3b5;
  --aerial-soft: #1d3738;
  --surface: #2c241d;
  --chip-bg: #2a221b;
  --glass: rgba(31, 25, 20, .94);
  --tl-bg: rgba(16, 12, 9, .84);
  --shadow: 0 6px 24px rgba(0, 0, 0, .45), 0 1px 3px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  position: fixed; inset: 0;
  font: 14px/1.45 var(--sans);
  color: var(--ink);
  background: var(--espresso);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button, a, input, select, .card { touch-action: manipulation; }
button { cursor: pointer; }
a { color: var(--accent); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ------------------------------------------------------------------ top bar */
.topbar {
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 18px;
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: linear-gradient(180deg, #2a1f17, var(--espresso));
  border-bottom: 1px solid #4a3a2b;
  color: var(--cream);
  position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font: 700 22px/1 var(--serif); letter-spacing: .3px; }
.brand-text em { font: italic 500 14px/1.1 var(--serif); color: var(--accent-2); }

.search { position: relative; flex: 1; max-width: 420px; display: flex; align-items: center; }
.search > svg { position: absolute; left: 11px; color: #b7a48c; pointer-events: none; }
.search input {
  width: 100%; height: 36px; padding: 0 12px 0 36px;
  border-radius: 8px; border: 1px solid #514030;
  background: #3a2d22; color: var(--cream);
}
.search input::placeholder { color: #a8957e; }
.search input:focus { outline: none; border-color: var(--accent-2); background: #43342a; }
.search-results {
  position: absolute; top: 42px; left: 0; right: 0; margin: 0; padding: 6px;
  list-style: none; background: var(--paper); color: var(--ink);
  border-radius: 10px; box-shadow: var(--shadow); max-height: 50vh; overflow: auto;
}
.search-results li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.search-results li small { display: block; color: var(--muted); font-size: 12px; }
.search-results li[aria-selected="true"] { background: var(--paper-2); }

.topnav { margin-left: auto; display: flex; gap: 6px; }
.navbtn {
  display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px;
  border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--cream);
}
.navbtn[aria-expanded="true"] { background: #3a2d22; border-color: #514030; }
.navbtn-icon { width: 36px; padding: 0; justify-content: center; }
.navbtn-lang { padding: 0 9px; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; }
.i-sun, [data-theme="dark"] .i-moon { display: none; }
[data-theme="dark"] .i-sun { display: block; }
[data-theme="dark"] .topbar { background: #15110e; border-bottom-color: #2c231b; }
[data-theme="dark"] .search input { background: #241d17; border-color: #3a2f25; }

/* ------------------------------------------------------------------ layout */
.app { position: absolute; inset: calc(var(--topbar-h) + env(safe-area-inset-top)) 0 0 0; display: flex; }
.mapwrap { position: relative; flex: 1; min-width: 0; background: var(--paper-2); }
.map { position: absolute; inset: 0; }
.map-compare { z-index: 1; }
.maplibregl-ctrl-group { border-radius: 10px !important; box-shadow: var(--shadow) !important; }
.maplibregl-ctrl-top-left { top: calc(var(--now-h, 140px) + 16px); transition: top .2s; }
.maplibregl-ctrl-bottom-left { bottom: calc(var(--timeline-h) + 18px); }
.maplibregl-ctrl-bottom-right { bottom: calc(var(--timeline-h) + 18px); }
.maplibregl-ctrl-attrib { background: var(--glass) !important; color: var(--ink-2); font-size: 11px; }
.maplibregl-ctrl-attrib a { color: var(--ink-2) !important; }
.maplibregl-ctrl-scale { background: var(--glass); border-color: var(--ink-2); color: var(--ink-2); }
[data-theme="dark"] .maplibregl-ctrl-group { background: var(--surface); }
[data-theme="dark"] .maplibregl-ctrl-group button + button { border-top-color: var(--line); }
[data-theme="dark"] .maplibregl-ctrl-icon,
[data-theme="dark"] .maplibregl-ctrl-attrib-button { filter: invert(.88) sepia(.25); }

/* ------------------------------------------------------------------ "acum" card */
.now {
  position: absolute; top: 14px; left: 14px; z-index: 5;
  width: min(360px, calc(100% - 28px));
  background: var(--glass);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px 12px;
}
.now-head { display: flex; align-items: center; gap: 12px; }
.now-year {
  font: 700 30px/1 var(--serif); color: var(--accent);
  padding-right: 12px; border-right: 1px solid var(--line);
  font-variant-numeric: lining-nums;
}
.now.is-aerial .now-year { color: var(--aerial); }
.now-titles { min-width: 0; flex: 1; }
.now-titles h1 { margin: 0; font: 700 19px/1.15 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-titles p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-spinner {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid var(--paper-3); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.opacity { display: flex; align-items: center; gap: 10px; margin: 12px 0 10px; font-size: 12.5px; color: var(--ink-2); }
.opacity output { width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
input[type="range"] { flex: 1; accent-color: var(--accent); height: 18px; cursor: pointer; }
.now.is-aerial input[type="range"] { accent-color: var(--aerial); }

.now-actions { display: flex; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; white-space: nowrap; flex: none;
  border-radius: 999px; border: 1px solid var(--line); background: var(--chip-bg); font-size: 12.5px; color: var(--ink-2);
}
.chip svg { width: 15px; height: 15px; }
.chip-icon { margin-left: auto; width: 30px; padding: 0; justify-content: center; }
.chip[aria-pressed="true"], .chip[aria-pressed="true"]:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* × pe card: inchide harta veche; fara harta, cardul arata doar "azi" */
.now-close, .now-fav { width: 30px; height: 30px; margin: -6px -6px -6px -4px; color: var(--muted); }
.now-fav { margin-right: -2px; }
.now-fav[aria-pressed="true"] { color: #d9a21b; }
.now-fav[aria-pressed="true"] svg { fill: currentColor; }
.now.is-empty .now-close, .now.is-empty .now-fav, .now.is-empty .opacity, .now.is-empty .now-actions { display: none; }
.now.is-empty .now-year { color: var(--ink-2); }

.fatal {
  position: absolute; inset: 0; z-index: 40; display: grid; place-content: center; text-align: center; padding: 24px;
  background: var(--paper-2); color: var(--ink-2);
}
.fatal h2 { font: 700 28px/1.2 var(--serif); color: var(--ink); margin: 0 0 8px; }

/* ------------------------------------------------------------------ hint + toast */
.hint {
  position: absolute; left: 50%; bottom: calc(var(--timeline-h) + 78px); transform: translateX(-50%); z-index: 6;
  display: flex; align-items: center; gap: 6px; padding: 8px 6px 8px 16px; max-width: min(520px, calc(100% - 28px));
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
  font-size: 13px; color: var(--ink-2); animation: rise .4s ease both;
}
.hint p { margin: 0; }
@media (pointer: coarse) { .kbd-only { display: none; } }
.hint b { color: var(--accent); font-weight: 600; }
.toast {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%); z-index: 30;
  background: var(--espresso); color: var(--cream); padding: 9px 16px; border-radius: 999px;
  font-size: 13px; box-shadow: var(--shadow); animation: rise .25s ease both;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ------------------------------------------------------------------ compare */
.swipe { position: absolute; top: 0; bottom: 0; left: 50%; z-index: 4; width: 0; }
.swipe-line { position: absolute; top: 0; bottom: 0; left: -1.5px; width: 3px; background: var(--paper); box-shadow: 0 0 0 1px rgba(36, 27, 20, .35); }
.swipe-knob {
  position: absolute; top: 50%; left: -22px; width: 44px; height: 44px; margin-top: -22px;
  border-radius: 50%; border: 2px solid var(--paper); background: var(--accent); color: #fff;
  box-shadow: var(--shadow); display: grid; place-items: center; cursor: ew-resize; touch-action: none;
}
.compare-bar {
  position: absolute; top: 14px; right: 14px; z-index: 6;
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
  max-width: calc(100% - 400px);
}
/* cand bara e ingusta, eticheta si lista se strang; butonul de inchidere ramane mereu vizibil */
.compare-label { font-size: 12.5px; color: var(--muted); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.compare-pick { min-width: 0; flex: 0 1 auto; display: flex; }
.compare-pick select {
  height: 30px; border-radius: 999px; border: 1px solid var(--line); background: var(--chip-bg); padding: 0 10px;
  width: 100%; max-width: 260px; min-width: 0;
}
.compare-bar .icon-btn { flex: none; }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink-2); }

/* ------------------------------------------------------------------ layers menu */
.layers-menu {
  position: absolute; top: 10px; right: 14px; z-index: 15; width: 270px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px 14px 12px; max-height: calc(100% - 20px); overflow: auto; overscroll-behavior: contain;
}
.layers-close { position: absolute; top: 6px; right: 6px; }
.layers-menu h2 { margin: 12px 0 8px; font: 600 11px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.seg { display: flex; padding: 3px; background: var(--paper-2); border-radius: 9px; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 6px 0; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg input:focus-visible + span { outline: 2px solid var(--accent-2); }
.switch { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; }
.switch b { font-weight: inherit; }
.switch small { color: var(--muted); font-size: 11.5px; }
.switch > span { width: 32px; height: 18px; border-radius: 99px; background: var(--paper-3); position: relative; flex: none; transition: background .15s; }
.switch > span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); display: inline-block; margin-left: -4px; }
.legend { list-style: none; margin: 0 0 6px 42px; padding: 0; display: grid; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 1.5px var(--surface); }
.legend small { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.lg { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin: 0 4px 1px 0; vertical-align: middle; background: var(--c); }
.dash { width: 18px; height: 0; border-top: 3px dashed #c4612f; display: inline-block; margin-left: -2px; }

/* ------------------------------------------------------------------ timeline */
/* rigla: gradatii fine, ani dedesubt, cursor rotund; punctele de deasupra sunt straturile */
.timeline {
  position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 5;
  height: var(--timeline-h);
  display: flex; align-items: center; gap: 2px; padding: 0 6px;
  background: var(--tl-bg); -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2);
  border: 1px solid rgba(243, 231, 208, .08);
  border-radius: var(--radius); box-shadow: var(--shadow); color: var(--cream);
  -webkit-user-select: none; user-select: none;
}
.tl-step { width: 30px; height: 40px; border-radius: 8px; border: 0; background: transparent; color: rgba(243, 231, 208, .7); display: grid; place-items: center; flex: none; }
.tl-step svg { width: 16px; height: 16px; }
.tl-track { position: relative; flex: 1; height: 100%; margin: 0 14px; touch-action: none; cursor: pointer; }
.tl-axis { position: absolute; left: 0; right: 0; top: 0; bottom: 0; pointer-events: none; }
.tl-tick { position: absolute; top: calc(var(--ruler-y) - 3px); width: 1px; height: 6px; margin-left: -.5px; background: rgba(243, 231, 208, .32); }
.tl-tick.k2 { top: calc(var(--ruler-y) - 5px); height: 10px; background: rgba(243, 231, 208, .5); }
.tl-tick.k3 { top: calc(var(--ruler-y) - 8px); height: 16px; width: 1.5px; background: rgba(243, 231, 208, .8); }
.tl-tick b {
  position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  font: 500 12.5px/1 var(--sans); letter-spacing: .01em; color: rgba(243, 231, 208, .82); font-variant-numeric: tabular-nums;
}
.timeline { --ruler-y: 27px; }
.tl-marks { position: absolute; left: 0; right: 0; top: 4px; height: 10px; }
.tl-mark {
  position: absolute; top: 0; width: 6px; height: 6px; margin-left: -3px;
  border-radius: 50%; border: 0; padding: 0; background: var(--accent-2); opacity: .85;
  transition: transform .12s, opacity .12s;
}
.tl-mark.aerial { background: #6fb3b5; }
.tl-mark.satellite { background: #8fb3de; }
.tl-mark.today { background: #9fd18a; }
.tl-mark.fav { box-shadow: 0 0 0 1.5px #f2c94c; }
.tl-mark.dim { opacity: .15; pointer-events: none; }
.tl-mark.active { background: #fff; opacity: 1; transform: scale(1.35); }
.tl-handle {
  position: absolute; top: calc(var(--ruler-y) - 12px); width: 24px; height: 24px; margin-left: -12px;
  border-radius: 50%; background: var(--accent); outline: none; z-index: 2;
  box-shadow: 0 0 0 3px rgba(185, 84, 43, .25), 0 2px 8px rgba(0, 0, 0, .45);
  transition: transform .12s;
}
.tl-handle::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: #fff; }
.tl-track.dragging .tl-handle { transform: scale(1.15); }
.tl-handle:focus-visible { box-shadow: 0 0 0 3px var(--cream), 0 2px 8px rgba(0, 0, 0, .45); }
.tl-tooltip {
  position: absolute; bottom: calc(100% + 12px); transform: translateX(-50%); pointer-events: none;
  background: var(--paper); color: var(--ink); padding: 6px 10px; border-radius: 8px; box-shadow: var(--shadow);
  font-size: 12.5px; white-space: nowrap; z-index: 3;
}
.tl-tooltip b { font-family: var(--serif); font-size: 15px; margin-right: 6px; color: var(--accent); }

/* placuta din colt: comuta intre harta de azi si satelit */
.base-switch {
  position: absolute; left: 14px; bottom: calc(var(--timeline-h) + 26px); z-index: 5;
  width: 68px; height: 68px; padding: 0; overflow: hidden;
  border-radius: 12px; border: 2px solid var(--surface); background: var(--paper-3); box-shadow: var(--shadow);
}
.base-switch img { display: block; width: 100%; height: 100%; object-fit: cover; }
.base-switch span {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 0 5px; text-align: center;
  font: 600 11.5px/1 var(--sans); color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .7));
}
/* butoanele de pe harta: repere, fotografii, locul prin timp */
.map-pills { position: absolute; left: 92px; bottom: calc(var(--timeline-h) + 26px); z-index: 5; display: flex; gap: 6px; }
.map-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px 0 11px; white-space: nowrap;
  border-radius: 999px; border: 1px solid var(--line); background: var(--glass); color: var(--ink-2);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: var(--shadow); font-weight: 600; font-size: 13px;
}
.map-pill svg { width: 17px; height: 17px; }
.map-pill[aria-pressed="true"] { background: #2f7d4f; border-color: #2f7d4f; color: #fff; }
.pill-photos[aria-pressed="true"] { background: #2d5f8a; border-color: #2d5f8a; }
.pill-through[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.touring .map-pills, .touring .base-switch, .touring .hint { display: none; }

/* locul prin timp: sirul de miniaturi */
.through {
  position: absolute; left: 14px; right: 14px; bottom: calc(var(--timeline-h) + 24px); z-index: 7;
  background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 6px 10px 14px;
  animation: rise-in .25s ease both;
}
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.through header { display: flex; align-items: flex-start; gap: 8px; padding-right: 4px; }
.through header div { flex: 1; min-width: 0; }
.through h2 { margin: 0; font: 700 18px/1.15 var(--serif); }
.through header p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.through-list { list-style: none; margin: 8px 0 0; padding: 0 0 4px; display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; overscroll-behavior: contain; }
.through-list li { flex: none; scroll-snap-align: start; }
.through-card {
  display: grid; gap: 3px; width: 150px; padding: 0; border: 0; background: none; text-align: left; color: var(--ink);
}
.through-img { display: block; width: 150px; height: 112px; border-radius: 9px; overflow: hidden; background: var(--paper-3); border: 2px solid transparent; position: relative; }
.through-img canvas { width: 100%; height: 100%; display: block; }
.through-img i { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%) var(--paper-3); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.through-card.active .through-img { border-color: var(--accent); }
.through-year { font: 700 17px/1 var(--serif); color: var(--accent); margin-top: 3px; }
.through-title { font-size: 12px; line-height: 1.25; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.through-pin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff; background: var(--accent); box-shadow: 0 0 0 3px rgba(185, 84, 43, .35), 0 2px 8px rgba(0, 0, 0, .4); }

/* traseele: cardul pasului curent */
.tour {
  position: absolute; right: 14px; bottom: calc(var(--timeline-h) + 24px); z-index: 8; width: min(400px, calc(100% - 28px));
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px 12px;
  animation: rise-in .25s ease both;
}
.tour-top { display: flex; align-items: center; gap: 8px; }
.tour-kicker { flex: 1; margin: 0; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.tour h2 { margin: 4px 0 6px; font: 700 22px/1.15 var(--serif); }
.tour p#tour-text { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); max-height: 32vh; overflow: auto; }
.tour-nav { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.tour-dots { flex: 1; display: flex; justify-content: center; gap: 5px; flex-wrap: wrap; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--paper-3); }
.tour-dots i.on { background: var(--accent); width: 16px; border-radius: 3px; }
.chip-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip:disabled { opacity: .4; cursor: default; }
.tours-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.tour-item {
  display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; width: 100%; padding: 8px; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
}
.tour-item img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--paper-3); }
.tour-item b { display: block; font: 700 18px/1.2 var(--serif); }
.tour-item small { display: block; margin-top: 2px; color: var(--ink-2); font-size: 12.5px; line-height: 1.4; }
.tour-item em { display: block; margin-top: 4px; font-style: normal; font-size: 12px; color: var(--accent); font-weight: 600; }
.modal-lead { margin: 0; color: var(--ink-2); }

/* ------------------------------------------------------------------ panel */
.panel {
  width: var(--panel-w); flex: none; display: flex; flex-direction: column;
  background: var(--paper); border-left: 1px solid var(--line); position: relative; z-index: 10;
}
.panel-grip { display: none; }
.panel-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.panel-head { padding: 16px 18px 4px; }
.panel-head h2 { margin: 0; font: 700 23px/1.1 var(--serif); }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.tabs { display: flex; gap: 4px; padding: 8px 18px 10px; border-bottom: 1px solid var(--line); }
.tabs button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; color: var(--ink-2); font-size: 13px;
}
.tabs button { display: inline-flex; align-items: center; }
.tabs button[aria-selected="true"] { background: var(--espresso); color: var(--cream); }
[data-theme="dark"] .tabs button[aria-selected="true"] { background: var(--cream); color: var(--espresso); }
.tab-fav svg { width: 14px; height: 14px; margin-right: 5px; }
.tab-count:not(:empty) { margin-left: 6px; padding: 1px 6px; border-radius: 99px; background: var(--paper-3); color: var(--ink-2); font-size: 11px; line-height: 1.4; }
.tabs button[aria-selected="true"] .tab-count { background: rgba(255, 255, 255, .18); color: inherit; }
.cards-empty { margin: 18px; padding: 18px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; font-size: 13px; }

.cards { list-style: none; margin: 0; padding: 8px 10px 16px; overflow-y: auto; flex: 1; scroll-behavior: smooth; }
.cards > li { position: relative; }
.fav-btn {
  position: absolute; top: 15px; right: 15px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: rgba(20, 15, 11, .5); color: #fff; opacity: 0; transition: opacity .15s;
}
.fav-btn svg { width: 16px; height: 16px; }
.fav-btn[aria-pressed="true"] { opacity: 1; color: #f2c94c; }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }
.fav-btn:focus-visible { opacity: 1; }
@media (pointer: coarse) {
  .fav-btn { opacity: .85; }
  /* tinte mai mari pentru deget: butoanele hartii si × de pe ferestre */
  .maplibregl-ctrl-group button { width: 36px; height: 36px; }
  .maplibregl-popup-close-button {
    top: -12px; right: -12px; width: 32px; height: 32px; border-radius: 50%;
    background: var(--paper); color: var(--ink-2); box-shadow: var(--shadow); font-size: 20px; line-height: 1;
  }
}
.card {
  display: grid; grid-template-columns: 1fr 92px; gap: 12px; align-items: center;
  padding: 10px 10px 10px 12px; margin-bottom: 4px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; position: relative;
}
.card.active { background: var(--surface); border-color: var(--line); box-shadow: 0 2px 10px rgba(36, 27, 20, .08); }
.card.active::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--accent); }
.card.active.aerial::before { background: var(--aerial); }
.card.offscreen { opacity: .5; }
.card-year { font: 700 20px/1 var(--serif); color: var(--accent); }
.card.aerial .card-year { color: var(--aerial); }
.card h3 { margin: 3px 0 2px; font: 600 15px/1.25 var(--sans); }
.card .meta { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.card .badges { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 99px; background: var(--accent-soft); color: #87391a; }
.badge.aerial { background: var(--aerial-soft); color: #1f5154; }
.badge.satellite { background: #dfe7f1; color: #2c4a6e; }
.badge.today { background: #e1efd8; color: #3b6a29; }
.badge.scale { background: var(--paper-2); color: var(--ink-2); }
[data-theme="dark"] .badge { color: #f0b896; }
[data-theme="dark"] .badge.aerial { color: #9fd6d6; }
[data-theme="dark"] .badge.satellite { background: #1e2a3a; color: #a9c4e6; }
[data-theme="dark"] .badge.today { background: #22301b; color: #b4d99f; }
[data-theme="dark"] .badge.scale { color: var(--ink-2); }
.card img {
  width: 92px; height: 72px; object-fit: cover; border-radius: 7px; background: var(--paper-3);
  border: 1px solid var(--line);
}
.panel-foot { margin: 0; padding: 10px 18px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------------ popups */
.maplibregl-popup-content { background: var(--paper); border-radius: 10px; box-shadow: var(--shadow); padding: 12px 14px; font-family: var(--sans); max-width: 300px; }
.maplibregl-popup-tip { border-top-color: var(--paper) !important; border-bottom-color: var(--paper) !important; }
.maplibregl-popup { z-index: 3; } /* peste butoanele de zoom, care pe telefon ar acoperi textul */
.maplibregl-popup.over { z-index: 9; } /* ecran prea jos pentru loc sub cardul de sus: fereastra trece peste el */
.popup { overflow-y: auto; overscroll-behavior: contain; } /* inaltimea maxima o pune keepVisible(), dupa spatiul liber */
.popup h4 { margin: 0 0 2px; font: 700 17px/1.2 var(--serif); }
.popup .kind { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.popup p { margin: 6px 0 0; font-size: 13px; line-height: 1.5; max-height: 220px; overflow: auto; }
.popup .kind i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: var(--c); }
.popup .src { display: inline-block; margin-top: 8px; font-size: 12px; text-decoration: none; }
.popup .src:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ modals */
.modal {
  border: 0; padding: 22px 24px; border-radius: 16px; background: var(--paper); color: var(--ink);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 64px); box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(36, 27, 20, .45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.modal-close-form { position: absolute; top: 10px; right: 10px; margin: 0; }
.modal-thumb { width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--paper-3); }
.modal-kicker { margin: 14px 0 2px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.about .modal-kicker { margin-top: 0; }
.modal h2 { margin: 0 0 8px; font: 700 28px/1.1 var(--serif); }
.modal h3 { margin: 18px 0 6px; font: 700 18px/1.2 var(--serif); }
.modal ul { padding-left: 18px; margin: 0; }
.modal li { margin: 4px 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 14px 0; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.modal-links { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.modal-links a { text-decoration: none; }

.mapbox-logo { position: absolute; right: 12px; bottom: calc(var(--timeline-h) + 58px); z-index: 4; line-height: 0; }
.mapbox-logo img { width: 88px; height: 23px; }
body.comparing .mapbox-logo, .touring .mapbox-logo,
body.comparing .esri-credit, .touring .esri-credit { bottom: calc(var(--timeline-h) + 90px); }
.esri-credit { position: absolute; right: 12px; bottom: calc(var(--timeline-h) + 58px); z-index: 4; padding: 2px 7px;
  border-radius: 6px; background: rgba(0, 0, 0, .55); color: #fff; font: 600 11px/1.4 var(--sans); text-decoration: none; }

/* donatii: butonul din bara de sus, fereastra, indemnul de la finalul traseului */
.nav-support svg { color: #f08a6a; }
.nav-support[aria-expanded="true"], .nav-support:focus-visible { background: #3a2d22; }
.about-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }
.about-foot .modal-links { gap: 4px 6px; color: var(--muted); }
.rights-note { flex-basis: 100%; margin: 0; font-size: 12.5px; color: var(--muted); }
.chip-primary svg { color: inherit; }
.support-modal .modal-kicker { margin-top: 0; }
.support-costs { margin: 10px 0 6px; font-size: 13px; color: var(--muted); }
.support-goals { margin: 0 0 14px !important; font-size: 13.5px; color: var(--ink-2); }
.support-goals b { color: var(--accent); }
.support-ways { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.support-way { height: 40px; padding: 0 16px; font-size: 14px; font-weight: 600; text-decoration: none; }
.support-way:not(.chip-primary) { color: var(--ink); }
.support-iban {
  flex: 1 1 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--chip-bg);
}
.support-iban b { grid-column: 1 / -1; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.support-iban code { font: 600 15px/1.3 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .03em; overflow-wrap: anywhere; }
.support-iban small { grid-column: 1; color: var(--muted); font-size: 12px; }
.support-iban button { grid-column: 2; grid-row: 2 / span 2; }
.support-soon { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--paper-2); font-size: 13.5px; color: var(--ink-2); }
.support-thanks { margin: 14px 0 0; font-size: 13px; color: var(--ink-2); }
.support-note { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); }
.nudge { padding: 8px 6px 8px 16px; }
.nudge .chip { flex: none; }
.popup .photo { display: block; margin: -2px -4px 8px; }
.popup .photo img { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 7px; background: var(--paper-3); }
.popup .credit { margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.popup .gallery { list-style: none; margin: 6px -4px 0 0; padding: 0 4px 0 0; max-height: 380px; overflow-y: auto; display: grid; gap: 14px; overscroll-behavior: contain; }
.popup .gallery li + li { border-top: 1px solid var(--line); padding-top: 12px; }
.popup .gallery h4 { font-size: 15px; }

/* ------------------------------------------------------------------ mobile */
/* ------------------------------------------------------------------ telefon / tableta mica */
/* card "acum" compact: an + titlu pe un rand, opacitate + butoane-iconita pe al doilea */
@media (max-width: 820px), (max-height: 560px) {
  .now {
    display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: center;
    padding: 9px 10px 9px 12px;
  }
  .now-head { grid-column: 1 / -1; gap: 10px; }
  .now-year { font-size: 25px; padding-right: 10px; }
  .now-titles h1 { font-size: 18px; }
  .opacity { margin: 0; min-width: 0; }
  .opacity > span, .opacity output { display: none; }
  .opacity input { height: 28px; }
  .now-actions { gap: 4px; }
  .now-actions .chip { width: 36px; height: 36px; padding: 0; justify-content: center; margin: 0; border-radius: 50%; }
  .now-actions .chip svg { width: 17px; height: 17px; }
  .now-actions .chip-label { display: none; }
}

@media (max-width: 820px) {
  :root { --topbar-h: 54px; --timeline-h: 62px; --sheet-h: calc(58px + env(safe-area-inset-bottom)); }
  .brand-text em, .navbtn span { display: none; }
  .brand-text strong { font-size: 20px; }
  .topbar { gap: 8px; padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  .search { max-width: none; min-width: 0; }
  .search input { font-size: 16px; height: 38px; } /* sub 16px, iOS mareste pagina la focus */
  .navbtn { padding: 0; width: 40px; justify-content: center; }

  .app { display: block; }
  .mapwrap { position: absolute; inset: 0 0 var(--sheet-h) 0; }
  .now { top: 8px; left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); width: auto; }
  .timeline { left: max(6px, env(safe-area-inset-left)); right: max(6px, env(safe-area-inset-right)); bottom: 6px; padding: 0 2px; gap: 0; }
  .tl-step { width: 28px; height: 40px; }
  .tl-track { margin: 0 10px; }
  .tl-tick b { font-size: 11px; }
  .tl-mark::before { content: ""; position: absolute; inset: -6px -3px; } /* tinta mai mare la atingere */
  .base-switch { left: max(8px, env(safe-area-inset-left)); bottom: calc(var(--timeline-h) + 14px); width: 54px; height: 54px; border-radius: 10px; }
  .map-pills { left: calc(max(8px, env(safe-area-inset-left)) + 62px); bottom: calc(var(--timeline-h) + 24px); gap: 5px; }
  .map-pill { height: 34px; padding: 0 10px; font-size: 12.5px; }
  .map-pill span { display: none; }   /* doar iconite: nu incap trei etichete langa placuta */
  .through { left: 6px; right: 6px; bottom: calc(var(--timeline-h) + 10px); padding: 8px 4px 8px 10px; }
  .through-card, .through-img { width: 118px; }
  .through-img { height: 88px; }
  .tour { left: 6px; right: 6px; width: auto; bottom: calc(var(--timeline-h) + 10px); padding: 12px 14px 10px; }
  .tour h2 { font-size: 19px; }
  .tour p#tour-text { font-size: 13px; max-height: 26vh; }
  .navbtn-lang { width: 34px; padding: 0; }
  .base-switch span { font-size: 10.5px; padding: 12px 0 4px; }
  .compare-bar {
    top: auto; bottom: calc(var(--timeline-h) + 14px); right: 50%; transform: translateX(50%);
    max-width: calc(100% - 16px); padding: 4px 4px 4px 6px;
  }
  .compare-label { display: none; }
  .compare-pick select { font-size: 16px; height: 34px; max-width: calc(100vw - 80px); }
  .layers-menu { right: 8px; left: 8px; width: auto; max-height: calc(100% - 20px); overflow: auto; }
  .search-results { min-width: min(340px, calc(100vw - 20px)); }
  .hint { left: 8px; right: 8px; bottom: calc(var(--timeline-h) + 78px); transform: none; max-width: none; border-radius: 14px; font-size: 12.5px; animation: none; }
  .toast { top: 84px; max-width: calc(100% - 24px); text-align: center; }
  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: calc(var(--timeline-h) + 10px); }
  .maplibregl-ctrl-scale { display: none; }

  /* lista hartilor: panou care urca de jos; se trage de maner sau se apasa */
  .panel {
    position: absolute; left: 0; right: 0; bottom: 0; width: auto; height: var(--sheet-h);
    padding-bottom: env(safe-area-inset-bottom);
    border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 24px rgba(36, 27, 20, .18); transition: height .28s cubic-bezier(.2, .8, .2, 1); z-index: 12;
  }
  .panel.open { height: min(80%, calc(100% - 30px)); height: min(80dvh, calc(100% - 30px)); }
  .panel.dragging { transition: none; }
  .panel-grip {
    display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%;
    border: 0; background: transparent; padding: 9px 0 12px; flex: none; touch-action: none;
  }
  .grip-bar { width: 42px; height: 5px; border-radius: 5px; background: var(--paper-3); }
  .grip-label { font-size: 13px; color: var(--ink-2); }
  .panel-body { display: none; }
  .panel.open .panel-body, .panel.dragging .panel-body { display: flex; }
  .panel-head { padding-top: 2px; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs button { flex: none; padding: 8px 14px; }
  .cards { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .card { grid-template-columns: 1fr 84px; padding: 10px; }
  .card img { width: 84px; height: 64px; }
  .modal { padding: 18px; max-height: calc(100% - 32px); overflow: auto; }
  .modal h2 { font-size: 25px; }
}

/* harta prea ingusta pentru bara de comparare langa cardul de sus: bara coboara deasupra liniei timpului,
   in locul butoanelor de pe harta */
@media (max-width: 1100px) {
  .map-pill span { display: none; } /* doar iconite: etichetele ar acoperi atribuirea hartii din dreapta */
  .compare-bar { top: auto; bottom: calc(var(--timeline-h) + 14px); right: 50%; transform: translateX(50%); max-width: calc(100% - 16px); }
  body.comparing .map-pills, body.comparing .base-switch { display: none; }
}

/* telefon ingust: doar sigla, butoane mai stranse; cautarea se intinde peste bara cat timp e folosita */
@media (max-width: 560px) {
  .brand-text { display: none; }
  .nav-support { display: none; } /* nu incape; "Susține" ramane in fereastra Despre si sub lista hartilor */
  .topbar { gap: 6px; }
  .topnav { gap: 0; }
  .navbtn { width: 38px; }
  .navbtn-lang { width: 34px; }
  .search input { padding-right: 8px; }
  .search:not(:focus-within) input::placeholder { color: transparent; } /* in cutia ingusta s-ar vedea doar „C” */
  .search:focus-within, .search:has(> .search-results:not([hidden])) {
    position: absolute; z-index: 3;
    top: calc(env(safe-area-inset-top) + (var(--topbar-h) - 38px) / 2);
    left: max(10px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right));
  }
}

/* telefon tinut orizontal: cardul de sus ramane ingust, ca sa se vada harta */
@media (max-width: 820px) and (max-height: 500px) {
  .now { right: auto; width: min(380px, 62%); }
  .now-titles p { display: none; }
  .maplibregl-ctrl-top-left { top: 8px; left: auto; right: max(8px, env(safe-area-inset-right)); }
  .hint { display: none !important; }
  .panel.open { height: calc(100% - 12px); }
  /* "prin timp" si traseele nu incap deasupra liniei timpului: ocupa harta de sus pana la ea */
  .through, .tour { top: 6px; bottom: calc(var(--timeline-h) + 8px); display: flex; flex-direction: column; overflow: hidden; }
  .through { padding-top: 6px; }
  .through header p { display: none; }
  .through-list { flex: 1; min-height: 0; margin-top: 4px; }
  .through-card, .through-img { width: 92px; }
  .through-img { height: 58px; }
  .through-title { -webkit-line-clamp: 1; }
  .tour { padding: 8px 12px; }
  .tour h2 { font-size: 17px; margin: 2px 0 4px; }
  .tour p#tour-text { flex: 1; min-height: 0; max-height: none; font-size: 12.5px; }
  .tour-nav { margin-top: 6px; }
}

/* telefon tinut orizontal: putina inaltime */
@media (max-height: 560px) and (min-width: 821px) {
  :root { --topbar-h: 48px; --timeline-h: 58px; --panel-w: 320px; }
  .brand-text em { display: none; }
  .now { top: 8px; left: 8px; width: min(340px, calc(100% - 16px)); }
  .now-titles p { display: none; }
  .hint { display: none !important; }
  .timeline { bottom: 6px; left: 8px; right: 8px; }
  .base-switch { left: 8px; bottom: calc(var(--timeline-h) + 14px); width: 48px; height: 48px; border-radius: 9px; }
  .map-pills { left: 64px; bottom: calc(var(--timeline-h) + 14px); }
  .map-pill { height: 34px; }
  .base-switch span { font-size: 10px; padding: 10px 0 3px; }
  .card img { width: 72px; height: 56px; }
  .card { grid-template-columns: 1fr 72px; }
}

@media (hover: hover) {
  .search-results li:hover { background: var(--paper-2); }
  .navbtn:hover { background: #3a2d22; border-color: #514030; }
  .chip:hover { border-color: var(--accent); color: var(--accent); }
  .icon-btn:hover { background: var(--paper-2); }
  .tl-step:hover { background: rgba(255, 255, 255, .08); color: var(--cream); }
  .tl-mark:hover { transform: scale(1.8); opacity: 1; z-index: 2; }
  .cards > li:hover .fav-btn { opacity: 1; }
  .fav-btn:hover { background: rgba(20, 15, 11, .7); }
  .base-switch:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(36, 27, 20, .3); }
  .through-card:hover .through-img { border-color: var(--accent-2); }
  .tour-item:hover { border-color: var(--accent); }
  .tabs button:hover:not([aria-selected="true"]) { background: var(--paper-2); }
  .card:hover { background: var(--paper-2); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
