/* =====================
   SPACE DECORATIONS
   ===================== */

.space-deco {
    position: fixed;
    top: 0;
    height: 100vh;
    width: 130px;
    pointer-events: none;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    padding: 80px 0;
    overflow: hidden;
}
.space-deco--left  { left: 0; }
.space-deco--right { right: 0; }

.deco-obj {
    display: block;
    animation: decoFloat var(--dur, 9s) ease-in-out infinite alternate;
    animation-delay: var(--delay, 0s);
    will-change: transform;
}

@keyframes decoFloat {
    0%   { transform: translateY(0px) rotate(0deg); }
    100% { transform: translateY(-22px) rotate(4deg); }
}
@keyframes decoFloatR {
    0%   { transform: translateY(0px) rotate(0deg); }
    100% { transform: translateY(-16px) rotate(-5deg); }
}
@keyframes decoSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes decoPulse {
    0%, 100% { opacity: 0.75; }
    50%      { opacity: 1; }
}

/* ---- Features section deco (rocket / UFO) ---- */
.features-inner {
  display: flex;
  align-items: center;
  width: 100%;
}
.features-inner .container {
  flex: 1;
  min-width: 0;
}
.feat-deco {
  flex-shrink: 0;
  pointer-events: none;
}
.feat-deco-rocket {
  width: 110px;
  margin-right: 20px;
  animation: featRocketFly 6s ease-in-out infinite, rocketGlow 3s ease-in-out infinite;
}
.feat-deco-ufo {
  width: 150px;
  margin-left: 20px;
  animation: featUfoFly 8s ease-in-out infinite, ufoGlow 4s ease-in-out infinite;
  animation-delay: -3s, -1.5s;
}

/* ロケット飛行パス：上下ジグザグで推進感 */
@keyframes featRocketFly {
  0%   { transform: translateY(8px)  translateX(0px)  rotate(-12deg) scale(1);    }
  15%  { transform: translateY(-22px) translateX(6px)  rotate(-16deg) scale(1.06); }
  30%  { transform: translateY(-8px)  translateX(-4px) rotate(-10deg) scale(1.02); }
  50%  { transform: translateY(-32px) translateX(8px)  rotate(-18deg) scale(1.09); }
  70%  { transform: translateY(-14px) translateX(-6px) rotate(-11deg) scale(1.03); }
  85%  { transform: translateY(-28px) translateX(4px)  rotate(-15deg) scale(1.07); }
  100% { transform: translateY(8px)  translateX(0px)  rotate(-12deg) scale(1);    }
}

/* UFO飛行パス：左右フラフラしながら浮遊 */
@keyframes featUfoFly {
  0%   { transform: translateX(0px)   translateY(6px)  rotate(-3deg); }
  20%  { transform: translateX(-22px) translateY(-16px) rotate(5deg);  }
  40%  { transform: translateX(16px)  translateY(-6px)  rotate(-4deg); }
  55%  { transform: translateX(-12px) translateY(-26px) rotate(6deg);  }
  70%  { transform: translateX(20px)  translateY(-10px) rotate(-2deg); }
  85%  { transform: translateX(-8px)  translateY(-20px) rotate(4deg);  }
  100% { transform: translateX(0px)   translateY(6px)  rotate(-3deg); }
}

/* ロケット噴射グロー点滅 */
@keyframes rocketGlow {
  0%, 100% { filter: drop-shadow(0 4px 10px rgba(183,33,255,0.4)) drop-shadow(0 6px 16px rgba(255,107,53,0.3)); }
  50%       { filter: drop-shadow(0 4px 22px rgba(183,33,255,0.8)) drop-shadow(0 8px 30px rgba(255,107,53,0.7)); }
}

/* UFO電光グロー点滅 */
@keyframes ufoGlow {
  0%, 100% { filter: drop-shadow(0 4px 10px rgba(0,188,212,0.4)) drop-shadow(0 0 20px rgba(0,255,251,0.2)); }
  50%       { filter: drop-shadow(0 4px 24px rgba(0,255,251,0.8)) drop-shadow(0 0 40px rgba(0,188,212,0.6)); }
}

