/* ============================================================
   "Страны фестиваля" — купол-полусфера (плоская половина Земли)
   с безформенными островами под метками. Светлый фон, фирменные
   цвета (синий / золотой / оранжевый).
   ============================================================ */

:root {
  --brand-blue: #0d195f;
  --brand-blue2: #1f3aa6;
  --brand-gold: #f5a623;
  --brand-orange: #f78e1a;
}

/* прячем оригинальные Tilda-блоки контента (кроме меню) */
body.earth-page #allrecords > div[id^="rec"]:not(#rec1201964966) { display: none !important; }
body.earth-page #earth-app { display: block; }
body.earth-page { overflow: hidden; height: 100dvh; }
html:has(body.earth-page) { overflow: hidden; height: 100%; }
body.earth-page #allrecords {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}
body.earth-page .site-header {
  flex: 0 0 auto;
}
body.earth-page #earth-app {
  flex: 1 1 auto;
  min-height: calc(100dvh - 76px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.earth-page .site-footer { display: none !important; }

.earth-section {
  position: relative;
  background: radial-gradient(120% 80% at 50% 115%, #dcecfb 0%, #eef5ff 50%, #ffffff 100%);
  color: var(--brand-blue);
  overflow-x: hidden;
  overflow-y: visible;
  padding: 22px 20px 0;
  box-sizing: border-box;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "head"
    "stage";
}

.earth-head {
  grid-area: head;
  position: relative;
  z-index: 6;
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
}
.earth-head h1 {
  font-family: 'TildaSans', Arial, sans-serif;
  font-size: clamp(28px, 5vw, 50px);
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: .3px;
  color: var(--brand-blue);
}
.earth-head h1 span { color: var(--brand-orange); }
.earth-head p {
  font-size: clamp(13px, 1.4vw, 15px);
  line-height: 1.55;
  color: #51608f;
  margin: 0 auto 16px;
  max-width: 520px;
}

/* ---------- сцена с куполом ---------- */
.earth-stage {
  grid-area: stage;
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 240px;
  margin: 8px auto 0;
  overflow: hidden;
  clip-path: inset(-80px 0 0 0);
  user-select: none;
  touch-action: none;
}

/* стрелки вращения — поверх материка и подписей */
.earth-arrows {
  position: absolute;
  inset: 0;
  z-index: 120;
  pointer-events: none;
}
.earth-arrow {
  position: absolute;
  pointer-events: auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35);
  background: var(--brand-blue);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(13, 25, 95, .32);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s ease, box-shadow .15s ease;
}
.earth-arrow__icon {
  display: block;
  width: 20px;
  height: 20px;
}
.earth-arrow:hover {
  background: var(--brand-orange);
  border-color: rgba(255, 255, 255, .45);
  box-shadow: 0 10px 26px rgba(247, 142, 26, .35);
}

/* планета: статичный океан (купол) */
.earth-dome {
  position: absolute;
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 32%, #57b4ec 0%, #2f97da 38%, #1877bd 72%, #0f63a6 100%);
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, .35),
    inset -26px -26px 70px rgba(0, 40, 80, .28),
    inset 26px 22px 70px rgba(255, 255, 255, .30),
    0 22px 60px rgba(13, 90, 150, .30);
}
/* очень мягкая статичная сетка-меридианы */
.earth-dome::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, rgba(255,255,255,.07) 0deg .5deg, transparent .5deg 30deg),
    radial-gradient(circle, transparent 0 32%, rgba(255,255,255,.08) 32% 32.4%, transparent 32.4% 58%, rgba(255,255,255,.08) 58% 58.4%, transparent 58.4% 82%, rgba(255,255,255,.08) 82% 82.4%, transparent 82.4%);
  pointer-events: none;
}
.earth-glow {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 86%;
  height: 64%;
  background: radial-gradient(ellipse at 50% 100%, rgba(120, 200, 255, .30), transparent 70%);
  filter: blur(4px);
  pointer-events: none;
  z-index: 1;
}

