/* The compact experience is enabled by the controller for phones and tablets. */
.hgis-scene .scene-hero {
  position: absolute;
  inset: 0;
}

.hgis-scene .compact-explorer {
  display: none;
}

/* Desktop detail presentation: leave the ecosystem on the left and anchor
   the code-style content window to the right of the viewport. */
@media (min-width: 1024px) {
  .hgis-scene:not(.compact-scene) [data-index-target="panel"] {
    position: absolute;
    inset: 0 0 0 auto;
    display: flex;
    width: 60%;
    height: 100svh;
    flex-direction: column;
    justify-content: center;
    padding: 2.5rem 4rem 2.5rem 2.5rem;
  }

  .hgis-scene:not(.compact-scene) [data-index-target="hgisStory"] {
    justify-content: flex-end;
  }

  .hgis-scene:not(.compact-scene) [data-index-target="hgisStory"] > aside {
    width: 60%;
  }
}

.hgis-scene.compact-scene {
  height: auto;
  min-height: 100svh;
  overflow: clip;
  background: #020617;
}

.compact-scene .scene-hero {
  position: relative;
  min-height: 100svh;
  isolation: isolate;
}

.compact-scene .scene-hero canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100svh;
  pointer-events: none;
}

.compact-scene .compact-explorer {
  display: flex;
  z-index: 1;
}

/* The fixed bottom navigator is sufficient; omit the duplicate hero title. */
.compact-scene .compact-intro {
  display: none;
}

.compact-scene .compact-intro {
  position: absolute;
  inset: 57svh 20px auto;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 3svh, 32px);
  text-align: center;
}

.compact-scene .compact-eyebrow {
  margin: 0 0 12px;
  color: #94a3b8;
  font: 11px/1.6 monospace;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.compact-scene .compact-title {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

.compact-scene .compact-navigation {
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(100%, 340px);
}

.compact-scene .compact-navigation button {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  height: 48px;
  border: 1px solid #64748b;
  border-radius: 50%;
  color: #fcd34d;
  background: #0f172a;
  font-size: 24px;
  cursor: pointer;
  touch-action: manipulation;
}

.compact-scene .compact-navigation button:hover {
  border-color: #fcd34d;
}

.compact-scene .compact-navigation button:disabled {
  opacity: 0.35;
  cursor: wait;
}

.compact-scene button:focus-visible {
  outline: 2px solid #fcd34d;
  outline-offset: 4px;
}

.compact-scene .compact-navigation-label {
  display: grid;
  gap: 4px;
  text-align: center;
  color: #cbd5e1;
  font: 12px/1.5 monospace;
}

.compact-scene [data-index-target="compactNumber"] {
  color: #94a3b8;
  font-size: 11px;
  letter-spacing: 0.15em;
}

.compact-scene .compact-scroll-hint {
  position: absolute;
  top: auto;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font: 11px/1.5 monospace;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  white-space: nowrap;
  cursor: pointer;
  animation: compact-scroll-hint-pulse 1.8s ease-in-out infinite;
}

.compact-scene .compact-reading-navigation {
  position: fixed;
  inset: auto 0 0;
  z-index: 40;
  width: 100%;
  padding: 12px max(20px, calc((100% - 680px) / 2)) max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid #334155;
  background: rgb(2 6 23 / 78%);
  backdrop-filter: blur(16px);
  visibility: visible;
  pointer-events: auto;
}

/* Reuse the existing content in document flow, with one page scrollbar. */
.compact-scene [data-index-target="panel"],
.compact-scene [data-index-target="hgisStory"] {
  position: relative;
  z-index: 2;
  inset: auto;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  opacity: 1 !important;
  visibility: visible;
  transform: none !important;
  pointer-events: auto !important;
  transition: none;
  scroll-margin-top: 16px;
  overflow-wrap: anywhere;
}

.compact-scene[data-compact-item="about"] [data-index-target="panel"],
.compact-scene[data-compact-item="service"] [data-index-target="hgisStory"],
.compact-scene:not([data-compact-item]) [data-index-target="panel"],
.compact-scene:not([data-compact-item]) [data-index-target="hgisStory"] {
  display: none;
}

.compact-scene [data-index-target="hgisStory"] > aside,
.compact-scene .service-window {
  width: 100%;
  height: auto;
  overflow: visible;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
  background: rgb(2 6 23 / 78%);
  backdrop-filter: blur(10px);
}

/* Remove the opaque editor-header blocks in compact reading mode. */
.compact-scene [data-index-target="siteHeader"],
.compact-scene .service-window > div:not(.absolute),
.compact-scene [data-index-target="hgisStory"] > aside > div:not([data-index-target]),
.compact-scene .service-body > [aria-hidden="true"],
.compact-scene [data-index-target="hgisStoryScroller"] > section {
  background: transparent;
  backdrop-filter: none;
}

.compact-scene [data-index-target="hgisStoryScroller"],
.compact-scene .service-scroller,
.compact-scene .service-body {
  overflow: visible;
}

.compact-scene .service-body {
  display: block;
}

.compact-scene .service-body > [aria-hidden="true"],
.compact-scene .service-footer,
.compact-scene [data-action="click->index#backToOverview"],
.compact-scene [data-action="click->index#backFromHgisStory"],
.compact-scene [data-index-target="panel"] > div:last-child,
.compact-scene > .pointer-events-none:not([data-index-target]) {
  display: none;
}

.compact-scene [data-index-target="title"] {
  font-size: clamp(28px, 6vw, 48px);
}

.compact-scene [data-index-target="hgisStoryScroller"] > section {
  padding: clamp(20px, 4vw, 40px);
}

.compact-scene [data-index-target="loading"] {
  height: 100svh;
}

@keyframes compact-scroll-hint-pulse {
  0%, 100% {
    opacity: 0.45;
  }

  50% {
    opacity: 1;
    text-shadow: 0 0 14px rgb(148 163 184 / 55%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .compact-scene .compact-scroll-hint {
    animation: none;
  }
}