@media (max-width: 900px) {
  .feat-deco { display: none; }
}


.side-moon {
  position: absolute;
  right: 8%;
  top: 50%;
  transform: translateY(-50%);
  width: 260px;
  pointer-events: none;
  z-index: 2;
  animation: moonFloat 11s ease-in-out infinite alternate;
  animation-delay: -5s;
}
@keyframes moonFloat {
  0%   { transform: translateY(calc(-50% + 0px)) rotate(3deg); }
  100% { transform: translateY(calc(-50% - 18px)) rotate(-2deg); }
}

/* ---- about.html flying decorations（page-hero内のみ） ---- */
.fly-starlink {
  position: absolute;
  top: 0;
  left: 0;
  width: 200px;
  pointer-events: none;
  z-index: 3;
  animation: flyStarlinkPath 20s cubic-bezier(.2,.6,.4,1) 1s infinite;
}

.fly-satellite {
  position: absolute;
  top: 0;
  left: 0;
  width: 110px;
  pointer-events: none;
  z-index: 3;
  animation: flySatellitePath 26s cubic-bezier(.3,.6,.5,1) -10s infinite;
}

/* スターリンク：左から右へ軌道を通過 */
@keyframes flyStarlinkPath {
  0%   { transform: translate(-230px, 40px)  rotate(-4deg) scale(0.5);  opacity: 0; }
  7%   { opacity: 1; }
  45%  { transform: translate(40vw,  90px)  rotate(3deg)  scale(1.05); opacity: 1; }
  83%  { transform: translate(110vw, 160px) rotate(-2deg) scale(0.6);  opacity: 0.4; }
  90%  { transform: translate(-230px, 40px)  rotate(-4deg) scale(0.5);  opacity: 0; }
  100% { transform: translate(-230px, 40px)  rotate(-4deg) scale(0.5);  opacity: 0; }
}

/* 衛星：右から左へゆっくり回転しながら通過 */
@keyframes flySatellitePath {
  0%   { transform: translate(110vw, 200px) rotate(0deg)   scale(0.6); opacity: 0; }
  7%   { opacity: 1; }
  40%  { transform: translate(55vw,  130px) rotate(130deg) scale(1.0); opacity: 1; }
  70%  { transform: translate(15vw,  170px) rotate(260deg) scale(0.9); opacity: 1; }
  84%  { transform: translate(-130px, 120px) rotate(360deg) scale(0.6); opacity: 0.4; }
  90%  { transform: translate(110vw, 200px) rotate(0deg)   scale(0.6); opacity: 0; }
  100% { transform: translate(110vw, 200px) rotate(0deg)   scale(0.6); opacity: 0; }
}

@media (max-width: 1350px) {
    .space-deco { width: 100px; }
    .deco-obj { transform: scale(0.82); }
}
@media (max-width: 1160px) {
    .space-deco { display: none; }
}


/* =====================
   DOCKING ANIMATION (works.html page-hero) — illustrated SVG style
   ===================== */

/* ---- Space Station ---- */
.fly-station {
  position: absolute;
  left: 6%;
  top: 50%;
  transform: translateY(-50%);
  width: 280px;
  pointer-events: none;
  z-index: 1;
}

/* ---- Docking Spacecraft ---- */
.fly-dockship {
  position: absolute;
  left: 100%;
  top: 50%;
  width: 160px;
  pointer-events: none;
  z-index: 1;
  animation: flyDockship 4s ease-in-out forwards;
}

@keyframes flyDockship {
  0%   { transform: translate(100px, -50%); }
  80%  { transform: translate(var(--dock-tx, -900px), -50%); }
  100% { transform: translate(calc(var(--dock-tx, -900px) - 8px), -50%); }
}

/* ---- Spark ---- */
.docking-spark {
  position: absolute;
  left: calc(6% + 248px);
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  animation: dockSpark 4s forwards;
}

