:root {
  color-scheme: light;
  --ink: #17233c;
  --gold: #bd8c3a;
  --background: #edf0f5;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--background);
  font-family: Georgia, "Times New Roman", serif;
}

button { font: inherit; }

.experience {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  isolation: isolate;
  overflow: hidden;
  padding: 2rem 1.25rem;
  background:
    radial-gradient(circle at 10% 5%, rgba(255, 255, 255, .85), transparent 32rem),
    linear-gradient(135deg, #f4f1ed, #dce3ed);
}

.glow {
  position: absolute;
  z-index: -1;
  width: 30rem;
  height: 30rem;
  border-radius: 50%;
  opacity: .28;
  filter: blur(10px);
}
.glow--one { top: -15rem; left: -11rem; background: #b9c8e0; }
.glow--two { right: -12rem; bottom: -16rem; background: #decda8; }

.letter-stage {
  display: grid;
  justify-items: center;
  transition: opacity .6s ease, transform .6s cubic-bezier(.2, .85, .25, 1);
}
.letter-stage { max-width: 43rem; text-align: center; }

h1 {
  position: relative;
  isolation: isolate;
  margin: 0 0 1.25rem;
  color: #1d4e95;
  font-size: clamp(1.85rem, 6vw, 3rem);
  font-weight: 400;
  line-height: 1.1;
  text-shadow: 0 0 10px rgba(108, 181, 232, .16);
}
.title-sparkle {
  position: absolute;
  z-index: 1;
  width: .42rem;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  content: "";
  opacity: 0;
  background: #fff1b0;
  box-shadow: 0 0 .9rem .23rem rgba(243, 197, 77, 1);
  animation: title-sparkle 9s ease-in-out infinite;
}
.title-sparkle:nth-of-type(1) { top: 12%; left: 8%; animation-delay: 0s; }
.title-sparkle:nth-of-type(2) { top: 67%; left: 16%; animation-delay: 3.4s; }
.title-sparkle:nth-of-type(3) { top: 24%; left: 25%; animation-delay: 1.1s; }
.title-sparkle:nth-of-type(4) { top: 78%; left: 34%; animation-delay: 5.8s; }
.title-sparkle:nth-of-type(5) { top: 10%; left: 43%; animation-delay: 2.2s; }
.title-sparkle:nth-of-type(6) { top: 56%; left: 51%; animation-delay: 6.4s; }
.title-sparkle:nth-of-type(7) { top: 31%; left: 59%; animation-delay: .45s; }
.title-sparkle:nth-of-type(8) { top: 80%; left: 65%; animation-delay: 4.7s; }
.title-sparkle:nth-of-type(9) { top: 13%; left: 72%; animation-delay: 2.9s; }
.title-sparkle:nth-of-type(10) { top: 60%; left: 80%; animation-delay: 1.8s; }
.title-sparkle:nth-of-type(11) { top: 34%; left: 88%; animation-delay: 5.1s; }
.title-sparkle:nth-of-type(12) { top: 82%; left: 92%; animation-delay: .75s; }
.title-sparkle:nth-of-type(13) { top: 45%; left: 4%; animation-delay: 4.2s; }
.title-sparkle:nth-of-type(14) { top: 4%; left: 58%; animation-delay: 6.7s; }
.title-sparkle:nth-of-type(15) { top: 89%; left: 47%; animation-delay: 3.7s; }
.title-sparkle:nth-of-type(16) { top: 46%; left: 96%; animation-delay: 1.45s; }
.title-sparkle:nth-of-type(17) { top: 38%; left: 12%; animation-delay: 5.45s; }
.title-sparkle:nth-of-type(18) { top: 91%; left: 24%; animation-delay: 2.55s; }
.title-sparkle:nth-of-type(19) { top: 6%; left: 36%; animation-delay: 4.95s; }
.title-sparkle:nth-of-type(20) { top: 70%; left: 46%; animation-delay: .2s; }
.title-sparkle:nth-of-type(21) { top: 43%; left: 68%; animation-delay: 3.05s; }
.title-sparkle:nth-of-type(22) { top: 92%; left: 76%; animation-delay: 6.1s; }
.title-sparkle:nth-of-type(23) { top: 8%; left: 86%; animation-delay: 2.05s; }
.title-sparkle:nth-of-type(24) { top: 73%; left: 96%; animation-delay: 4.45s; }

.letter {
  position: relative;
  width: min(588px, 88vw);
  aspect-ratio: 588 / 536.03;
  padding: 0;
  border: 0;
  cursor: pointer;
  overflow: visible;
  isolation: isolate;
  background: #102642;
  perspective: 1200px;
  transform-style: preserve-3d;
}
.letter:focus-visible, .restart:focus-visible { outline: 3px solid #9a762d; outline-offset: 7px; }

.letter::before {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 30%;
  aspect-ratio: 1;
  pointer-events: none;
  content: "";
  opacity: 0;
  transform: translate(-50%, -50%) scale(.15);
  background: radial-gradient(circle, rgba(255, 255, 255, .88) 0 10%, rgba(255, 255, 232, .78) 18%, rgba(164, 241, 255, .58) 34%, rgba(83, 183, 245, .2) 57%, transparent 74%);
  filter: blur(7px);
}
.letter::after {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  content: "";
  opacity: 0;
  transform: translate(-50%, -50%) scale(.15);
  background: radial-gradient(circle, rgba(255, 255, 255, .78) 0 5%, rgba(245, 255, 251, .74) 12%, rgba(178, 244, 255, .52) 28%, rgba(87, 189, 249, .16) 55%, transparent 74%);
  mix-blend-mode: screen;
}

.letter__half {
  position: absolute;
  z-index: 1;
  top: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(.25, .8, .2, 1), opacity .35s ease .55s;
}
.letter__half img {
  position: absolute;
  top: 0;
  display: block;
  width: 200%;
  height: 100%;
  max-width: none;
  object-fit: fill;
}
.letter__half--left { left: 0; transform-origin: left center; }
.letter__half--left img { left: 0; }
.letter__half--right { right: 0; transform-origin: right center; }
.letter__half--right img { right: 0; }

.opening-star {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.opening-star::before {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 25rem;
  aspect-ratio: 1;
  border-radius: 50%;
  content: "";
  opacity: 0;
  transform: translate(-50%, -50%) scale(.1);
  background: radial-gradient(circle, rgba(255, 255, 255, .88) 0 12%, rgba(229, 253, 255, .75) 26%, rgba(167, 234, 255, .55) 50%, rgba(81, 179, 234, .38) 72%, rgba(58, 145, 207, .14) 88%, transparent 100%);
  filter: blur(8px);
}
.opening-star i {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 54rem;
  height: 1.35rem;
  border-radius: 0;
  opacity: 0;
  clip-path: polygon(0 50%, 50% 0, 100% 50%, 50% 100%);
  background: linear-gradient(90deg, rgba(86, 182, 230, .03) 0%, rgba(104, 203, 245, .32) 16%, rgba(165, 233, 255, .58) 35%, rgba(244, 255, 255, .72) 47%, rgba(255, 255, 255, .78) 50%, rgba(244, 255, 255, .72) 53%, rgba(165, 233, 255, .58) 65%, rgba(104, 203, 245, .32) 84%, rgba(86, 182, 230, .03) 100%);
  box-shadow: 0 0 14px 3px rgba(160, 236, 255, .55);
  filter: blur(1px);
  mix-blend-mode: screen;
  transform: translate(-50%, -50%) rotate(var(--rotation)) scaleX(.05);
}


.experience.is-opening .letter__half--left { opacity: .15; transform: rotateY(-62deg); }
.experience.is-opening .letter__half--right { opacity: .15; transform: rotateY(62deg); }
.experience.is-opening .letter::before { animation: star-core .9s ease-out both; }
.experience.is-opening .letter::after { animation: opening-light .95s ease-out both; }
.experience.is-opening .opening-star { animation: opening-spin .95s ease-out both; }
.experience.is-opening .opening-star::before { animation: star-fill .9s ease-out both; }
.experience.is-opening .opening-star i { animation: star-ray .9s ease-out both; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes breathe { 50% { opacity: .55; transform: translateY(3px); } }
@keyframes title-sparkle {
  0%, 3%, 100% { opacity: 0; transform: scale(.35); }
  5%, 7% { opacity: 1; transform: scale(1); }
  9% { opacity: 0; transform: scale(.5); }
}
@keyframes opening-light {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.15); }
  22% { opacity: .68; transform: translate(-50%, -50%) scale(1.15); }
  62% { opacity: .45; transform: translate(-50%, -50%) scale(1.65); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.5); }
}
@keyframes opening-spin {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(250deg); }
  45% { transform: rotate(320deg); }
  100% { transform: rotate(360deg); }
}
@keyframes star-core {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.1); }
  18% { opacity: .72; transform: translate(-50%, -50%) scale(1.2); }
  58% { opacity: .6; transform: translate(-50%, -50%) scale(1.9); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(3.4); }
}
@keyframes star-ray {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--rotation)) scaleX(.03); }
  18% { opacity: .7; transform: translate(-50%, -50%) rotate(var(--rotation)) scaleX(1); }
  60% { opacity: .45; transform: translate(-50%, -50%) rotate(var(--rotation)) scaleX(.88); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--rotation)) scaleX(.55); }
}
@keyframes star-fill {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.1); }
  18% { opacity: .72; transform: translate(-50%, -50%) scale(1); }
  60% { opacity: .48; transform: translate(-50%, -50%) scale(1.25); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.7); }
}

@media (max-height: 680px) and (min-width: 600px) {
  .experience { padding-block: 1rem; }
  h1 { margin-bottom: .9rem; }
}
@media (max-width: 599px) {
  .experience { align-items: start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
