/* 3D-карта побережья (map3d.js) */
.m3d { position: relative; overflow: hidden; background: #0b1b33; color: #fff; isolation: isolate;
       --m3d-gold: #d4b483; --m3d-glass: rgba(11, 27, 51, .62); }
.m3d-stage, .m3d-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.m3d-stage canvas { touch-action: none; }
.m3d:not(.is-full) .m3d-stage canvas { touch-action: pan-y; pointer-events: none; } /* на странице не мешает прокрутке */
.m3d-fallback { width: 100%; height: 100%; object-fit: cover; }

/* Метки */
.m3d-markers { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.m3d-pin { position: absolute; left: 0; top: 0; pointer-events: auto; background: none; border: 0; padding: 0; cursor: pointer;
           display: flex; align-items: center; gap: 8px; -webkit-tap-highlight-color: transparent; will-change: transform; }
.m3d-dot { width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; flex-shrink: 0; position: relative;
           background: rgba(255, 255, 255, .92); box-shadow: 0 2px 10px rgba(0, 0, 0, .35); transition: transform .25s ease; }
.m3d-dot::after { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: #1d3557; }
.m3d-pin.is-active .m3d-dot { transform: scale(1.18); }
@media (hover: hover) { .m3d-pin:hover .m3d-dot { transform: scale(1.18); } }
.m3d-pin--house .m3d-dot { width: 34px; height: 34px; margin: -17px 0 0 -17px; background: var(--m3d-gold);
                           box-shadow: 0 0 0 6px rgba(212, 180, 131, .28), 0 4px 16px rgba(0, 0, 0, .4); }
.m3d-pin--house .m3d-dot::after { inset: 11px; background: #fff; }
.m3d-pin--house .m3d-dot::before { content: ''; position: absolute; inset: -6px; border-radius: 50%;
                                   border: 2px solid rgba(212, 180, 131, .7); animation: m3d-pulse 2.4s ease-out infinite; }
@keyframes m3d-pulse { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.9); opacity: 0; } }
.m3d-label { margin-top: -13px; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1.2;
             white-space: nowrap; color: #fff; background: var(--m3d-glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
             opacity: 0; transform: translateX(-4px); transition: opacity .2s, transform .2s; pointer-events: none; }
.m3d-pin--house .m3d-label { opacity: 1; transform: none; margin-top: -17px; background: rgba(212, 180, 131, .92); color: #0b1b33; }
.m3d-pin.is-active .m3d-label, .m3d.m3d-near .m3d-label { opacity: 1; transform: none; }
@media (hover: hover) { .m3d-pin:hover .m3d-label { opacity: 1; transform: none; } }

/* Интерфейс */
.m3d-ui { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.m3d-ui > * { pointer-events: auto; }
.m3d-season { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; padding: 4px; border-radius: 999px;
              background: var(--m3d-glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.m3d-season button { border: 0; background: none; color: rgba(255, 255, 255, .8); font: inherit; font-size: 14px; font-weight: 600;
                     padding: 8px 20px; border-radius: 999px; cursor: pointer; letter-spacing: .04em; transition: background .25s, color .25s; }
.m3d-season button.is-on { background: #fff; color: #0b1b33; }
.m3d-season button.is-loading { opacity: .6; }
.m3d-explore { position: absolute; right: 22px; bottom: 22px; border: 1px solid rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .08);
               color: #fff; font: inherit; font-size: 14px; font-weight: 600; letter-spacing: .04em; padding: 10px 20px; border-radius: 999px;
               cursor: pointer; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: background .2s, color .2s; }
@media (hover: hover) { .m3d-explore:hover { background: #fff; color: #0b1b33; } }
.m3d-close, .m3d-home { position: absolute; top: 18px; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
                        background: var(--m3d-glass); color: #fff; font-size: 26px; line-height: 1; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.m3d-close { right: 18px; display: none; }
.m3d-home { left: 18px; font-size: 22px; }
.m3d-hint { position: absolute; top: 24px; left: 50%; transform: translateX(-50%); font-size: 12px; color: rgba(255, 255, 255, .78);
            background: var(--m3d-glass); padding: 6px 14px; border-radius: 999px; white-space: nowrap; display: none; pointer-events: none; }
.m3d.is-full .m3d-close { display: block; }
.m3d.is-full .m3d-explore { display: none; }
.m3d.is-full .m3d-hint { display: block; animation: m3d-hint 6s forwards; }
@keyframes m3d-hint { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* Полноэкранный режим исследования */
.m3d.is-full { position: fixed !important; inset: 0 !important; width: auto !important; height: auto !important; z-index: 1000; border-radius: 0 !important; }
html.m3d-lock, html.m3d-lock body { overflow: hidden !important; }

/* Карточка места */
.m3d-card { position: absolute; z-index: 4; left: 22px; bottom: 80px; width: min(380px, calc(100% - 44px)); border-radius: 18px; overflow: hidden;
            background: rgba(250, 247, 241, .97); color: #1b2a3e; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); animation: m3d-in .35s ease; }
.m3d-card[hidden] { display: none; }
@keyframes m3d-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.m3d-card-img { aspect-ratio: 16 / 9; background: #e5ded1; }
.m3d-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m3d-card-body { padding: 16px 18px 18px; }
.m3d-card-kicker { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #9a7b4f; font-weight: 700; }
.m3d-card h3 { margin: 4px 0 6px; font-size: 22px; line-height: 1.2; font-family: var(--font-display, Georgia, serif); font-weight: 600; }
.m3d-card p { margin: 0 0 14px; font-size: 14px; line-height: 1.55; color: #3d4b5c; }
.m3d-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.m3d-btn { display: inline-flex; align-items: center; padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; text-decoration: none;
           color: #1b2a3e; border: 1px solid rgba(27, 42, 62, .25); transition: background .2s, color .2s; }
@media (hover: hover) { .m3d-btn:hover { background: #1b2a3e; color: #fff; } }
.m3d-btn--primary { background: #1b2a3e; color: #fff; border-color: #1b2a3e; }
@media (hover: hover) { .m3d-btn--primary:hover { background: #2b4366; } }
.m3d-card-close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
                  background: rgba(11, 27, 51, .6); color: #fff; font-size: 22px; line-height: 1; z-index: 1; }

.m3d-loading { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; text-align: center;
               padding: 20px; font-size: 15px; letter-spacing: .03em; color: rgba(255, 255, 255, .85); background: #0b1b33; transition: opacity .8s; }
.m3d-loading.is-done { opacity: 0; pointer-events: none; }
.m3d-attr { position: absolute; z-index: 3; right: 10px; bottom: 4px; max-width: 70%; font-size: 9px; line-height: 1.3; text-align: right;
            color: rgba(255, 255, 255, .45); pointer-events: none; }

@media (max-width: 640px) {
    .m3d-card { left: 10px; right: 10px; width: auto; bottom: 74px; max-height: calc(100% - 150px); overflow-y: auto; }
    .m3d-card-img { aspect-ratio: 2 / 1; }
    .m3d-explore { right: 50%; transform: translateX(50%); bottom: 72px; }
    .m3d.is-full .m3d-season { bottom: 22px; }
    .m3d-hint { white-space: normal; width: calc(100% - 140px); text-align: center; }
    .m3d-attr { max-width: 100%; left: 10px; text-align: left; }
}
@media (prefers-reduced-motion: reduce) { .m3d-pin--house .m3d-dot::before { animation: none; } }
/* метка за горой — плавно скрывается */
.m3d-pin { transition: opacity .35s ease; }
.m3d-pin.is-behind { opacity: 0; pointer-events: none; }

/* Крестики и кнопка «Наш дом»: SVG строго по центру, крестик поворачивается при наведении */
.m3d-close, .m3d-card-close { display: flex; align-items: center; justify-content: center; padding: 0; font-size: 0; line-height: 0;
                              transform-origin: 50% 50%; transition: background .3s, transform .3s; }
.m3d.is-full .m3d-close { display: flex; }
.m3d-close svg, .m3d-card-close svg, .m3d-home svg { display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.m3d-close svg { width: 22px; height: 22px; }
.m3d-card-close svg { width: 18px; height: 18px; }
@media (hover: hover) { .m3d-close:hover, .m3d-card-close:hover { transform: rotate(90deg); background: rgba(11, 27, 51, .9); } }
.m3d-home { width: auto; height: 44px; padding: 0 18px 0 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 8px;
            font-size: 14px; font-weight: 600; letter-spacing: .02em; line-height: 1; transition: background .25s, color .25s; }
.m3d-home svg { width: 20px; height: 20px; flex-shrink: 0; }
@media (hover: hover) { .m3d-home:hover { background: #fff; color: #0b1b33; } }

/* Фото места в карточке: стопкой, спокойная смена (раз в 5 с) с мягким перетеканием */
.m3d-card-img { position: relative; overflow: hidden; }
.m3d-card-img img { position: absolute; inset: 0; opacity: 0; transition: opacity 1.4s ease; }
.m3d-card-img img.is-on { opacity: 1; }
/* полоса прокрутки карточки (на телефоне) — в стиле сайта */
.m3d-card { scrollbar-width: thin; scrollbar-color: rgba(27, 42, 62, .3) transparent; }
.m3d-card::-webkit-scrollbar { width: 8px; }
.m3d-card::-webkit-scrollbar-track { background: transparent; margin: 14px 0; }
.m3d-card::-webkit-scrollbar-thumb { background: rgba(27, 42, 62, .3); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }

/* Крестик закрытия карты — только в полноэкранном режиме («Исследовать карту») */
.m3d:not(.is-full) .m3d-close { display: none !important; }

/* Низкий экран (телефон горизонтально): карточка места — фото слева, текст справа, целиком помещается */
@media (max-height: 560px) {
    .m3d-card { display: grid; grid-template-columns: 42% minmax(0, 1fr); left: 14px; right: auto; bottom: 70px;
                width: min(660px, calc(100% - 28px)); max-height: calc(100% - 88px); overflow: hidden; }
    .m3d-card-img { aspect-ratio: auto !important; height: 100%; min-height: 0; }
    .m3d-card-body { overflow-y: auto; padding: 12px 16px 14px; }
    .m3d-card h3 { font-size: 19px; margin: 2px 0 4px; }
    .m3d-card p { font-size: 13px; line-height: 1.45; margin-bottom: 10px; }
    .m3d-btn { padding: 7px 13px; font-size: 13px; }
}