.docking-spark::before,
.docking-spark::after {
  content: '';
  position: absolute;
  background: orange;
  border-radius: 8px;
}

.docking-spark::before {
  width: 20px;
  height: 3px;
  top: 8px;
  left: 0;
}

.docking-spark::after {
  width: 3px;
  height: 20px;
  left: 8px;
  top: 0;
}

@keyframes dockSpark {
  0%, 78%       { opacity: 0; transform: translateY(-50%) scale(0.5); }
  83%, 94%      { opacity: 1; transform: translateY(-50%) scale(1.6); }
  100%          { opacity: 0; transform: translateY(-50%) scale(0.5); }
}

@media (max-width: 700px) {
  .fly-station,
  .fly-dockship,
  .docking-spark { display: none; }
}


/* =====================
   ASTRONAUT ANIMATIONS (voice.html page-hero)
   ===================== */

/* Astronaut B — lower left module of station, holding clipboard */
.fly-astronaut-b {
  position: absolute;
  left: 7%;
  top: 52%;
  width: 80px;
  pointer-events: none;
  z-index: 2;
  animation: astronautFloatB 9s ease-in-out infinite alternate;
  animation-delay: -4s;
}

/* Astronaut D — stationed at right module, working in place */
.fly-astronaut-d {
  position: absolute;
  right: 7%;
  top: 18%;
  width: 85px;
  pointer-events: none;
  z-index: 2;
  animation: astronautWorkD 3.5s ease-in-out infinite alternate;
}

/* Right-side space module — where D flies to work */
.fly-module-right {
  position: absolute;
  right: 1%;
  top: 8%;
  width: 92px;
  pointer-events: none;
  z-index: 1;
  animation: moduleFloatR 14s ease-in-out infinite alternate;
}

@keyframes moduleFloatR {
  0%   { transform: translateY(0px); }
  100% { transform: translateY(-10px); }
}

/* B: checking clipboard — steady work bob */
@keyframes astronautFloatB {
  0%   { transform: translateY(0px) rotate(2deg); }
  18%  { transform: translateY(-10px) rotate(-3deg); }
  36%  { transform: translateY(-5px) rotate(4deg); }
  55%  { transform: translateY(-17px) rotate(-2deg); }
  73%  { transform: translateY(-9px) rotate(5deg); }
  100% { transform: translateY(-21px) rotate(-4deg); }
}

/* D: working in place at right module — wrench oscillation */
@keyframes astronautWorkD {
  0%   { transform: translate(8px, -8px)  rotate(-4deg); }
  25%  { transform: translate(11px, -12px) rotate(-7deg); }
  50%  { transform: translate(7px, -6px)  rotate(-2deg); }
  75%  { transform: translate(10px, -11px) rotate(-6deg); }
  100% { transform: translate(8px, -9px)  rotate(-4deg); }
}

@media (max-width: 700px) {
  .fly-astronaut-b,
  .fly-astronaut-d,
  .fly-module-right { display: none; }
}


/* =====================
   MARS LANDING ANIMATION (staff.html page-hero)
   ===================== */

/* Star field overlay — covers full hero */
.mars-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* Twinkling groups — each group pulses at a different rhythm */
.mars-twinkle-a {
  animation: marsTwinkleA 2.8s ease-in-out infinite alternate;
}
.mars-twinkle-b {
  animation: marsTwinkleA 4.2s ease-in-out infinite alternate;
  animation-delay: -1.6s;
}
.mars-twinkle-c {
  animation: marsTwinkleA 5.5s ease-in-out infinite alternate;
  animation-delay: -3.1s;
}
.mars-twinkle-bright {
  animation: marsTwinkleBright 3.6s ease-in-out infinite alternate;
  animation-delay: -0.8s;
}

@keyframes marsTwinkleA {
  0%   { opacity: 0.35; }
  50%  { opacity: 1; }
  100% { opacity: 0.45; }
}
@keyframes marsTwinkleBright {
  0%   { opacity: 0.55; filter: drop-shadow(0 0 2px rgba(180,210,255,0.6)); }
  50%  { opacity: 1;    filter: drop-shadow(0 0 6px rgba(180,210,255,1)); }
  100% { opacity: 0.65; filter: drop-shadow(0 0 3px rgba(180,210,255,0.7)); }
}

