/* Night Fighter Navigator — site stylesheet */

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url(/fonts/SourceSerif4.woff2) format("woff2");
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url(/fonts/SourceSerif4-italic.woff2) format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url(/fonts/SourceSans3.woff2) format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url(/fonts/SourceSans3-italic.woff2) format("woff2");
}

:root {
  --ink: #1a2233;
  --ink-soft: #343d4c;
  --muted: #5a6270;
  --paper: #f3f3ee;
  --paper-deep: #e8e8e1;
  --night: #101a2b;
  --night-text: #dfe2e8;
  --night-muted: #9aa4b5;
  --raf: #4a6a8c;
  --brass: #7c6230;
  --rule: #d3d4cc;
  --log-bg: #ebebe4;

  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;

  --measure: 42rem;
  --margin-col: 22rem;
  --gutter: 3rem;
}

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

html {
  font-size: 106.25%;
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
}
@media (min-width: 900px) {
  html {
    font-size: 112.5%;
  }
}
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: 76rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

a {
  color: var(--raf);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  text-decoration-color: color-mix(in srgb, var(--raf) 55%, transparent);
}
a:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}
:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.5rem 0.9rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  z-index: 10;
}
.skip:focus {
  top: 1rem;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ---------- Site header ---------- */

.site-header {
  background: var(--night);
  color: var(--night-text);
}
.site-header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 3.5rem;
  padding-block: 0.9rem;
}
.site-title {
  color: var(--paper);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.125rem;
  letter-spacing: 0.01em;
}
.site-title:hover {
  color: #fff;
  text-decoration: underline;
}
.site-nav {
  font-family: var(--sans);
  font-size: 0.9375rem;
  display: flex;
  gap: 1.5rem;
}
.site-nav a {
  color: var(--night-text);
  text-decoration: none;
}
.site-nav a:hover {
  color: #fff;
  text-decoration: underline;
}
.site-header :focus-visible {
  outline-color: var(--paper);
}
body.home .site-header .wrap {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
body.home .site-title {
  visibility: hidden;
}

/* ---------- Masthead (home) ---------- */

.masthead {
  background: var(--night);
  color: var(--night-text);
}
.masthead-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  padding-block: 3rem 3.5rem;
}
@media (min-width: 760px) {
  .masthead-grid {
    grid-template-columns: minmax(0, 1fr) minmax(13rem, 16rem);
    gap: 4rem;
    align-items: start;
    padding-block: 4rem 4.5rem;
  }
}
.masthead-title {
  margin: 0;
  font-size: clamp(2.4rem, 6.5vw, 4.4rem);
  line-height: 1.02;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: #fff;
  text-wrap: balance;
}
.masthead-tagline {
  margin: 1.25rem 0 0;
  max-width: 30rem;
  font-size: clamp(1.1rem, 1.9vw, 1.35rem);
  line-height: 1.4;
  font-style: italic;
  color: var(--night-text);
  text-wrap: pretty;
}
.masthead-author {
  margin: 1.25rem 0 0;
  font-family: var(--sans);
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: #fff;
}
.masthead-intro {
  margin: 2.5rem 0 0;
  max-width: 32rem;
  font-size: 1rem;
  color: var(--night-muted);
  text-wrap: pretty;
}
.masthead-start {
  margin: 1.5rem 0 0;
  font-family: var(--sans);
  font-size: 1rem;
}
.masthead-start a {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  text-decoration: none;
  border-radius: 2px;
}
.masthead-start a:hover {
  background: var(--paper);
  color: var(--night);
  border-color: var(--paper);
}
.masthead .photo {
  float: none;
  width: 100%;
  max-width: 16rem;
  margin: 0;
}
.masthead .photo figcaption {
  color: var(--night-muted);
}
.masthead .photo figcaption strong {
  color: var(--night-text);
}
.masthead .photo a,
.masthead .photo-larger a {
  color: var(--night-muted);
}
.masthead .photo-larger a:hover {
  color: #fff;
}
.masthead :focus-visible {
  outline-color: var(--paper);
}

/* ---------- Reading column ---------- */

.reading {
  max-width: var(--measure);
  margin-inline: auto;
  padding-block: 2.5rem 3rem;
}
@media (min-width: 1180px) {
  /* Shift the chapter text left so that photographs can sit in a margin column beside it. */
  .chapter-body.has-photos {
    margin-left: max(0px, calc((100% - var(--measure)) / 2 - (var(--margin-col) + var(--gutter)) / 2));
    margin-right: 0;
  }
}

