:root {
  color-scheme: dark;
  --space: #03080d;
  --ink: #edf4f5;
  --muted: #87969a;
  --signal: #9dd5d7;
  --warm: #d7c39e;
  --ease: cubic-bezier(0.2, 0.72, 0.2, 1);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--space);
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar { width: 0; height: 0; display: none; }

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--space);
  color: var(--ink);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, summary { font: inherit; }

.skip-link {
  position: fixed;
  left: 18px;
  top: 18px;
  z-index: 100;
  padding: 10px 14px;
  background: #fff;
  color: #071014;
  transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

.space-scene,
.space-scene canvas,
.space-haze,
.space-grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.space-field,
.nebula-ribbon {
  position: absolute;
  display: block;
  pointer-events: none;
  user-select: none;
}

.space-scene {
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 110%, rgba(161, 200, 207, 0.13), transparent 46%),
    radial-gradient(ellipse at 78% 46%, rgba(25, 62, 72, 0.16), transparent 38%),
    linear-gradient(180deg, #010408 0%, #03090e 54%, #02070b 100%);
}

.space-field {
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.44;
  filter: brightness(0.72) saturate(0.7) contrast(1.04);
  mix-blend-mode: screen;
}

.space-scene canvas {
  z-index: 1;
  opacity: 0.72;
  mix-blend-mode: screen;
  filter: saturate(1.08) brightness(1.08);
}

.nebula-ribbon {
  z-index: 2;
  left: 17%;
  bottom: -13%;
  width: 92%;
  height: 76%;
  object-fit: contain;
  object-position: center bottom;
  opacity: 0.14;
  filter: brightness(0.78) saturate(0.58);
  mix-blend-mode: screen;
  mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 82%, transparent 100%);
}

.space-haze {
  z-index: 3;
  background:
    linear-gradient(112deg, transparent 38%, rgba(123, 178, 190, 0.045) 51%, transparent 64%),
    radial-gradient(ellipse at 74% 8%, rgba(98, 135, 148, 0.1), transparent 27%);
  mix-blend-mode: screen;
}

.space-grain {
  z-index: 4;
  opacity: 0.2;
  background-image: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 4px);
  mask-image: linear-gradient(to bottom, #000, rgba(0, 0, 0, 0.45));
}

.foreground-stars {
  position: fixed;
  z-index: 8;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
}

main, .universe-back, .noscript-note { position: relative; z-index: 3; }

.universe-back {
  position: fixed;
  left: clamp(20px, 3vw, 48px);
  top: clamp(20px, 3vw, 42px);
  z-index: 20;
  width: 44px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(171, 209, 214, 0.26);
  border-radius: 50%;
  background: rgba(5, 13, 17, 0.48);
  color: rgba(230, 242, 243, 0.82);
  font-size: 19px;
  backdrop-filter: blur(10px);
  transition: border-color 220ms ease, background 220ms ease, color 220ms ease, transform 220ms ease;
}

.universe-back:hover,
.universe-back:focus-visible {
  border-color: rgba(157, 213, 215, 0.7);
  background: rgba(13, 31, 36, 0.72);
  color: #fff;
  outline: none;
  transform: translateX(-3px);
}

.connections-hero {
  min-height: 72svh;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 100px 24px 74px;
  text-align: center;
}

.hero-coordinate {
  margin: 0 0 30px;
  color: rgba(157, 213, 215, 0.64);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.28em;
}