/* contact page — 赤い星 */
.contact-twinkle-red {
  animation: contactTwinkleRed 3.8s ease-in-out infinite alternate;
  animation-delay: -1.2s;
}
@keyframes contactTwinkleRed {
  0%   { opacity: 0.30; filter: drop-shadow(0 0 1px rgba(255,90,70,0.4)); }
  50%  { opacity: 1;    filter: drop-shadow(0 0 4px rgba(255,90,70,0.9)); }
  100% { opacity: 0.40; filter: drop-shadow(0 0 2px rgba(255,90,70,0.5)); }
}

/* contact page — 青い星 */
.contact-twinkle-blue {
  animation: contactTwinkleBlue 4.8s ease-in-out infinite alternate;
  animation-delay: -2.4s;
}
@keyframes contactTwinkleBlue {
  0%   { opacity: 0.28; filter: drop-shadow(0 0 1px rgba(60,150,255,0.4)); }
  50%  { opacity: 1;    filter: drop-shadow(0 0 5px rgba(60,150,255,1)); }
  100% { opacity: 0.38; filter: drop-shadow(0 0 2px rgba(60,150,255,0.5)); }
}

/* contact page — 赤・青 輝きハロー */
.contact-twinkle-bright-color {
  animation: contactTwinkleBrightColor 3.2s ease-in-out infinite alternate;
  animation-delay: -0.6s;
}
@keyframes contactTwinkleBrightColor {
  0%   { opacity: 0.50; }
  50%  { opacity: 1; }
  100% { opacity: 0.60; }
}

/* Earth visible from the Moon */
.moon-earth {
  position: absolute;
  left: 4%;
  top: 14%;
  width: 200px;
  pointer-events: none;
  z-index: 1;
  animation: earthFloat 14s ease-in-out infinite alternate;
  animation-delay: -5s;
  filter: drop-shadow(0 0 14px rgba(50,120,255,0.60)) drop-shadow(0 0 6px rgba(50,120,255,0.35));
}
@keyframes earthFloat {
  0%   { transform: translateY(0px) rotate(-1.5deg); }
  100% { transform: translateY(-12px) rotate(1.5deg); }
}
@media (max-width: 700px) {
  .moon-earth { display: none; }
}

/* Full-width Mars terrain at hero bottom */
.mars-surface {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 85px;
  pointer-events: none;
  z-index: 1;
}

/* Mars lander — descends from above and lands */
.mars-lander {
  position: absolute;
  right: 10%;
  bottom: 40px;
  width: 140px;
  pointer-events: none;
  z-index: 2;
  animation: marsLand 5.5s cubic-bezier(0.3, 0, 0.5, 1) forwards;
}

/* Thruster flame inside the SVG — fades out when lander touches down */
.lander-flame {
  animation: flameFade 5.5s forwards;
}

/* Landing dust puff at foot pads */
.mars-dust {
  position: absolute;
  right: 10%;
  bottom: 40px;
  width: 140px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(140,155,175,0.7) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  animation: marsDust 5.5s forwards;
}

@keyframes marsLand {
  0%   { transform: translateY(-340px); }
  55%  { transform: translateY(-90px); }
  78%  { transform: translateY(-28px); }
  90%  { transform: translateY(-7px); }
  100% { transform: translateY(0px); }
}

@keyframes flameFade {
  0%, 72%  { opacity: 1; }
  92%, 100% { opacity: 0; }
}

@keyframes marsDust {
  0%, 86%  { opacity: 0; transform: scaleX(0.3); }
  93%      { opacity: 0.85; transform: scaleX(1.8); }
  100%     { opacity: 0; transform: scaleX(2.8); }
}

@media (max-width: 700px) {
  .mars-surface,
  .mars-lander,
  .mars-dust { display: none; }
}
