:root {
  color-scheme: dark;
  --void: #08090c;
  --ink: #ebe6dc;
  --muted: #a39b90;
  --faint: #6f6a63;
  --line: rgba(235, 230, 220, 0.22);
  --paper: #f3ecdf;
  --paper-ink: #221e19;
  --star: #f3e2c0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--void);
  color: var(--ink);
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", "Songti TC", "PMingLiU", serif;
  font-size: 1.05rem;
  line-height: 1.65;
}

body {
  overflow-x: hidden;
  padding-bottom: 4rem;
}

#space,
.veil,
.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#space {
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.veil {
  z-index: 1;
  background:
    radial-gradient(ellipse at 72% 46%, transparent 36%, rgba(8, 9, 12, 0.42) 100%),
    linear-gradient(180deg, rgba(8, 9, 12, 0.55), transparent 7.5rem),
    linear-gradient(90deg, rgba(8, 9, 12, 0.62) 0%, rgba(8, 9, 12, 0.34) 28%, rgba(8, 9, 12, 0.08) 46%, transparent 60%);
}

.sky { z-index: 2; }

body > :not(#space):not(.veil):not(.sky) {
  position: relative;
  z-index: 2;
}

.no-gl .sky::before {
  content: "";
  position: fixed;
  width: 1px;
  height: 1px;
  background: transparent;
  box-shadow:
    8vw 22vh 0 0 rgba(235, 230, 220, 0.28),
    18vw 12vh 0 0 rgba(235, 230, 220, 0.18),
    31vw 28vh 0 0 rgba(235, 230, 220, 0.16),
    46vw 8vh 0 0 rgba(235, 230, 220, 0.22),
    58vw 34vh 0 0 rgba(235, 230, 220, 0.12),
    70vw 16vh 0 0 rgba(235, 230, 220, 0.2),
    84vw 42vh 0 0 rgba(235, 230, 220, 0.15),
    24vw 46vh 0 0 rgba(235, 230, 220, 0.1),
    90vw 8vh 0 0 rgba(235, 230, 220, 0.25);
}

.star {
  position: fixed;
  z-index: 2;
  left: 70vw;
  top: 42vh;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: transparent;
}

.no-gl .star {
  background: var(--star);
  box-shadow:
    0 0 10px 3px rgba(243, 226, 192, 0.45),
    0 0 36px 8px rgba(243, 226, 192, 0.16);
  animation: breathe 7s ease-in-out infinite;
}

@keyframes breathe {
  50% { opacity: 0.45; }
}

.column {
  width: min(60rem, calc(100% - 2.5rem));
  margin-left: max(1.25rem, 8vw);
}

.top { padding-top: 1.6rem; }

.mark {
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
}

