/*
 * One typeface, one weight, two sizes. Black, greys and near-white; a hex darkens with the share of aircraft
 * that lost reliable GPS. Red marks one thing only: where the interference is estimated to come from.
 * Blue marks ships. Structure is space and hairlines.
 */

@font-face {
  font-family: "Helvetica Now Display";
  src: url("/static/fonts/HelveticaNowDisplayMedium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #fafafa;
  --ink: #0a0a0a;
  --mute: #6b6b6b;
  --rule: #d9d9d9;
  --land: #efefee;
  --red: #e00b00;
  --blue: #1f4fd8;
  --gutter: 16px;
  --size: 17px;
  --lead: 1.38;
}

@media (min-width: 900px) {
  :root {
    --gutter: 24px;
    --size: 18px;
  }
}

* {
  box-sizing: border-box;
}

html {
  font-size: var(--size);
  font-synthesis-weight: none;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Now Display", Helvetica, Arial, sans-serif;
  font-size: 1rem;
  font-weight: 500;
  line-height: var(--lead);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}

main {
  flex: 1;
}

h1,
h2,
h3,
b,
strong,
th,
dt {
  font-size: 1rem;
  font-weight: 500;
  margin: 0;
}

p,
ol,
ul,
dl,
dd {
  margin: 0;
  padding: 0;
}

ol,
ul {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

p a,
dd a {
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--red);
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

/* top and bottom */

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--gutter);
}

.top nav {
  display: flex;
  gap: 1.1em;
}

.top nav a {
  color: var(--mute);
}

.top nav a[aria-current],
.top nav a:hover {
  color: var(--ink);
}

.foot {
  margin-top: 4rem;
  padding: var(--gutter);
  border-top: 1px solid var(--rule);
  color: var(--mute);
  display: grid;
  gap: 0.5rem;
  max-width: 62rem;
  text-wrap: pretty;
}

/* text */

.lead {
  font-size: 1.55rem;
  line-height: 1.16;
  letter-spacing: 0;
  text-wrap: balance;
  max-width: 24em;
}

@media (min-width: 900px) {
  .lead {
    font-size: 2rem;
  }
}

.note,
.crumb {
  color: var(--mute);
  text-wrap: pretty;
}

.crumb a:hover {
  color: var(--red);
}

h2 {
  margin-top: 2.2rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--ink);
}

.column {
  padding: 1.5rem var(--gutter) 0;
  display: grid;
  gap: 1rem;
  max-width: 46rem;
}

.column > p {
  text-wrap: pretty;
}

.column > h2 {
  margin-top: 1.6rem;
}

/*
 * Text beside the map. On a phone: the statement, the map, the rest, in one scroll.
 * On a wide screen the map stands still and only the text pane scrolls.
 */

.split {
  display: grid;
  gap: 1.25rem;
  padding: 1.5rem var(--gutter) 0;
  grid-template-areas: "head" "map" "rest" "foot";
}

.split .side {
  display: contents;
}

.split .head,
.split .rest {
  display: grid;
  gap: 1rem;
  align-content: start;
  min-width: 0;
}

.split .head {
  grid-area: head;
}

.split .rest {
  grid-area: rest;
}

.split .foot {
  grid-area: foot;
  margin: 2rem calc(-1 * var(--gutter)) 0;
}

.mapwrap {
  grid-area: map;
  margin: 0 calc(-1 * var(--gutter));
}

.labels.wide {
  display: none;
}

@media (min-width: 900px) {
  body.panes {
    height: 100vh;
    overflow: hidden;
  }

  body.panes main,
  body.panes #live {
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
  }

  .split {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "side map";
    gap: 0;
    padding: 0;
  }

  .split .side {
    grid-area: side;
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: 1.5rem var(--gutter) 0;
  }

  .split .head {
    margin-bottom: 1.5rem;
  }

  .split .foot {
    margin: 4rem calc(-1 * var(--gutter)) 0;
  }

  .mapwrap {
    margin: 0;
    min-height: 0;
    position: relative;
    overflow: hidden;
  }

  .mapwrap .map {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(100% - var(--gutter));
    height: calc(100% - var(--gutter));
  }

  .labels.wide {
    display: inline;
  }

  .labels.narrow {
    display: none;
  }
}

