:root {
  --bg0: #0b1c23;
  --bg1: #122e3b;
  --text: #0f1720;
  --text-invert: #ffffff;
  --brand: #146e4a;
  --brand-2: #24a28c;
  --card: rgba(0, 0, 0, 0.5);
  --glass: rgba(0, 0, 0, 0.65);
  --glass-dark: rgba(16, 28, 35, 0.5);
  --radius: 12px;
  --gap: 14px;
  --nav-h: 64px;
  --footer-h: 54px;
  --mint: #38e2b8;
  --mint-600: #1ec6a0;
  --fg: #e5e7eb;
  --glass-bg: rgba(255,255,255,.06);
  --glass-br: rgba(255,255,255,.18);
  --shadow: 0 8px 24px rgba(0,0,0,.28);
  --ring-w: 2px;
}

/* Ссылка как кнопка — не меняем класс */
.open-image {
  --accent: var(--mint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;

  padding: 15px;
  margin-top: 10px;

  font: 600 .95rem/1.1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--fg);
  text-decoration: none;

  background: var(--glass-bg);
  border: 1px solid var(--glass-br);
  border-radius: 6px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow);

  transition: transform .18s ease,
              background-color .18s ease,
              border-color .18s ease,
              box-shadow .18s ease,
              color .18s ease;
}

.open-image:hover {
  border-color: color-mix(in oklab, var(--accent) 45%, white 55%);
  box-shadow: 0 10px 28px color-mix(in oklab, var(--accent) 25%, black 75%);
}

.open-image:active {
  transform: translateY(1px) scale(.99);
  box-shadow: 0 6px 18px color-mix(in oklab, var(--accent) 20%, black 80%);
}

/* Доступный контур фокуса для клавиатуры */
.open-image:focus { outline: none; }
.open-image:focus-visible {
  outline: var(--ring-w) solid color-mix(in oklab, var(--accent) 70%, white 30%);
  outline-offset: 2px;
  box-shadow: 0 0 0 calc(var(--ring-w) + 1px) color-mix(in oklab, var(--accent) 35%, transparent 65%),
              var(--shadow);
}

/* Неактивное состояние, если понадобится */
.open-image[aria-disabled="true"] {
  opacity: .55;
  pointer-events: none;
  cursor: not-allowed;
}

/* Уважение системной настройки «меньше анимаций» */
@media (prefers-reduced-motion: reduce) {
  .open-image { transition: none; }
  .open-image:active { transform: none; }
}

html,
body {
  margin: 0;
  padding: 0;
}
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell,
    "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji",
    "Segoe UI Symbol";
  color: var(--text-invert);
  background: radial-gradient(
    1200px 800px at 70% -10%,
    #1c4556 0%,
    var(--bg1) 40%,
    var(--bg0) 100%
  );
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: #0e1b23;
  color: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
nav a {
  color: #eaf2f5;
}
nav a:hover {
  background: rgba(0, 0, 0, 0.08);
}

.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
body.nav-open .nav-overlay {
  opacity: 1;
  pointer-events: auto;
}

.nav-toggle {
  display: inline-flex;
}
.nav-panel {
  position: fixed;
  z-index: 1100;
  inset: var(--nav-h) 0 auto 0;
  background: rgba(15, 34, 44, 0.6);

  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%); 
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.18s ease, opacity 0.18s ease;
  max-height: calc(100svh - var(--nav-h));
  overflow: auto;
}
body.nav-open .nav-panel {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}
.nav-panel ul {
  margin: 12px;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.nav-panel a {
  display: block;
  width: 92%;
  text-align: center;
  padding: 14px 16px;
  border-radius: 10px;
  background: linear-gradient(180deg, #156565 0%, #085151 100%);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.16);
}
.nav-panel a:focus-visible {
  outline: 3px solid #2c8981;
  outline-offset: 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand img {
  height: 36px;
  width: auto;
  display: block;
}

header.page-header {
  width: 96%;
  margin: 18px auto 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
}

h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.actions a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  background: linear-gradient(180deg, #259b86 0%, #1f8a77 100%);
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  transition: transform 0.06s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 18px rgba(36, 162, 140, 0.28);
}
.actions a:hover {
  transform: translateY(-1px);
}
.actions a:active {
  transform: translateY(0);
}

.map-wrap {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  width: 100%;
  padding: 8px 0 0;
}
.map-container {
  width: 96%;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: clip;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.04)
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  min-height: 360px;
}
#map {
  flex: 1 1 auto; 
  min-height: calc(
    100svh - var(--nav-h) - var(--footer-h) - 180px
  ); 
  width: 100%;
  height: 85vh;
}

.popup {
  position: absolute;
  transform: translate(-50%, -110%);
  display: flex;
  flex-direction: column;
  min-width: 260px;
  z-index: 1000;
}
.popup-content {
  padding: 10px;
  border-radius: 10px;
  background: var(--card);
  color: #ffffff !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.popup-content img {
  width: 320px;
  height: auto;
  border-radius: 8px;
  display: block;
  margin-bottom: 8px;
}
.popup-close {
  position: absolute;
  top: 6px;
  right: 8px;
  padding: 0 6px;
  font-size: 12px;
  line-height: 20px;
  width: 20px;
  height: 20px;
  text-align: center;
  cursor: pointer;
  color: #334;
  border-radius: 6px;
  transition: background 0.2s ease;
}
.popup-close:hover {
  background: rgba(0, 0, 0, 0.06);
}
.popup-tip {
  width: 0;
  height: 0;
  align-self: center;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--card);
  filter: drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.08));
}

