/* Fonts, from scripts/fonts.mbtx. Choices in docs/typography.md. */
@font-face {
  font-family: "EB Garamond";
  src: url("./fonts/eb-garamond.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("./fonts/eb-garamond-italic.woff2") format("woff2");
  font-weight: 400 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("./fonts/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("./fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Fira Sans";
  src: url("./fonts/fira-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fira Sans";
  src: url("./fonts/fira-sans-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Fira Sans";
  src: url("./fonts/fira-sans-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fira Sans";
  src: url("./fonts/fira-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Serif CJK TC";
  src: url("./fonts/noto-serif-tc-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Serif CJK TC";
  src: url("./fonts/noto-serif-tc-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("./fonts/atkinson-hyperlegible-next.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("./fonts/atkinson-hyperlegible-next-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

/* Palette and faces. Values and contrast in docs/visual-design.md. */
:root {
  color-scheme: light dark;
  --paper: #f0e7d5;
  --ink: #1b1914;
  --quiet: #6b6254;
  --rule: #c9bca4;
  --accent: #7e2e22;
  --font-display: "EB Garamond", Georgia, serif;
  --font-text: "Newsreader", "EB Garamond", Georgia, serif;
  --font-ui: "Fira Sans", system-ui, sans-serif;
  --font-han: "Noto Serif CJK TC", "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --weight-display: 400;
  --weight-text: 400;
}
/* The player's choice of Type. Not preloaded: the file loads only when a
   rule uses it. The hanzi keep --font-han. */
:root[data-face="legible"] {
  --font-display: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --font-ui: "Atkinson Hyperlegible Next", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1513;
    --ink: #e9e0cf;
    --quiet: #8f9b92;
    --rule: #2b3630;
    --accent: #c6a15b;
    --weight-display: 450;
    --weight-text: 450;
  }
}
/* A ship's page sets its accent inline; the defaults are the fallbacks. */
.ship {
  --accent: var(--ship-accent-light, #7e2e22);
}
@media (prefers-color-scheme: dark) {
  .ship {
    --accent: var(--ship-accent-dark, #c6a15b);
  }
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-synthesis: none;
  line-height: 1.5;
}

p,
.log li {
  text-wrap: pretty;
}

/* Model lines can carry a word wider than a column at large text sizes.
   Breaking it is better than a sideways scroll. */
.checkin p,
.checkin li,
.masthead h1 {
  overflow-wrap: anywhere;
}

.han {
  font-family: var(--font-han);
  font-style: normal;
  font-synthesis: none;
  letter-spacing: 0;
  white-space: nowrap;
}

/* Crossing simulator. Scoped so the game client is unaffected. */
.sim {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem;
}
.sim .controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.75rem;
  align-items: end;
  margin: 1rem 0;
}
.sim .field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sim .field span {
  font-size: 0.875rem;
}
.sim input,
.sim select,
.sim button {
  font: inherit;
  padding: 0.35rem 0.5rem;
}
.sim button {
  justify-self: start;
}
.sim figure {
  margin: 1rem 0;
}
.sim figcaption {
  font-size: 0.875rem;
  max-width: 40rem;
}
.sim .table-scroll {
  overflow-x: auto;
  margin: 1rem 0;
}
.sim table {
  border-collapse: collapse;
  font-size: 0.875rem;
}
.sim caption {
  text-align: start;
  font-weight: 600;
  padding-block-end: 0.25rem;
}
.sim th,
.sim td {
  padding: 0.25em 0.75em;
  border: 0;
  vertical-align: baseline;
  text-align: start;
}
.sim thead th {
  border-block-end: 1px solid currentColor;
}
.sim .num {
  text-align: end;
  font-variant-numeric: tabular-nums lining-nums;
}
.sim details summary {
  font-size: 0.875rem;
  cursor: pointer;
}

/* The check-in. One column at any size; see docs/visual-design.md. */
.checkin {
  max-width: 36rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}
@media (min-width: 40rem) {
  .checkin {
    padding-inline: 1.5rem;
  }
}
.checkin p,
.checkin ul {
  margin-block: 0 0.5rem;
}
.checkin ul {
  padding-inline-start: 1.25rem;
}
.checkin li::marker {
  color: var(--quiet);
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  column-gap: 1rem;
  border-block-start: 3px solid var(--accent);
  padding-block-start: 1rem;
}
/* The title keeps most of the line; at large text or on a narrow phone the
   link wraps under it rather than squeezing it. */
.masthead h1 {
  flex: 1 1 0;
  min-width: min(100%, 7em);
}
/* The way out to the settings menu: quiet, at the top end, off the ship's
   papers. It follows the title in the source. */
.masthead .menu {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  margin-block-start: -0.25rem;
  padding: 0.25rem 0;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  color: var(--quiet);
}
.masthead .menu:hover {
  color: var(--ink);
}
.masthead h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: 2.25rem;
  line-height: 1.05;
  text-wrap: balance;
  text-autospace: normal;
}
@media (min-width: 40rem) {
  .masthead h1 {
    font-size: 2.75rem;
  }
}
.masthead .pennant {
  display: block;
  margin-block-end: 0.5rem;
  font-size: 1rem;
  line-height: 1.5;
}
.masthead .han {
  font-size: 0.8em;
}
.pennant {
  font-family: var(--font-ui);
  font-weight: 500;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums lining-nums slashed-zero;
}

.checkin section {
  margin-block-start: 2rem;
  padding-block-start: 1rem;
  border-block-start: 1px solid var(--rule);
}
.checkin h2,
.checkin h3 {
  margin-block: 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.25rem;
  line-height: 1.2;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.05em;
}

.checkin h2.page {
  margin-block: 1.5rem 0;
  font-size: 2rem;
  font-weight: var(--weight-display);
  font-variant-caps: normal;
  letter-spacing: 0;
}
.checkin h2.page + section {
  margin-block-start: 1rem;
}

.voice {
  margin-block: 0.75rem;
  padding-inline-start: 0.875rem;
  border-inline-start: 2px solid var(--accent);
  font-family: var(--font-text);
  font-weight: var(--weight-text);
  font-optical-sizing: auto;
  font-size: 1.1875rem;
  line-height: 1.4;
}

.checkin .stage {
  margin-block-start: 1rem;
  border-block-start: 0;
  padding-block-start: 0;
}
.stage .stage-voice {
  margin-block: 0.5rem 1rem;
  padding-block: 0.25rem;
  padding-inline-start: 1rem;
  border-inline-start-width: 3px;
  font-size: 1.75rem;
  line-height: 1.25;
}
.stage p {
  margin-block: 0 0.5rem;
}
.readout {
  font-weight: 600;
}
.checkin summary {
  padding-block: 0.625rem;
  font-weight: 500;
  cursor: pointer;
}
.checkin summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.effect-note {
  display: block;
  font-size: 0.875rem;
  color: var(--quiet);
}

.track {
  display: flex;
  gap: 0.25rem;
  margin-block: 0.5rem 0.25rem;
  container-type: inline-size;
  overflow: hidden;
}
.track .stretch {
  min-width: 0;
}
.bar {
  height: 0.375rem;
  background: var(--rule);
}
.fill {
  height: 100%;
  background: var(--accent);
}
.track .label {
  display: block;
  margin-block-start: 0.25rem;
  font-size: 0.875rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  color: var(--quiet);
  white-space: nowrap;
}
.track .now .label {
  color: var(--ink);
  font-weight: 600;
}
/* The same voyage on the worlds' clock, a sliver of it in the burns. No
   numbers: the Instruments table has those. */
.ages {
  margin-block: 0 1rem;
}
.ages .label {
  display: block;
  margin-block-end: 0.25rem;
  font-size: 0.875rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  color: var(--quiet);
}
.ages .agebar {
  display: flex;
  gap: 0.25rem;
  height: 0.25rem;
}
.ages .age {
  min-width: 0;
}
.ages .age .bar {
  height: 100%;
}
/* A bar beside the sentence it repeats; see docs/visual-design.md. */
.measure {
  flex: 1 0 100%;
  margin-block: 0.25rem 0.75rem;
}
.measure .label {
  display: block;
  margin-block-end: 0.25rem;
  font-size: 0.875rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  color: var(--quiet);
}
/* The reckoning: speed over the voyage and tables of figures. The drawings
   are hairlines and repeat the tables; see docs/visual-design.md. */
.chart,
.bow,
.map {
  margin-block: 0.5rem 1.25rem;
}
.chart .plot {
  position: relative;
}
.chart svg {
  display: block;
  width: 100%;
  height: 6rem;
  overflow: visible;
}
/* The ship, over the drawing so the stretched viewBox keeps it round. */
.chart .dot {
  position: absolute;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
}
.chart svg *,
.bow svg *,
.map svg * {
  vector-effect: non-scaling-stroke;
  fill: none;
}
.chart .axis,
.map .lane {
  stroke: var(--rule);
  stroke-width: 1px;
}
.chart .flown,
.map .flown {
  stroke: var(--accent);
  stroke-width: 2px;
}
.chart .ahead,
.map .ahead {
  stroke: var(--quiet);
  stroke-width: 1px;
  stroke-dasharray: 4 3;
}
.chart .now {
  stroke: var(--ink);
  stroke-width: 1.5px;
}
.chart .peak {
  stroke: var(--rule);
  stroke-width: 1px;
  stroke-dasharray: 1 3;
}
.chart .scale,
.bow .scale,
.map .place {
  font-size: 0.875rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  color: var(--quiet);
}
.chart .scale,
.bow .scale {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-block: 0.25rem;
}
.chart .total,
.bow .total {
  font-variant-caps: normal;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums lining-nums;
}
/* The bow sight: the sky ahead on a log tan scale, so aberration slides the
   field toward the bow without changing its shape. Rings are round angles;
   the accent ring holds half the sky. */
.bow .sight {
  position: relative;
  width: min(100%, 22rem);
  aspect-ratio: 1;
  margin: 0.5rem auto 0;
}
.bow svg {
  display: block;
  width: 100%;
  height: 100%;
}
.bow .rim,
.bow .ring {
  stroke: var(--rule);
  stroke-width: 1px;
}
.bow .star {
  fill: var(--ink);
  stroke: none;
}
.bow .half {
  stroke: var(--accent);
  stroke-width: 2px;
}
.bow .cross {
  stroke: var(--accent);
  stroke-width: 1.5px;
}
/* A ring's angle, on the ring above the bow. */
.bow .mark {
  position: absolute;
  left: 50%;
  transform: translate(0.25rem, -100%);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--quiet);
  line-height: 1;
}
.map {
  position: relative;
  overflow: hidden;
}
.map svg {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.map .world {
  fill: var(--ink);
}
.map .sun {
  stroke: var(--quiet);
  stroke-width: 1px;
}
.map .ship {
  fill: var(--accent);
}
.map .other {
  fill: var(--paper);
  stroke: var(--quiet);
  stroke-width: 1px;
}
/* A name sits above its point, centered on it. */
.map .place {
  position: absolute;
  transform: translate(-50%, calc(-100% - 0.4rem));
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
  white-space: nowrap;
}
.map .place.sun {
  transform: translate(-50%, 0.4rem);
}
.map .place.other {
  transform: translate(-50%, calc(-100% - 0.2rem));
  font-variant-caps: normal;
  letter-spacing: 0.04em;
}
.map .name {
  color: var(--ink);
  font-weight: 500;
}
.map .star {
  font-variant-caps: normal;
  letter-spacing: 0;
}
.figures {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin-block: 0 1.25rem;
  font-size: 0.9375rem;
}
.figures th,
.figures td {
  overflow-wrap: anywhere;
}
.figures caption {
  text-align: start;
  margin-block-end: 0.25rem;
  font-weight: 500;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  color: var(--quiet);
  overflow-wrap: anywhere;
}
.figures th,
.figures td {
  padding-block: 0.25rem;
  border-block-end: 1px solid var(--rule);
  vertical-align: baseline;
}
.figures th {
  text-align: start;
  font-weight: 400;
  padding-inline-end: 1rem;
}
.figures td {
  text-align: end;
  font-variant-numeric: tabular-nums lining-nums slashed-zero;
}

/* Rank: the full title as text, the insignia a mark beside it. The glyphs
   ship only in the CJK subset. */
.rank {
  margin-block: 0 1rem;
  font-weight: 600;
}
.insignia {
  font-family: var(--font-han);
  font-variant-emoji: text;
  color: var(--quiet);
  font-weight: 400;
}
.rank-compact {
  white-space: nowrap;
}
.effect {
  font-weight: 500;
}

/* The watch bill: one officer per item, the service number as the name. */
.roster {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}
.roster li {
  padding-block: 0.625rem;
  border-block-end: 1px solid var(--rule);
}
.roster .who {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin-block: 0 0.25rem;
  font-weight: 600;
}
.roster .service {
  font-variant-numeric: tabular-nums lining-nums slashed-zero;
  letter-spacing: 0.06em;
}
.roster .you {
  font-size: 0.875rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  color: var(--quiet);
  font-weight: 500;
}
.roster .duty {
  margin-block: 0 0.125rem;
}
.roster .last {
  margin-block: 0;
  color: var(--quiet);
  font-size: 0.9375rem;
}
.roster .when {
  font-size: 0.875rem;
  white-space: nowrap;
}

/* A service number, set as a designation rather than a word. */
.designation {
  font-variant-numeric: tabular-nums lining-nums slashed-zero;
  letter-spacing: 0.1em;
  font-weight: 500;
}

/* A link that acts as a control, for the settings menu. */
.checkin a.control {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--quiet);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}
.checkin a.control:hover {
  border-color: var(--ink);
}
.checkin a.control:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Below this width the three labels no longer fit, so only the current
   phase keeps its label. em follows the text size. */
@container (max-width: 13em) {
  .track .stretch:not(.now) .label {
    visibility: hidden;
  }
}

.checkin fieldset,
.checkin .choice-row {
  border: 0;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}
.checkin legend {
  padding: 0;
  margin-block-end: 0.375rem;
  font-weight: 500;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  color: var(--quiet);
}
.checkin fieldset p {
  margin: 0;
}
.checkin button {
  font: inherit;
  min-height: 2.75rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--quiet);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  text-align: start;
  min-width: 0;
  overflow-wrap: break-word;
  hyphens: auto;
  cursor: pointer;
  text-autospace: normal;
}
/* The ships to choose from: each title a button, where it is beneath. */
.checkin ul.fleet {
  padding: 0;
  list-style: none;
}
.fleet li {
  margin-block: 0 1.25rem;
}
.fleet button {
  display: block;
  width: 100%;
  margin-block-end: 0.375rem;
}
.fleet .pennant {
  margin-inline-end: 0.25rem;
}
.checkin button:hover {
  border-color: var(--ink);
}
.checkin button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
  font-weight: 600;
}
.checkin button:focus-visible,
[tabindex="-1"]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.checkin button[aria-pressed="true"] .effect-note {
  color: inherit;
}
.checkin button .han {
  font-size: 0.95em;
  font-weight: 500;
}

.log {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}
.log li {
  padding-block: 0.375rem;
  border-block-end: 1px solid var(--rule);
}
.log li.voice {
  padding-inline-start: 0.875rem;
  border-inline-start: 2px solid var(--accent);
  font-family: var(--font-text);
  font-size: 1.1875rem;
  line-height: 1.4;
}
.log li.new {
  border-inline-start: 4px solid var(--accent);
  padding-inline-start: 0.625rem;
}
.log li.voice.new {
  border-inline-start-width: 4px;
}
.log .when,
.stage .when,
.pending {
  color: var(--quiet);
}
.log .when,
.stage .when,
.roster .when {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  white-space: normal;
  overflow-wrap: anywhere;
}
.pending {
  font-family: var(--font-text);
  font-weight: var(--weight-text);
  font-optical-sizing: auto;
  font-style: italic;
}

/* The bar of pages. In the flow at the end of the page; fixed to the bottom
   edge only when the viewport is tall enough that it leaves room to read,
   which a short viewport or 400% zoom is not. em follows the text size. */
.pages {
  display: flex;
  flex-wrap: wrap;
  max-width: 36rem;
  margin: 0 auto;
  padding-inline: 1rem;
  gap: 0.5rem;
  border-block-start: 1px solid var(--rule);
}
.pages a {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.5rem;
  border: 1px solid var(--quiet);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.pages a:hover {
  border-color: var(--ink);
}
.pages a[aria-current="page"] {
  border-block-end: 4px solid var(--ink);
  border-color: var(--ink);
  font-weight: 600;
}
.pages a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.pages .count {
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums lining-nums slashed-zero;
  padding-inline: 0.375rem;
  border: 1px solid currentColor;
  border-radius: 2px;
}
@media (min-height: 34em) {
  .pages {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    padding-block: 0.5rem;
    background: var(--paper);
  }
  .checkin {
    padding-block-end: 6rem;
  }
}

/* Present to screen readers, absent from the page. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (forced-colors: active) {
  .pages a {
    border-color: ButtonText;
  }
  .pages a[aria-current="page"] {
    border-color: Highlight;
    color: Highlight;
  }
  .log li.new {
    border-inline-start-color: Highlight;
  }
  .checkin button {
    border-color: ButtonText;
  }
  .checkin button[aria-pressed="true"] {
    background: Highlight;
    color: HighlightText;
    forced-color-adjust: none;
  }
  .bar {
    background: GrayText;
  }
  .fill {
    background: CanvasText;
  }
}

/* iOS applies Dynamic Type only when the root asks for the body face. */
@supports (font: -apple-system-body) and (-webkit-touch-callout: default) {
  html {
    font: -apple-system-body;
  }
}
