:root {
  color-scheme: dark;
  --page: #17242b;
  --panel: #202f35;
  --line: #425057;
  --text: #f9efe4;
  --muted: #bac5c6;
  --accent: #ffb879;
  --accent-hover: #ffd0a5;
  --ink: #251a16;
  --body: system-ui, sans-serif;
  --display: "Baskerville", "Georgia", serif;
  --ease: cubic-bezier(.2, .65, .3, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  background: var(--page);
  font: 400 1rem/1.6 var(--body);
}

h1, h2, p, figure, dl, dd { margin: 0; }

button, select {
  color: inherit;
  font: inherit;
}

button { cursor: pointer; }

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.wrap {
  width: min(100% - 96px, 1240px);
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  padding: 12px 16px;
  color: var(--ink);
  background: var(--accent);
  transform: translateY(calc(-100% - 20px));
}

.skip-link:focus { transform: none; }

.site-header {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.brand,
.header-links {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  font: 500 1.4rem/1 var(--display);
  white-space: nowrap;
}

.brand-mark {
  display: inline-block;
  flex: 0 0 auto;
  width: 15px;
  height: 20px;
  background: var(--accent);
  border: 1px solid #603b2d;
  border-radius: 44% 44% 28% 28% / 26% 26% 14% 14%;
  box-shadow: inset 4px 0 #8c4a322e, inset -3px 0 #8c4a3233;
  position: relative;
}

.brand-mark::after {
  position: absolute;
  content: "";
  inset: auto 2px 1px;
  height: 3px;
  border-top: 1px solid #a85e3d;
  border-radius: 50%;
  background: #ffdeaa;
}

.header-links {
  gap: 28px;
  color: var(--muted);
  font-size: .875rem;
}

.header-links a:hover { color: var(--text); }

.language { position: relative; }

.language::after {
  position: absolute;
  content: "";
  width: 6px;
  height: 6px;
  transform: rotate(45deg);
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  inset: calc(50% - 5px) 14px auto auto;
  pointer-events: none;
}

.language select {
  min-height: 44px;
  appearance: none;
  padding: 0 32px 0 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.language select:hover { background: var(--panel); }

.hero {
  display: grid;
  grid-template-columns: minmax(270px, .76fr) minmax(0, 1.6fr);
  align-items: center;
  gap: clamp(32px, 4.2vw, 64px);
  padding-block: 56px 64px;
}

.hero-copy { padding-bottom: 36px; }

h1 {
  font: 400 clamp(5.2rem, 8.5vw, 8rem)/.81 var(--display);
  letter-spacing: -.065em;
}

h1 span { display: block; }

.introduction {
  max-width: 26ch;
  margin-top: 32px;
  color: var(--muted);
  font-size: clamp(1.125rem, 1.55vw, 1.375rem);
  line-height: 1.45;
}

.purchase {
  margin-top: 28px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.purchase p {
  color: var(--muted);
  font-size: .875rem;
}

.buy-button,
.dialog-button {
  min-height: 48px;
  padding: 8px 28px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  background: var(--accent);
  font-weight: 600;
  transition: background-color 160ms var(--ease);
}

.buy-button:hover,
.dialog-button:hover { background: var(--accent-hover); }

.demo { min-width: 0; }

.demo-frame {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.demo-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 8px 0 16px;
  color: var(--muted);
  font-size: .875rem;
}

.motion-toggle {
  display: grid;
  place-items: center;
  margin-inline-start: auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.motion-toggle:hover,
.wallpaper-choice button:hover { color: var(--text); }

.demo-header :focus-visible { outline-offset: -4px; }

.motion-toggle span {
  width: 11px;
  height: 12px;
  border-color: currentColor;
  border-style: solid;
  border-width: 0 2px;
}

.motion-toggle[data-paused="true"] span {
  width: 0;
  height: 0;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent currentColor;
}

.scene {
  --dock-bottom: 16px;
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1.62;
  isolation: isolate;
  min-height: 252px;
  background: #2f485d url("assets/dusk.webp") center 58% / cover no-repeat;
}

.scene[data-wallpaper="dawn"] {
  background-image: url("assets/dawn.webp");
  background-color: #b2bfaa;
}

.sky-lantern,
.lantern-flight {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.sky-lantern {
  left: var(--x);
  bottom: var(--y);
  width: var(--size);
  aspect-ratio: 0.63;
  background: url("assets/sky-lantern.webp") center / contain no-repeat;
  filter: brightness(.94) drop-shadow(0 0 8px #fac77e7a);
  opacity: var(--opacity, 1);
  transform: rotate(var(--angle));
  animation: drift var(--duration, 8s) ease-in-out var(--delay, 0s) infinite alternate;
}

.drifting-one { --x: 22%; --y: 58%; --size: 4.2%; --angle: -9deg; --delay: -3s; }
.drifting-two { --x: 48%; --y: 70%; --size: 3%; --angle: 6deg; --delay: -5s; --opacity: .86; --duration: 10s; }
.drifting-three { --x: 72%; --y: 57%; --size: 4.8%; --angle: 10deg; --delay: -6s; --duration: 11s; }
.drifting-four { --x: 85%; --y: 78%; --size: 2.1%; --angle: -4deg; --opacity: .82; --duration: 9s; }

@keyframes drift {
  from { transform: translate(-4%, 12%) rotate(var(--angle)); }
  to { transform: translate(19%, -18%) rotate(calc(var(--angle) + 8deg)); }
}

.station {
  --maker-height: clamp(100px, 15vw, 176px);
  position: absolute;
  bottom: calc(var(--dock-bottom) + 36px);
  left: var(--position);
  z-index: 3;
  height: var(--maker-height);
  aspect-ratio: 2 / 3;
}

.station-left { --position: 21%; }

.station-right {
  --position: 63%;
  --maker-height: clamp(84px, 12vw, 140px);
}

.maker {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.station-right .maker { transform: scaleX(-1); }

.lantern-button {
  position: absolute;
  display: grid;
  place-items: center;
  top: -17%;
  left: 56%;
  width: max(44px, 50%);
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  touch-action: manipulation;
}

.station-right .lantern-button { left: auto; right: 56%; }

.lantern-button img,
.lantern-flight img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 8px #ffb46dba);
}

.station[data-state="rest"] .lantern-button img { opacity: 0; }
.station[data-state="waiting"] .lantern-button img { opacity: .58; }
.station[data-state="waiting"] .lantern-button:focus-visible img { opacity: 1; }
.scene[data-moving="false"] :is(.sky-lantern, .spark, .lantern-flight) { animation-play-state: paused; }

.dock {
  position: absolute;
  left: 50%;
  bottom: var(--dock-bottom);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  height: 36px;
  border: 1px solid #eee2ce61;
  border-radius: 10px;
  background: #17242b82;
}

.dock i {
  display: block;
  width: 21px;
  height: 21px;
  border: 1px solid #ffeed25c;
  border-radius: 6px;
  background: var(--tile, #8da9ad);
  box-shadow: inset 0 -4px #17242b37;
}

.dock i:nth-child(2) { --tile: #998b98; }
.dock i:nth-child(3) { --tile: #dec199; }
.dock i:nth-child(4) { --tile: #788b94; }
.dock i:nth-child(5) { --tile: #a88072; }

.firework-button {
  display: grid;
  place-items: center;
  position: absolute;
  right: 16px;
  bottom: var(--dock-bottom);
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--text);
  border: 1px solid #eee2ce61;
  border-radius: 8px;
  background: #17242be8;
  z-index: 4;
  touch-action: manipulation;
}

.firework-button:hover { background: #354650; }

.firework-icon {
  position: relative;
  width: 22px;
  height: 22px;
}

.firework-icon::before,
.firework-icon::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(currentColor, currentColor) top center / 1px 7px no-repeat,
    linear-gradient(currentColor, currentColor) bottom center / 1px 7px no-repeat,
    linear-gradient(currentColor, currentColor) center left / 7px 1px no-repeat,
    linear-gradient(currentColor, currentColor) center right / 7px 1px no-repeat;
}

.firework-icon::after { transform: rotate(45deg); }

.spark {
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  color: var(--spark-color);
  background: currentColor;
  box-shadow: 0 0 4px currentColor;
  opacity: 0;
  animation: burst 1000ms var(--ease) var(--delay, 0ms) both;
}

.burst {
  position: absolute;
  z-index: 3;
  pointer-events: none;
}

@keyframes burst {
  0% { opacity: 0; transform: translate(0, 0) scale(.4); }
  20% { opacity: 1; }
  74% { opacity: .7; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.5); }
}

.demo-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: .875rem;
}

.touch-hint { display: none; }

.wallpaper-choice {
  display: flex;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.wallpaper-choice button {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
}

.wallpaper-choice button[aria-pressed="true"] {
  color: var(--text);
  background: #36454a;
}

.about {
  display: grid;
  grid-template-columns: minmax(240px, .76fr) minmax(0, 1.6fr);
  gap: clamp(32px, 4.2vw, 64px);
  padding-block: 40px 48px;
  border-top: 1px solid var(--line);
}

.about h2,
.purchase-dialog h2 {
  font: 400 clamp(2.25rem, 4vw, 3.6rem)/1 var(--display);
  letter-spacing: -.035em;
}

.about p {
  max-width: 29ch;
  margin-top: 12px;
  color: var(--muted);
}

.details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.details dt { margin-bottom: 8px; font-weight: 600; }
.details dd { color: var(--muted); }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  border-top: 1px solid var(--line);
  padding-block: 16px 20px;
  color: var(--muted);
  font-size: .875rem;
}

.purchase-dialog {
  max-width: min(100% - 40px, 460px);
  padding: 28px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.purchase-dialog::backdrop { background: #10191dd9; }
.purchase-dialog h2 { margin-bottom: 16px; }
.purchase-dialog p + p { margin-top: 8px; color: var(--muted); }
.purchase-dialog form { margin-top: 24px; }

@media (hover: none), (pointer: coarse) {
  .mouse-hint { display: none; }
  .touch-hint { display: inline; }
}

@media (max-width: 1100px) {
  .purchase { align-items: start; flex-direction: column; }
  .demo-caption { flex-wrap: wrap; }
  .details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .wrap { width: calc(100% - 48px); }
  .site-header { min-height: 68px; }
  .header-links > a { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-block: 40px; }
  .hero-copy { padding-bottom: 0; }
  h1 { font-size: clamp(3.5rem, 13vw, 6rem); line-height: .9; }
  h1 span { display: inline; }
  .introduction { margin-top: 20px; max-width: 31ch; }
  .purchase { flex-flow: row wrap; align-items: center; margin-top: 20px; }
  .about { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-block: 28px 40px; }
  .details { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .details dt { margin-bottom: 4px; }
  .details dd { max-width: 50ch; }
}

@media (max-width: 420px) {
  .wrap { width: calc(100% - 32px); }
  .scene { --dock-bottom: 12px; }
  .station-left { --position: 14%; }
  .station-right { --position: 65%; }
  .firework-button { right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; }
}

.lantern-flight {
  animation: lift 4600ms ease-in-out forwards;
}

.lantern-flight[data-still] {
  animation: none;
  transform: translate(var(--drift), calc(var(--height) * -.42)) scale(.65);
}

.burst[data-still] .spark {
  animation: none;
  opacity: .95;
  transform: translate(var(--dx), var(--dy));
}

@keyframes lift {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  22% { transform: translate(-6px, -48px) rotate(-6deg) scale(.92); }
  72% { opacity: .88; }
  100% { opacity: 0; transform: translate(var(--drift), calc(-1 * var(--height))) rotate(11deg) scale(.47); }
}

[data-checkout-form]:not([hidden]) { display: grid; gap: 12px; }
[data-checkout-form] label { display: grid; gap: 4px; }
[data-checkout-form] input,
[data-checkout-form] select {
  width: 100%;
  padding: 8px;
  font: inherit;
}
[data-checkout-result] { margin-top: 16px; }
[data-checkout-command] { overflow-wrap: anywhere; }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.footer-links a,
.legal a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-links a:hover,
.legal a:hover { color: var(--accent-hover); }

.legal-page #language {
  padding: 6px 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.legal {
  max-width: 72ch;
  padding-block: 48px 64px;
}

.legal h1 {
  font: 400 clamp(2.25rem, 6vw, 3.25rem)/1.1 var(--display);
}

.legal h2 {
  margin-top: 32px;
  font-size: 1.125rem;
}

.legal p,
.legal ul { margin: 8px 0 0; color: var(--muted); }

.legal ul { padding-left: 20px; }
.legal li + li { margin-top: 8px; }
.legal strong { color: var(--text); }
.legal-date { font-size: .875rem; }

@media (max-width: 760px) {
  .legal { padding-block: 32px 48px; }
}
