/* ── Trigger rocket on page corner ── */
.cosmo-trigger {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99999;
  width: 128px;
  height: 128px;
  border: 3px solid #FFC003;
  border-radius: 50%;
  background: #961c20;
  cursor: pointer;
  padding: 0;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(150,28,32,0.45);
  transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
}
.cosmo-trigger svg {
  width: 74px;
  height: 74px;
  display: block;
}
.cosmo-trigger:hover {
  transform: translateY(-2px);
  background: #a82025;
  box-shadow:
    0 0 0 6px rgba(255,192,3,0.15),
    0 0 30px 8px rgba(255,192,3,0.55),
    0 0 70px 18px rgba(255,120,30,0.45),
    0 0 120px 30px rgba(150,28,32,0.55);
}
.cosmo-trigger.cosmo-hidden { display: none; }

/* ═══════════════════════════════════════════
   COSMO — День космонавтики
   Soviet Space Realism × Editorial Elegance
   ═══════════════════════════════════════════ */




/* ── FULLSCREEN FLIGHT ── */
.flight {
  cursor: pointer;
  position: fixed;
  inset: 0;
  background: #0a1520;
  z-index: 100000;
  overflow: hidden;
  transition: background 4s ease, opacity 0.8s ease;
  opacity: 0;
}
.flight.visible {
  opacity: 1;
}

/* ── STARFIELD — infinite vertical scroll ── */
.stars-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.stars-belt {
  position: absolute;
  left: 0; right: 0;
  height: 300%;
  top: -100%;
  animation: star-fall var(--star-speed, 60s) linear infinite;
}
@keyframes star-fall {
  0%   { transform: translateY(0); }
  100% { transform: translateY(33.33%); }
}
.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
}
.star-twinkle {
  animation: twink var(--d, 2s) ease-in-out infinite alternate;
  animation-delay: var(--w, 0s);
}
/* Enhanced shimmer for final screen */
.stars-belt.shimmer .star {
  animation: twink-shimmer calc(var(--d, 2s) * 1.2) ease-in-out infinite alternate;
}
@keyframes twink-shimmer {
  0%   { opacity: 0.1; transform: scale(0.8); }
  50%  { opacity: 0.8; transform: scale(1.3); box-shadow: 0 0 4px 1px rgba(200,220,255,0.3); }
  100% { opacity: 0.25; transform: scale(1); }
}

@keyframes twink {
  0%   { opacity: 0.1; }
  100% { opacity: 1; box-shadow: 0 0 3px 1px rgba(255,255,255,0.35); }
}

/* ── ATMOSPHERE GRADIENT ── */
.atmo {
  position: absolute;
  inset: 0;
  transition: opacity 3s ease;
  pointer-events: none;
}

/* ── ROCKET: SOYUZ-2 ── */
.rocket-col {
  position: absolute;
  left: 5%;
  bottom: 15%;
  width: 160px;
  height: 70vh;
  z-index: 100005;
}
.rocket-col svg, .rocket-col img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top center;
}
.rocket-col::after {
  content: '';
  position: absolute;
  bottom: -22%;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 260px;
  background: linear-gradient(to bottom,
    #fff 0%,
    #ffe680 5%,
    #ffaa00 15%,
    #ff6600 30%,
    rgba(255,60,0,0.9) 45%,
    rgba(220,30,0,0.7) 60%,
    rgba(180,20,0,0.4) 80%,
    transparent 100%);
  clip-path: polygon(32% 0%, 68% 0%, 100% 100%, 0% 100%);
  animation: exhaust-flicker 0.1s ease-in-out infinite alternate;
  filter: blur(2px);
  z-index: -1;
}
.rocket-col::before {
  content: '';
  position: absolute;
  bottom: -12%;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 160px;
  background: linear-gradient(to bottom,
    #fff 0%,
    rgba(255,255,200,0.95) 10%,
    rgba(255,220,80,0.8) 30%,
    rgba(255,160,30,0.5) 60%,
    transparent 100%);
  clip-path: polygon(25% 0%, 75% 0%, 100% 100%, 0% 100%);
  filter: blur(1px);
  z-index: -1;
  animation: exhaust-flicker 0.08s ease-in-out infinite alternate-reverse;
}
@keyframes exhaust-flicker {
  0%   { transform: translateX(-50%) scaleX(1) scaleY(1); opacity: 0.9; }
  100% { transform: translateX(-50%) scaleX(0.85) scaleY(1.1); opacity: 1; }
}