/* центральный материк — вращается вместе с глобусом */
.earth-mainland {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  pointer-events: none;
  transform-origin: center center;
  will-change: transform;
  background:
    radial-gradient(circle at 44% 28%, #8edd98 0%, #5fba6e 22%, #449e56 48%, #327a42 75%, #245832 100%);
  clip-path: polygon(
    50% 8%,  67% 12%,  84% 26%, 92% 44%, 88% 62%, 74% 78%,
    50% 88%, 26% 78%, 12% 62%,  8% 44%, 16% 26%, 33% 12%
  );
  -webkit-clip-path: polygon(
    50% 8%,  67% 12%,  84% 26%, 92% 44%, 88% 62%, 74% 78%,
    50% 88%, 26% 78%, 12% 62%,  8% 44%, 16% 26%, 33% 12%
  );
  box-shadow:
    inset 0 -18px 32px rgba(0, 35, 10, .42),
    inset 14px 12px 28px rgba(255, 255, 255, .24);
  filter: drop-shadow(0 8px 20px rgba(0, 35, 70, .32));
}
.earth-mainland::before {
  content: "";
  position: absolute;
  left: 22%;
  top: 16%;
  width: 24%;
  height: 24%;
  background: radial-gradient(circle, rgba(255, 255, 255, .32), transparent 68%);
  border-radius: 50%;
}
.earth-mainland::after {
  content: "";
  position: absolute;
  left: -6%;
  right: -6%;
  bottom: -2%;
  height: 42%;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(120, 200, 255, .65) 0%, rgba(80, 170, 230, .25) 45%, transparent 78%);
  filter: blur(4px);
  pointer-events: none;
}

/* выносные линии */
.earth-lines {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}
.earth-lines line {
  stroke: var(--brand-blue);
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: .65;
}

/* слой объектов (острова, точки, подписи) */
.earth-objects { position: absolute; inset: 0; z-index: 5; }

/* острова — частично погружены в воду */
.earth-island {
  position: absolute;
  left: 0; top: 0;
  background:
    radial-gradient(circle at 44% 30%, #6fbf78 0%, #469a57 50%, #2c773f 100%);
  box-shadow:
    inset 0 -8px 16px rgba(0, 50, 18, .30),
    0 0 0 6px rgba(13, 90, 150, .18),
    0 6px 14px rgba(0, 35, 70, .30);
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
  pointer-events: none;
  z-index: 3;
}
/* блик-«отмель» по нижнему краю — будто остров уходит в воду */
.earth-island::after {
  content: "";
  position: absolute;
  left: -8%; right: -8%; bottom: -10%;
  height: 46%;
  background: radial-gradient(ellipse at 50% 0%, rgba(120, 200, 255, .55), transparent 72%);
  border-radius: 50%;
  filter: blur(2px);
}

/* точки-метки */
.earth-pin {
  position: absolute;
  left: 0; top: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--c, var(--brand-orange));
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .92), 0 2px 7px rgba(0, 0, 0, .35);
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 5;
  will-change: transform, opacity;
}

