/* Off the Curve's scene: the world Preppy climbs (src/scene.js). Everything here is decoration:
   the scene never takes a pointer, the ui sits over it. Fonts are the game's own (the ui loads
   them): DM Sans for the axis labels, Inter for the facts. */

:where(.ss-root) {
  position: relative;
  overflow: hidden;
}

.ss {
  position: absolute;
  inset: 0;
  overflow: hidden;
  contain: strict;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  font-family: "DM Sans", "Inter", "Fredoka";
  background: #fdfeff;
  --medal: 46px;
  --ink: #0a0a0a;
  --deep: #135073;
  --teal: #46d5d3;
  --mint: #57e9e6;
  --blue: #1cb0f6;
  --gold: #ffc21a;
}

.ss-sky,
.ss-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  will-change: transform;
  backface-visibility: hidden;
}

.ss-crowd {
  position: absolute;
  left: 0;
  top: 0;
}

.ss-overlay {
  position: absolute;
  inset: 0;
}

/* ---- the sky */

.ss-floor {
  position: absolute;
  left: 0;
  width: 100%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0, rgba(255, 255, 255, 0) 4px),
    linear-gradient(180deg, #fbefdc 0%, #f6e3c8 40%, #f3dcbd 100%);
  box-shadow: 0 -2px 0 #f0d6b0;
}

.ss-floor::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 22px;
  height: 2px;
  background: rgba(255, 255, 255, 0.55);
}

.ss-glow {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 244, 205, 0.95), rgba(255, 233, 168, 0.55) 30%, rgba(255, 240, 200, 0.22) 60%, rgba(255, 248, 225, 0) 100%);
  mix-blend-mode: screen;
}

.ss-cloud {
  position: absolute;
  animation: ss-drift var(--dur, 20s) ease-in-out infinite alternate;
  animation-play-state: paused;
  will-change: transform;
}

.ss-cloud.is-on {
  animation-play-state: running;
}

.ss-cloud svg,
.ss-twinkle svg,
.ss-desk svg,
.ss-podium svg,
.ss-p svg {
  display: block;
  width: 100%;
  height: 100%;
}

@keyframes ss-drift {
  from { transform: translate3d(calc(var(--drift, 20px) * -1), 0, 0); }
  to { transform: translate3d(var(--drift, 20px), 0, 0); }
}

.ss-twinkle {
  position: absolute;
  opacity: 0.85;
  animation: ss-twinkle 2.8s ease-in-out infinite;
  animation-play-state: paused;
}

.ss-twinkle.is-on {
  animation-play-state: running;
}

@keyframes ss-twinkle {
  0%, 100% { transform: scale(0.55) rotate(0deg); opacity: 0.35; }
  50% { transform: scale(1) rotate(25deg); opacity: 1; }
}

/* ---- the axis */

.ss-rail {
  position: absolute;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(90deg, #e3f2f6 0%, #ffffff 42%, #ffffff 58%, #dcedf2 100%);
  box-shadow:
    inset 0 0 0 2px #cfe5eb,
    0 3px 0 #bcd7e0,
    0 8px 18px rgba(13, 34, 48, 0.08);
}

.ss-rail__fill {
  position: absolute;
  left: 3px;
  right: 3px;
  top: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, #8af3ef 0%, #46d5d3 18%, #1cb0f6 70%, #1693d9 100%);
  box-shadow: inset 0 -3px 0 rgba(10, 90, 140, 0.25);
  will-change: transform;
}

.ss-rail__fill::after {
  content: "";
  position: absolute;
  left: 24%;
  width: 24%;
  top: 7px;
  bottom: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}

.ss-tick {
  position: absolute;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 2px;
  background: #c4d8e0;
}

.ss-tick--major {
  height: 4px;
  margin-top: -2px;
  background: #a9c2cc;
}

/* the axis labels: at least 4.4:1 on every sky they sit on (4.9:1 and up through the crowd), with
   a soft white halo for bright light; a landmark's turns deep blue once Preppy has passed it */
.ss-num {
  position: absolute;
  transform: translateY(-50%);
  font: 700 15px/1 "DM Sans", "Inter";
  letter-spacing: -0.01em;
  color: #466271;
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.9), 0 0 7px rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ss-num--lm {
  font-size: 17px;
  font-weight: 800;
  color: #466271;
  transition: color 0.3s ease;
}

.ss-num--lm.is-lit {
  color: var(--deep);
}

.ss-num--word {
  font-size: 16px;
}

.ss-num.is-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 0 #cfe5eb, 0 4px 10px rgba(13, 34, 48, 0.1);
  transition: color 0.3s ease, opacity 0.18s ease;
}

