/* ================= Мапа дайв-сайтів (сторінка Diving, блок #sites) =================
   Розмітку генерує tools/dive-map/build.py, поведінку — assets/js/dive-map.js.
   Кольори — з палітри сайту: --main-blue #1d317b, --text-bright #f4ecea, --text-dark #182142, акцент #0096df. */

.dm {
  --dm-navy: var(--main-blue, #1d317b);
  --dm-cream: var(--text-bright, #f4ecea);
  --dm-ink: var(--text-dark, #182142);
  --dm-accent: #0096df;
  --dm-sky: #7cc7f0;
  --dm-line: #c8c3c8;
  --dm-radius: clamp(16px, 2.083vw, 30px);
  --mks: 1;                      /* масштаб маркерів на мапі */
  font-family: Zain, Arial, sans-serif;
  color: var(--dm-ink);
}

.dm-intro { margin-bottom: clamp(28px, 3.75vw, 56px); }
.dm-intro .header-h2 { margin-bottom: clamp(12px, 1.25vw, 20px); }
.dm-intro-p { max-width: 46em; }

.dm-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(330px, 1fr);
  gap: clamp(16px, 1.667vw, 28px);
  align-items: start;
}

/* ---------- мапа ---------- */
.dm-map {
  position: relative;
  aspect-ratio: 1000 / 900;            /* = viewBox мапи; на телефоні інший (нижче) */
  border-radius: var(--dm-radius);
  overflow: hidden;
  isolation: isolate;
  line-height: 0;
  box-shadow: 0 22px 40px -30px rgba(24, 33, 66, .35);
}
/* рамка поверх мапи: напівпрозора — на суші як у панелі, на морі зливається з водою */
.dm-map::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 1px solid rgba(24, 33, 66, .2); pointer-events: none; }
/* SVG у звичайному потоці (не absolute — інакше браузер не втримує сторінку при довантаженні картинок вище)
   і завжди повністю закриває блок (slice), тому між мапою і рамкою не лишається щілини */
.dm-svg { display: block; width: 100%; height: 100%; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.dm-svg text { font-family: Zain, Arial, sans-serif; }

.dm-iso { fill: none; stroke: rgba(244, 236, 234, .16); stroke-width: 1.4; stroke-dasharray: 2 8; stroke-linecap: round; }
.dm-iso-2 { stroke: rgba(244, 236, 234, .09); }

.dm-wave path { fill: none; stroke: rgba(244, 236, 234, .32); stroke-width: 1.8; stroke-linecap: round;
  animation: dmWave 5.5s ease-in-out infinite alternate; animation-delay: calc(var(--d) * -1); }
.dm-wave path + path { stroke: rgba(244, 236, 234, .18); animation-duration: 6.5s; }
@keyframes dmWave { from { transform: translateX(-7px); } to { transform: translateX(9px); } }

.dm-shallow path { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.dm-shallow .s1 { stroke: #22378a; stroke-width: 130; }
.dm-shallow .s2 { stroke: #2a4699; stroke-width: 66; }
.dm-shallow .s3 { stroke: #3c6fb8; stroke-width: 24; }

.dm-land { fill: var(--dm-cream); }
.dm-topo path { fill: none; stroke: #e4d8d4; stroke-width: 1.4; }
.dm-coast { fill: none; stroke: var(--dm-sky); stroke-width: 2.2; stroke-linejoin: round; }
.dm-island { fill: var(--dm-cream); stroke: var(--dm-sky); stroke-width: 2; }

.dm-village { fill: rgba(29, 49, 123, .5); font-size: 15px; font-weight: 700; letter-spacing: 3px; }
.dm-village-l { font-size: 30px; letter-spacing: 7px; fill: rgba(29, 49, 123, .32); }

.dm-pointer path { fill: none; stroke: rgba(29, 49, 123, .45); stroke-width: 1.6; stroke-linecap: round; }
.dm-pointer text { fill: rgba(29, 49, 123, .55); font-size: 13px; font-weight: 700; letter-spacing: 2.5px; }
.dm-pointer .dm-pointer-sub { font-weight: 400; letter-spacing: 1px; }
.dm-pointer-sea path { stroke: rgba(244, 236, 234, .5); }
.dm-pointer-sea text { fill: rgba(244, 236, 234, .6); }

.dm-inset-land path { fill: #e6dad6; }
.dm-inset-box { fill: rgba(0, 150, 223, .18); stroke: var(--dm-accent); stroke-width: 2; }
.dm-inset-label { fill: rgba(29, 49, 123, .55); font-size: 15px; font-weight: 700; letter-spacing: 4px; }

.dm-compass circle { fill: none; stroke: rgba(244, 236, 234, .35); stroke-width: 1.2; }
.dm-compass .dm-compass-in { stroke-dasharray: 2 4; }
.dm-compass path { fill: rgba(244, 236, 234, .45); }
.dm-compass .dm-compass-n { fill: var(--dm-cream); }
.dm-compass text { fill: var(--dm-cream); font-size: 18px; font-weight: 700; letter-spacing: 1px; }

.dm-scale path { fill: none; stroke: rgba(244, 236, 234, .6); stroke-width: 1.6; }
.dm-scale text { fill: rgba(244, 236, 234, .7); font-size: 13px; font-weight: 700; letter-spacing: 2px; }

/* курорт */
.dm-resort circle { fill: var(--dm-navy); stroke: var(--dm-cream); stroke-width: 3; }
.dm-resort path { fill: var(--dm-cream); }
.dm-resort text { fill: var(--dm-navy); font-size: 12.5px; font-weight: 800; letter-spacing: 2.2px; paint-order: stroke; stroke: var(--dm-cream); stroke-width: 5px; stroke-linejoin: round; }


/* виноски та точки на березі */
.dm-leader { fill: none; stroke: rgba(244, 236, 234, .4); stroke-width: 1.3; stroke-dasharray: 3 5; transition: stroke .3s, stroke-width .3s; }
.dm-leader.is-hover, .dm-leader.is-active { stroke: var(--dm-cream); stroke-width: 1.8; stroke-dasharray: none; }

.dm-dot { fill: var(--dm-accent); stroke: var(--dm-cream); stroke-width: 2.4; transition: r .3s; }
.dm-ripple { fill: none; stroke: var(--dm-sky); stroke-width: 1.6; opacity: 0;
  transform-box: view-box; transform-origin: 0 0;
  animation: dmRipple 3.2s ease-out infinite; animation-delay: calc(var(--i) * .29s); }
.dm-ripple-2 { animation-delay: calc(var(--i) * .29s + 1.6s); }
@keyframes dmRipple { 0% { transform: scale(1); opacity: .85; } 100% { transform: scale(4.2); opacity: 0; } }
.dm-spot.is-active .dm-dot, .dm-spot.is-hover .dm-dot { r: 7.5px; }
.dm-spot.is-active .dm-ripple { stroke: var(--dm-cream); stroke-width: 2.2; animation-duration: 2.2s; }

/* маркери з номерами */
.dm-marker { cursor: pointer; outline: none; }
.dm-mk { transform-box: view-box; transform-origin: 0 0; transform: scale(var(--mks)); transition: transform .35s cubic-bezier(.3, 1.4, .5, 1); }
.dm-hit { fill: transparent; }
.dm-mk-c { fill: var(--dm-cream); transition: fill .3s; }
.dm-mk-ring { fill: none; stroke: rgba(244, 236, 234, .45); stroke-width: 1.5; transition: stroke .3s, stroke-width .3s; }
.dm-mk-n { fill: var(--dm-navy); font-size: 20px; font-weight: 800; transition: fill .3s; }
.dm-label-name { fill: var(--dm-cream); font-size: 20px; font-weight: 700; letter-spacing: 2.6px; transition: fill .3s; }
.dm-label-depth { fill: var(--dm-sky); font-size: 17px; font-weight: 400; letter-spacing: 1.2px; }

.dm-marker:hover .dm-mk, .dm-marker.is-hover .dm-mk { transform: scale(calc(var(--mks) * 1.1)); }
.dm-marker:hover .dm-mk-c { fill: #fff; }
.dm-marker.is-active .dm-mk { transform: scale(calc(var(--mks) * 1.16)); }
.dm-marker.is-active .dm-mk-c { fill: var(--dm-accent); }
.dm-marker.is-active .dm-mk-n { fill: #fff; }
.dm-marker.is-active .dm-mk-ring { stroke: var(--dm-cream); stroke-width: 2.4; }
.dm-marker.is-active .dm-label-name { fill: #fff; }
.dm-marker:focus-visible .dm-mk-ring { stroke: #fff; stroke-width: 3.5; }

/* ---------- поява при прокрутці (лише коли працює JS) ---------- */
.dm-js:not(.dm-in) .dm-coast { stroke-dashoffset: 1; }
.dm-js .dm-coast { stroke-dasharray: 1; }
.dm-js.dm-in .dm-coast { animation: dmDraw 2s cubic-bezier(.4, 0, .2, 1) both; }
@keyframes dmDraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

.dm-js:not(.dm-in) .dm-mk, .dm-js:not(.dm-in) .dm-spot, .dm-js:not(.dm-in) .dm-leader { opacity: 0; }
.dm-js.dm-in .dm-mk { animation: dmPop .7s cubic-bezier(.3, 1.6, .5, 1) backwards; animation-delay: calc(var(--i) * 90ms + .5s); }
.dm-js.dm-in .dm-spot { animation: dmFade .5s ease backwards; animation-delay: calc(var(--i) * 90ms + .35s); }
.dm-js.dm-in .dm-leader { animation: dmFade .6s ease backwards; animation-delay: calc(var(--i) * 90ms + .45s); }
@keyframes dmPop { from { transform: scale(0); opacity: 0; } to { transform: scale(var(--mks)); opacity: 1; } }
@keyframes dmFade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- панель з картками ---------- */
.dm-panel {
  border: 1px solid var(--dm-line);
  border-radius: var(--dm-radius);
  padding: clamp(16px, 1.667vw, 28px);
  min-width: 0;
  display: flex; flex-direction: column; gap: clamp(14px, 1.25vw, 20px);
}
.dm-nav { display: flex; align-items: center; gap: 10px; }
.dm-count { flex: 1; text-align: center; font-size: 15px; letter-spacing: 2.4px; text-transform: uppercase; color: #8a8d98; padding-top: 3px; }
.dm-count b { color: var(--dm-navy); font-weight: 800; }
.dm-arrow {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding: 0;
  font: 700 15px/1 Zain, Arial, sans-serif; color: var(--dm-navy);
  border: 1px solid var(--dm-line); background: transparent; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color .3s, color .3s, border-color .3s;
  -webkit-tap-highlight-color: transparent;
}
.dm-arrow { width: 44px; height: 44px; flex: none; border-color: var(--dm-navy); }
.dm-arrow svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.dm-arrow:hover { background: var(--dm-navy); color: var(--dm-cream); }
.dm-arrow:focus-visible, .dm-track:focus-visible { outline: 2px solid var(--dm-accent); outline-offset: 2px; }

.dm-track {
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scroll-behavior: auto;
  scrollbar-width: none; -ms-overflow-style: none;
  overscroll-behavior-x: contain; position: relative;
  align-items: flex-start;              /* кожна картка своєї висоти */
  transition: height .45s cubic-bezier(.4, 0, .2, 1);
}
.dm-track::-webkit-scrollbar { display: none; }
.dm-card { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; padding: 2px 4px 4px 2px; box-sizing: border-box; }

.dm-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.dm-card-n { font-family: kumlien-pro, Georgia, serif; font-size: clamp(30px, 2.6vw, 42px); line-height: 1; color: var(--dm-accent); }
.dm-card-area { font-size: 13px; font-weight: 700; letter-spacing: 2.4px; text-transform: uppercase; color: #5b5f6d; text-align: right; }
.dm-card-intro .dm-card-area { text-align: left; }
.dm-card-name { font-family: kumlien-pro, Georgia, serif; font-weight: 500; font-size: clamp(28px, 2.4vw, 40px); line-height: 1.02; letter-spacing: -.4px; margin: 0 0 clamp(16px, 1.4vw, 22px); color: var(--dm-ink); }

.dm-depth { margin-bottom: 14px; }
.dm-depth-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; letter-spacing: 2.4px; text-transform: uppercase; font-weight: 700; color: #5b5f6d; margin-bottom: 8px; }
.dm-depth-head b { font-size: 17px; letter-spacing: 1px; color: var(--dm-navy); text-transform: none; }
.dm-depth-bar { position: relative; height: 10px; border-radius: 10px; background: repeating-linear-gradient(90deg, #e6dcda 0 calc(25% - 2px), transparent calc(25% - 2px) 25%); }
.dm-depth-bar i { position: absolute; top: 0; bottom: 0; border-radius: 10px; background: linear-gradient(90deg, var(--dm-sky), var(--dm-accent) 60%, var(--dm-navy)); transform-origin: left; }
.dm-card.is-active .dm-depth-bar i { animation: dmBar .9s cubic-bezier(.3, 1, .4, 1) both .15s; }
@keyframes dmBar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.dm-depth-scale { display: flex; justify-content: space-between; font-size: 12px; color: #8a8d98; margin-top: 6px; letter-spacing: .5px; }

.dm-facts { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dm-facts li { display: flex; align-items: center; gap: 10px; border: 1px dashed var(--dm-line); border-radius: 14px; padding: 9px 10px; font-size: 17px; font-weight: 700; color: var(--dm-navy); line-height: 1.1; }
.dm-facts small { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: #8a8d98; margin-bottom: 3px; }
.dm-fact-ic { width: 34px; height: 34px; flex: none; border-radius: 50%; background: rgba(0, 150, 223, .1); display: inline-flex; align-items: center; justify-content: center; }
.dm-fact-ic svg { width: 20px; height: 20px; fill: none; stroke: var(--dm-navy); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dm-level { width: 34px; height: 34px; flex: none; border-radius: 50%; background: rgba(0, 150, 223, .1); display: inline-flex; align-items: flex-end; justify-content: center; gap: 3px; padding-bottom: 10px; box-sizing: border-box; }
.dm-level i { width: 4px; border-radius: 2px; background: #cfc6c8; }
.dm-level i:nth-child(1) { height: 6px; } .dm-level i:nth-child(2) { height: 10px; } .dm-level i:nth-child(3) { height: 14px; }
.dm-level[data-l="1"] i:nth-child(-n+1), .dm-level[data-l="2"] i:nth-child(-n+2), .dm-level[data-l="3"] i { background: var(--dm-accent); }

.dm-desc { font-size: clamp(16px, 1.15vw, 18px); line-height: 1.45; font-weight: 300; letter-spacing: .4px; color: var(--dm-ink); margin: 0 0 14px; }
.dm-life { font-size: 16px; line-height: 1.4; color: var(--dm-navy); margin: 0 0 14px; font-weight: 700; letter-spacing: .3px; }
.dm-life small { display: block; font-size: 11.5px; letter-spacing: 2px; text-transform: uppercase; color: #8a8d98; margin-bottom: 4px; }
.dm-links { display: flex; flex-wrap: wrap; gap: 8px 26px; }
.dm-link { text-decoration: none; color: var(--dm-ink); }
.dm .dm-link { font-size: 14px; }
.dm .dm-link .link-arrow { width: 26px; }
.dm .dm-link .link-arrow svg { width: 100%; height: auto; display: block; }

.dm-hint { font-size: 15px; letter-spacing: 1.5px; text-transform: uppercase; font-weight: 700; color: var(--dm-accent); margin: 0; }
.dm-hint-mob { display: none; }
@media (hover: none) { .dm-hint-desk { display: none; } .dm-hint-mob { display: inline; } }

/* ---------- планшет: мапа над картками ---------- */
@media screen and (max-width: 1099px) {
  .dm-grid { grid-template-columns: 1fr; }
  .dm-panel { border: 0; padding: 0; }
  .dm-track { gap: 14px; }
  .dm-card { flex-basis: min(520px, 72%); border: 1px solid var(--dm-line); border-radius: 22px; padding: 22px 22px 24px; }
  .dm-card-intro { background: rgba(255, 255, 255, .35); }
}

/* ---------- телефон ---------- */
@media screen and (max-width: 767px) {
  .dm { --mks: 1.2; }
  .dm-label, .dm-pointer, .dm-inset, .dm-compass, .dm-scale { display: none; }
  .dm-village { font-size: 17px; }
  .dm-village-l { font-size: 34px; }
  .dm-grid { gap: 14px; }
  .dm-map { aspect-ratio: 740 / 720; margin: 0 -4px; }
  .dm-nav { gap: 6px; }
  .dm-arrow { width: 40px; height: 40px; }
  .dm-track { gap: 12px; }
  .dm-card { flex-basis: 86%; border-radius: 20px; padding: 18px 16px 20px; }
  .dm-facts li { font-size: 15px; padding: 8px; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .dm-wave path, .dm-ripple { animation: none !important; }
  .dm-js .dm-coast, .dm-js.dm-in .dm-mk, .dm-js.dm-in .dm-spot, .dm-js.dm-in .dm-leader, .dm-card.is-active .dm-depth-bar i { animation: none !important; }
  .dm-js:not(.dm-in) .dm-mk, .dm-js:not(.dm-in) .dm-spot, .dm-js:not(.dm-in) .dm-leader { opacity: 1; }
  .dm-js:not(.dm-in) .dm-coast { stroke-dashoffset: 0; }
  .dm-mk, .dm-track { transition: none; }
}