/* выносные подписи */
.earth-callout {
  position: absolute;
  left: 0; top: 0;
  transform: translate(-50%, -50%);
  padding: 8px 15px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid var(--c, var(--brand-orange));
  color: var(--brand-blue);
  font-family: 'TildaSans', Arial, sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(13, 25, 95, .16);
  z-index: 6;
  will-change: transform, opacity;
  transition: background .15s ease, color .15s ease;
  isolation: isolate;
}
.earth-callout:hover,
.earth-callout.is-active {
  background: var(--c, var(--brand-orange));
  color: #fff;
}
.earth-callout.is-active { box-shadow: 0 10px 26px rgba(13, 25, 95, .28); }
.earth-pin.is-active::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 2px solid var(--c, var(--brand-orange));
  opacity: .7;
  animation: earth-pulse 2s ease-out infinite;
}
@keyframes earth-pulse {
  0% { transform: scale(.7); opacity: .8; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ---------- панель всех стран ---------- */
.earth-list {
  grid-area: stage;
  align-self: end;
  justify-self: center;
  position: relative;
  z-index: 8;
  width: min(720px, 90%);
  margin-bottom: 10px;
  text-align: center;
}
.earth-list__toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: 999px;
  border: none;
  background: var(--brand-blue);
  color: #fff;
  font-family: 'TildaSans', Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(13, 25, 95, .35);
  transition: background .15s ease;
}
.earth-list__toggle:hover { background: var(--brand-orange); }
.earth-list__chev {
  font-size: 12px;
  transform: rotate(180deg);
  transition: transform .25s ease;
}
.earth-list.is-open .earth-list__chev { transform: rotate(0deg); }
.earth-list__panel {
  margin-top: 12px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 18px;
  padding: 0 16px;
  box-shadow: 0 14px 40px rgba(0, 40, 80, .28);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height .35s ease, opacity .3s ease, padding .3s ease;
}
.earth-list.is-open .earth-list__panel {
  max-height: 420px;
  opacity: 1;
  padding: 14px 16px 16px;
  overflow-y: auto;
}
.earth-list__title {
  display: none;
}
.earth-list__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.earth-list__item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, .5);
  background: rgba(255, 255, 255, .92);
  color: var(--brand-blue);
  font-family: 'TildaSans', Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.earth-list__item:hover {
  transform: translateY(-2px);
  background: #fff;
  box-shadow: 0 10px 22px rgba(0, 40, 80, .25);
}
.earth-list__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c, var(--brand-orange));
  flex-shrink: 0;
}
@media (max-width: 720px) {
  .earth-list__grid { grid-template-columns: repeat(2, 1fr); }
  .earth-list__item { font-size: 12px; padding: 8px 10px; }
}
@media (max-width: 460px) {
  .earth-list__grid { grid-template-columns: minmax(0, 1fr); }
  .earth-list__item { font-size: 12px; padding: 8px 10px; }
}

/* ============ Панель страны — модальное окно по центру ============ */
.country-panel {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  visibility: hidden;
  pointer-events: none;
}
.country-panel.is-open { visibility: visible; pointer-events: auto; }
.country-panel__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 12, 40, .55);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity .3s ease;
}
.country-panel.is-open .country-panel__backdrop { opacity: 1; }

.country-panel__drawer {
  position: relative;
  width: min(900px, 100%);
  max-height: 90vh;
  background: #f6f7fb;
  color: var(--brand-blue);
  overflow-y: auto;
  border-radius: 22px;
  transform: translateY(18px) scale(.97);
  opacity: 0;
  transition: transform .35s cubic-bezier(.22, .61, .36, 1), opacity .3s ease;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
}
.country-panel.is-open .country-panel__drawer { transform: none; opacity: 1; }

.country-panel__hero {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 26px 30px 22px;
  background: var(--c, var(--brand-orange));
  color: #fff;
}
.country-panel__hero h2 {
  margin: 0;
  font-family: 'TildaSans', Arial, sans-serif;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  line-height: 1.15;
  max-width: calc(100% - 56px);
}
.country-panel__hero small {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  opacity: .9;
}
.country-panel__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, .25);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  transition: background .15s ease, transform .15s ease;
}
.country-panel__close:hover { background: rgba(255, 255, 255, .42); transform: rotate(90deg); }

.country-panel__body { position: relative; z-index: 1; padding: 26px 30px 40px; }
.country-panel__intro {
  font-size: 15.5px;
  line-height: 1.7;
  white-space: pre-line;
  margin: 0 0 8px;
  color: #2a3566;
}