.ss-num.is-under {
  opacity: 0;
}

.is-phone .ss-num {
  font-size: 12px;
}

.is-phone .ss-num--lm {
  font-size: 12.5px;
}

.is-phone .ss-num--word {
  font-size: 11.5px;
}

.is-phone .ss-num.is-pill {
  padding: 3px 7px;
}

/* the landmark medallions on the rail */
.ss-lm {
  position: absolute;
  width: var(--medal);
  height: var(--medal);
  margin: calc(var(--medal) / -2) 0 0 calc(var(--medal) / -2);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #f4f9fb 60%, #e4eef2 100%);
  box-shadow:
    0 0 0 3px #d9e8ee,
    0 3px 0 3px #c3d8e0,
    0 8px 14px rgba(13, 34, 48, 0.12);
  transition: box-shadow 0.3s ease;
}

.ss-lm .ss-icon {
  width: 74%;
  height: 74%;
  filter: grayscale(1) opacity(0.45);
  transition: filter 0.35s ease;
}

.ss-lm__ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: conic-gradient(from 200deg, #57e9e6, #1cb0f6, #57e9e6, #46d5d3, #57e9e6) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0) border-box;
  mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0) border-box;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ss-lm.is-lit {
  box-shadow:
    0 0 0 3px #57e9e6,
    0 3px 0 3px #1ba7e8,
    0 8px 18px rgba(28, 176, 246, 0.32);
}

.ss-lm.is-lit .ss-lm__ring {
  opacity: 1;
}

.ss-lm.is-lit .ss-icon {
  filter: none;
}

.ss-lm.is-pop {
  animation: ss-pop 0.62s cubic-bezier(0.3, 1.7, 0.45, 1);
}

@keyframes ss-pop {
  0% { transform: scale(0.7); }
  40% { transform: scale(1.38) rotate(-6deg); }
  70% { transform: scale(0.94) rotate(3deg); }
  100% { transform: scale(1); }
}

.is-phone .ss-lm {
  box-shadow:
    0 0 0 2px #d9e8ee,
    0 2px 0 2px #c3d8e0,
    0 5px 10px rgba(13, 34, 48, 0.12);
}

.is-phone .ss-lm.is-lit {
  box-shadow:
    0 0 0 2px #57e9e6,
    0 2px 0 2px #1ba7e8,
    0 5px 12px rgba(28, 176, 246, 0.3);
}

/* ---- set pieces */

.ss-desk,
.ss-podium,
.ss-crownfloat {
  position: absolute;
}

/* the crown at 1600: four layers, each moved on the compositor (no SVG repaints) */
.ss-crownfloat > div {
  position: absolute;
  inset: 0;
}

.ss-crownfloat > div > svg {
  display: block;
  width: 100%;
  height: 100%;
}

.ss-crownfloat__rays {
  transform-origin: 50% 52.5%;
  animation: ss-spin 18s linear infinite;
  animation-play-state: paused;
  opacity: 0.7;
}

.ss-crownfloat__crown {
  transform-origin: 50% 70%;
  animation: ss-hover 2.8s ease-in-out infinite;
  animation-play-state: paused;
}

.ss-crownfloat__sparks {
  animation: ss-sparks 1.8s ease-in-out infinite;
  animation-play-state: paused;
}

.ss-crownfloat.is-on > div {
  animation-play-state: running;
}

.ss-crownfloat {
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.5, 0, 0.8, 0.4), visibility 0s linear 0s;
}

.ss-crownfloat.is-taken {
  opacity: 0;
  visibility: hidden;
  transform: translateY(40px) scale(0.6);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.5, 0, 0.8, 0.4), visibility 0s linear 0.45s;
}

.ss-crownfloat.is-taken > div {
  animation-play-state: paused;
}

