/* In the Beginning: a calm, editorial daily record. One accent colour, hairlines instead of
   boxes, serif for reading and sans for data. System fonts only; no external resources.
   Colours live on :root so dark mode is one override block. */
:root {
  --paper: #f6f4ee;
  --ink: #1a1917;
  --muted: #6b675d;
  --rule: #dcd8cc;
  --series: #2a78d6;
  --series-fill: rgba(42, 120, 214, 0.1);
  --link: #1c5cab;
  --ok: #2f7a3d;
  --warn: #9a6a00;
  --warn-bg: #f9f1dc;
  /* The Moon: dark disc, lit part in paper colour, so a full moon reads as bright. */
  --moon-dark: #3a3833;
  --moon-lit: #fbfaf6;

  --serif: Charter, "Iowan Old Style", "Bitstream Charter", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --prose: 46rem;
  --gutter: 16px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151411;
    --ink: #ece8df;
    --muted: #a39e92;
    --rule: #302e29;
    --series: #5c9ded;
    --series-fill: rgba(92, 157, 237, 0.14);
    --link: #8ab8f0;
    --ok: #7fc98b;
    --warn: #e0b25a;
    --warn-bg: #2c2516;
    --moon-dark: #2a2824;
    --moon-lit: #ece8df;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 16 px on phones, 17 px from tablet width up; every rem below scales with it. */
html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (min-width: 40rem) {
  html {
    font-size: 106.25%;
  }

  :root {
    --gutter: 32px;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  overflow-wrap: break-word;
  font-variant-numeric: tabular-nums;
}

/* One centred column for reading; the measurements grid may run wider. */
.wrap {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 var(--gutter) 3rem;
}

.masthead,
main > *,
.footer {
  max-width: var(--prose);
  margin-left: auto;
  margin-right: auto;
}

main > .wide {
  max-width: none;
}

a {
  color: var(--link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent);
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-color: currentColor;
}

a:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--series);
  outline-offset: 2px;
  border-radius: 2px;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 2rem;
  margin: 2rem 0 0.75rem;
}

h2 {
  font-size: 1.5rem;
  margin: 3rem 0 0.75rem;
}

h3 {
  font-size: 1.1rem;
  margin: 0 0 0.25rem;
}

p {
  margin: 0 0 0.75rem;
}

code {
  font-family: var(--mono);
  font-size: 0.85em;
}

.muted {
  color: var(--muted);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.eyebrow {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  line-height: 1.4;
  margin: 0 0 0.5rem;
}

/* Prose: serif, comfortable measure. */
.lead,
.description,
article:not(.cell) > p:not(.value):not(.asof),
.note-missing,
.notes-list p,
.lede,
.sky-lines p {
  font-family: var(--serif);
  line-height: 1.6;
  max-width: 68ch;
}

.lede {
  color: var(--muted);
}

.lead,
.description {
  font-size: 1.1rem;
}

/* Masthead */
.masthead {
  padding: 2.5rem 0 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.masthead h1 {
  font-size: 2rem;
  margin: 0 0 0.35rem;
}

@media (min-width: 40rem) {
  .masthead h1 {
    font-size: 2.75rem;
  }

  h1 {
    font-size: 2.25rem;
  }
}

.tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.today {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.masthead-compact {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 1.25rem 0 0.9rem;
}

.site-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  margin: 0;
}

.site-title a {
  color: var(--ink);
  text-decoration: none;
}

/* Status: one small line with a coloured dot; a tinted band only when something is behind. */
.status {
  margin-top: 1.25rem;
  font-size: 0.875rem;
}

.status p {
  margin: 0;
}

.status p::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--ok);
  margin-right: 0.5rem;
  vertical-align: 0.05em;
}

.status-behind {
  background: var(--warn-bg);
  border-left: 4px solid var(--warn);
  padding: 0.5rem 0.75rem;
}

.status-behind p::before {
  background: var(--warn);
}

.status-behind p + p {
  margin-top: 0.25rem;
}

.status h1 {
  font-size: 1.5rem;
  margin: 0.25rem 0 0.5rem;
}

.status h1::before {
  content: none;
}

/* The note: the hero of the page. */
.note {
  margin-top: 2.5rem;
}

.note-body p {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.65;
  margin: 0 0 1em;
  max-width: 68ch;
}