.reading h1,
.reading h2,
.reading h3 {
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.reading h2 {
  font-size: 1.6rem;
  margin: 0 0 1rem;
}
.reading p {
  margin: 0 0 1.1em;
  text-wrap: pretty;
  hanging-punctuation: first;
}
.reading ul.plain {
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
}
.reading ul.plain li {
  margin-bottom: 0.25em;
}
.signature {
  font-weight: 600;
  margin-top: 1.5rem;
}
cite {
  font-style: italic;
}

.preface {
  padding-top: 3rem;
}

/* ---------- Chapter heading ---------- */

.chapter-head {
  margin-bottom: 2.25rem;
}
.chapter-num {
  font-family: var(--sans);
  font-size: 0.9375rem;
  color: var(--muted);
  margin: 0 0 0.6rem;
}
.chapter-head h1 {
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  margin: 0;
}
.chapter-head .deck {
  margin: 0.75rem 0 0;
  font-size: 1.125rem;
  font-style: italic;
  color: var(--muted);
}
.chapter-head::after {
  content: "";
  display: block;
  width: 3rem;
  height: 2px;
  margin-top: 1.5rem;
  background: var(--brass);
}

/* ---------- Photographs ---------- */

.photo {
  margin: 1.5rem auto 2rem;
  width: 100%;
  max-width: 28rem;
  font-family: var(--sans);
}
.photo-link {
  display: block;
}
.photo img {
  width: 100%;
  background: var(--paper-deep);
}
.photo figcaption {
  margin-top: 0.7rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--muted);
}
.photo figcaption strong {
  display: block;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
}
.photo figcaption p {
  margin: 0 0 0.5em;
  text-wrap: pretty;
}
.photo-larger {
  font-size: 0.8125rem;
}
@media (max-width: 699px) {
  .chapter-text .photo-portrait {
    max-width: 17rem;
  }
}
@media (min-width: 700px) {
  .chapter-text .photo {
    float: right;
    clear: right;
    width: 46%;
    margin: 0.3rem 0 1.25rem 1.75rem;
  }
}
@media (min-width: 1180px) {
  .chapter-text .photo {
    width: var(--margin-col);
    margin: 0.3rem calc(-1 * (var(--margin-col) + var(--gutter))) 1.5rem 0;
  }
}

/* ---------- Log book entries ---------- */

.log {
  position: relative;
  margin: 1.75rem 0;
  padding: 0.9rem 1.1rem 0.7rem;
  background: var(--log-bg);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.log::before {
  content: "Log book";
  position: absolute;
  top: 0.6rem;
  right: 1rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--muted);
}
.log p {
  margin: 0;
  padding: 0.25rem 0;
  border-bottom: 1px dotted var(--rule);
  text-wrap: pretty;
}
.log p:first-child {
  font-weight: 600;
  padding-right: 4.5rem;
}
.log p:last-child {
  border-bottom: 0;
}
.log .log-note {
  font-style: italic;
  font-size: 0.875rem;
}

/* ---------- Footnotes ---------- */

.fnref {
  font-size: 0.7em;
  line-height: 0;
  vertical-align: baseline;
  position: relative;
  top: -0.6em;
}
.fnref a {
  text-decoration: none;
  color: var(--brass);
  font-weight: 600;
  padding: 0 0.1em;
}
.footnotes-heading {
  font-size: 1rem !important;
  margin: 2.5rem 0 0.5rem !important;
  color: var(--muted);
}
.footnotes {
  margin: 0;
  padding-left: 1.4rem;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}
.footnotes li {
  margin-bottom: 0.4em;
}
.footnotes li::marker {
  color: var(--brass);
  font-weight: 600;
}
.fnback {
  text-decoration: none;
  margin-left: 0.25em;
}
:target {
  scroll-margin-top: 4.5rem;
}

/* ---------- Previous / next ---------- */

.pager {
  clear: both;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.pager a {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  color: var(--ink);
}
.pager a:hover .pager-title {
  text-decoration: underline;
}
.pager-next {
  text-align: right;
}
.pager-label {
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--muted);
}
.pager-title {
  font-size: 1.125rem;
  font-weight: 600;
}

/* ---------- Contents ---------- */

