: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;
}

.sky {
  pointer-events: none;
}

.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;
  top: 16vh;
  right: 13vw;
  z-index: 2;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  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(45rem, 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(2rem, 4vw, 2.8rem);
  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; }

.km {
  margin: 0;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  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); }

.desk { margin-top: 3.5rem; min-height: 26rem; }

.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);
}

.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 (max-width: 640px) {
  .star { right: 8vw; top: 12vh; }
  .paper { transform: none; padding: 1.4rem 1.1rem 1.1rem; }
}

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