/* map */

.map {
  display: block;
  width: 100%;
  height: auto;
  background: var(--paper);
}

.map .land {
  fill: var(--land);
}

.map .border {
  fill: none;
  stroke: #cfcfcd;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.hex {
  stroke: var(--paper);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.hex.none {
  fill: #0a0a0a;
  fill-opacity: 0.07;
}

.hex.some {
  fill: #0a0a0a;
  fill-opacity: 0.36;
}

.hex.high {
  fill: #0a0a0a;
  fill-opacity: 0.92;
}

.ship {
  fill: none;
  stroke: var(--blue);
  stroke-opacity: 0.85;
  stroke-width: 2.6;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.ship.still {
  stroke-opacity: 0.22;
}

.r95 {
  fill: var(--red);
  fill-opacity: 0.16;
  stroke: var(--red);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.r68 {
  fill: var(--red);
  fill-opacity: 0.75;
  stroke: none;
}

.map a:hover .r95 {
  fill-opacity: 0.25;
}

.map .town {
  fill: var(--mute);
}

.map .place {
  fill: var(--mute);
  font-family: inherit;
  letter-spacing: 0.01em;
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 0.22em;
  stroke-linejoin: round;
}

/* legend */

.legend {
  display: grid;
  gap: 0.2rem;
  color: var(--mute);
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.6em;
}

.legend svg {
  width: 1.05em;
  height: 1.05em;
  flex: none;
  overflow: visible;
}

/* episode rows */

.rows li {
  border-bottom: 1px solid var(--rule);
}

.rows a {
  display: grid;
  grid-template-columns: 1fr;
  padding: 0.6rem 0;
  column-gap: var(--gutter);
}

.rows .when,
.rows .est {
  color: var(--mute);
}

.rows a:hover span {
  color: var(--red);
}

@media (min-width: 560px) {
  .rows a {
    grid-template-columns: 12.5em 1fr;
  }

  .rows .when {
    grid-row: span 2;
  }

  .rows .est {
    grid-column: 2;
  }
}

.rows .est,
.rows .what {
  text-wrap: pretty;
}

/* facts */

.facts {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--ink);
}

.facts dt {
  color: var(--mute);
  padding-top: 0.55rem;
}

.facts dd {
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--rule);
  text-wrap: pretty;
}

@media (min-width: 560px) {
  .facts {
    grid-template-columns: 12.5em 1fr;
  }

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

  .facts dt {
    padding-right: var(--gutter);
  }
}

/* archive calendar */

.cal {
  display: grid;
  grid-template-columns: 5.2em 1fr;
  row-gap: 5px;
  column-gap: var(--gutter);
  align-items: center;
  margin-top: 0.5rem;
}

.cal .month {
  color: var(--mute);
  white-space: nowrap;
}

.cal .month[aria-current],
.cal .month:hover {
  color: var(--ink);
}

.cal .days {
  display: grid;
  grid-template-columns: repeat(31, minmax(0, 1fr));
  gap: 2px;
  max-width: 31rem;
}

.cal .days a,
.cal .days span {
  aspect-ratio: 1;
  background: #0a0a0a;
}

.cal .days span {
  background: none;
  box-shadow: inset 0 0 0 1px var(--rule);
}

.cal .s0 { opacity: 0.07; }
.cal .s1 { opacity: 0.25; }
.cal .s2 { opacity: 0.45; }
.cal .s3 { opacity: 0.7; }
.cal .s4 { opacity: 1; }

.cal .days a:hover {
  background: var(--red);
  opacity: 1;
}

/* method tables */

table {
  border-collapse: collapse;
  width: 100%;
}

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

th {
  color: var(--mute);
  border-bottom-color: var(--ink);
}

th:first-child,
td:first-child {
  text-align: left;
  padding-left: 0;
}

.scroll {
  overflow-x: auto;
}

.vessel {
  display: grid;
  gap: 0.8rem;
}

.column h3 {
  margin-top: 0.8rem;
}