footer {
  min-height: var(--footer-h);
  padding: 12px 0;
  color: #eaf2f5;
  background: var(--glass-dark);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  backdrop-filter: blur(8px) saturate(120%);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-inner {
  width: 96%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-brand {
  font-weight: 700;
  letter-spacing: -0.01em;
  opacity: 0.95;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f6fbff;
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.08s ease, background 0.2s ease, color 0.2s ease;
}
.link-pill:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.link-pill:focus-visible {
  outline: 3px solid #76c7ff; 
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .footer-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .footer-brand {
    text-align: center;
  }
  .links {
    justify-content: center;
  }
}


.nav-toggle {
  display: none;
}
.nav-panel {
  display: block;
}

nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  backdrop-filter: saturate(140%) blur(10px);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
nav .inner {
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
}
nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  margin: 0;
}
nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
}
nav a:hover {
  background: rgba(0, 0, 0, 0.06);
}
nav a.active {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 6px 16px rgba(39, 106, 64, 0.25);
}

.nav-toggle {
  position: relative;
  z-index: 1100;
  width: 44px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: #fff;
  will-change: transform, opacity; 
}
.nav-toggle:focus-visible {
  outline: 3px solid #76c7ff;
  outline-offset: 2px;
}

.nav-toggle-bar {
  position: absolute;
  left: 9px;
  right: 9px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.nav-toggle-bar:nth-child(1) {
  top: 11px;
}
.nav-toggle-bar:nth-child(2) {
  top: 18px;
}
.nav-toggle-bar:nth-child(3) {
  top: 25px;
}

body.nav-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
body.nav-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
body.nav-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-panel {
  display: block;
}
.nav-panel[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
  }
  .nav-panel {
    position: fixed;
    inset: var(--nav-h) 0 auto 0;
    display: block;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    backdrop-filter: blur(10px) saturate(140%);
    max-height: calc(100svh - var(--nav-h));
    overflow: auto;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  }
  body.nav-open .nav-panel {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }
}

footer {
  min-height: var(--footer-h);
  padding: 10px 0;
  color: #eaf2f5;
  background: var(--glass-dark);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  backdrop-filter: blur(8px) saturate(120%);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-inner {
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.footer-brand {
  font-weight: 600;
  opacity: 0.9;
}
.socials {
  display: flex;
  align-items: center;
  gap: 8px;
}
.socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: transform 0.08s ease, background 0.2s ease;
}
.socials a:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}
.socials svg {
  width: 20px;
  height: 20px;
  fill: #eaf2f5;
}
@media (max-width: 640px) {
  .footer-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .footer-brand {
    text-align: center;
    margin-bottom: 6px;
  }
  .socials {
    justify-content: center;
  }
}

#add-modal {
  width: min(1000px, 90vw);
  height: 90svh; 
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: #0f222c;
  color: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
#add-modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

#add-modal .modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
#add-modal .modal-body {
  height: calc(100% - 50px); 
  overflow: hidden; 
}
#add-frame {
  width: 100%;
  height: 100%; 
  border: 0;
  background: #fff;
}

html.modal-open,
body.modal-open {
  overflow: hidden;
}

#img-modal {
  width: 96vw;
  height: 96svh;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}
#img-modal::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.img-figure {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
}

#img-view {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
  cursor: zoom-out;
}
.img-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 14px;
  color: #eef7ff;
  font-weight: 600;
  line-height: 1.3;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.55) 40%,
    rgba(0, 0, 0, 0.65) 100%
  );
  cursor: pointer;
  user-select: text;
}
.img-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}
.img-close:focus-visible {
  outline: 3px solid #76c7ff;
  outline-offset: 2px;
}

#img-view {
  width: 100%;
  height: 100%;
  object-fit: contain; 
  display: block;
  background: #000; 
}
#img-modal .img-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}
#img-modal .img-close:focus-visible {
  outline: 3px solid #76c7ff;
  outline-offset: 2px;
}
