/* ShipReel Feed — dark-native, Linear-class restraint. Luminance does the work; there is
   exactly one chromatic accent and it only marks the primary action. */

:root {
  --bg: #08090a;
  --panel: #0f1011;
  --surface: #191a1b;
  --surface-hi: #28282c;
  --text: #f7f8f8;
  --text-2: #d0d6e0;
  --text-3: #8a8f98;
  --text-4: #62666d;
  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --accent: #5e6ad2;
  --accent-hi: #7170ff;
  --danger: #d05d63;
  --radius: 6px;
  --topbar-h: 48px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.165px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text-2); text-decoration: none; }
a:hover { color: var(--text); }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 13px; }

/* --- top bar ------------------------------------------------------------- */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(8, 9, 10, 0.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
}

.topbar-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.wordmark { font-weight: 500; font-size: 14px; letter-spacing: -0.2px; white-space: nowrap; }
.queue-count { font-size: 12px; color: var(--text-4); white-space: nowrap; }

/* Five destinations have to fit a 414px phone: the nav scrolls rather than wrapping into
   the card below it. */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar-nav::-webkit-scrollbar { display: none; }
.topbar-nav a, .topbar-nav .linkish { white-space: nowrap; }
.topbar-nav a, .linkish {
  font-size: 13px;
  color: var(--text-3);
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
}
.topbar-nav a:hover, .linkish:hover { color: var(--text); }
.topbar-nav a.active { color: var(--text); }
.topbar-nav form { display: flex; }

/* --- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.btn:active { background: rgba(255, 255, 255, 0.09); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: #fff; }
.btn-danger:hover { color: var(--danger); border-color: rgba(208, 93, 99, 0.4); }

kbd {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-4);
}
.btn-primary kbd { border-color: rgba(255, 255, 255, 0.25); color: rgba(255, 255, 255, 0.75); }

/* --- login --------------------------------------------------------------- */

body.centered { display: grid; place-items: center; }
.auth { width: min(340px, calc(100vw - 48px)); }
.auth h1 { font-size: 20px; font-weight: 590; letter-spacing: -0.24px; margin: 0 0 4px; }
.auth .subtitle { color: var(--text-3); font-size: 14px; margin: 0 0 24px; }
.auth-form { display: flex; flex-direction: column; gap: 8px; }
.auth-form label { font-size: 12px; color: var(--text-3); }
.auth-form input {
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: inherit;
}
.auth-form input:focus { outline: none; border-color: var(--accent-hi); }
.auth-form .btn { margin-top: 8px; }
.auth-error { color: var(--danger); font-size: 13px; margin: 4px 0 0; }

/* --- feed ---------------------------------------------------------------- */

.feed {
  height: 100dvh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-y: contain;
}

.card {
  min-height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  /* The video sets its own height now, so centre the stack: a short (landscape) video must
     not leave the actions floating over a screen of empty black. */
  justify-content: center;
  gap: 12px;
  padding: calc(var(--topbar-h) + 12px) 16px calc(16px + env(safe-area-inset-bottom));
  outline: none;
}
.card[hidden] { display: none; }

/* Mobile-first surface, centred rather than stretched on wide screens. */
.card > * { width: 100%; max-width: 960px; margin-inline: auto; }

.card-meta { flex: 0 0 auto; }
.card-heading { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; }
.repo { color: var(--text-3); }
.pr { color: var(--text-4); }
.pr:hover { color: var(--text-2); }
.card-title {
  margin: 4px 0 2px;
  font-size: 20px;
  font-weight: 590;
  letter-spacing: -0.24px;
  line-height: 1.33;
}
.card-sub { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--text-3); }
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-4); }

/* v0.2: the video sizes itself. The combined asset is a 1280x1440 vertical stack, so a
   fixed-height box letterboxed it into a thin strip in an ocean of black. No container,
   no object-fit — natural aspect, capped so the actions always stay on screen. */
.card-media {
  display: block;
  width: 100%;
  height: auto;
  max-height: 78vh;
  max-height: 78dvh;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #000;
}

/* Landing only: a still mock card, where a fixed ratio is the point. */
.card-video {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #000;
  overflow: hidden;
}
.card-video video { width: 100%; height: 100%; object-fit: cover; display: block; }

.card-actions { flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px; }
.card-status { margin: 0; font-size: 13px; color: var(--danger); }
.card-status[data-tone="ok"] { color: var(--text-3); }
.buttons { display: grid; grid-template-columns: 1.1fr 1.3fr 0.7fr 0.8fr; gap: 8px; }
.buttons .btn { white-space: nowrap; padding: 0 10px; }

/* Card chips: branch, "before / after", and any non-pending state. */
.branch, .badge {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  color: var(--text-3);
}
.badge.state-merged { color: var(--accent); }
.badge.state-rejected { color: var(--danger); }
.badge.state-skipped, .badge.state-archived { color: var(--text-4); }

/* The deep-linked single card is not a scroll surface. */
.feed.single { scroll-snap-type: none; }
.feed.single .card { min-height: auto; }

.card.empty { align-items: center; justify-content: center; }
.empty-inner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-inner h2 { font-size: 18px; font-weight: 510; margin: 0; }
.empty-inner p { margin: 0; font-size: 14px; }
.empty-inner .btn { margin-top: 8px; }