.note-body p:first-child::first-letter {
  float: left;
  font-family: var(--serif);
  /* Three lines tall: two line-heights (2 × 1.65) plus a cap height, at about 0.7 em per cap. */
  font-size: 5.45em;
  line-height: 0.78;
  padding: 0.04em 0.07em 0 0;
  color: var(--ink);
}

.note-body::after {
  content: "";
  display: block;
  clear: both;
}

.note-missing {
  font-size: 1.15rem;
  color: var(--muted);
}

.note-link,
.meta {
  font-size: 0.875rem;
  color: var(--muted);
}

/* Measurements: hairline-separated cells, no boxes. */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-bottom: 1px solid var(--rule);
}

.cell {
  position: relative;
  padding: 1.25rem 0 1.25rem;
  border-top: 1px solid var(--rule);
  min-width: 0;
}

@media (min-width: 40rem) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cell:nth-child(2n) {
    border-left: 1px solid var(--rule);
    padding-left: 1.5rem;
  }

  .cell:nth-child(2n + 1) {
    padding-right: 1.5rem;
  }
}

@media (min-width: 64rem) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cell:nth-child(n) {
    border-left: 0;
    padding: 1.25rem 1.5rem;
  }

  .cell:nth-child(3n + 2),
  .cell:nth-child(3n + 3) {
    border-left: 1px solid var(--rule);
  }

  .cell:nth-child(3n + 1) {
    padding-left: 0;
  }

  .cell:nth-child(3n + 3) {
    padding-right: 0;
  }
}

.cell-name a {
  color: var(--muted);
  text-decoration: none;
}

/* The name link covers the whole cell; the source link sits above it. */
.cell-name a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.cell-name a:focus-visible {
  outline: none;
}

.cell-name a:focus-visible::after {
  outline: 2px solid var(--series);
  outline-offset: -2px;
}

.cell:hover .cell-name a {
  color: var(--link);
}

.cell-source a {
  position: relative;
  z-index: 1;
}

.value {
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0.15rem 0 0.2rem;
}

.value .unit {
  font-size: 1rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}

.value-none,
.value-none span {
  font-size: 1rem;
  font-weight: 400;
  color: var(--muted);
}

.value-large {
  font-size: 2.5rem;
}

.value-large .unit {
  font-size: 1.15rem;
}

.asof {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.compare {
  font-size: 0.9rem;
  margin: 0.35rem 0 0;
}

.cell-source {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.75rem 0 0;
}

/* Charts: the SVG stretches to the plot box; labels are HTML around it. */
.chart {
  margin: 0.9rem 0 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "y plot"
    ". x"
    "cap cap";
  column-gap: 0.45rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.chart-y {
  grid-area: y;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: right;
  line-height: 1;
}

.chart-plot {
  grid-area: plot;
  position: relative;
  height: 56px;
}

.chart-detail {
  font-size: 0.8rem;
  margin-top: 2rem;
}

.chart-detail .chart-plot {
  height: 240px;
  touch-action: pan-y;
  cursor: crosshair;
}

@media (min-width: 40rem) {
  .chart-detail .chart-plot {
    height: 320px;
  }
}

.chart svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-x {
  grid-area: x;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.3rem;
}

.chart figcaption {
  grid-area: cap;
  padding-top: 0.6rem;
  font-size: 0.85rem;
}

.chart-line {
  stroke: var(--series);
}

.chart-area {
  fill: var(--series-fill);
}

.chart-grid {
  stroke: var(--rule);
  stroke-width: 1;
}

.chart-cross {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--muted);
  pointer-events: none;
}

.chart-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--series);
  border: 2px solid var(--paper);
  pointer-events: none;
}

.chart-tip {
  position: absolute;
  top: 0.25rem;
  margin: 0 0.5rem;
  padding: 0.3rem 0.55rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
}

.chart-cross[hidden],
.chart-dot[hidden],
.chart-tip[hidden] {
  display: none;
}

.chart-empty {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.75rem 0 0;
}

/* Rows: earthquakes and asteroids. */
.rows {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--rule);
}

.row {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr);
  column-gap: 0.75rem;
  align-items: baseline;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.95rem;
}

.row-mag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  align-self: center;
}

.row-mag strong {
  font-weight: 600;
  min-width: 1.8em;
}

.quake-dot {
  flex: none;
  fill: var(--series);
}

.row-main a {
  text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent);
}

