/* fonts are self-hosted (SIL OFL, see /fonts/LICENSE-*) */
@font-face { font-family: "Big Shoulders Display"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/big-shoulders-display-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Big Shoulders Display"; font-weight: 800; font-style: normal; font-display: swap; src: url("/fonts/big-shoulders-display-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Big Shoulders Display"; font-weight: 900; font-style: normal; font-display: swap; src: url("/fonts/big-shoulders-display-latin-900-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-style: normal; font-display: swap; src: url("/fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/barlow-latin-600-normal.woff2") format("woff2"); }

:root {
  --cobalt: #0F2A5E;      /* page */
  --deep: #0A1F47;        /* surfaces */
  --panel: #13336F;       /* raised */
  --line: #24467F;
  --silver: #D7DEE8;      /* ink */
  --steel: #8C9DBA;       /* secondary ink */
  --blue: #2F6BDB;        /* livery blue */
  --gold: #E2B04A;        /* liftoff, primary action */
  --gold-ink: #241A05;
  --danger: #FF8A7A;
  --ok: #5CD6A0;          /* upload finished */
  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --body: "Barlow", "Segoe UI", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --row-h: 220px;
  color-scheme: dark;
}
/* The site has one deliberate theme (the rocket's livery); dark mode keeps it. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --cobalt: #0F2A5E; --deep: #0A1F47; }
}
:root[data-theme="dark"] { --cobalt: #0F2A5E; --deep: #0A1F47; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--cobalt); color: var(--silver); font: 400 16px/1.5 var(--body); overflow-x: hidden; }
img, video { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- livery: the roll-pattern stripe off the airframe ---------- */
.livery { display: grid; grid-template-columns: 5fr 1fr 2fr 1fr; height: 14px; }
.livery span:nth-child(1) { background: linear-gradient(180deg, #EEF2F7, #A9B5C6); }
.livery span:nth-child(2) { background: var(--blue); }
.livery span:nth-child(3) { background: linear-gradient(180deg, #F2CB6E, #B9862A); }
.livery span:nth-child(4) { background: var(--blue); }

.wordmark { font: 900 clamp(120px, 26vw, 300px)/0.78 var(--display); letter-spacing: 0.02em; margin: 0;
  background: linear-gradient(180deg, #F4F7FB 0%, #C3CDDB 48%, #8D9AAF 52%, #DDE4EE 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.wordmark-sm { font-size: 112px; }

/* ---------- buttons ---------- */
.btn { border: 0; border-radius: 6px; padding: 10px 18px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn-gold { background: var(--gold); color: var(--gold-ink); }
.btn-gold:hover { background: #F0C463; }
.btn-ghost { background: transparent; color: var(--silver); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover, .btn-ghost[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--silver); }
.icon-btn { background: none; border: 0; color: var(--silver); width: 40px; height: 40px; font-size: 18px; cursor: pointer; border-radius: 50%; }
.icon-btn:hover { background: rgba(255,255,255,.08); }
.btn-text { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.danger { color: var(--danger); }

/* ---------- gate ---------- */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: var(--gutter); }
.gate-card { width: min(420px, 100%); }
.gate-card .livery { margin-bottom: 28px; }
.gate-lede { color: var(--steel); margin: 18px 0 24px; }
.gate-card form { display: flex; gap: 10px; }
.gate-card input { flex: 1; min-width: 0; background: var(--deep); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; font-size: 20px; letter-spacing: .25em; }
.gate-error { color: var(--danger); min-height: 1.5em; }

/* ---------- top bar ---------- */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px var(--gutter);
  background: rgba(10, 31, 71, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar-mark { display: flex; align-items: center; gap: 8px; color: var(--silver); text-decoration: none; font: 800 24px/1 var(--display); }
.bar-filters { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.bar-actions { display: flex; gap: 8px; }
.seg { display: inline-flex; background: var(--deep); border-radius: 6px; padding: 3px; box-shadow: inset 0 0 0 1px var(--line); }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; color: var(--steel); font-weight: 500; }
.seg button[aria-checked="true"] { background: var(--panel); color: var(--silver); }
.sel select, .search input { background: var(--deep); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }
.search { flex: 1; max-width: 340px; min-width: 120px; }
.search input { width: 100%; }

/* ---------- hero ---------- */
.hero { padding: clamp(32px, 7vw, 88px) var(--gutter) 0; }
.hero-text { max-width: 1100px; }
.hero-line { font-size: clamp(18px, 2.2vw, 24px); margin: 24px 0 4px; max-width: 34em; }
.hero-counts { color: var(--steel); margin: 0 0 28px; }
.livery-hero { height: 22px; margin: 0 calc(-1 * var(--gutter)); }

/* ---------- timeline ---------- */
.timeline { padding: 8px var(--gutter) 120px; }
.queue-note { margin: 20px var(--gutter) 0; color: var(--steel); font-size: 14px; }
.tgroup { display: grid; grid-template-columns: 112px 1fr; gap: 0 24px; position: relative; }
.tgroup::before { content: ""; position: absolute; left: 112px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.tmark { padding: 34px 18px 0 0; text-align: right; position: relative; }
.tmark::after { content: ""; position: absolute; right: -7px; top: 42px; width: 12px; height: 12px; z-index: 1; border-radius: 50%;
  background: var(--cobalt); border: 2px solid var(--steel); }
.tmark .t { font: 800 30px/1 var(--display); display: block; }
.tmark .clock { color: var(--steel); font-size: 14px; }
.tbody { padding: 30px 0 18px; min-width: 0; }
.tbody h2 { font: 600 22px/1.2 var(--display); letter-spacing: .02em; margin: 0 0 12px; }
.tbody h2 small { font: 400 15px var(--body); color: var(--steel); margin-left: 8px; }

.tgroup.liftoff::before { background: var(--gold); width: 4px; left: 111px; }
.tgroup.liftoff .tmark::after { background: var(--gold); border-color: var(--gold); width: 18px; height: 18px; right: -10px; top: 40px; }
.tgroup.liftoff .tmark .t { color: var(--gold); font-size: 40px; }
.tgroup.liftoff .tbody { background: linear-gradient(90deg, rgba(226,176,74,.13), transparent 70%); margin-left: -24px; padding-left: 24px; }
.tgroup.liftoff .tbody h2 { color: var(--gold); }

/* justified rows */
.rows { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; gap: 6px; }
.tile { position: relative; flex: none; background: var(--deep); border-radius: 3px; overflow: hidden; cursor: pointer; border: 0; padding: 0; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile:hover img { filter: brightness(1.08); }
.tile .badge { position: absolute; right: 6px; bottom: 6px; background: rgba(5,15,35,.78); color: var(--silver); font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 3px; }
.tile .play { position: absolute; left: 8px; bottom: 8px; width: 0; height: 0; border-left: 12px solid #fff; border-top: 8px solid transparent; border-bottom: 8px solid transparent; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.tile.processing { display: grid; place-items: center; color: var(--steel); font-size: 13px;
  background: linear-gradient(100deg, var(--deep) 30%, var(--panel) 50%, var(--deep) 70%) 0 0 / 300% 100%; animation: sheen 1.6s linear infinite; }
.tile.filetile { display: grid; place-items: center; text-align: center; padding: 10px; font-size: 13px; color: var(--steel); }
.tile.filetile b { display: block; font: 800 28px var(--display); color: var(--silver); }
.tile .check { position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: rgba(5,15,35,.4); display: none; }
.selecting .tile .check { display: block; }
.tile.selected .check { background: var(--gold); border-color: var(--gold); }
.tile.selected .check::after { content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px; border: solid var(--gold-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.tile.selected img { opacity: .75; }
@keyframes sheen { to { background-position: -300% 0; } }

.empty { text-align: center; padding: 80px var(--gutter); }
.empty h2 { font: 800 40px var(--display); margin: 0; }
.empty p { color: var(--steel); max-width: 30em; margin: 10px auto 24px; }

/* ---------- selection bar ---------- */
.selbar { position: fixed; z-index: 25; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  background: var(--deep); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 10px 18px; box-shadow: 0 12px 40px rgba(0,0,0,.45); max-width: calc(100% - 24px); flex-wrap: wrap; }

/* ---------- upload drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(4,12,30,.55); z-index: 30; }
.drawer { position: fixed; z-index: 31; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--deep); border-left: 1px solid var(--line);
  padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-head h2 { font: 800 30px var(--display); margin: 0; }
.field { display: grid; gap: 6px; font-weight: 500; }
.field input { background: var(--cobalt); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.drop { display: grid; gap: 6px; padding: 28px 20px; border: 2px dashed var(--line); border-radius: 8px; text-align: center; cursor: pointer; }
.drop span { color: var(--steel); font-size: 14px; }
.drop.over { border-color: var(--gold); background: rgba(226,176,74,.06); }
.up-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.up-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 14px; }
.up-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-list .st { color: var(--steel); }
.up-list .st.err { color: var(--danger); }
.up-list .st.ok { color: var(--ok); }
.up-list progress { grid-column: 1 / -1; width: 100%; height: 4px; appearance: none; border: 0; background: var(--cobalt); border-radius: 2px; }
.up-list progress::-webkit-progress-bar { background: var(--cobalt); }
.up-list progress::-webkit-progress-value { background: var(--gold); }
.up-list progress::-moz-progress-bar { background: var(--gold); }
.up-list li.done progress::-webkit-progress-value { background: var(--ok); }
.up-list li.done progress::-moz-progress-bar { background: var(--ok); }

/* ---------- lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 40; background: #050D20; display: grid; grid-template-columns: 1fr 340px; }
.lb-stage { display: grid; place-items: center; min-height: 0; min-width: 0; padding: 20px; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: calc(100dvh - 40px); object-fit: contain; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(15,42,94,.7); border: 0; color: var(--silver); font-size: 34px; width: 48px; height: 72px; cursor: pointer; border-radius: 6px; }
.lb-prev { left: 12px; } .lb-next { right: 352px; }
.lb-close { position: absolute; top: 12px; right: 352px; background: rgba(15,42,94,.7); }
.lb-info { background: var(--deep); border-left: 1px solid var(--line); padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.lb-info h2 { font: 600 22px/1.2 var(--body); margin: 0; word-break: break-word; }
.lb-info dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 15px; }
.lb-info dt { color: var(--steel); }
.lb-info dd { margin: 0; }
.lb-dl { display: grid; gap: 8px; }
.dl-opt { display: grid; grid-template-columns: 1fr auto; align-items: center; text-decoration: none; color: var(--silver); padding: 12px 14px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--line); }
.dl-opt:hover { box-shadow: inset 0 0 0 1px var(--silver); }
.dl-opt.primary { background: var(--gold); color: var(--gold-ink); box-shadow: none; }
.dl-opt b { font-weight: 600; }
.dl-opt small { grid-column: 1; opacity: .75; font-size: 13px; }
.dl-opt .sz { grid-row: 1 / span 2; grid-column: 2; font-weight: 600; }
.dl-opt.off { opacity: .55; pointer-events: none; }

.toast { position: fixed; z-index: 50; left: 50%; top: 76px; transform: translateX(-50%); background: var(--silver); color: var(--cobalt); padding: 10px 18px; border-radius: 6px; font-weight: 600; }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  :root { --row-h: 140px; }
  .bar { flex-wrap: wrap; gap: 10px; }
  .bar-filters { order: 3; flex-basis: 100%; flex-wrap: wrap; }
  .bar-actions { margin-left: auto; }
  .search { max-width: none; flex-basis: 100%; }
  .tgroup { grid-template-columns: 64px 1fr; gap: 0 18px; }
  .tgroup::before { left: 64px; }
  .tgroup.liftoff::before { left: 63px; }
  .tmark { padding-right: 12px; }
  .tmark .t { font-size: 22px; }
  .tgroup.liftoff .tmark .t { font-size: 26px; }
  .tmark .clock { font-size: 12px; }
  .lb { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .lb-info { border-left: 0; border-top: 1px solid var(--line); max-height: 45dvh; padding: 16px; }
  .lb-stage { padding: 8px; }
  .lb-stage img, .lb-stage video { max-height: 52dvh; }
  .lb-next, .lb-close { right: 12px; }
  .lb-nav { top: 28%; }
}
@media (prefers-reduced-motion: reduce) {
  .tile.processing { animation: none; }
}