.hint {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 6px;
  font-size: 11px;
  color: var(--text-4);
  pointer-events: none;
}
/* Phones: no keyboard, so no key chips — and the thumb row gets the space back. */
@media (max-width: 720px) {
  .hint { display: none; }
  .buttons .btn kbd { display: none; }
  .buttons .btn { font-size: 13px; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 12px; gap: 12px; }
  .topbar-nav { gap: 13px; font-size: 12.5px; }
  /* The nav needs the room more than the count does; on a phone, Refresh is a pull-down. */
  .queue-count, .nav-refresh { display: none; }
}
/* Desktop: reserve the strip the keyboard hint sits in so nothing overlaps it. */
@media (min-width: 721px) {
  .card { padding-bottom: 36px; }
}

/* --- log ----------------------------------------------------------------- */

.log { max-width: 880px; margin: 0 auto; padding: calc(var(--topbar-h) + 32px) 16px 64px; }
.log h1 { font-size: 24px; font-weight: 400; letter-spacing: -0.288px; margin: 0 0 20px; }
.log-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.log-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 510;
  color: var(--text-4);
  padding: 0 12px 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.log-table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
}
.tag-merge { color: #27a644; border-color: rgba(39, 166, 68, 0.3); }
.tag-reject { color: var(--danger); border-color: rgba(208, 93, 99, 0.3); }
.tag-skip { color: var(--text-3); }

/* --- landing ------------------------------------------------------------- */

body.landing-body { height: auto; min-height: 100%; }
.btn-small { min-height: 32px; padding: 0 12px; font-size: 13px; }

.landing { max-width: 1120px; margin: 0 auto; padding: calc(var(--topbar-h) + 64px) 24px 96px; }
.landing-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 64px; align-items: start; }
.landing h1 { font-size: 44px; line-height: 1.1; font-weight: 590; letter-spacing: -1.1px; margin: 0 0 20px; }
.landing .lede { font-size: 17px; line-height: 1.6; color: var(--text-2); margin: 0 0 28px; max-width: 52ch; }
.landing-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 48px; }

.steps { list-style: none; counter-reset: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; }
.step-n {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
}
.steps h3 { margin: 2px 0 4px; font-size: 15px; font-weight: 510; }
.steps p { margin: 0; font-size: 14px; max-width: 46ch; }
code { font-family: var(--mono); font-size: 0.92em; color: var(--text-2); }

.landing-preview { display: flex; flex-direction: column; gap: 12px; }
.preview-card {
  height: auto;
  padding: 16px;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}
.preview-card .card-video { aspect-ratio: 16 / 10; flex: 0 0 auto; }
.preview-card .buttons .btn { cursor: default; }
.preview-note { font-size: 12px; margin: 0; }

@media (max-width: 900px) {
  .landing { padding-top: calc(var(--topbar-h) + 40px); }
  .landing-hero { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .landing h1 { font-size: 34px; letter-spacing: -0.8px; }
}

/* --- dashboard ----------------------------------------------------------- */

.dash { max-width: 880px; margin: 0 auto; padding: calc(var(--topbar-h) + 32px) 16px 80px; }
.dash-section { margin-bottom: 48px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.dash h1 { font-size: 24px; font-weight: 400; letter-spacing: -0.288px; margin: 0; }
.dash h2 { font-size: 16px; font-weight: 510; margin: 0; }

.flash {
  margin: 0 0 24px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  color: var(--text-2);
}
.flash-error { color: var(--danger); border-color: rgba(208, 93, 99, 0.3); }

.add-form { display: flex; gap: 8px; }
.add-form input {
  height: 32px;
  width: 220px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.add-form input:focus { outline: none; border-color: var(--accent-hi); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.dash-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dash-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 510;
  color: var(--text-4);
  padding: 0 12px 8px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.dash-table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.dash-table .row-actions { text-align: right; padding-right: 0; }
.setup-link { font-size: 12px; margin-left: 8px; color: var(--text-3); }

.dash-empty {
  align-items: flex-start;
  text-align: left;
  padding: 32px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--panel);
}
.suggestions { list-style: none; margin: 4px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 4px; color: var(--text-2); }

.pending-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.pending-list li { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); }
.pending-title { font-size: 14px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 560px) {
  .dash-head { flex-direction: column; align-items: stretch; }
  .add-form input { width: 100%; }
}

/* --- library + docs (v0.2) ------------------------------------------------ */

.library-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.library-head h1 { margin-bottom: 20px; }
.filter select {
  height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.filter select:focus { outline: none; border-color: var(--accent-hi); }
.log-table .links { display: flex; gap: 12px; font-size: 13px; }
.log-table .links a { color: var(--text-3); }
.log-table .links a:hover { color: var(--text); }
.notice.error { color: var(--danger); font-size: 14px; }

.docs { max-width: 760px; margin: 0 auto; padding: calc(var(--topbar-h) + 40px) 20px 96px; }
.docs-lede { color: var(--text-3); font-size: 14px; margin: 0 0 28px; }
.prose h1 { font-size: 28px; font-weight: 590; letter-spacing: -0.5px; margin: 0 0 16px; }
.prose h2 { font-size: 18px; font-weight: 560; margin: 40px 0 12px; }
.prose h3 { font-size: 15px; font-weight: 560; margin: 28px 0 10px; color: var(--text-2); }
.prose p, .prose li { color: var(--text-2); font-size: 15px; line-height: 1.65; }
.prose ul { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.prose pre {
  background: var(--panel);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.55;
}
.prose pre code { color: var(--text-2); }
.prose code { background: var(--panel); border-radius: 4px; padding: 1px 5px; }
.prose pre code { background: none; padding: 0; }