.republic {
  margin-top: 12px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e3e9f7;
  border-left: 4px solid transparent;
  box-shadow: 0 6px 20px rgba(13, 25, 95, .08);
  overflow: hidden;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.republic:hover {
  border-color: color-mix(in srgb, var(--c, var(--brand-orange)) 28%, #e3e9f7);
  border-left-color: var(--c, var(--brand-orange));
  box-shadow: 0 10px 26px rgba(13, 25, 95, .12);
  transform: translateY(-1px);
}
.republic.is-open {
  border-color: color-mix(in srgb, var(--c, var(--brand-orange)) 35%, #e3e9f7);
  border-left-color: var(--c, var(--brand-orange));
  box-shadow: 0 10px 26px rgba(13, 25, 95, .11);
}
.republic__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  font-family: 'TildaSans', Arial, sans-serif;
  font-weight: 700;
  font-size: 16px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  color: var(--brand-blue);
  transition: background .15s ease, color .15s ease;
}
.republic:hover .republic__head,
.republic.is-open .republic__head {
  background: color-mix(in srgb, var(--c, var(--brand-orange)) 11%, #fff);
}
.republic__head:hover {
  color: var(--c, var(--brand-orange));
}
.republic__head::before {
  content: "";
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--c, var(--brand-orange));
  flex-shrink: 0;
  transition: transform .18s ease, box-shadow .18s ease;
}
.republic:hover .republic__head::before,
.republic.is-open .republic__head::before {
  transform: scale(1.15);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c, var(--brand-orange)) 24%, transparent);
}
.republic__toggle {
  margin-left: auto;
  font-size: 22px;
  transition: transform .25s ease, color .15s ease;
  color: var(--c, var(--brand-orange));
}
.republic__head:hover .republic__toggle {
  color: var(--c, var(--brand-orange));
}
.republic.is-open .republic__toggle { transform: rotate(45deg); }
.republic__content { display: none; padding: 0 18px 16px; }
.republic.is-open .republic__content { display: block; padding-top: 16px; }
.republic__text {
  font-family: 'TildaSans', Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  color: #2a3566;
  margin: 0 0 8px;
}
.republic__text:last-child { margin-bottom: 0; }
.republic__content .rcarousel { margin-top: 12px; }

/* мини-карусель */
.rcarousel {
  position: relative;
  z-index: 0;
  isolation: isolate;
}
.rcarousel__track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}
.rcarousel__track::-webkit-scrollbar { height: 6px; }
.rcarousel__track::-webkit-scrollbar-thumb { background: rgba(13,25,95,.25); border-radius: 3px; }
.rcarousel__item {
  flex: 0 0 auto;
  width: 70%;
  max-width: 420px;
  aspect-ratio: 4 / 3;
  scroll-snap-align: center;
  border-radius: 12px;
  overflow: hidden;
  background: #e6e8f0;
}
.rcarousel__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rcarousel__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(13, 25, 95, .8);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  box-sizing: border-box;
  z-index: 1;
  transition: background .15s ease;
}
.rcarousel__btn:hover { background: var(--c, var(--brand-orange)); }
.rcarousel__btn--prev { left: 8px; }
.rcarousel__btn--next { right: 8px; }

@media (max-width: 700px) {
  .earth-section {
    padding: 16px 14px 0;
    grid-template-rows: auto auto minmax(200px, 1fr);
    grid-template-areas:
      "head"
      "list"
      "stage";
  }
  .earth-head p { margin-bottom: 8px; }
  .earth-list {
    grid-area: list;
    align-self: stretch;
    justify-self: stretch;
    width: auto;
    min-width: 0;
    max-width: 100%;
    margin: 0 0 4px;
    box-sizing: border-box;
  }
  .earth-list__toggle {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    justify-content: center;
    padding: 10px 14px;
    font-size: 13px;
  }
  .earth-list__panel {
    background: #eef4ff;
    border-color: #dbe6fb;
    box-shadow: 0 8px 22px rgba(13, 25, 95, .08);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-sizing: border-box;
  }
  .earth-list.is-open .earth-list__panel {
    max-height: none;
    overflow: visible;
    padding: 10px 12px 12px;
  }
  .earth-list__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    max-height: none;
    overflow: visible;
  }
  .earth-list__item {
    font-size: 11.5px;
    padding: 7px 9px;
    line-height: 1.25;
    min-width: 0;
    word-break: break-word;
  }
  .earth-callout {
    white-space: normal;
    max-width: min(132px, 36vw);
    line-height: 1.28;
    text-align: center;
    border-radius: 10px;
    padding: 5px 8px;
    font-size: 10.5px;
  }
  .earth-stage { margin-top: 0; min-height: 200px; }
}

@media (max-width: 600px) {
  .earth-head h1 { font-size: clamp(24px, 7vw, 34px); }
  .earth-head p { font-size: 13px; }
  .earth-arrow { width: 40px; height: 40px; }
  .earth-arrow__icon { width: 17px; height: 17px; }
  .country-panel { padding: 0; }
  .country-panel__drawer { max-height: 100vh; height: 100%; border-radius: 0; width: 100%; }
  .country-panel__hero { padding: 20px 20px 16px; }
  .country-panel__body { padding: 20px 18px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .earth-pin.is-active::after { animation: none; }
}