.connections-hero h1 {
  margin: 0;
  font-family: "Songti SC", STSong, SimSun, serif;
  font-size: clamp(44px, 5vw, 82px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: 0.025em;
  text-wrap: balance;
  text-shadow: 0 0 42px rgba(190, 225, 229, 0.08);
}

.connections-hero h1 span { color: var(--warm); }

.hero-copy {
  max-width: 760px;
  margin: 24px 0 0;
  color: rgba(225, 233, 234, 0.7);
  font-family: "Songti SC", STSong, serif;
  font-size: clamp(16px, 1.35vw, 22px);
  line-height: 1.8;
  letter-spacing: 0.06em;
}

.scroll-cue {
  position: absolute;
  bottom: 34px;
  display: grid;
  justify-items: center;
  gap: 12px;
  color: rgba(213, 228, 230, 0.36);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.22em;
}

.scroll-cue i {
  width: 1px;
  height: 38px;
  display: block;
  background: linear-gradient(var(--signal), transparent);
  animation: scroll-signal 2s ease-in-out infinite;
}

.events-journey { position: relative; height: 620svh; }

.journey-stage {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

.journey-stage::before,
.journey-stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

.cosmic-art {
  position: absolute;
  z-index: 2;
  left: 0;
  top: 50%;
  width: min(35vw, 620px);
  height: 100%;
  margin: 0;
  opacity: 0.58;
  pointer-events: none;
  transform: translateY(-50%);
  mask-image: radial-gradient(ellipse 76% 72% at 48% 54%, #000 24%, rgba(0, 0, 0, 0.92) 58%, transparent 100%);
}

.cosmic-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 48%;
  filter: brightness(0.88) contrast(1.05) saturate(0.72);
  mix-blend-mode: screen;
}

.journey-stage::before {
  inset: 0;
  background:
    radial-gradient(ellipse at 47% 104%, rgba(217, 228, 226, 0.12), transparent 38%),
    radial-gradient(ellipse at 10% 48%, rgba(143, 184, 191, 0.08), transparent 30%),
    radial-gradient(ellipse at 91% 54%, rgba(143, 184, 191, 0.07), transparent 32%);
  opacity: 0.9;
}

.journey-stage::after {
  inset: 0;
  background:
    linear-gradient(90deg, rgba(1, 5, 8, 0.2), transparent 24%, transparent 82%, rgba(1, 5, 8, 0.24)),
    linear-gradient(0deg, rgba(1, 5, 8, 0.08), transparent 34%);
}

.journey-orbit {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  opacity: 0;
}

#journey-path {
  fill: none;
  stroke: url(#orbit-gradient);
  stroke-width: 1.25;
  vector-effect: non-scaling-stroke;
}

#journey-nodes circle {
  fill: #0b1317;
  stroke: rgba(181, 208, 210, 0.5);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

#journey-signal { fill: var(--warm); stroke: rgba(255, 247, 227, 0.86); stroke-width: 1; }

.event-stack {
  position: absolute;
  z-index: 4;
  inset: 0;
  perspective: 1100px;
  perspective-origin: 65% 50%;
}

.event-stack::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: calc(65% - min(390px, 27.5vw) - 52px);
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(transparent, rgba(167, 202, 206, 0.3) 18%, rgba(215, 195, 158, 0.25) 50%, rgba(167, 202, 206, 0.22) 82%, transparent);
}

.event-window {
  --stack-y: 0px;
  --stack-scale: 1;
  --stack-opacity: 1;
  --stack-blur: 0px;
  --stack-z: 0px;
  --stack-rotate: 0deg;
  --stack-bank: 0deg;
  position: absolute;
  left: 65%;
  top: 50%;
  width: min(780px, 55vw);
  height: clamp(300px, 38svh, 350px);
  border: 0;
  background: transparent;
  opacity: var(--stack-opacity);
  filter: blur(var(--stack-blur)) saturate(0.74);
  pointer-events: none;
  transform: translate3d(-50%, calc(-50% + var(--stack-y)), var(--stack-z)) rotateX(var(--stack-rotate)) rotateZ(var(--stack-bank)) scale(var(--stack-scale));
  transform-origin: 50% 50% -340px;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity, filter;
}

.event-window.is-active {
  filter: none;
  pointer-events: auto;
  cursor: pointer;
}

.event-window::before,
.event-window::after {
  content: "";
  position: absolute;
  z-index: 5;
  top: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 240ms ease;
}

.event-window::before {
  left: -52px;
  width: 52px;
  height: 1px;
  background: linear-gradient(90deg, rgba(215, 195, 158, 0.72), rgba(157, 213, 215, 0.45));
}

.event-window::after {
  left: -59px;
  width: 11px;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 247, 226, 0.92);
  border-radius: 50%;
  background: var(--warm);
  box-shadow: 0 0 18px rgba(215, 195, 158, 0.62);
  transform: translateY(-50%);
}