.row-meta {
  grid-column: 2;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (min-width: 40rem) {
  .row {
    grid-template-columns: 4.25rem minmax(0, 1fr) auto;
  }

  .row-meta {
    grid-column: 3;
    text-align: right;
  }
}

/* Asteroids: name, then when, distance and speed on their own lines on phones. */
/* Phones: name, then when, then distance with the speed at the right. */
.row-asteroid {
  grid-template-columns: minmax(0, 1fr) auto;
  row-gap: 0.15rem;
}

.row-asteroid > .row-main,
.row-asteroid > .row-meta:nth-of-type(2) {
  grid-column: 1 / -1;
  text-align: left;
}

.row-asteroid > .row-dist {
  grid-column: 1;
}

.row-asteroid > .row-meta:last-child {
  grid-column: 2;
  text-align: right;
}

@media (min-width: 40rem) {
  .row-asteroid {
    grid-template-columns: 6.5rem minmax(0, 1fr) auto 4.75rem;
  }

  .row-asteroid > .row-main {
    grid-column: 1;
  }

  .row-asteroid > .row-meta:nth-of-type(2) {
    grid-column: 2;
    text-align: left;
  }

  .row-asteroid > .row-dist {
    grid-column: 3;
  }

  .row-asteroid > .row-meta:last-child {
    grid-column: 4;
    text-align: right;
  }
}

.row-asteroid strong {
  font-weight: 600;
}

.row-dist {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.row-dist .muted {
  font-size: 0.85rem;
}

.ld-bar {
  flex: none;
}

.ld-track {
  fill: var(--rule);
}

.ld-fill {
  fill: var(--series);
}

.ld-near .ld-fill {
  fill: var(--warn);
}

.more {
  margin: 0;
}

.more summary {
  cursor: pointer;
  padding: 0.6rem 0;
  font-size: 0.9rem;
  color: var(--link);
  border-bottom: 1px solid var(--rule);
}

.more .rows {
  border-top: 0;
}

/* The sky */
.sky {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 1.25rem 0;
}

@media (min-width: 40rem) {
  .sky {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 1.75rem;
    align-items: start;
  }
}

.sky-lines p {
  margin-bottom: 0.6rem;
}

.sky-lines p:last-child {
  margin-bottom: 0;
}

.moon-dark {
  fill: var(--moon-dark);
}

.moon-lit {
  fill: var(--moon-lit);
}

.moon-edge {
  stroke: var(--muted);
  stroke-width: 1;
}

.live-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  border: 1px solid var(--series);
  vertical-align: 0.05em;
  animation: pulse 2s ease-in-out infinite;
}

.live-dot.is-live {
  background: var(--series);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot {
    animation: none;
  }
}

.credit {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

/* Signal page */
.signal-title {
  margin-top: 2.25rem;
}

.signal-value {
  margin: 0.5rem 0 1.25rem;
}

.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  margin: 1.75rem 0 0;
  border-top: 1px solid var(--rule);
  font-size: 0.95rem;
}

.facts dt,
.facts dd {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  margin: 0;
}

.facts dt {
  color: var(--muted);
  padding-right: 1.5rem;
}

.table-wrap {
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.table-wrap summary {
  cursor: pointer;
  color: var(--link);
}

.table-scroll {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}

caption {
  text-align: left;
  color: var(--muted);
  padding: 0.75rem 0 0.5rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.4rem 0.75rem 0.4rem 0;
  border-bottom: 1px solid var(--rule);
}

th {
  font-weight: 500;
  color: var(--muted);
}

table.values td:last-child,
table.values th:last-child {
  text-align: right;
  padding-right: 0;
}

/* Notes archive */
.notes-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  border-top: 1px solid var(--rule);
}

.notes-list li {
  border-bottom: 1px solid var(--rule);
  padding: 0.9rem 0 0.6rem;
}

.notes-list h2 {
  font-size: 1.2rem;
  margin: 0 0 0.3rem;
}

.notes-list h2 a {
  color: var(--ink);
  text-decoration: none;
}

.notes-list h2 a:hover {
  color: var(--link);
}

/* About and article pages */
article h2 {
  font-size: 1.35rem;
  margin-top: 2.25rem;
}

article ul.list {
  list-style: none;
  padding: 0;
  border-top: 1px solid var(--rule);
}

article ul.list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}

/* Footer */
.footer {
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
}

.colophon {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 68ch;
}

.footer-links {
  font-size: 0.85rem;
}

.commit code {
  color: var(--muted);
}
