/* Fraunces (Undercase Type, SIL OFL 1.1 — see fonts/OFL.txt), self-hosted so
   no font request ever leaves this origin. Latin subset only; ~20 KB per face. */
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../fonts/fraunces-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('../fonts/fraunces-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fraunces'; font-style: italic; font-weight: 400; font-display: swap;
  src: url('../fonts/fraunces-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Fraunces'; font-style: italic; font-weight: 700; font-display: swap;
  src: url('../fonts/fraunces-latin-700-italic.woff2') format('woff2'); }

:root {
  --bg: #070b16;
  --bg-2: #0d1326;
  --ink: #e8edf3;
  --ink-2: #c9d1dc;
  --muted: #8b95a5;
  --accent: #8fb3ff;
  --gold: #ffd27a;
  --line: rgba(143, 179, 255, 0.28);
  --line-soft: rgba(143, 179, 255, 0.16);
  --card: rgba(13, 19, 38, 0.82);
  --card-solid: #0e162b;            /* opaque twin of --card, for photo fade + tiles */
  --mono: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --r: 18px;                        /* card radius */
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  min-height: 100vh;
}
#sky {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
.wrap {
  position: relative; z-index: 1;
  max-width: 820px; margin: 0 auto; padding: 48px 20px 80px;
}

/* ── Hero (page) ─────────────────────────────────────────────────────── */
.hero { text-align: center; margin-bottom: 36px; }
.hero__eyebrow, .pass__eyebrow, .blk__k, .tile__k, .field__k, .form__opt {
  font: 600 12px/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
}
.hero h1 {
  font: 700 clamp(40px, 7vw, 64px)/1.05 var(--serif);
  margin: 8px 0 16px; letter-spacing: -0.01em;
}
.hero__epigraph {
  font: italic 400 clamp(16px, 2.4vw, 19px)/1.45 var(--serif); color: var(--ink-2);
  max-width: 560px; margin: -4px auto 22px;
}
.hero__epigraph span { font-style: normal; font: 600 11px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-left: 6px; white-space: nowrap; }
.hero__lede { color: var(--ink-2); max-width: 640px; margin: 0 auto 14px; }
.hero__privacy { color: var(--muted); font-size: 15px; max-width: 640px; margin: 0 auto; }
.hero__privacy strong { color: var(--ink); }

/* ── Form ────────────────────────────────────────────────────────────── */
.form {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; backdrop-filter: blur(6px);
}
.form__row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.form label {
  flex: 1 1 140px; display: flex; flex-direction: column; gap: 6px;
  font: 600 13px/1.3 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.form__opt { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); }
select {
  font: 16px var(--sans); color: var(--ink);
  background: #101a33; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; min-height: 44px;
}
select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn {
  font: 600 15px var(--sans); color: var(--ink);
  background: #172345; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 18px; min-height: 44px; cursor: pointer;
}
.btn:hover { background: #1d2c56; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn--primary { background: var(--accent); color: #0a1226; border-color: transparent; width: 100%; font-size: 17px; }
.btn--primary:hover { background: #a6c3ff; }
.status { min-height: 1.4em; margin: 12px 0 0; color: var(--muted); font-size: 15px; text-align: center; }

/* ── Pass: shell ─────────────────────────────────────────────────────── */
.pass-slot { margin-top: 36px; }
.pass {
  position: relative;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  backdrop-filter: blur(6px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  font-size: 15px; line-height: 1.5;
  /* no padding: every band manages its own gutters so rules can run edge to edge */
}
.pass p { margin: 0 0 8px; }
.pass p:last-child { margin-bottom: 0; }

/* ── Pass: hero photo with overlays ──────────────────────────────────── */
.pass__hero {
  position: relative; overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: calc(var(--r) - 1px) calc(var(--r) - 1px) 0 0;
  background: radial-gradient(120% 90% at 20% 10%, #1a2750, #0a1020 60%);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 14px 16px 16px;
}
.pass__hero--nophoto { aspect-ratio: auto; min-height: 220px; }
.pass__photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center; display: block; z-index: 0;
}
/* legibility scrim: darker top band for masthead, soft fade into card at bottom */
.pass__hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 11, 22, 0.62) 0%, rgba(7, 11, 22, 0) 30%),
    linear-gradient(180deg, rgba(14, 22, 43, 0) 40%, rgba(14, 22, 43, 0.72) 74%, var(--card-solid) 100%);
}
.pass__top, .pass__title { position: relative; z-index: 2; }
.pass__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pass__mast { min-width: 0; }
.pass__headline {
  font: 700 17px/1.2 var(--serif); margin: 2px 0 0; color: var(--ink);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}
.pass__sig {
  flex: 0 0 auto; font: 500 11px/1 var(--mono); color: var(--ink-2);
  border: 1px solid rgba(232, 237, 243, 0.35); border-radius: 6px; padding: 6px 8px;
  background: rgba(7, 11, 22, 0.45); white-space: nowrap; backdrop-filter: blur(4px);
}
.pass__siglabel { color: var(--accent); margin-right: 5px; }
.pass__title { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.pass__destname {
  font: 700 clamp(30px, 8vw, 46px)/1.02 var(--serif); color: var(--gold);
  margin: 2px 0 4px; letter-spacing: -0.01em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.65);
}
.pass__destkind { color: var(--ink-2); font-size: 14px; margin: 0; }
.pass__credit {
  flex: 0 0 auto; font: 400 10px/1.3 var(--mono); color: var(--muted);
  text-align: right; max-width: 40%; opacity: 0.85;
}

/* ── Voyage strip ────────────────────────────────────────────────────── */
.voyage {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 56px; padding: 8px 16px 6px; border-bottom: 1px solid var(--line);
}
.voyage__end { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 44px; }
.voyage__label {
  font: 600 10px/1.2 var(--mono); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap; max-width: 110px; overflow: hidden; text-overflow: ellipsis;
}
.voyage__earth, .voyage__body { width: 14px; height: 14px; border-radius: 50%; }
.voyage__earth {
  background: radial-gradient(circle at 35% 35%, #a9dcff, #2f7ad9 55%, #143a7a);
  box-shadow: 0 0 0 2px rgba(143, 179, 255, 0.22);
}
.voyage__body {
  background: radial-gradient(circle at 35% 35%, #fff2c8, var(--gold) 55%, #b0802a);
  box-shadow: 0 0 14px rgba(255, 210, 122, 0.45);
}
.voyage__path { position: relative; height: 24px; }
.voyage__path::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  border-top: 2px dashed var(--line);
}
.voyage__probe {
  position: absolute; top: 50%; left: 0; width: 24px; height: 14px;
  transform: translate(-50%, -50%); color: var(--ink);
  filter: drop-shadow(0 0 4px rgba(143, 179, 255, 0.6));
  animation: probe-travel 14s cubic-bezier(0.45, 0, 0.25, 1) infinite;
}
@keyframes probe-travel {
  0%   { left: 0;    opacity: 0; }
  6%   { opacity: 1; }
  82%  { left: 100%; opacity: 1; }
  90%, 100% { left: 100%; opacity: 0; }
}

/* ── Ticket fields row ───────────────────────────────────────────────── */
.pass__fields {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line); margin: 0;
}
.field { padding: 10px 14px; border-left: 1px solid var(--line-soft); min-width: 0; }
.field:nth-child(odd) { border-left: 0; }
.field:nth-child(n + 3) { border-top: 1px solid var(--line-soft); }
.field__k { font-size: 10.5px; margin-bottom: 2px; }
.field__v { font: 500 14px/1.35 var(--mono); color: var(--ink); overflow-wrap: anywhere; margin: 0; }
.field__v small { display: block; font: 400 12px/1.4 var(--sans); color: var(--muted); }
.field__moon { display: inline-flex; align-items: center; gap: 7px; }
.field__moon .moon { flex: 0 0 auto; filter: drop-shadow(0 0 4px rgba(232, 237, 243, 0.35)); }

/* ── Body: main + aside ──────────────────────────────────────────────── */
.pass__body {
  display: grid; grid-template-columns: 1fr;
  grid-template-areas: "aside" "main";
}
.pass__main  { grid-area: main;  padding: 16px 16px 18px; min-width: 0; }
.pass__aside { grid-area: aside; padding: 16px 16px 18px; border-bottom: 1px solid var(--line); min-width: 0; }
.blk { margin: 0 0 14px; }
.blk:last-child { margin-bottom: 0; }
.blk__k { display: block; margin-bottom: 4px; }
.pass__grit { font-size: 16.5px; line-height: 1.5; color: var(--ink); }
.pass__broadcast { color: var(--ink-2); font-size: 14px; }
.pass__tx { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.pass__tx blockquote {
  margin: 4px 0 0; font: italic 700 clamp(19px, 3.2vw, 23px)/1.3 var(--serif); color: var(--gold);
}

/* ── Cosmic identity (address label) ─────────────────────────────────── */
.ident { position: relative; margin-bottom: 20px; }
.ident__callsign { font: 700 21px/1.15 var(--serif); margin: 2px 0 6px; color: var(--ink); }
.ident__code {
  display: inline-block; font: 600 11.5px/1 var(--mono); letter-spacing: 0.08em;
  color: var(--accent); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px;
  background: rgba(143, 179, 255, 0.08);
}
.ident__addr {
  list-style: none; margin: 12px 0 0; padding: 2px 0 2px 10px;
  border-left: 2px solid var(--line); font: 12.5px/1.55 var(--mono); color: var(--ink-2);
}
.ident__addr li { position: relative; }
.ident__addr li + li::before { content: "↳"; color: var(--muted); margin-right: 5px; }
.ident__addr li:nth-child(2) { padding-left: 0.4em; }
.ident__addr li:nth-child(3) { padding-left: 0.8em; color: var(--muted); }
.ident__addr li:nth-child(4) { padding-left: 1.2em; color: var(--muted); }
.ident__addr li:nth-child(5) { padding-left: 1.6em; color: var(--muted); opacity: 0.85; }
.ident__addr li:nth-child(6) { padding-left: 2.0em; color: var(--muted); opacity: 0.7; }
.stamp {
  display: inline-block; margin-top: 12px; padding: 5px 9px;
  border: 1.5px dashed rgba(255, 210, 122, 0.6); border-radius: 6px; color: var(--gold);
  font: 600 10.5px/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  transform: rotate(-2.5deg); transform-origin: left center;
  max-width: calc(100% - 12px); margin-bottom: 6px;
}

/* ── Odometer (ticket rows) ──────────────────────────────────────────── */
.odo { list-style: none; margin: 4px 0 0; padding: 0; font: 13px/1.5 var(--mono); }
.odo li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 3px 0; border-bottom: 1px dotted var(--line-soft);
}
.odo li:last-child { border-bottom: 0; }
.odo b { color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; }
.odo span { color: var(--ink-2); }

/* ── Tear line + "More" details ──────────────────────────────────────── */
.pass__tear { position: relative; height: 0; border-top: 2px dashed var(--line); }
.pass__tear::before, .pass__tear::after {
  content: ""; position: absolute; top: -10px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg-2); border: 1px solid var(--line);
}
.pass__tear::before { left: -10px; }
.pass__tear::after  { right: -10px; }