.event-window.is-active::before,
.event-window.is-active::after {
  opacity: 1;
}

.event-timeline-date {
  position: absolute;
  z-index: 6;
  left: -150px;
  top: 50%;
  width: 72px;
  color: rgba(230, 214, 177, 0.92);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.12em;
  text-align: right;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(8px);
  transition: opacity 240ms ease, transform 360ms var(--ease);
  text-shadow: 0 0 16px rgba(215, 195, 158, 0.28);
}

.event-window.is-active .event-timeline-date {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.event-window:focus-visible {
  outline: 1px solid rgba(157, 213, 215, 0.72);
  outline-offset: 8px;
}

.event-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 760ms var(--ease);
}

.event-window.is-flipped .event-card-inner {
  transform: rotateY(180deg);
}

.event-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(165, 198, 201, 0.16);
  border-radius: 14px;
  background: linear-gradient(118deg, rgba(9, 20, 26, 0.93), rgba(4, 11, 16, 0.84));
  box-shadow: 0 28px 78px rgba(0, 0, 0, 0.38);
  backface-visibility: hidden;
}

.event-window.is-active .event-face {
  border-color: rgba(215, 195, 158, 0.66);
  box-shadow: 0 0 0 1px rgba(191, 224, 228, 0.08), 0 34px 100px rgba(0, 0, 0, 0.54), 0 0 58px rgba(182, 219, 224, 0.07);
}

.event-front {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(240px, 0.82fr);
}

.event-face::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, rgba(255, 255, 255, 0.055), transparent 28% 72%, rgba(157, 213, 215, 0.025));
}

.event-back {
  display: grid;
  align-items: center;
  padding: clamp(26px, 3vw, 44px);
  transform: rotateY(180deg);
}

.event-back-content {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.event-back .event-index { margin-bottom: 12px; }

.event-back h3 {
  margin: 0;
  font-family: "Songti SC", STSong, SimSun, serif;
  font-size: clamp(25px, 2.4vw, 38px);
  font-weight: 500;
  letter-spacing: 0.025em;
}

.event-back ul {
  display: grid;
  gap: 8px;
  margin: 20px 0 0;
  padding: 18px 0 0 1.25em;
  border-top: 1px solid rgba(175, 202, 204, 0.14);
  color: rgba(220, 231, 232, 0.67);
  font-size: 13px;
  line-height: 1.55;
}

.event-back-closing {
  margin: 17px 0 0;
  color: var(--warm);
  font-family: "Songti SC", STSong, serif;
  font-size: 13px;
}

.event-media {
  position: relative;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background: #071014;
}

.event-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 68%, rgba(7, 15, 19, 0.58)), linear-gradient(0deg, rgba(2, 6, 8, 0.24), transparent 35%);
}

.event-media img {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  object-fit: cover;
  filter: brightness(0.74) saturate(0.76) contrast(1.08);
  transform: scale(1.02);
  transition: filter 520ms ease, transform 900ms var(--ease);
}

.event-window.is-active .event-media img {
  filter: brightness(0.96) saturate(0.88) contrast(1.04);
  transform: scale(1);
}

.event-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 32px 28px;
}