.contents-section {
  padding-top: 1rem;
}
ol.contents {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}
ol.contents li {
  border-bottom: 1px solid var(--rule);
}
ol.contents a {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  grid-template-areas: "num ttl" "num deck";
  column-gap: 0.5rem;
  padding: 0.85rem 0.25rem;
  color: var(--ink);
  text-decoration: none;
}
ol.contents a:hover {
  background: var(--paper-deep);
}
ol.contents a:hover .ttl {
  text-decoration: underline;
}
ol.contents .num {
  grid-area: num;
  color: var(--brass);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
}
ol.contents .ttl {
  grid-area: ttl;
  font-size: 1.125rem;
  font-weight: 600;
}
ol.contents .deck {
  grid-area: deck;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--muted);
}
ol.contents li.current a {
  background: var(--paper-deep);
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--night);
  color: var(--night-text);
  margin-top: 3rem;
  font-family: var(--sans);
  font-size: 0.9375rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  padding-block: 3rem 3.5rem;
}
@media (min-width: 760px) {
  .footer-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 4rem;
  }
}
.footer-heading {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 0.75rem;
}
.footer-contents {
  margin: 0;
  padding-left: 1.5rem;
  column-gap: 2rem;
}
@media (min-width: 520px) {
  .footer-contents {
    columns: 2;
  }
}
.footer-contents li {
  margin-bottom: 0.3rem;
  break-inside: avoid;
}
.footer-contents a,
.colophon a {
  color: var(--night-text);
}
.footer-contents a:hover,
.colophon a:hover {
  color: #fff;
}
.colophon p {
  margin: 0 0 0.5rem;
  color: var(--night-muted);
}
.colophon-title {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff !important;
}
.site-footer :focus-visible {
  outline-color: var(--paper);
}

/* ---------- Print ---------- */

@media print {
  html {
    font-size: 11pt;
  }
  body {
    background: #fff;
    color: #000;
  }
  .site-header,
  .site-footer,
  .pager,
  .skip,
  .photo-larger,
  .masthead-start {
    display: none;
  }
  .masthead {
    background: none;
    color: #000;
  }
  .masthead-title,
  .masthead-author {
    color: #000;
  }
  .reading {
    margin-inline: auto;
    max-width: none;
  }
  .chapter-text .photo {
    float: none;
    margin: 1rem 0;
    width: 60%;
  }
  a {
    color: #000;
    text-decoration: none;
  }
}

/* ---------- Editorial notes (not the author's text) ---------- */

.editorial {
  clear: both;
  margin-top: 3.5rem;
  padding: 1.75rem clamp(1rem, 3vw, 2rem) 2rem;
  background: var(--paper-deep);
  border-top: 3px solid var(--brass);
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
@media (min-width: 1180px) {
  .chapter-body.has-photos .editorial {
    width: calc(100% + var(--margin-col) + var(--gutter));
  }
}
.editorial h2 {
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 0.35rem;
  color: var(--ink);
}
.ed-statement {
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
  color: var(--muted);
  max-width: 60ch;
}
.ed-afterword {
  max-width: 62ch;
}
.ed-afterword p {
  margin: 0 0 0.9em;
}
.ed-sources {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0.25rem 0 0;
}
.editorial a {
  color: var(--raf);
}
.ed-map {
  margin: 1.75rem 0 0;
  max-width: 100%;
}
.ed-map svg {
  display: block;
  width: 100%;
  height: auto;
  background: var(--paper);
  border: 1px solid var(--rule);
}
.ed-map figcaption {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 70ch;
}
.ed-map figcaption strong {
  color: var(--ink-soft);
}
.ed-cards-heading {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  color: var(--ink);
}
.ed-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 760px) {
  .ed-cards {
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  }
}
.ed-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 1rem 1.1rem 1.1rem;
}
.ed-card h3 {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0.75rem 0 0.15rem;
  color: var(--ink);
}
.ed-variants {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.ed-facts {
  margin: 0;
  padding-left: 1.1rem;
}
.ed-facts li {
  margin-bottom: 0.35em;
}
.ed-photo {
  margin: -1rem -1.1rem 0;
}
.ed-photo img {
  width: 100%;
  height: auto;
  background: var(--paper-deep);
}
.ed-photo figcaption {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.35rem 1.1rem 0;
}

/* Glossary and about pages */

.editorial-page {
  font-family: var(--serif);
}
.editorial-page .ed-statement {
  font-family: var(--sans);
}
.editorial-page h2 {
  font-size: 1.3rem;
  margin: 2rem 0 0.75rem;
}
.glossary {
  margin: 1.5rem 0 0;
  border-top: 1px solid var(--rule);
}
.gl-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.2rem 1.5rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 700px) {
  .gl-item {
    grid-template-columns: 11rem 1fr;
  }
}
.glossary dt {
  font-weight: 600;
  color: var(--ink);
}
.gl-exp {
  display: block;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--muted);
}
.glossary dd {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.ed-link {
  font-size: 0.8125rem;
  margin-left: 0.4rem;
}