/* Flame flicker */
.flame-g {
  animation: flame-f 0.08s ease-in-out infinite alternate;
  transform-origin: 50% 0%;
}
@keyframes flame-f {
  0%   { transform: scaleY(1) scaleX(1); }
  100% { transform: scaleY(1.08) scaleX(0.94); }
}

/* ── EXHAUST PARTICLES (canvas-drawn) ── */

/* ── CENTER CONTENT ── */
.center {
  position: absolute;
  top: 46%;
  left: 55%;
  transform: translate(-50%, -50%);
  z-index: 100006;
  text-align: center;
  width: 520px;
  max-width: 60vw;
  transition: left 2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Phase card */
.card {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.9s cubic-bezier(0.16,1,0.3,1),
              transform 0.9s cubic-bezier(0.16,1,0.3,1);
}
.card.show {
  opacity: 1;
  transform: translateY(0);
}
.card-phase {
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}
.card-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 72px;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 10px;
  text-shadow: 0 4px 30px rgba(0,0,0,0.5);
}
.card-km {
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: rgba(255,255,255,0.4);
  margin-bottom: 34px;
  letter-spacing: 0.05em;
}

/* Divider */
.card-line {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 0 auto 32px;
}

/* Quote */
.card-quote {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 28px;
  font-style: italic;
  font-weight: 400;
  color: rgba(255,255,255,0.85);
  line-height: 1.55;
  max-width: 460px;
  margin: 0 auto;
}

/* Author */
.card-author {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: center;
  margin-top: 28px;
}
.card-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 2px solid rgba(255,192,3,0.25);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  flex-shrink: 0;
  background: #222;
}
.card-name {
  font-family: 'Manrope', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  text-align: left;
}
.card-role {
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: rgba(255,192,3,0.5);
  text-align: left;
  margin-top: 2px;
  letter-spacing: 0.04em;
}

/* ── FINAL SCREEN ── */
.card.final .card-phase {
  font-size: 15px;
  letter-spacing: 0.32em;
  margin-bottom: 16px;
}
.card.final .card-title {
  font-size: 56px;
  background: linear-gradient(135deg, var(--gold), #fff, var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.card.final .card-quote {
  font-style: normal;
  font-size: 22px;
  color: rgba(255,255,255,0.5);
}

/* ── ALTITUDE COUNTER (right side) ── */
.alt-counter {
  position: absolute;
  right: 40px;
  bottom: 40px;
  z-index: 100006;
  text-align: right;
}
.alt-num {
  font-family: 'Manrope', sans-serif;
  font-size: 80px;
  font-weight: 700;
  color: rgba(255,255,255,0.45);
  line-height: 1;
  letter-spacing: -0.02em;
  transition: color 0.3s;
}
.alt-unit {
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 6px;
}

/* ── PROGRESS BAR (top) ── */
.progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 100008;
  background: rgba(255,255,255,0.05);
  pointer-events: none;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--maroon), var(--gold));
  transition: width 0.5s linear;
  box-shadow: 0 0 10px rgba(255,192,3,0.3);
}

/* ── Overlay logo ── */
.cosmo-logo {
  position: absolute;
  bottom: 45px;
  left: 55%;
  transform: translateX(-50%);
  z-index: 100009;
  width: 96px;
  height: auto;
  opacity: 0.85;
  pointer-events: none;
  filter: brightness(0) invert(1) drop-shadow(0 2px 10px rgba(0,0,0,0.5));
  transition: left 2s cubic-bezier(0.16, 1, 0.3, 1);
}
.cosmo-logo.centered { left: 50%; }
.center.centered { left: 50%; }

/* ── CLOSE ── */
.close-btn {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 100010;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.4);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  backdrop-filter: blur(8px);
}
.close-btn:hover {
  border-color: rgba(255,192,3,0.3);
  color: var(--gold);
  background: rgba(255,192,3,0.05);
}