.title {
  margin-top: 2.2rem;
  margin-bottom: 0.4rem;
  font-size: clamp(2.15rem, 4.6vw, 3.35rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.lede {
  margin-top: 0;
  margin-bottom: 0;
  max-width: 28rem;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--muted);
  letter-spacing: 0.16em;
  font-size: 0.75rem;
}

.distance { margin-top: 3.2rem; }

.rule {
  width: 4.75rem;
  height: 1px;
  margin: 1.05rem 0 0.85rem;
  background: rgba(154, 186, 214, 0.8);
}

.km {
  margin: 0;
  color: #e6b25a;
  text-shadow: 0 0 28px rgba(230, 178, 90, 0.16);
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: clamp(2rem, 4.4vw, 2.9rem);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.unit {
  font-family: "Iowan Old Style", Palatino, "Songti TC", serif;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.meta {
  max-width: 36rem;
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.quiet { color: var(--faint); }

.imagine {
  max-width: 34rem;
  margin: 1.6rem 0 0;
  color: var(--ink);
  line-height: 1.8;
}

.invite {
  margin-top: 1.25rem;
  padding: 0.72rem 1.2rem;
  border: 1px solid rgba(235, 230, 220, 0.45);
  background: transparent;
  color: var(--ink);
  font: inherit;
  letter-spacing: 0.14em;
  cursor: pointer;
}

.invite:hover { border-color: var(--ink); }
.invite:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

.desk {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: 0;
  min-height: 0;
  transition: grid-template-rows 0.72s cubic-bezier(0.16, 0.84, 0.24, 1), margin-top 0.72s cubic-bezier(0.16, 0.84, 0.24, 1);
}

.desk.is-open {
  grid-template-rows: 1fr;
  margin-top: 1.5rem;
}

.desk-fold {
  min-height: 0;
  overflow: hidden;
}

.desk.is-settled .desk-fold { overflow: visible; }

.paper {
  color-scheme: light;
  width: min(34rem, 100%);
  margin: 0;
  padding: 1.8rem 1.6rem 1.4rem;
  background: var(--paper);
  color: var(--paper-ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transform: rotate(-0.35deg);
  transform-origin: top center;
  transition: transform 0.72s cubic-bezier(0.16, 0.84, 0.24, 1), opacity 0.4s ease;
}

.desk:not(.is-open) .paper {
  opacity: 0;
  transform: rotate(-0.35deg) translateY(-0.8rem) scaleY(0.88);
}

.desk.is-open .paper {
  opacity: 1;
  transform: rotate(-0.35deg);
}

.paper.is-flying {
  position: relative;
  z-index: 5;
  animation: fly 2.7s cubic-bezier(0.62, 0.05, 0.78, 0.45) forwards;
}

@keyframes fly {
  0% { transform: translate(0, 0) scale(1) rotate(-0.35deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.03) rotate(8deg); opacity: 0; }
}

body.is-launching .distance,
body.is-launching .title,
body.is-launching .lede,
body.is-launching .top {
  opacity: 0.35;
  transition: opacity 1s ease;
}

.recipient {
  margin: 0 0 1.2rem;
  letter-spacing: 0.12em;
}

label { display: block; margin-top: 1rem; }

label span {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: #6d645b;
}

.paper input,
.paper textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(34, 30, 25, 0.22);
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0.35rem 0;
}

.paper textarea {
  min-height: 9rem;
  margin-top: 0.35rem;
  padding: 0.75rem;
  border-bottom: 0;
  background: rgba(34, 30, 25, 0.04);
  resize: vertical;
}

.paper input:focus,
.paper textarea:focus { outline: 1px solid #221e19; outline-offset: 3px; }

.paper input::placeholder,
.paper textarea::placeholder { color: #a3988c; }

.count {
  margin: 0.35rem 0 0;
  text-align: right;
  color: #8a8176;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.75rem;
}

.hint {
  margin: 1rem 0 0;
  color: #6d645b;
  font-size: 0.92rem;
}

.error {
  margin: 0.8rem 0 0;
  color: #8a3d32;
}

.paper button,
.text-button {
  font: inherit;
  cursor: pointer;
}

.paper button {
  width: 100%;
  margin-top: 1.3rem;
  border: 0;
  background: #221e19;
  color: var(--paper);
  padding: 0.85rem 1rem;
}

.paper button:disabled { opacity: 0.55; cursor: progress; }

.after { padding: 0.5rem 0 2rem; max-width: 28rem; }

.after a,
.quiet-link { color: var(--ink); }

.text-button {
  margin-top: 0.4rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
}

.journey { margin-top: 3rem; }

.journey h2 {
  margin: 0 0 0.4rem;
  font-size: 1.8rem;
  font-weight: 500;
}

.track {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.8rem;
  align-items: center;
  margin: 1.8rem 0;
  color: var(--muted);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

.track-line {
  position: relative;
  height: 1px;
  background: var(--line);
}

.dot {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 10px rgba(235, 230, 220, 0.75);
  transition: left 1s linear;
}

.times {
  display: grid;
  gap: 0.8rem;
  margin: 0;
}

.times div { display: grid; gap: 0.15rem; }

.times dt {
  color: var(--faint);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
}

.times dd { margin: 0; }

blockquote {
  margin: 1.5rem 0 0.4rem;
  padding-left: 1rem;
  border-left: 1px solid var(--line);
  color: var(--muted);
  white-space: pre-wrap;
}

footer {
  margin-top: 4rem;
  color: var(--faint);
  font-size: 0.85rem;
}

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

::selection { background: #f3e2c0; color: #221e19; }

@media (min-width: 980px) {
  .column { width: min(33rem, 42vw); }
}

@media (max-width: 979px) {
  .veil {
    background:
      linear-gradient(180deg, rgba(8, 9, 12, 0.62), rgba(8, 9, 12, 0.08) 4.2rem, rgba(8, 9, 12, 0.02) 32%, rgba(8, 9, 12, 0.78) 48%, rgba(8, 9, 12, 0.94) 64%, #08090c 100%);
  }
  .hero { padding-top: 48vh; }
  .title { margin-top: 0.35rem; }
  .paper { padding: 1.4rem 1.1rem 1.1rem; }
  .desk:not(.is-open) .paper { transform: translateY(-0.6rem) scaleY(0.9); }
  .desk.is-open .paper { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .no-gl .star,
  .paper.is-flying { animation: none; }
  .dot, .desk, .paper { transition: none; }
}
