:root {
  --sky: #060a18;
  --panel: #0e1530;
  --panel-2: #131c3c;
  --line: #222d5a;
  --text: #edf1ff;
  --muted: #a3aed6;
  --dim: #7480ad;
  --gold: #ffc862;
  --radius: 18px;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--sky); }
body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.5 var(--sans);
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 85% -10%, #1a2a62 0%, transparent 60%),
    radial-gradient(900px 500px at -15% 110%, #1b1242 0%, transparent 55%),
    var(--sky);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); }
button, input, select { font: inherit; }
img { max-width: 100%; }

.view {
  max-width: 620px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
  outline: none;
}

/* ---- header ---- */
.brand { display: flex; align-items: center; gap: 12px; margin: 6px 2px 14px; }
.brand img { width: 44px; height: 44px; border-radius: 12px; }
.brand h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.brand p { margin: 0; color: var(--muted); font-size: 14px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; margin: -14px -16px 12px; padding: 10px 16px; background: #060a18e6; backdrop-filter: blur(10px); border-bottom: 1px solid #ffffff10; }
.top span { flex: 1; font-weight: 650; color: var(--muted); font-size: 15px; }
.back, .home { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--text); text-decoration: none; font-size: 19px; cursor: pointer; }

/* ---- search ---- */
.search { display: flex; gap: 8px; margin: 0 0 14px; }
.search input { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: #0b1128; color: var(--text); }
.search input::placeholder { color: var(--dim); }
.search button { height: 46px; padding: 0 16px; border-radius: 14px; border: 0; background: linear-gradient(180deg, #ffd27a, #ff9f4a); color: #1d1206; font-weight: 700; cursor: pointer; }

/* ---- cards and sections ---- */
.card, .apod { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; }
.card h2, .apod h2, .row h2 { margin: 0 0 8px; font-size: 19px; letter-spacing: -0.01em; }
.card p, .apod p { margin: 0 0 10px; color: #cfd6f4; }
.eyebrow { margin: 0 0 8px !important; font: 700 11px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold) !important; }
.apod-media { display: block; position: relative; margin: 0 -16px 12px; }
.apod-media img { display: block; width: 100%; max-height: 420px; object-fit: cover; }
.apod-media.video span { position: absolute; left: 12px; bottom: 12px; padding: 8px 12px; border-radius: 12px; background: #000000b3; color: #fff; font-weight: 650; }
.apod-media.empty { display: flex; align-items: center; justify-content: center; min-height: 160px; background: #0b1128; text-decoration: none; }
.apod-media.empty span { position: static; background: transparent; color: var(--gold); }
.credit { font-size: 13px; color: var(--dim) !important; margin-top: -4px !important; }
.more { display: inline-block; margin-top: 2px; font-weight: 600; }
.muted { color: var(--muted); }
.meta { font-size: 13px; color: var(--dim); }
.lead { color: #cfd6f4; margin: 0 0 14px; }
.page-title { margin: 4px 0 6px; font-size: 28px; line-height: 1.15; letter-spacing: -0.02em; }

.cta { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin: 0 0 18px; border-radius: var(--radius); border: 1px solid #5a4a2a; background: linear-gradient(180deg, #2a2140, #151b37); color: var(--text); text-decoration: none; }
.cta span { font-size: 26px; }
.cta b { display: block; }
.cta small { color: var(--muted); }

/* ---- rows of objects ---- */
.row { margin: 0 0 18px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 2px 8px; }
.row-head a { font-size: 14px; white-space: nowrap; text-decoration: none; }
.scroller { display: grid; grid-auto-flow: column; grid-auto-columns: 42%; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.obj { scroll-snap-align: start; display: block; text-decoration: none; color: var(--text); }
.obj img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 16px; background: #10183a; border: 1px solid #ffffff14; }
.obj b { display: block; margin: 6px 2px 0; font-size: 15px; line-height: 1.25; }
.obj small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 2px 2px 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; }

/* ---- object page ---- */
.hero { margin: 0 -16px 12px; }
.hero img { display: block; width: 100%; max-height: 460px; object-fit: cover; background: #0b1128; }
.hero figcaption { padding: 6px 16px 0; font-size: 12px; color: var(--dim); }
.hero figcaption a { color: var(--muted); }
.photo-full img { object-fit: contain; max-height: 70vh; background: #000; }
.badge { display: inline-block; margin: 4px 0 0; padding: 3px 10px; border-radius: 99px; background: #1a2350; color: var(--muted); font-size: 13px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.facts div { background: #0b1128; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.facts dt { font: 700 10px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.facts dd { margin: 3px 0 0; font-weight: 650; line-height: 1.3; }
.dyk { margin: 0; padding-left: 20px; color: #cfd6f4; }
.dyk li { margin-bottom: 8px; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photos.big { grid-template-columns: repeat(3, 1fr); margin-bottom: 12px; }
.photo img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 10px; background: #10183a; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip { padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); background: #0b1128; color: var(--text); text-decoration: none; font-size: 14px; }
.description summary { cursor: pointer; color: #cfd6f4; }
.description p { color: #cfd6f4; }

/* ---- compare ---- */
.pickers { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 0 0 12px; }
.pickers span { color: var(--dim); font-size: 14px; }
select { width: 100%; height: 46px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--line); background: #0b1128; color: var(--text); }
.compare { text-align: center; }
.circles { display: block; width: 100%; max-width: 420px; margin: 0 auto 6px; }
.circles text { fill: #cfd6f4; font: 600 13px var(--sans); }
.big { font-size: 19px; font-weight: 700; color: var(--text) !important; }
table.side { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 14px; table-layout: fixed; }
.side th, .side td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.side thead th { color: var(--gold); }
.side tbody th { color: var(--dim); font-weight: 600; width: 30%; }
.row.two { display: flex; justify-content: space-between; gap: 10px; }
.obj-link { text-decoration: none; font-weight: 600; }

/* ---- misc ---- */
.ghost { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line); background: transparent; color: var(--text); font-weight: 600; cursor: pointer; }
.ghost.wide { width: 100%; }
.about ul { padding-left: 18px; color: #cfd6f4; }
.about li { margin-bottom: 10px; }
.skeleton { height: 220px; border-radius: 14px; background: linear-gradient(90deg, #10183a, #19244f, #10183a); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.skeleton.small { height: 110px; grid-column: 1 / -1; }
.skeleton.tall { height: 360px; }
@keyframes shimmer { to { background-position: -200% 0; } }
footer.foot { margin: 22px 4px 0; font-size: 13px; color: var(--dim); text-align: center; }
.noscript { padding: 20px; text-align: center; }

@media (min-width: 560px) {
  .scroller { grid-auto-columns: 30%; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .photos.big { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ---- constellations ---- */
.chart { display: block; width: 100%; height: auto; }
.obj .chart { aspect-ratio: 1 / 1; border-radius: 16px; border: 1px solid #ffffff14; }
.hero.sky { background: #070c20; }
.hero.sky .chart { max-height: 440px; margin: 0 auto; }

/* ---- every exoplanet ---- */
.chip.on { border-color: #ffd166aa; background: #ffd16622; color: #fff2cc; }
.exo-list { list-style: none; margin: 0 0 12px; padding: 0; }
.exo-row { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.exo-row .dot { flex: none; width: 40px; height: 40px; }
.exo-row b { display: block; font-size: 15px; line-height: 1.3; }
.exo-row small { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; }
.note { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: #0b1128; border: 1px solid var(--line); color: #cfd6f4; font-size: 14px; }
.note.water { background: #0e2a2a; border-color: #1f5550; color: #d6f5f0; }

/* ---- sky calendar ---- */
.upcoming .row-head { margin: 0 0 4px; }
.upcoming .exo-list, .calendar .exo-list { margin: 0; }
.upcoming li:last-child .exo-row, .calendar li:last-child .exo-row { border-bottom: 0; }
.calendar .exo-row { align-items: flex-start; }
.calendar small + small { margin-top: 3px; }
.calendar small a { color: var(--gold); }
.when { flex: none; width: 48px; padding: 5px 0; border-radius: 12px; background: #0b1128; border: 1px solid var(--line); text-align: center; }
.when b { display: block; font-size: 19px; line-height: 1.1; }
.when small { display: block; font: 700 10px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); }

/* ---- tonight's sky ---- */
.sky-tag { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 99px; font: 600 12px var(--sans); font-style: normal; vertical-align: 1px; white-space: nowrap; }
.sky-tag.see { background: #163a2a; color: #9fe1cb; }
.sky-tag.late { background: #3a2d12; color: #fac775; }
.sky-tag.no { background: #23253c; color: var(--muted); }
.sky-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 10px; }
.sky-tags a { color: var(--text); text-decoration: none; font-weight: 600; }
.tonight-card .tonight-moon { margin: 0; }
.sky-row { align-items: flex-start; }
.sky-row b { margin-bottom: 2px; }
.sky-dot { flex: none; width: 44px; height: 44px; margin-top: 2px; border-radius: 50%; object-fit: cover; background: #1b2550; }
.sky-row.faded .sky-dot { opacity: 0.45; }
.tonight li:last-child .exo-row { border-bottom: 0; }
.place-pick { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; font: inherit; cursor: pointer; }
.place-status:empty { display: none; }
.where-now p:last-child { margin-bottom: 0; }
.row-intro { margin: -2px 2px 12px; color: var(--muted); font-size: 14px; }

/* ---- how dark is your sky, and shapes to look for ---- */
.sky-glow { padding: 10px 16px 2px; }
.sky-glow label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 13px; font-weight: 650; }
.sky-glow input[type=range] { width: 100%; margin: 0; accent-color: var(--gold); }
.sky-ticks { display: flex; justify-content: space-between; color: var(--dim); font-size: 12px; }
.gold { color: var(--gold); }
.shapes p { margin: 0 0 8px; }
.shapes p:last-child { margin-bottom: 0; }

/* ---- stories ---- */
.story-cards { display: grid; gap: 12px; }
.group-stories { margin: 0 0 28px; }
.story-card { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, var(--panel-2), var(--panel)); color: var(--text); text-decoration: none; }
.story-card img { flex: none; width: 84px; height: 84px; object-fit: cover; border-radius: 12px; background: #10183a; }
.story-card b { display: block; margin-bottom: 2px; font-size: 17px; }
.story-card small { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 14px; line-height: 1.4; }
.diagram { margin: 0 0 16px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #070c20; }
.diagram svg { display: block; width: 100%; height: auto; }
.diagram figcaption { margin-top: 6px; color: var(--dim); font-size: 13px; }
.stage-objects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
.stage-objects .obj small { display: none; }
.stage-objects .obj b { font-size: 13px; }
.path-title { margin: 24px 2px 10px; color: var(--gold); font-size: 21px; }
button.chip { font: inherit; font-size: 14px; cursor: pointer; }
.light-view { margin: 0 0 10px; }
.light-view img { display: block; width: 100%; max-height: 460px; object-fit: contain; border-radius: 12px; background: #000; }
.light-view figcaption { margin-top: 8px; color: #cfd6f4; font-size: 14px; }
.light-kind { border-left: 4px solid var(--kind, var(--line)); }
.light-kind::after { content: ''; display: block; clear: both; }
.kind-example { float: right; width: 96px; margin: 0 0 8px 12px; color: var(--muted); text-decoration: none; text-align: center; }
.kind-example img { display: block; width: 96px; height: 96px; object-fit: cover; border-radius: 10px; background: #10183a; }
.kind-example small { display: block; margin-top: 3px; font-size: 12px; line-height: 1.25; }

@media (min-width: 1000px) {
  .story-cards { grid-template-columns: 1fr 1fr; }
  .story-card img { width: 110px; height: 110px; }
  .paths { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
  .light-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
}

/* ---- the website on a computer ----
   Everything above is the phone app. From 1000px wide the same pages become a magazine-style website: a top
   navigation bar, today's photo beside "coming up", wide photo grids, and photo-beside-facts object pages. The
   wrappers used here (home-top, object-top, narrow…) have no styles of their own on a phone. */
.site-nav, .site-foot, .desktop-only { display: none; }

@media (min-width: 1000px) {
  .site-nav { display: block; position: sticky; top: 0; z-index: 10; background: #060a18d9; backdrop-filter: blur(12px); border-bottom: 1px solid #ffffff12; }
  .site-nav-inner { display: flex; align-items: center; gap: 24px; max-width: 1240px; height: 68px; margin: 0 auto; padding: 0 32px; }
  .site-brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 18px; letter-spacing: -0.01em; white-space: nowrap; }
  .site-brand img { width: 34px; height: 34px; border-radius: 9px; }
  .site-nav nav { display: flex; flex: 1; gap: 2px; }
  .site-nav nav a { padding: 8px 12px; border-radius: 10px; color: var(--muted); font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap; }
  .site-nav nav a:hover { color: var(--text); background: #ffffff0d; }
  .site-nav nav a.on { color: var(--gold); background: #ffc8621a; }
  .nav-search { display: flex; width: 250px; }
  .nav-search input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px; background: #0b1128; color: var(--text); }
  .nav-search input::placeholder { color: var(--dim); }
  .nav-search button { width: 44px; height: 40px; border: 1px solid var(--line); border-radius: 0 10px 10px 0; background: var(--panel-2); color: var(--text); cursor: pointer; }

  .site-foot { display: block; margin-top: 16px; border-top: 1px solid #ffffff12; }
  .site-foot-inner { display: flex; justify-content: space-between; gap: 24px; max-width: 1240px; margin: 0 auto; padding: 22px 32px 36px; color: var(--dim); font-size: 14px; }
  .site-foot a { color: var(--muted); }

  .view { max-width: 1240px; padding: 28px 32px 40px; }
  .brand, .home-search, .top, footer.foot { display: none; }
  .desktop-only { display: flex; }
  .page-title { font-size: 40px; }
  .lead { max-width: 780px; font-size: 18px; }
  .narrow { max-width: 880px; margin-left: auto; margin-right: auto; }

  /* home */
  .home-top { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; align-items: start; margin-bottom: 36px; }
  .home-top .apod { margin: 0; padding: 22px; }
  .home-top .apod-media { margin: 0 -22px 16px; }
  .home-top .apod-media img { max-height: 500px; }
  .home-top .apod h2 { font-size: 26px; }
  .home-side { display: flex; flex-direction: column; gap: 16px; }
  .home-side > * { margin: 0; }

  /* rows and grids of objects */
  .row { margin-bottom: 40px; }
  .row h2 { font-size: 24px; }
  .row-head { margin-bottom: 12px; }
  .row-head a { font-size: 15px; }
  .scroller { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px 18px; margin: 0; padding: 0; overflow: visible; scroll-snap-type: none; }
  .scroller > :nth-child(n + 7) { display: none; }
  .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 24px 18px; }
  .obj { transition: transform 0.15s ease; }
  .obj:hover { transform: translateY(-3px); }
  .obj:hover img, .obj:hover .chart { border-color: #ffc86280; }

  /* an object, an exoplanet or a photo: the picture beside the facts */
  .object-top { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; margin-bottom: 32px; }
  .object-top .hero { position: sticky; top: 92px; margin: 0; }
  .object-top .hero img { border-radius: 18px; max-height: 640px; }
  .object-top .hero.sky { overflow: hidden; border-radius: 18px; }
  .object-top .hero figcaption { padding: 8px 2px 0; font-size: 13px; }
  .object-top .hero.sky figcaption { padding: 8px 14px 12px; }
  .object-top .photo-full img { max-height: 76vh; }
  .object-info .page-title { margin-top: 10px; }
  .photos { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
  .photos.big { grid-template-columns: repeat(6, minmax(0, 1fr)); }

  /* long lists run in two columns */
  #exo-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 36px; }
}

/* ---- the pages search engines find (pages.js) ----
   They are plain pages, not the app, so on a phone they keep a compact header and footer of their own: the brand,
   then a row of links that scrolls sideways. From 1000px wide they use the site bar above. */
.page-nav, .page-foot { display: block; }
.page-nav { border-bottom: 1px solid #ffffff12; background: #060a18d9; }
.page-nav .site-nav-inner { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px 6px; }
.page-nav .site-brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 17px; }
.page-nav .site-brand img { width: 30px; height: 30px; border-radius: 8px; }
.page-nav nav { display: flex; gap: 2px; margin: 0 -16px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.page-nav nav a { flex: none; padding: 10px 8px; color: var(--muted); font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.page-nav nav a[aria-current] { color: var(--gold); }
.page-foot { margin-top: 8px; border-top: 1px solid #ffffff12; }
.page-foot .site-foot-inner { display: flex; flex-direction: column; gap: 8px; padding: 18px 16px 32px; color: var(--dim); font-size: 14px; }
.page-foot a { color: var(--muted); }
.crumbs { margin: 0 2px 10px; font-size: 13px; color: var(--dim); }
.crumbs a { color: var(--muted); text-decoration: none; }
.page-sub { margin: 22px 2px 4px; font-size: 21px; letter-spacing: -0.01em; }
.next-moon h2 { font-size: 22px; }
.moon-list .exo-row { padding: 10px 2px; }
@media (min-width: 1000px) {
  .page-nav .site-nav-inner { flex-direction: row; gap: 24px; padding: 0 32px; }
  .page-nav nav { margin: 0; padding: 0; overflow: visible; }
  .page-nav nav a { padding: 8px 12px; border-radius: 10px; }
  .page-foot .site-foot-inner { flex-direction: row; padding: 22px 32px 36px; }
  .page .card, .page .row, .page .lead, .page > p { max-width: 880px; }
}

@media (min-width: 1300px) {
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
