/* Expedition survey treatment. Existing tabs, artwork and game links stay native. */
#worlds {
  --survey-accent: #f6b47d;
  --survey-rgb: 246, 180, 125;
}

#worlds[data-theme="relay"] {
  --survey-accent: #8ce7df;
  --survey-rgb: 140, 231, 223;
}

#worlds[data-theme="rift"] {
  --survey-accent: #b2c9ff;
  --survey-rgb: 178, 201, 255;
}

#worlds .world-tabs {
  border-top: 1px solid #b8d4d04d;
  background: #07171e;
}

#worlds .world-tabs button {
  position: relative;
  border-bottom: 2px solid transparent;
  background: #0a1c24;
  color: #d0dedb;
  transition: background .2s, color .2s, border-color .2s;
}

#worlds .world-tabs button + button {
  border-left: 1px solid #b8d4d025;
}

#worlds .world-tabs button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 0;
  background: var(--survey-accent);
  transition: height .2s;
}

#worlds .world-tabs button[aria-selected="true"] {
  color: #f7f5ed;
  background: #20363d;
  border-bottom-color: var(--survey-accent);
  box-shadow: inset 0 1px #d9ffff15;
}

#worlds .world-tabs button[aria-selected="true"]::before {
  height: 100%;
}

#worlds .world-tabs button[aria-selected="true"] small {
  color: var(--survey-accent);
}

#worlds .world-tabs button:hover {
  background: #263e46;
  color: #fff8ec;
}

#worlds .world-tabs button:focus-visible {
  outline: 2px solid #d3f4f0;
  outline-offset: -6px;
}

#worlds .world-panel {
  isolation: isolate;
  overflow: hidden;
  animation: none;
}

#worlds .world-panel::after {
  z-index: 0;
}

#worlds .world-panel > img {
  animation: survey-scene-settle .9s cubic-bezier(.2,.65,.25,1) both;
}

#worlds .survey-effects,
#worlds .survey-effects > span {
  position: absolute;
  pointer-events: none;
}

#worlds .survey-effects {
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

/* The open frame belongs to the scene, with no extra dashboard readings. */
#worlds .survey-frame {
  inset: 18px;
  opacity: .65;
  background:
    linear-gradient(var(--survey-accent), var(--survey-accent)) left top / 32px 1px,
    linear-gradient(var(--survey-accent), var(--survey-accent)) left top / 1px 32px,
    linear-gradient(var(--survey-accent), var(--survey-accent)) right top / 32px 1px,
    linear-gradient(var(--survey-accent), var(--survey-accent)) right top / 1px 32px,
    linear-gradient(var(--survey-accent), var(--survey-accent)) left bottom / 20px 1px,
    linear-gradient(var(--survey-accent), var(--survey-accent)) left bottom / 1px 20px,
    linear-gradient(var(--survey-accent), var(--survey-accent)) right bottom / 20px 1px,
    linear-gradient(var(--survey-accent), var(--survey-accent)) right bottom / 1px 20px;
  background-repeat: no-repeat;
}

/* Unhiding a selected panel runs one sweep, then clears it completely. */
#worlds .survey-scan {
  left: 18px;
  right: 18px;
  top: 6%;
  height: 23%;
  opacity: 0;
  border-bottom: 1px solid rgba(var(--survey-rgb), .5);
  background: linear-gradient(transparent, rgba(var(--survey-rgb), .07));
  animation: survey-once .95s cubic-bezier(.15,.55,.3,1) both;
}

#worlds .survey-weather {
  inset: 0;
  opacity: .65;
  mask-image: linear-gradient(#000 5%, #000 46%, transparent 76%);
  animation: survey-weather-settle 1.4s ease-out both;
}

/* Embers skim the warm abandoned mining ground. */
#worlds #world-crater .survey-weather {
  background:
    radial-gradient(2px 2px at 16% 58%, #ffbe82, transparent),
    radial-gradient(1px 1px at 24% 43%, #ffe1b8, transparent),
    radial-gradient(2px 2px at 32% 64%, #e9a268, transparent),
    radial-gradient(1px 1px at 67% 39%, #ffda9b, transparent),
    radial-gradient(1px 1px at 82% 55%, #fbc288, transparent),
    radial-gradient(ellipse at 18% 67%, #e88c3414, transparent 38%);
}

/* A narrow light spill follows the relay's original cyan palette. */
#worlds #world-relay .survey-weather {
  background:
    linear-gradient(105deg, transparent 42%, #8effef0d 48%, transparent 58%),
    radial-gradient(ellipse at 68% 31%, #8cfbe31a, transparent 39%),
    radial-gradient(1px 1px at 22% 36%, #bcfff6, transparent),
    radial-gradient(1px 1px at 46% 54%, #d2fffa, transparent),
    radial-gradient(2px 2px at 79% 47%, #a4eced9c, transparent);
}

/* Sparse ice catches a cold aurora above the rift. */
#worlds #world-rift .survey-weather {
  background:
    radial-gradient(1px 1px at 14% 20%, #f2fbff, transparent),
    radial-gradient(2px 2px at 27% 41%, #d7e9ff, transparent),
    radial-gradient(1px 1px at 39% 14%, #f2fbff, transparent),
    radial-gradient(1px 1px at 58% 35%, #e5edff, transparent),
    radial-gradient(2px 2px at 71% 18%, #e5edff, transparent),
    radial-gradient(1px 1px at 86% 49%, #f2fbff, transparent),
    linear-gradient(170deg, transparent 20%, #96b8ff0d 31%, #bd9fff0d 34%, transparent 47%);
}

#worlds .world-copy .eyebrow {
  color: var(--survey-accent);
}

#worlds .world-copy .scene-link {
  border-bottom-color: rgba(var(--survey-rgb), .65);
}

#worlds .world-copy .scene-link:is(:hover, :focus-visible) {
  color: var(--survey-accent);
}

#worlds .world-copy .scene-link:focus-visible {
  outline: 2px solid #d3f4f0;
  outline-offset: 5px;
}

@keyframes survey-scene-settle {
  from { transform: scale(1.025); }
  to { transform: scale(1); }
}

@keyframes survey-once {
  0% { transform: translateY(-100%); opacity: 0; }
  15% { opacity: .8; }
  75% { opacity: .5; }
  100% { transform: translateY(240%); opacity: 0; }
}

@keyframes survey-weather-settle {
  from { transform: translateY(6px); opacity: .1; }
  to { transform: translateY(0); opacity: .65; }
}

@media (max-width: 760px) {
  #worlds .survey-frame { inset: 12px; opacity: .55; }
  #worlds .survey-scan { left: 12px; right: 12px; }
  #worlds .survey-weather { opacity: .45; animation: none; }
  #worlds .world-tabs button::before { width: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  #worlds .world-panel > img,
  #worlds .survey-scan,
  #worlds .survey-weather { animation: none; transform: none; }
  #worlds .survey-scan { display: none; }
}