.pass__more { border-radius: 0 0 calc(var(--r) - 1px) calc(var(--r) - 1px); overflow: hidden; }
.pass__summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  font: 600 12px/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent);
}
.pass__summary::-webkit-details-marker { display: none; }
.pass__summary::after {
  content: ""; margin-left: auto; flex: 0 0 auto; width: 8px; height: 8px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform 0.2s ease;
}
.pass__more[open] .pass__summary::after { transform: translateY(2px) rotate(-135deg); }
.pass__summary:hover { background: rgba(143, 179, 255, 0.06); }
.pass__summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.summary__hint {
  font: 400 13px/1.4 var(--sans); letter-spacing: 0; text-transform: none; color: var(--muted);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.more {
  display: grid; grid-template-columns: 1fr; gap: 1px;
  background: var(--line-soft); border-top: 1px solid var(--line);
}
.tile { background: var(--card-solid); padding: 14px 16px; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.tile--wide { grid-column: 1 / -1; }
.tile__k { display: block; margin-bottom: 4px; }
.tile__facts { margin: 0; padding-left: 18px; }
.tile__facts li { margin-bottom: 5px; }
.tile__small { font-size: 13px; color: var(--muted); margin-top: 6px; }
.tile__forward { font-size: 16.5px; color: var(--ink); }

/* "Show the working": the card's arithmetic, laid bare */
.tile--working { padding: 0; }
.working__summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 14px 16px;
}
.working__summary::-webkit-details-marker { display: none; }
.working__summary .tile__k { margin: 0; }
.working__summary .tile__small { margin: 0; }
.working__summary:hover { background: rgba(143, 179, 255, 0.05); }
.working__summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.working__pre {
  margin: 0; padding: 4px 16px 16px; overflow-x: auto;
  font: 12.5px/1.6 var(--mono); color: var(--ink-2); white-space: pre;
  font-variant-numeric: tabular-nums;
}
@media (min-width: 640px) { .working__summary { padding: 14px 18px; } .working__pre { padding: 4px 18px 18px; } }

/* ── Actions / footer ────────────────────────────────────────────────── */
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; align-items: center; }
.actions__note { flex-basis: 100%; margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.foot { margin-top: 56px; color: var(--muted); font-size: 14px; text-align: center; }
.foot a { color: var(--accent); }

/* ── ≥ 640px: two-column body, wider hero, 3-col tiles ───────────────── */
@media (min-width: 640px) {
  .pass__hero { aspect-ratio: 12 / 5; padding: 16px 22px 18px; }
  .pass__headline { font-size: 19px; }
  .pass__sig { font-size: 12px; }
  .voyage { padding: 8px 22px 6px; gap: 16px; }
  .voyage__label { max-width: 160px; }

  .pass__fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .field { border-left: 1px solid var(--line-soft); }
  .field:first-child { border-left: 0; }
  .field:nth-child(n + 3) { border-top: 0; }

  .pass__body { grid-template-columns: minmax(0, 1fr) 240px; grid-template-areas: "main aside"; }
  .pass__main  { padding: 18px 22px 20px; }
  .pass__aside { padding: 18px 18px 20px; border-bottom: 0; border-left: 1px solid var(--line); }
  .pass__grit { font-size: 17px; }

  .pass__summary { padding: 14px 22px; }
  .more { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile { padding: 16px 18px; }
}

@media (max-width: 639px) {
  .wrap { padding-top: 32px; }
  .pass__sig { font-size: 10.5px; padding: 5px 7px; }
  .pass__credit { display: none; }               /* credit still in the PNG + alt text */
}

/* ── Motion ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .voyage__probe { animation: none; left: 62%; opacity: 1; }
  .pass__summary::after { transition: none; }
}