.next-btn {
  position: absolute;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  z-index: 100010;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.5);
  font-size: 22px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: next-pulse 2s ease-in-out infinite;
}
.next-btn:hover {
  border-color: rgba(255,192,3,0.5);
  color: var(--gold);
  background: rgba(255,192,3,0.1);
  transform: translateY(-50%) scale(1.1);
}
@keyframes next-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,192,3,0); }
  50%     { box-shadow: 0 0 12px 3px rgba(255,192,3,0.15); }
}

/* ── Rocket departs on final screen ── */
.rocket-col.departing {
  animation: none !important;
  transition: transform 3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(-120vh);
}

/* ── Rocket acceleration ── */
.rocket-col {
  --vib: 0.08s;
}
.rocket-col.flying {
  animation: rocket-vib var(--vib) linear infinite;
}
@keyframes rocket-vib {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(0.8px, -0.5px); }
  50%  { transform: translate(-0.8px, 0.3px); }
  75%  { transform: translate(0.3px, 0.8px); }
}


/* ── SPEED LINES ── */
.speed-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 100003;
}
.speed-line {
  position: absolute;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: line-drop 0.35s linear forwards;
}
@keyframes line-drop {
  0%   { transform: translateY(-100%); opacity: 1; }
  100% { transform: translateY(100vh); opacity: 0; }
}

/* ═══════════════════════════════════════════
   MOBILE ADAPTATION
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .cosmo-trigger {
    width: 76px;
    height: 76px;
    bottom: 14px;
    right: 14px;
    border-width: 2px;
  }
  .cosmo-trigger svg {
    width: 44px;
    height: 44px;
  }

  .cosmo-logo {
    bottom: 20px;
    left: 50%;
    width: 64px;
  }

  /* Rocket — smaller, pinned to left edge, container sized to image
     aspect (826×3864) so the exhaust lands right at the nozzle */
  .rocket-col {
    width: 72px;
    height: calc(72px * 3864 / 826);
    left: 0;
    bottom: 38%;
  }
  .rocket-col::after {
    width: 44px;
    height: 110px;
    bottom: -22%;
  }
  .rocket-col::before {
    width: 24px;
    height: 70px;
    bottom: -12%;
  }

  /* Center content shifted right to clear rocket; narrower than the
     next-btn (44px + 14px margin) so quote text cannot slide under it */
  .center {
    left: 50%;
    width: 60vw;
    max-width: 60vw;
    top: 48%;
  }

  .card-phase {
    font-size: 11px;
    letter-spacing: 0.22em;
    margin-bottom: 10px;
  }
  .card-title {
    font-size: 40px;
    line-height: 1.08;
    margin-bottom: 8px;
  }
  .card-km {
    font-size: 13px;
    margin-bottom: 22px;
  }
  .card-line {
    margin-bottom: 22px;
  }
  .card-quote {
    font-size: 18px;
    line-height: 1.5;
    max-width: 100%;
    padding: 0;
  }
  .card-author {
    gap: 12px;
    margin-top: 22px;
  }
  .card-avatar {
    width: 56px;
    height: 56px;
  }
  .card-name {
    font-size: 14px;
  }
  .card-role {
    font-size: 11px;
  }
  .card.final .card-title {
    font-size: 30px;
  }
  .card.final .card-quote {
    font-size: 15px;
  }

  /* Altitude counter */
  .alt-counter {
    right: 16px;
    bottom: 20px;
  }
  .alt-num {
    font-size: 44px;
  }
  .alt-unit {
    font-size: 11px;
    margin-top: 4px;
  }

  /* Close and next buttons */
  .close-btn {
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    font-size: 15px;
  }
  .next-btn {
    right: 14px;
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
}

/* Extra-narrow phones */
@media (max-width: 420px) {
  .rocket-col {
    width: 60px;
    height: calc(60px * 3864 / 826);
  }
  .card-title {
    font-size: 34px;
  }
  .card-quote {
    font-size: 16px;
  }
  .alt-num {
    font-size: 36px;
  }
  .cosmo-logo {
    width: 54px;
  }
  .cosmo-trigger {
    width: 68px;
    height: 68px;
  }
  .cosmo-trigger svg {
    width: 40px;
    height: 40px;
  }
}