/* ---- base ---- */

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 100%;
  line-height: 1.55;
  max-width: 60rem;
  margin: 0 auto;
  padding: 1rem;
  background: #faf8f6;
  color: #1c1917;
}

h1 {
  font-size: 1.7rem;
  margin: 0 0 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #c9c0b8;
}

h2 {
  font-size: 1.2rem;
  color: #b5462f;
  margin: 0 0 0.7rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #e2d9d2;
}

h3 {
  font-size: 1.05rem;
  color: #b5462f;
  margin: 1.2rem 0 0.3rem;
}

p {
  margin: 0 0 0.7rem;
}

/* ---- section panels ---- */

.panel {
  background: #fffdfc;
  border: 1px solid #eae1da;
  border-radius: 4px;
  padding: 1.1rem 1.3rem;
  margin: 1.5rem 0;
}

.panel > *:last-child {
  margin-bottom: 0;
}

.panel-method {
  background: #fdf4f0;
  border-color: #eccfc3;
}

/* one panel per comet in the synopsis section */
.synopsis {
  background: #fffdfc;
  border: 1px solid #eae1da;
  border-radius: 4px;
  padding: 1rem 1.2rem;
  margin: 1.2rem 0;
}

.synopsis > *:last-child {
  margin-bottom: 0;
}

/* ---- page furniture ---- */

.lede {
  font-size: 1.05rem;
}

.jumpto a {
  margin-right: 1.5rem;
  font-weight: bold;
  white-space: nowrap;
}

.video {
  margin: 1.2rem 0 2rem;
  max-width: 560px;
}

.video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
}

.method {
  margin: 0;
}

.comet-notes li {
  margin-bottom: 0.75rem;
}

.disintegrated {
  margin-top: 1rem;
}

.disintegrated strong:first-child {
  color: #b5462f;
}

/* ---- synopsis headings ---- */

.synopsis-title {
  color: #b5462f;
  font-weight: bold;
  margin: 0 0 0.4rem;
}

.synopsis-body {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

/* ---- tables ---- */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.2rem;
}

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

.comet-table th,
.comet-table td {
  border: 1px solid #cfc6be;
  padding: 3px 6px;
  text-align: left;
  vertical-align: top;
}

.comet-table thead th {
  background: #f0ebe6;
  text-align: center;
}

.comet-table th[scope="row"] {
  font-weight: normal;
  white-space: nowrap;
}

.comet-table td.num {
  text-align: right;
  white-space: nowrap;
}

.comet-table tbody tr:nth-child(even) {
  background: #f3efeb;
}

.comet-table caption {
  caption-side: top;
  text-align: left;
  font-size: 0.85rem;
  padding-bottom: 0.3rem;
  color: #444;
}

/* ---- links block ---- */

.links {
  background: #efe9e3;
  padding: 0.6rem 0.8rem;
  margin-top: 1.5rem;
}

.links ul {
  list-style: none;
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

/* ---- small screens ---- */

@media (max-width: 40rem) {
  body { padding: 0.6rem; }
  h1 { font-size: 1.35rem; }
  .jumpto a { display: inline-block; margin-bottom: 0.3rem; }
}

/* ---- synopsis extras ---- */

.finder {
  font-weight: bold;
  white-space: nowrap;
}

.table-note,
.footnote {
  font-size: 0.85rem;
  color: #444;
}

.links h2 {
  font-size: 1rem;
  color: #111;
  margin: 0 0 0.3rem;
  border-bottom: 1px solid #cfc6be;
}

/* ---- visibility tables ---- */

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

/* the visibility column is prose now, so let it breathe */
.vis-table td[data-label="Visibility"] {
  line-height: 1.5;
}

.vis-table th,
.vis-table td {
  border: 1px solid #cfc6be;
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
}

.vis-table thead th {
  background: #f0ebe6;
  white-space: nowrap;
}

.vis-table th[scope="row"] {
  font-weight: normal;
  white-space: nowrap;
  background: #f3efeb;
}

.vis-table td.nv {
  color: #888;
}

.vis-table td.nights {
  white-space: nowrap;
  text-align: center;
}

.vis-table caption {
  caption-side: top;
  text-align: left;
  font-size: 0.85rem;
  padding-bottom: 0.3rem;
  color: #444;
}

/* ================================================================
   MOBILE
   ================================================================ */

/* Keep the latitude column visible while scrolling a wide table */
@media (max-width: 60rem) {
  .vis-table th[scope="row"],
  .comet-table th[scope="row"] {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #f0ebe6;
  }
}

/* Below 34rem the visibility tables restack as one card per latitude */
@media (max-width: 34rem) {

  .panel, .synopsis {
    padding: 0.8rem 0.9rem;
    border-radius: 0;
    margin-left: -0.6rem;
    margin-right: -0.6rem;
  }

  .vis-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .vis-table,
  .vis-table tbody,
  .vis-table tr,
  .vis-table th,
  .vis-table td {
    display: block;
    width: auto;
  }

  .vis-table tr {
    border: 1px solid #cfc6be;
    margin-bottom: 0.8rem;
    padding: 0.2rem 0;
  }

  .vis-table th[scope="row"] {
    position: static;
    background: #f0ebe6;
    font-weight: bold;
    border: 0;
    border-bottom: 1px solid #ccc;
    padding: 0.4rem 0.6rem;
  }

  .vis-table td {
    border: 0;
    padding: 0.3rem 0.6rem;
    display: flex;
    gap: 0.8rem;
    align-items: baseline;
  }

  .vis-table td::before {
    content: attr(data-label);
    font-weight: bold;
    color: #555;
    flex: 0 0 6.5rem;
  }

  /* a single prose column needs no inline label */
  .vis-table td[data-label="Visibility"] { display: block; }
  .vis-table td[data-label="Visibility"]::before { content: none; }

  .vis-table td.nv {
    color: #999;
  }

  .vis-table caption {
    display: block;
    width: 100%;
  }

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

  /* finder chart links get a proper tap target */
  .finder {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.25rem 0.6rem;
    border: 1px solid #b5462f;
    border-radius: 3px;
    text-decoration: none;
    font-size: 0.85rem;
  }
}

/* ---- dark mode, for use at the telescope ---- */

@media (prefers-color-scheme: dark) {
  body { background: #14100f; color: #d8d2cc; }
  h1 { border-bottom-color: #4a4340; }
  h2, h3, .synopsis-title { color: #d98b7a; }
  h2 { border-bottom-color: #332c2a; }
  a { color: #e0a08f; }
  .method { border-left-color: #d98b7a; }
  .vis-table th, .vis-table td,
  .comet-table th, .comet-table td { border-color: #4a4340; }
  .vis-table thead th,
  .comet-table thead th { background: #241d1b; }
  .vis-table th[scope="row"],
  .comet-table th[scope="row"] { background: #1e1817; }
  .comet-table tbody tr:nth-child(even) { background: #1a1514; }
  .vis-table td.nv { color: #7a706b; }
  .panel, .synopsis { background: #1a1514; border-color: #352d2a; }
  .panel-method { background: #241b18; border-color: #4a352e; }
  .links { background: #241d1b; }
  .links h2 { color: #d8d2cc; border-bottom-color: #4a4340; }
  .table-note, .footnote, caption { color: #a9a09a; }
}

/* ---- values extrapolated from stale observations ---- */

.uncertain {
  color: #b5462f;
  font-weight: bold;
  cursor: help;
  margin-left: 0.15em;
}

@media (prefers-color-scheme: dark) {
  .uncertain { color: #e0a08f; }
}