@font-face {
  font-family: Fredoka;
  src: url("public/fonts/fredoka-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #50205e;
  background: #f8d8f4;
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 80% 18%, #fff0d9, transparent 56%),
    radial-gradient(ellipse at 17% 86%, #e0b7f7, transparent 64%),
    #f8d8f4;
}

button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.experience {
  --left: clamp(2.75rem, 6.7vw, 6rem);
  --orb-x: 71%;
  --orb-y: 48%;
  --orb-size: clamp(15rem, min(36vw, 68svh), 31rem);
  --city-defocus: clamp(.95rem, 2.05vw, 1.65rem);
  --contact-x: calc(var(--orb-x) - var(--orb-size) * .27);
  --contact-y: calc(var(--orb-y) + var(--orb-size) * .45);
  --action-bottom: 19%;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  overflow: clip;
  width: min(91.5vw, 87.5rem);
  height: min(49rem, calc(100svh - 4rem));
  min-height: 34rem;
  margin: 2rem auto;
  border: 1px solid #fff4fc;
  border-radius: 1.875rem;
  background: #f9d9f2;
  box-shadow: 0 1.3rem 4rem #924d9c2f, 0 0 0 1px #cb81bc33;
}

.city-field, .sky, .city-view, .city-art, .city-light, .shade, .flash, .sparks,
.dome-swells, .river-flow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.city-field {
  inset-inline-start: 24%;
  width: 76%;
  overflow: hidden;
  background: #f5b9e6;
  mask-image: linear-gradient(90deg, transparent, #000 24%);
}

.sky {
  background:
    radial-gradient(ellipse at 46% 35%, #fff2d4 0%, #fec0e3 31%, transparent 63%),
    radial-gradient(ellipse at 65% 97%, #ff899d, transparent 52%),
    linear-gradient(145deg, #eed9ff, #f5a9dc 62%, #f5c2e2);
}

.city-view {
  --city-image: url("public/candy-city-day.webp");
  --close-view: 1.52;
  --art-position: center 54%;
  --dome-left: 32% 29%;
  --dome-right: 79% 27%;
  --river-x: 52%;
  --river-y: 82%;
  transform-origin: 54% 45%;
  transform: scale(1);
}

.awakened .city-view { transition: transform 980ms cubic-bezier(.16, .73, .23, 1); }

.city-art {
  display: block;
  color: transparent;
  object-fit: cover;
  object-position: var(--art-position);
  filter: blur(0) brightness(1) saturate(1);
}

.awakened[data-scene="bloom"] .city-art { transition: filter 710ms ease-out; }

.city-art:not([src]), .city-art[data-failed] { visibility: hidden; }

.experience:is([data-scene="idle"], [data-scene="energy"]) .city-view {
  transform: scale(var(--close-view));
}

.experience[data-scene="idle"] .city-art { filter: blur(var(--city-defocus)) brightness(1) saturate(.86); }
.experience[data-scene="energy"] .city-art { filter: blur(var(--city-defocus)) brightness(1.02) saturate(1.04); }

.dome-swells {
  visibility: hidden;
}

.awakened .city-picture:has(.city-art:not([data-failed])) ~ .dome-swells { visibility: visible; }

.awakened .dome-swells::before, .awakened .dome-swells::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--city-image) var(--art-position) / cover;
  mask-image: radial-gradient(ellipse 14% 14% at var(--dome), #000 28%, transparent 86%);
  transform-origin: var(--dome);
  animation: jelly-swell 1.25s ease-in-out both;
}

.dome-swells::before { --dome: var(--dome-left); }
.dome-swells::after { --dome: var(--dome-right); animation-delay: 130ms; }

.river-flow {
  opacity: 0;
  mix-blend-mode: screen;
  background: radial-gradient(ellipse 19% 25% at var(--river-x) var(--river-y), #fff5bdc9, #ffad8f62 48%, transparent 96%);
}

.awakened .river-flow { animation: syrup-flow 1.08s 115ms ease-out both; }

.city-light {
  background:
    radial-gradient(ellipse at 54% 68%, #ffbd717a, transparent 34%),
    radial-gradient(ellipse at 76% 39%, #ff85b349, transparent 43%);
  mix-blend-mode: screen;
  opacity: 0;
}

.awakened .city-light {
  animation: light-city 1.1s 75ms ease-out both;
}

.shade {
  background:
    linear-gradient(90deg, #f9d9f2 0%, #f9d9f2f5 20%, #f9d9f2bf 36%, #f9d9f217 63%, transparent 78%),
    linear-gradient(0deg, #fbd5e98f, transparent 26%, transparent 89%, #fff1fa4a);
}

.orb-reflection {
  position: absolute;
  left: var(--contact-x);
  top: var(--contact-y);
  width: calc(var(--orb-size) * 1.03);
  height: calc(var(--orb-size) * .25);
  translate: -50% -50%;
  rotate: -10deg;
  background: radial-gradient(ellipse, #ad276258 0%, #ca477c39 42%, transparent 70%);
  mix-blend-mode: multiply;
  opacity: 0;
  pointer-events: none;
  transition: opacity 420ms ease;
}

.experience:is([data-scene="idle"], [data-scene="energy"]) .orb-reflection { opacity: 1; }

.flash {
  z-index: 2;
  background:
    radial-gradient(circle at var(--orb-x) var(--orb-y), #fff5cb 0%, #ffcaa3a8 11%, #ff8fb343 28%, transparent 44%),
    radial-gradient(ellipse 28% 21% at var(--contact-x) var(--contact-y), #ffe6ab9c, #ffc3954f 50%, transparent);
  opacity: 0;
  mix-blend-mode: screen;
}

.awakened .flash { animation: core-flash 660ms ease-out both; }
.sparks { z-index: 4; }

.masthead {
  position: sticky;
  z-index: 6;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: 1.55rem clamp(1.5rem, 3.8vw, 3.5rem) 0 var(--left);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: .42rem;
  flex: 0 0 auto;
  color: #552063;
}

.brand-mark {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px #96245f42);
}

.brand-wordmark {
  font: 700 1.25rem/.89 Fredoka, system-ui, sans-serif;
  letter-spacing: -.025em;
  white-space: nowrap;
  text-shadow: 0 1px 0 #fff6fc, 0 3px 6px #a4318626;
}

.brand-wordmark strong {
  display: block;
  margin-top: .12em;
  font-size: 1.29em;
  color: #ae276b;
}

.copy {
  position: absolute;
  z-index: 5;
  left: var(--left);
  top: 45%;
  transform: translateY(-50%);
}

.intro, .energy, .finale, .activate { display: none; }
.experience[data-scene="idle"] .intro,
.experience:is([data-scene="energy"], [data-scene="bloom"]) .energy,
.experience[data-scene="city"] .finale { display: block; }

.title {
  margin: 0;
  color: #542160;
  font: 700 clamp(3.65rem, 7.1vw, 7.2rem)/.88 Fredoka, "Arial Rounded MT Bold", system-ui, sans-serif;
  letter-spacing: -.032em;
  text-shadow: 0 .04em 0 #fff8fe, 0 .09em .23em #b252af39;
}

.title span, .title em { display: block; }

.title em {
  padding: 0 .08em .07em 0;
  font-style: normal;
  color: #b72473;
  background: linear-gradient(158deg, #b63f3d 12%, #c72c71 50%, #9e268c 93%);
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 .03em 0 #fff6fc) drop-shadow(0 .08em .19em #da56a33c);
}

.energy .title {
  font-size: clamp(3.35rem, 6.2vw, 6.25rem);
  animation: copy-in 260ms ease-out both;
}

.activate {
  position: absolute;
  z-index: 3;
  inset: 0;
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
}

.experience:is([data-scene="idle"], [data-scene="energy"], [data-scene="bloom"]) .activate {
  display: block;
}

.activate:focus { outline: 0; }

.orb {
  position: absolute;
  top: var(--orb-y);
  left: var(--orb-x);
  width: var(--orb-size);
  height: var(--orb-size);
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.experience[data-scene="idle"] .orb, .experience[data-scene="idle"] .activate-label {
  pointer-events: auto;
  cursor: pointer;
}

.tap-guide {
  --hand-size: clamp(3.35rem, 8vw, 5.15rem);
  display: none;
  position: absolute;
  top: 73%;
  left: 76%;
  pointer-events: none;
}

.experience[data-scene="idle"] .tap-guide { display: block; }

.tap-guide::before {
  content: "";
  position: absolute;
  width: 2.05rem;
  aspect-ratio: 1;
  border: 2px solid #fff6dd;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #8a2d6b8f, 0 0 .65rem #f854a68f;
  translate: -50% -50%;
  animation: tap-ripple 1.8s ease-out infinite;
}

.tap-hand {
  display: block;
  position: absolute;
  width: var(--hand-size);
  height: auto;
  left: calc(var(--hand-size) * -.40);
  top: calc(var(--hand-size) * -.05);
  rotate: -24deg;
  transform-origin: 40% 5%;
  filter: drop-shadow(0 .24rem .25rem #6f184d59);
  animation: tap-hand 1.8s ease-in-out infinite;
}

.orb-halo, .orb-glass, .orb-art, .orb-syrup, .syrup-glint, .cracks {
  position: absolute;
  border-radius: 50%;
}

.orb-halo {
  inset: -19%;
  background: radial-gradient(circle, #fff6d8a8, #ff8fb34d 45%, transparent 67%);
  animation: breathe 3.8s ease-in-out infinite alternate;
}

.orb-glass {
  inset: 7%;
  background:
    radial-gradient(ellipse at 36% 28%, #fff8ecde 0%, transparent 15%),
    radial-gradient(ellipse at 58% 55%, #ffe6a2 0%, #ffac729a 25%, transparent 44%),
    conic-gradient(from 38deg at 48% 55%, #be67cc, #f750a1, #f9a6d2, #a454bf, #ff8b4e, #faaad6);
  box-shadow:
    inset 0 0 1.3rem #ffdfcc, inset 0 0 4rem #f64391,
    0 0 3rem #ff67916b, 0 0 .45rem #ffffeaba;
  transition: filter 240ms ease, scale 240ms ease;
}

.orb.with-art .orb-glass {
  background: transparent;
  box-shadow: none;
}

.orb-art, .orb-syrup {
  inset: -8%;
  width: 116%;
  height: 116%;
  object-fit: contain;
  filter: drop-shadow(0 .48rem .92rem #a22f645f) drop-shadow(0 0 .65rem #ff828d63);
}

.orb-art { visibility: hidden; }
.orb.with-art .orb-art { visibility: visible; }
.orb.with-art:has(.orb-syrup:not([hidden])) .orb-art { visibility: hidden; }

.syrup-glint {
  inset: 4%;
  background: radial-gradient(ellipse 62% 34% at 38% 40%, #ffd48061, #fd81b224 47%, transparent 74%);
  mix-blend-mode: screen;
  animation: syrup-sheen 7.8s ease-in-out infinite alternate;
}

.cracks {
  inset: 2%;
  clip-path: polygon(6% 34%, 34% 43%, 44% 39%, 53% 54%, 62% 43%, 60% 28%, 78% 12%, 62% 29%, 64% 44%, 55% 57%, 64% 68%, 70% 65%, 96% 72%, 70% 67%, 63% 70%, 54% 59%, 42% 79%, 47% 88%, 38% 98%, 44% 87%, 40% 79%, 51% 57%, 43% 42%, 34% 46%);
  background: linear-gradient(126deg, #ffe2f5, #fff4d4 48%, #fff7f9 56%, #ffb7a4);
  opacity: 0;
}

.experience[data-scene="idle"] .orb:hover .orb-glass { filter: brightness(1.12); scale: 1.025; }
.experience[data-scene="energy"] .orb-glass { animation: crack-core 480ms ease-in-out both; }
.experience[data-scene="energy"] .cracks { animation: show-cracks 480ms ease-out both; }
.experience[data-scene="bloom"] .orb { animation: dissolve 480ms ease-out both; }
.experience.shattering[data-scene="bloom"] .orb { opacity: 0; animation: none; }

.action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  min-height: 3.5rem;
  padding: .85rem 1.45rem;
  border: 1px solid #ffb8d7;
  border-radius: 1.1rem;
  background: linear-gradient(180deg, #bd2866 0%, #a71c69 55%, #961b6e 100%);
  color: #fff9fc;
  box-shadow: 0 .32rem 0 #6e1d76, 0 .62rem 1.45rem #91377849, inset 0 1px 0 1px #f896c762;
  text-decoration: none;
  white-space: nowrap;
  font: 800 .84rem/1.2 system-ui, sans-serif;
  letter-spacing: .09em;
  text-transform: uppercase;
  transition: translate 170ms ease-out, filter 170ms ease-out, box-shadow 170ms ease-out;
}

.masthead .lobby {
  position: relative;
  overflow: hidden;
  min-height: 3rem;
  padding: .66rem 1rem;
  border-color: #fff3fa;
  border-radius: .92rem;
  background: linear-gradient(180deg, #822c9b, #67267d 67%, #5d216e);
  box-shadow: 0 .25rem 0 #4a185c, 0 .45rem 1rem #70286035, inset 0 1px 0 #d78eec7d;
  pointer-events: auto;
}

.lobby::after {
  content: "";
  position: absolute;
  inset-block: -15%;
  left: -62%;
  width: 46%;
  transform: skewX(-24deg);
  background: linear-gradient(90deg, transparent, #fff8dc59 48%, transparent);
  pointer-events: none;
  animation: lobby-shine 3.6s ease-out infinite;
}

.lobby .arrow { width: .84rem; }

.activate-label {
  position: absolute;
  bottom: var(--action-bottom);
  left: var(--left);
}

.experience:not([data-scene="idle"]) .activate-label { visibility: hidden; }
.activate:hover .activate-label, a.action:hover { filter: brightness(1.08); translate: 0 -2px; }
.activate:active .activate-label, a.action:active { translate: 0 3px; }

.activate:focus-visible :is(.activate-label, .orb), a.action:focus-visible {
  outline: 2px solid #65226f;
  outline-offset: .38rem;
}

.action-spark, .preview-spark {
  display: inline-block;
  width: .9rem;
  height: .9rem;
  flex-shrink: 0;
  background: currentColor;
  clip-path: polygon(50% 0, 62% 37%, 100% 50%, 62% 63%, 50% 100%, 38% 63%, 0 50%, 38% 37%);
}

.finale {
  top: 50%;
  animation: copy-in 420ms ease-out both;
}

.finale .title { font-size: clamp(4.4rem, 8.2vw, 8.75rem); }

.intro-guide, .final-guide {
  max-width: 33ch;
  margin: 1rem 0 0;
  color: #50205e;
  font-size: clamp(.96rem, 1.3vw, 1.13rem);
  font-weight: 650;
  line-height: 1.4;
  text-wrap: balance;
}

.final-guide strong {
  display: block;
  margin-bottom: .16em;
}

.preview-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 .95rem;
  color: #64286a;
  font: 750 .71rem/1.3 system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: .18em;
}

.preview-spark { width: .72rem; height: .72rem; color: #bc347a; }
.entry { margin-top: 1.05rem; min-width: 12rem; justify-content: space-between; }

.arrow {
  display: inline-block;
  width: 1rem;
  height: .64rem;
  background: currentColor;
  clip-path: polygon(0 40%, 74% 40%, 52% 6%, 67% 6%, 100% 50%, 67% 94%, 52% 94%, 74% 60%, 0 60%);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes tap-hand {
  0%, 100% { translate: .62rem .66rem; }
  33%, 44% { translate: 0 0; scale: .94; }
  69% { translate: .62rem .66rem; }
}

@keyframes tap-ripple {
  0%, 32% { opacity: 0; scale: .52; }
  40% { opacity: 1; }
  73%, 100% { opacity: 0; scale: 1.48; }
}

@keyframes lobby-shine {
  0%, 12% { translate: 0; }
  40%, 100% { translate: 410%; }
}

@keyframes syrup-sheen {
  from { translate: -2% 1%; opacity: .38; }
  to { translate: 4% -3%; opacity: .74; }
}
@keyframes breathe { from { scale: .93; opacity: .64; } to { scale: 1.05; opacity: 1; } }
@keyframes copy-in { from { opacity: 0; translate: 0 .6rem; } to { opacity: 1; translate: 0; } }
@keyframes light-city { 0% { opacity: 0; } 30% { opacity: .86; } 100% { opacity: 0; } }
@keyframes core-flash { 0% { opacity: .66; } 33% { opacity: .38; } 100% { opacity: 0; } }
@keyframes show-cracks { 0% { opacity: 0; scale: .8; } 35%, 100% { opacity: 1; scale: 1; } }

@keyframes jelly-swell {
  0%, 100% { opacity: 0; scale: 1; }
  40% { opacity: .85; scale: 1.032 1.058; }
  64% { opacity: .7; scale: 1.015 .992; }
}

@keyframes syrup-flow {
  0% { opacity: 0; translate: 0 3%; }
  27% { opacity: .94; }
  100% { opacity: 0; translate: 1% -11%; }
}

@keyframes crack-core {
  0% { transform: scale(1); }
  18% { transform: scale(.954, .967); }
  40% { transform: translate(-2px, 1px) scale(1.025); }
  61% { transform: translate(2px, -1px) scale(1.044); }
  100% { transform: scale(1.085); filter: brightness(1.25); }
}

@keyframes dissolve {
  from { scale: 1; opacity: 1; }
  to { scale: 1.24; opacity: 0; }
}

@media (min-width: 761px) and (max-height: 720px) {
  .experience { --action-bottom: 14%; }
  .title { font-size: clamp(3.65rem, min(7.1vw, 14vh), 7.2rem); }
  .masthead { padding-top: 1.15rem; }
}

@media (max-width: 760px) {
  .experience {
    --left: 1.2rem;
    --orb-x: 50%;
    --orb-y: 51%;
    --orb-size: clamp(11.8rem, min(78vw, 45svh), 23rem);
    --action-bottom: max(2.4rem, calc(env(safe-area-inset-bottom) + 1.25rem));
    width: 100%;
    min-height: 30rem;
    height: 100vh;
    height: 100svh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .city-field { inset: 0; width: 100%; mask-image: none; }
  .city-view {
    --close-view: 1.43;
    --art-position: 94% center;
    --dome-left: 37% 36%;
    --dome-right: 67% 28%;
    --river-x: 26%;
    inset-block-start: 4%;
    height: 96%;
    mask-image: linear-gradient(180deg, transparent, #000 15%);
    transform-origin: 53% 50%;
  }

  .shade {
    background:
      linear-gradient(180deg, #f9d8f1ea, #f9d8f121 31%, transparent 66%, #f9d8f15c 84%, #f9d8f1df),
      radial-gradient(ellipse at 50% 43%, transparent 27%, #f5d0ee2b 86%);
  }

  .experience[data-scene="city"] .shade {
    background: linear-gradient(180deg, #f9d8f166, transparent 22%, transparent 58%, #f9d8f1b0 79%, #f9d8f1fc 100%);
  }

  .masthead {
    padding: max(.78rem, calc(env(safe-area-inset-top) + .45rem)) max(.9rem, env(safe-area-inset-right))
      0 max(.8rem, env(safe-area-inset-left));
  }

  .brand-mark { width: 2.65rem; height: 2.65rem; }
  .brand-wordmark { font-size: .99rem; }
  .masthead .lobby { min-height: 2.75rem; padding: .55rem .72rem; font-size: .72rem; gap: .4rem; }

  .copy {
    inset-inline: var(--left);
    top: max(5.2rem, calc(env(safe-area-inset-top) + 4.15rem));
    transform: none;
    text-align: center;
  }

  .title,
  .energy .title { font-size: clamp(2.35rem, 11.05vw, 4.7rem); line-height: .94; }
  .title span:nth-child(2), .title em { display: inline-block; }
  .title em { padding-right: .045em; }

  .activate-label {
    left: 50%;
    transform: translateX(-50%);
  }

  .action { min-height: 3.4rem; padding-inline: 1.3rem; }

  .finale { top: auto; bottom: var(--action-bottom); }
  .finale .title { font-size: clamp(3rem, 12vw, 6.25rem); }
  .finale .title span { display: inline-block; }
  .preview-label { justify-content: center; margin-bottom: .65rem; }
  .intro-guide, .final-guide { margin: .45rem auto 0; }
  .intro-guide { font-size: .88rem; }
  .entry { margin-top: .9rem; }
}

@media (max-width: 760px) and (orientation: portrait) {
  .city-view {
    --city-image: url("public/candy-city-panorama.webp");
    --close-view: 1.68;
    --art-position: center 52%;
    --dome-left: 27% 40%;
    --dome-right: 84% 40%;
    --river-x: 51%;
    --river-y: 74%;
    inset-block-start: 0;
    height: 100%;
    mask-image: none;
    transform-origin: 50% 54%;
  }
}

@media (max-width: 760px) and (max-height: 610px) {
  .experience { --orb-y: 54%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .orb-syrup { display: none; }
  .tap-guide::before, .tap-hand, .lobby::after { animation: none; }
  .experience[data-scene="energy"] :is(.city-light, .cracks), .flash, .sparks { visibility: hidden; }
}
