/* Bright "AI field" home stage (see motion/stage-motion.js). */

/* The generative scene replaces the painted backgrounds entirely. */
html[data-stage-scene="ai"] .page-stage-media__frame,
html[data-stage-scene="ai"] .page-stage-media__art {
  background: #f7f8ff !important;
}

html[data-stage-scene="ai"] .page-stage-media__sheet,
html[data-stage-scene="ai"] .page-stage-media__art::before,
html[data-stage-scene="ai"] .page-stage-media__art::after {
  display: none !important;
}

/* Header and dock glass in the stage's cool palette (legacy rules use !important). */
html[data-stage-scene="ai"] .site-header {
  background: linear-gradient(180deg, rgb(255 255 255 / 0.78), rgb(244 245 255 / 0.62)) !important;
  border-color: rgb(99 102 241 / 0.14) !important;
  box-shadow: 0 10px 30px rgb(79 70 229 / 0.08) !important;
  backdrop-filter: blur(18px) saturate(1.3) !important;
}

html[data-stage-scene="ai"] .top-nav__toggle,
html[data-stage-scene="ai"] .site-search {
  border-color: rgb(99 102 241 / 0.18) !important;
  background: rgb(255 255 255 / 0.66) !important;
}

html[data-stage-scene="ai"] .top-nav__toggle:hover,
html[data-stage-scene="ai"] .top-nav__toggle.is-active {
  border-color: rgb(99 102 241 / 0.4) !important;
  background: #fff !important;
  box-shadow: 0 6px 16px rgb(79 70 229 / 0.12) !important;
}

html[data-stage-scene="ai"] .top-nav__label {
  color: #1e1b4b !important;
}

html[data-stage-scene="ai"] .desktop-dock,
html[data-stage-scene="ai"] .spectrum-root .spectrum-dock {
  border: 1px solid rgb(255 255 255 / 0.9) !important;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.8), rgb(240 242 255 / 0.66)) !important;
  box-shadow:
    0 24px 44px rgb(79 70 229 / 0.14),
    0 8px 18px rgb(15 23 42 / 0.05),
    inset 0 1px 0 rgb(255 255 255 / 0.95) !important;
}

.stage-motion {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.stage-motion__gradient,
.stage-motion__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.stage-motion__gradient.is-fallback {
  background:
    radial-gradient(circle at 20% 25%, #d9d6ff 0, transparent 45%),
    radial-gradient(circle at 75% 20%, #c7ecff 0, transparent 45%),
    radial-gradient(circle at 60% 60%, #d3f7ea 0, transparent 40%),
    #f7f8ff;
}

/* ------------------------------------------------------------ characters */
/* JS drives position, frames, bob and turning; the click "surprise" keeps its CSS jump. */
html[data-walker="js"] .page-stage-media__walker {
  animation: none;
  transition: none;
}

html[data-walker="js"] .page-stage-media__walker .page-stage-media__walker-sprite,
html[data-walker="js"] .page-stage-media__walker.is-surprised .page-stage-media__walker-sprite {
  animation: none;
}

/* Frame blending: the sprite shows frame A, the overlay cross-fades frame B. */
html[data-walker="js"] .page-stage-media__walker-sprite {
  background-position: var(--frame-a, 0) 0 !important;
}

html[data-walker="js"] .page-stage-media__walker-sprite::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: inherit;
  background-repeat: no-repeat;
  background-size: inherit;
  background-position: var(--frame-b, 0) 0;
  opacity: var(--frame-blend, 0);
  pointer-events: none;
}

html[data-walker="js"] .page-stage-media__walker.is-jumping .page-stage-media__walker-sprite {
  background-image: url("../media/bg-walker-pair-v4-surprise-sprite.png?v=20260507a");
}

/* Contact shadow follows the jump height set from JS; lighter on the bright floor. */
html[data-walker="js"] .page-stage-media__walker::before,
html[data-walker="js"] .page-stage-media__walker.is-surprised::before {
  animation: none;
  opacity: calc(var(--walker-shadow-opacity, 0.66) * 0.6);
  transform: scaleX(var(--walker-shadow-scale, 1));
}

html[data-stage-scene="ai"] .page-stage-media__walker-sprite {
  filter: drop-shadow(0 10px 14px rgb(79 70 229 / 0.18));
}

.stage-bubble {
  position: absolute;
  z-index: 4;
  max-width: min(320px, 70vw);
  padding: 9px 14px;
  border: 1px solid rgb(99 102 241 / 0.22);
  border-radius: 16px;
  background: rgb(255 255 255 / 0.92);
  box-shadow: 0 12px 28px rgb(79 70 229 / 0.16);
  backdrop-filter: blur(10px);
  color: #1e1b4b;
  font: 600 13px/1.45 "Pretendard Variable", "Instrument Sans", system-ui, sans-serif;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-100% + 8px)) scale(0.92);
  transform-origin: 50% 100%;
  transition:
    opacity 0.25s ease,
    transform 0.35s cubic-bezier(0.2, 0.9, 0.25, 1.25);
}

.stage-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  border-right: 1px solid rgb(99 102 241 / 0.22);
  border-bottom: 1px solid rgb(99 102 241 / 0.22);
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
}