.event-index {
  margin: 0 0 16px;
  color: var(--signal);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.event-copy h2 {
  margin: 0;
  font-family: "Songti SC", STSong, SimSun, serif;
  font-size: clamp(23px, 2vw, 33px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.02em;
  text-wrap: balance;
}

.event-copy time {
  display: none;
  margin-top: 14px;
  color: var(--warm);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.event-result {
  margin: 17px 0 0;
  padding-top: 17px;
  border-top: 1px solid rgba(175, 202, 204, 0.14);
  color: rgba(220, 230, 231, 0.62);
  font-size: 13px;
  line-height: 1.65;
}

.event-copy details { margin-top: 15px; color: rgba(215, 227, 228, 0.66); }

.event-copy summary {
  width: max-content;
  color: rgba(157, 213, 215, 0.7);
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  list-style: none;
}

.event-copy summary::-webkit-details-marker { display: none; }
.event-copy summary::after { content: " +"; }
.event-copy details[open] summary::after { content: " −"; }

.event-copy ul { margin: 13px 0 0; padding-left: 1.2em; font-size: 11px; line-height: 1.7; }

.event-copy details p {
  margin: 10px 0 0;
  color: var(--warm);
  font-family: "Songti SC", STSong, serif;
  font-size: 12px;
}

.event-flip-action {
  position: relative;
  z-index: 3;
  width: max-content;
  margin-top: 15px;
  padding: 0 0 5px;
  border: 0;
  border-bottom: 1px solid rgba(157, 213, 215, 0.24);
  background: transparent;
  color: rgba(157, 213, 215, 0.72);
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease;
}

.event-flip-action:hover,
.event-flip-action:focus-visible {
  border-color: var(--signal);
  color: #e8fbfc;
  outline: none;
}

.journey-progress {
  position: absolute;
  z-index: 8;
  right: clamp(24px, 4vw, 62px);
  bottom: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(215, 230, 232, 0.34);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
}

.journey-progress span:first-child { color: var(--signal); }
.journey-progress i { width: 58px; height: 1px; display: block; background: rgba(164, 199, 202, 0.24); }

.journey-hint {
  position: absolute;
  z-index: 8;
  left: clamp(24px, 3.5vw, 58px);
  bottom: 38px;
  margin: 0;
  color: rgba(212, 228, 229, 0.22);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  letter-spacing: 0.22em;
}

.noscript-note {
  position: fixed;
  inset: auto 16px 16px;
  margin: 0;
  padding: 12px 16px;
  background: #0c171c;
  color: #dfeaec;
  font-size: 13px;
}

@keyframes scroll-signal {
  0%, 100% { transform: scaleY(0.5); opacity: 0.3; transform-origin: top; }
  50% { transform: scaleY(1); opacity: 0.8; transform-origin: top; }
}

@media (max-width: 1060px) {
  .cosmic-art { width: 40vw; opacity: 0.48; }
  .event-window { left: 66%; width: min(700px, 60vw); }
  .event-stack::before { left: calc(66% - min(350px, 30vw) - 46px); }
}

@media (max-width: 760px) {
  .universe-back {
    top: max(14px, env(safe-area-inset-top));
    left: max(14px, env(safe-area-inset-left));
    width: 44px;
    touch-action: manipulation;
  }
  .connections-hero {
    min-height: 78dvh;
    padding:
      calc(88px + env(safe-area-inset-top))
      max(20px, env(safe-area-inset-right))
      72px
      max(20px, env(safe-area-inset-left));
  }
  .hero-coordinate { margin-bottom: 22px; }
  .connections-hero h1 { max-width: 8em; font-size: clamp(42px, 13vw, 64px); }
  .hero-copy { max-width: 22em; font-size: 15px; }
  .events-journey { height: 680dvh; }
  .journey-stage::before { opacity: 0.62; }
  .cosmic-art { left: -24vw; width: 82vw; opacity: 0.16; }
  .space-field { opacity: 0.34; }
  .space-scene canvas { opacity: 0.58; }
  .nebula-ribbon { left: -4%; width: 124%; opacity: 0.1; }
  .journey-orbit { opacity: 0; transform: translateX(7vw); }
  .event-window {
    left: 50%;
    width: calc(100vw - 32px - env(safe-area-inset-left) - env(safe-area-inset-right));
    height: min(72dvh, 590px);
    touch-action: manipulation;
  }
  .event-stack::before { left: 11px; }
  .event-window::before { left: -7px; width: 22px; }
  .event-window::after { left: -12px; }
  .event-timeline-date { display: none; }
  .event-front { grid-template-columns: 1fr; grid-template-rows: clamp(170px, 26dvh, 230px) 1fr; }
  .event-face { border-radius: 13px; }
  .event-media { min-height: 0; height: clamp(170px, 26dvh, 230px); }
  .event-media::after { background: linear-gradient(0deg, rgba(7, 15, 19, 0.64), transparent 42%); }
  .event-media img { min-height: 0; }
  .event-copy { padding: 20px 22px 22px; }
  .event-index { margin-bottom: 10px; }
  .event-copy h2 { font-size: clamp(22px, 6.6vw, 30px); }
  .event-copy time { display: block; margin-top: 8px; }
  .event-result { margin-top: 12px; padding-top: 12px; }
  .journey-hint { display: none; }
  .journey-progress {
    right: max(18px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
  }
  .event-back { padding: 28px 24px; }
  .event-back ul { font-size: 12px; }
}

@media (max-width: 390px) {
  .connections-hero h1 {
    font-size: clamp(38px, 12vw, 52px);
  }

  .hero-copy {
    font-size: 14px;
  }

  .event-window {
    width: calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right));
    height: min(74dvh, 560px);
  }

  .event-copy {
    padding: 16px 18px 18px;
  }

  .event-back {
    padding: 22px 19px;
  }

  .event-back ul {
    gap: 6px;
    margin-top: 14px;
    padding-top: 14px;
    font-size: 11px;
  }
}

@media (max-width: 760px) and (orientation: landscape) {
  .connections-hero {
    min-height: 100dvh;
    padding-block: calc(64px + env(safe-area-inset-top)) max(40px, env(safe-area-inset-bottom));
  }

  .connections-hero h1 {
    max-width: 12em;
    font-size: clamp(36px, 8vw, 56px);
  }

  .event-window {
    width: min(82vw, 720px);
    height: min(76dvh, 350px);
  }

  .event-front {
    grid-template-columns: minmax(0, 1.1fr) minmax(220px, 0.9fr);
    grid-template-rows: 1fr;
  }

  .event-media {
    height: 100%;
  }

  .event-copy {
    padding: 20px 24px;
  }
}

@media (max-width: 960px) and (max-height: 520px) and (orientation: landscape) {
  .universe-back {
    top: max(10px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    width: 44px;
  }

  .connections-hero {
    min-height: 100dvh;
    padding:
      calc(54px + env(safe-area-inset-top))
      max(24px, env(safe-area-inset-right))
      max(30px, env(safe-area-inset-bottom))
      max(24px, env(safe-area-inset-left));
  }

  .connections-hero h1 {
    max-width: 12em;
    font-size: clamp(34px, 7vw, 54px);
  }

  .hero-coordinate {
    margin-bottom: 14px;
  }

  .hero-copy {
    margin-top: 14px;
    font-size: 14px;
  }

  .event-window {
    left: 53%;
    width: min(80vw, 720px);
    height: min(76dvh, 350px);
    touch-action: manipulation;
  }

  .event-front {
    grid-template-columns: minmax(0, 1.1fr) minmax(220px, 0.9fr);
    grid-template-rows: 1fr;
  }

  .event-media {
    height: 100%;
  }

  .event-copy {
    padding: 18px 22px;
  }

  .event-back {
    padding: 20px 24px;
  }
}

@media (max-height: 720px) and (min-width: 761px) {
  .event-window { height: 290px; }
  .event-copy { padding: 24px 28px; }
  .event-index { margin-bottom: 10px; }
  .event-result { margin-top: 12px; padding-top: 12px; }
  .event-copy details { margin-top: 9px; }
  .event-back { padding: 22px 28px; }
  .event-back ul { gap: 5px; margin-top: 13px; padding-top: 12px; font-size: 11px; }
  .event-back-closing { margin-top: 10px; }
  .event-back .event-flip-action { margin-top: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