@keyframes ss-hover {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-2deg); }
  50% { transform: translate3d(0, -7%, 0) rotate(2deg); }
}

@keyframes ss-spin {
  to { transform: rotate(360deg); }
}

@keyframes ss-sparks {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* ---- Preppy */

.ss-halo {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.4) 42%, rgba(236, 253, 255, 0.12) 72%, rgba(236, 253, 255, 0) 100%);
  will-change: transform;
}

.ss-preppy {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

/* the ledge he stands on: a glossy candy slab out of the rail, white on top, teal in front */
.ss-ledge {
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  border-radius: 3px 999px 999px 3px;
  transform-origin: 0 50%;
  background:
    linear-gradient(180deg, #ffffff 0%, #e6fbff 34%, #7fece9 35%, #3fd0dc 62%, #1cb0f6 100%);
  box-shadow:
    inset 0 -3px 0 rgba(10, 110, 170, 0.35),
    0 3px 0 #1590d6,
    0 9px 14px rgba(13, 34, 48, 0.16);
  opacity: 0;
  will-change: transform;
}

.ss-ledge::after {
  content: "";
  position: absolute;
  left: 18%;
  width: 34%;
  top: 46%;
  height: 16%;
  min-height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}

.pp {
  position: relative;
}

.pp__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* ---- particles */

.ss-fx {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 0;
}

.ss-p,
.ss-ring,
.ss-flash,
.ss-dot {
  position: absolute;
  will-change: transform, opacity;
}

.ss-p--star svg {
  filter: drop-shadow(0 2px 0 rgba(200, 120, 0, 0.35));
}

.ss-ring {
  border-radius: 50%;
  border: 4px solid #57e9e6;
  box-sizing: border-box;
}

.ss-flash {
  border-radius: 50%;
}

.ss-dot {
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

/* ---- the fact callout beside Preppy */

.ss-callout {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  box-sizing: border-box;
  padding: 12px 15px 13px 12px;
  border-radius: 20px;
  background: #ffffff;
  border: 2px solid #dff6fa;
  box-shadow:
    0 4px 0 #c9ecf3,
    0 16px 34px rgba(19, 80, 115, 0.18);
  opacity: 0;
  visibility: hidden;
  transform-origin: 0 50%;
  will-change: transform;
}

.ss-callout.is-on {
  opacity: 1;
  visibility: visible;
}

.ss-callout[data-side="above"] {
  transform-origin: 50% 100%;
}

.ss-callout__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(160deg, #e9fdff, #cefbff);
  box-shadow: inset 0 -2px 0 rgba(28, 176, 246, 0.18);
}

.ss-callout__body {
  min-width: 0;
  padding-top: 1px;
}

.ss-callout__label {
  font: 800 16px/1.15 "DM Sans", "Inter";
  letter-spacing: -0.01em;
  color: var(--deep);
}

.ss-callout__fact {
  margin-top: 4px;
  font: 500 13.5px/1.38 "Inter", "DM Sans";
  color: #2c3c46;
  overflow-wrap: break-word;
}

.ss-callout__tail {
  position: absolute;
  left: -9px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-left: 2px solid #dff6fa;
  border-bottom: 2px solid #dff6fa;
  border-bottom-left-radius: 4px;
  transform: rotate(45deg);
}

.ss-callout[data-side="above"] .ss-callout__tail {
  top: auto;
  bottom: -9px;
  transform: rotate(-45deg);
}

.is-phone .ss-callout {
  gap: 9px;
  padding: 10px 12px 11px 10px;
  border-radius: 17px;
}

.is-phone .ss-callout__icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

.is-phone .ss-callout__label {
  font-size: 14.5px;
}

.is-phone .ss-callout__fact {
  font-size: 12.5px;
}

.ss-callout__icon[hidden],
.ss-callout__label[hidden] {
  display: none !important;
}

.ss-callout__label[hidden] + .ss-callout__fact {
  margin-top: 0;
}

/* a short strip (a phone's, above the score report): smaller, then the label runs into the fact */

.ss-callout.is-compact {
  gap: 8px;
  padding: 8px 11px 9px 9px;
  border-radius: 15px;
}

.ss-callout.is-compact .ss-callout__icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.ss-callout.is-compact .ss-callout__icon svg {
  width: 26px;
  height: 26px;
}

.ss-callout.is-compact .ss-callout__label {
  font-size: 13.5px;
}

.ss-callout.is-compact .ss-callout__fact {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.3;
}

.ss-callout.is-tight {
  padding: 6px 10px 7px 10px;
  border-radius: 13px;
}

.ss-callout.is-tight .ss-callout__icon {
  display: none;
}

.ss-callout.is-tight .ss-callout__label,
.ss-callout.is-tight .ss-callout__fact {
  display: inline;
  font-size: 11.5px;
  line-height: 1.28;
}

.ss-callout.is-tight .ss-callout__label::after {
  content: " ";
}

.ss-callout.is-tight .ss-callout__body {
  padding-top: 0;
  font: 500 11.5px/1.28 "Inter", "DM Sans";
}

/* ---- the overview (scene.setView): the whole world at a glance, on its own layer over the follow
   camera's, with its Preppy on a layer above both so he stays solid through a swoop */

.ss-ov,
.ss-ovp {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  visibility: hidden;
}

.ss[data-view="overview"] > .ss-ov,
.ss[data-view="overview"] > .ss-ovp,
.ss[data-view="swoop"] > .ss-ov,
.ss[data-view="swoop"] > .ss-ovp {
  visibility: visible;
}

.ss[data-view="swoop"] > .ss-ov,
.ss[data-view="swoop"] > .ss-ovp {
  will-change: transform, opacity;
}

.ss[data-view="overview"] > .ss-sky,
.ss[data-view="overview"] > .ss-crowd,
.ss[data-view="overview"] > .ss-world,
.ss[data-view="swoop"] > .ss-world .ss-preppy {
  visibility: hidden;
}

/* what isn't showing doesn't animate (only the pieces that do, so a switch restyles little) */
.ss[data-view="follow"] > .ss-ov .ss-cloud,
.ss[data-view="follow"] > .ss-ov .ss-twinkle,
.ss[data-view="follow"] > .ss-ov .ss-crownfloat > div,
.ss[data-view="overview"] > .ss-sky .ss-cloud,
.ss[data-view="overview"] > .ss-sky .ss-twinkle,
.ss[data-view="overview"] > .ss-world .ss-crownfloat > div {
  animation-play-state: paused !important;
}

.ss-ov__sky,
.ss-ov__crowd {
  position: absolute;
  left: 0;
  top: 0;
}

.ss-ov__world {
  position: absolute;
  inset: 0;
}

.ss-ovpreppy {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

.ss-ov .ss-rail {
  box-shadow:
    inset 0 0 0 1.5px #cfe5eb,
    0 2px 0 #bcd7e0,
    0 5px 10px rgba(13, 34, 48, 0.08);
}

.ss-ov .ss-rail__fill {
  left: 1.5px;
  right: 1.5px;
}

.ss-ov .ss-rail__fill::after {
  top: 4px;
  bottom: 6px;
}

.ss-ov .ss-tick {
  height: 2px;
  margin-top: -1px;
  background: #a9c2cc;
}

.ss-ovnum {
  position: absolute;
  transform: translateY(-50%);
  font: 700 13px/1 "DM Sans", "Inter";
  letter-spacing: -0.01em;
  color: #466271;
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.9), 0 0 6px rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ss-ov .ss-lm {
  box-shadow:
    0 0 0 2px #d9e8ee,
    0 2px 0 2px #c3d8e0,
    0 4px 8px rgba(13, 34, 48, 0.12);
}

.ss-ov .ss-lm.is-lit {
  box-shadow:
    0 0 0 2px #57e9e6,
    0 2px 0 2px #1ba7e8,
    0 4px 10px rgba(28, 176, 246, 0.3);
}

.ss-ov .ss-lm__ring {
  inset: -2px;
  border-width: 2px;
}

/* ---- paused and reduced motion */

.ss.is-paused *,
.ss.is-paused *::before,
.ss.is-paused *::after {
  animation-play-state: paused !important;
}

.ss.is-reduced *,
.ss.is-reduced *::before,
.ss.is-reduced *::after {
  animation: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .ss *,
  .ss *::before,
  .ss *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