.stage-bubble.is-on {
  opacity: 1;
  transform: translate(-50%, -100%) scale(1);
}

body:has(.workspace-window:not([hidden])) .stage-bubble {
  display: none;
}

/* ------------------------------------------------------------------ hero */
.stage-hero {
  position: absolute;
  left: clamp(16px, 3.4vw, 56px);
  top: clamp(20px, 5.5vh, 64px);
  z-index: 3;
  width: min(520px, calc(100% - 32px));
  padding: 24px 26px 20px;
  border: 1px solid rgb(255 255 255 / 0.85);
  border-radius: 24px;
  background: linear-gradient(160deg, rgb(255 255 255 / 0.78), rgb(245 247 255 / 0.6));
  box-shadow:
    0 30px 60px rgb(79 70 229 / 0.12),
    0 8px 20px rgb(15 23 42 / 0.05),
    inset 0 1px 0 rgb(255 255 255 / 0.95);
  backdrop-filter: blur(20px) saturate(1.3);
  color: #1e1b4b;
  font-family: "Pretendard Variable", "Instrument Sans", "Inter", system-ui, sans-serif;
  /* The stage section disables pointer events; the hero's links need them back. */
  pointer-events: auto;
  transition:
    opacity 0.45s ease,
    transform 0.45s ease,
    visibility 0.45s;
}

body:has(.workspace-window:not([hidden])) .stage-hero,
body:has(.header-panel:not([hidden])) .stage-hero {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
}

.stage-hero__eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #4f46e5, #0891b2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stage-hero__title {
  margin: 0;
  font-size: clamp(24px, 2.3vw, 34px);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.025em;
  color: #111132;
}

.stage-hero__line {
  display: block;
}

.stage-hero__word {
  display: inline-block;
  opacity: 0;
  filter: blur(8px);
  transform: translateY(0.45em);
}

.stage-hero.is-in .stage-hero__word {
  animation: hero-word 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: calc(var(--i) * 90ms + 150ms);
}

@keyframes hero-word {
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

.stage-hero__core,
.stage-hero__body,
.stage-hero__stats,
.stage-hero__live {
  opacity: 0;
  transform: translateY(8px);
}

.stage-hero.is-in .stage-hero__core { animation: hero-fade 0.7s ease 0.45s forwards; }
.stage-hero.is-in .stage-hero__body { animation: hero-fade 0.7s ease 0.55s forwards; }
.stage-hero.is-in .stage-hero__stats { animation: hero-fade 0.7s ease 0.7s forwards; }
.stage-hero.is-in .stage-hero__live { animation: hero-fade 0.7s ease 0.85s forwards; }

@keyframes hero-fade {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stage-hero__core {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 12px 0 0;
  font-size: 13px;
}

.stage-hero__core span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(30 27 75 / 0.55);
}

.stage-hero__rotator {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgb(99 102 241 / 0.14), rgb(6 182 212 / 0.16));
  color: #3730a3;
  font-weight: 700;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    filter 0.3s ease;
}

.stage-hero__rotator.is-out {
  opacity: 0;
  filter: blur(4px);
  transform: translateY(-6px);
}

.stage-hero__body {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.65;
  color: rgb(30 27 75 / 0.72);
}

.stage-hero__stats {
  display: flex;
  gap: 22px;
  margin: 16px 0 0;
}

.stage-hero__stats div {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stage-hero__stats dt {
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #4f46e5, #0891b2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stage-hero__stats dd {
  margin: 0;
  font-size: 12px;
  color: rgb(30 27 75 / 0.6);
}

.stage-hero__live {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgb(99 102 241 / 0.14);
}

.stage-hero__live-label {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1e1b4b;
}

.stage-hero__live-label b {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgb(16 185 129 / 0.6);
  animation: live-pulse 1.8s ease-out infinite;
}

@keyframes live-pulse {
  70% { box-shadow: 0 0 0 8px rgb(16 185 129 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(16 185 129 / 0); }
}

.stage-hero__ticker {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.stage-hero__track {
  display: flex;
  gap: 8px;
  width: max-content;
  animation: ticker 46s linear infinite;
}

.stage-hero__ticker:hover .stage-hero__track,
.stage-hero__ticker:focus-within .stage-hero__track {
  animation-play-state: paused;
}

@keyframes ticker {
  to {
    transform: translateX(-50%);
  }
}

.stage-hero__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid rgb(99 102 241 / 0.18);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.75);
  color: #1e1b4b;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.stage-hero__chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

.stage-hero__chip:hover {
  border-color: rgb(99 102 241 / 0.45);
  background: #fff;
  transform: translateY(-1px);
}

@media (width <= 720px) {
  .stage-hero {
    padding: 16px 16px 14px;
    border-radius: 18px;
  }

  .stage-hero__title {
    font-size: 24px;
  }

  .stage-hero__body,
  .stage-hero__stats {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage-hero__track,
  .stage-hero__live-label b {
    animation: none;
  }

  .stage-hero__word,
  .stage-hero__core,
  .stage-hero__body,
  .stage-hero__stats,
  .stage-hero__live {
    opacity: 1;
    filter: none;
    transform: none;
    animation: none !important;
  }
}
