/* The website is the same document the bot prints, unfolded.
 *
 * There is no dark mode. The identity is buff survey paper with black ink, and
 * a paper document does not have a night version — inverting it would produce
 * the generic dark-dashboard look the whole design was chosen to avoid. Every
 * colour is therefore stated explicitly so the browser's preference cannot
 * repaint it.
 */

:root {
  --paper: #d6cab0;
  --paper-light: #e3dac5;
  --paper-deep: #c4b596;
  --ink: #26211b;
  /* Measured against the paper: the old --ink-soft came out at 3.7:1 and
     --ink-faint at 1.9:1, both under the 4.5:1 body text needs. These are
     5.7:1 and 3.3:1. Anything a reader has to read uses ink or ink-soft;
     ink-faint is for rules and marks that are not words. */
  --ink-soft: #4f463a;
  --ink-faint: #756a5b;
  --stamp: #a8281f;
  --water: #8b9f96;
  --brass: #c9a227;

  --display: "Futura", "Avenir Next Condensed", "Jost", "Century Gothic",
    "URW Gothic", "Trebuchet MS", sans-serif;
  --stamp-face: "American Typewriter", "Courier Prime", "Nimbus Mono PS",
    "Courier New", monospace;
  --data: "Menlo", "DejaVu Sans Mono", "Courier New", monospace;

  --rule: 1px solid rgba(38, 33, 27, 0.28);
  --measure: 1180px;
}

* { box-sizing: border-box; }

html {
  background: var(--paper-deep);
  color-scheme: only light;
}

body {
  margin: 0;
  padding: 0 20px 90px;
  background:
    /* The grain. A single repeating SVG turbulence, the same one the rendered
       sheets use, so the page and the attachments read as one stock. */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.028'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(170deg, var(--paper-light), var(--paper) 45%, var(--paper-deep));
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--display);
  font-size: 17.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.sheet {
  max-width: var(--measure);
  margin: 0 auto;
}

/* ── masthead ───────────────────────────────────────────────────────────── */
header.masthead {
  padding: 46px 0 0;
}

.masthead h1 {
  margin: 0;
  font-size: clamp(34px, 7vw, 62px);
  font-weight: 600;
  letter-spacing: clamp(6px, 1.6vw, 16px);
  line-height: 1;
}

.masthead .sub {
  margin: 10px 0 0 3px;
  font-family: var(--stamp-face);
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.masthead .rule {
  margin-top: 18px;
  border-top: 2px solid var(--ink);
}

nav.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 26px;
  padding: 12px 0 10px;
  border-bottom: var(--rule);
  font-family: var(--stamp-face);
  font-size: 13.5px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

nav.tabs a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
nav.tabs a:hover { color: var(--ink); }
nav.tabs a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--stamp);
}
nav.tabs a:focus-visible {
  outline: 2px solid var(--stamp);
  outline-offset: 3px;
}

/* ── sections ───────────────────────────────────────────────────────────── */
section { margin-top: 44px; }

h2 {
  margin: 0 0 4px;
  font-size: 13px;
  font-family: var(--stamp-face);
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 400;
}

h2 + .rule { border-top: 1px solid var(--ink); margin-bottom: 22px; }

p.lede {
  max-width: 68ch;
  font-size: 18px;
  margin: 0 0 8px;
}

p.note {
  max-width: 72ch;
  color: var(--ink-soft);
  font-size: 15px;
}

/* ── the map ────────────────────────────────────────────────────────────── */
.map-frame {
  border: 2.4px solid var(--ink);
  padding: 10px;
  background: rgba(227, 218, 197, 0.35);
  overflow-x: auto;
}
.map-frame svg { display: block; width: 100%; height: auto; min-width: 640px; }

/* ── stat strip ─────────────────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.stats div {
  padding: 16px 18px 14px;
  border-right: var(--rule);
}
.stats div:last-child { border-right: 0; }
.stats dt {
  font-family: var(--stamp-face);
  font-size: 11.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.stats dd {
  margin: 4px 0 0;
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
}
.stats dd small {
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-soft);
  letter-spacing: 0;
}

/* ── tables ─────────────────────────────────────────────────────────────── */
.scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  min-width: 560px;
}

thead th {
  text-align: left;
  padding: 0 12px 8px 0;
  font-family: var(--stamp-face);
  font-size: 11.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 400;
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}

tbody td {
  padding: 12px 12px 12px 0;
  border-bottom: var(--rule);
  vertical-align: baseline;
}

tbody tr:hover td { background: rgba(227, 218, 197, 0.45); }

td.num, th.num { text-align: right; font-family: var(--data); font-size: 15px; }
td.rank { font-size: 19px; font-weight: 600; color: var(--ink-soft); width: 42px; }
td strong { font-weight: 600; }

.tag {
  display: inline-block;
  font-family: var(--stamp-face);
  font-size: 12px;
  letter-spacing: 1.2px;
  color: var(--ink-soft);
}

.swatch {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 1px solid var(--ink);
  vertical-align: -2px;
  margin-right: 9px;
}

/* A meter that matches the bot's block-character bars. */
.meter {
  display: inline-block;
  width: 92px;
  height: 12px;
  border: 1px solid var(--ink);
  background: rgba(196, 181, 150, 0.5);
  vertical-align: -1px;
  overflow: hidden;
}
.meter i { display: block; height: 100%; }

/* ── district & crew cards ──────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 1px;
  border: 1px solid rgba(38, 33, 27, 0.22);
}

/* The hairline between cards belongs to the cards, not to the grid behind
   them. A background on the grid shows through every trailing empty cell as a
   slab of ink — which is what six cards in a four-column row looked like. */
.card {
  background: linear-gradient(160deg, rgba(227, 218, 197, 0.75), rgba(214, 202, 176, 0.4));
  box-shadow: 0 0 0 1px rgba(38, 33, 27, 0.22);
  padding: 16px 18px 18px;
  min-height: 132px;
}

.card h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.6px;
}

.card .kind {
  font-family: var(--stamp-face);
  font-size: 11.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.card .holder { margin-top: 10px; font-size: 14px; }
.card .blurb {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.45;
}

.pill {
  display: inline-block;
  font-family: var(--stamp-face);
  font-size: 11.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  border: 1px solid currentColor;
  padding: 1px 6px;
  margin-right: 5px;
}
.pill.hot { color: var(--stamp); }
.pill.contested { color: var(--ink); }
.pill.open { color: var(--ink-faint); }

/* ── news ───────────────────────────────────────────────────────────────── */
.news li {
  list-style: none;
  padding: 16px 0;
  border-bottom: var(--rule);
}
.news ul { margin: 0; padding: 0; }
.news h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.news time {
  font-family: var(--stamp-face);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.news p { margin: 6px 0 0; color: var(--ink-soft); font-size: 15px; max-width: 76ch; }

/* ── war ────────────────────────────────────────────────────────────────── */
.war {
  border: 1px solid var(--ink);
  padding: 20px 22px;
  margin-bottom: 18px;
  background: rgba(227, 218, 197, 0.4);
}
.war .sides {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  flex-wrap: wrap;
}
.war .side { font-size: 21px; font-weight: 600; }
.war .tug {
  display: flex;
  height: 26px;
  margin: 14px 0 8px;
  border: 1px solid var(--ink);
  overflow: hidden;
}
.war .tug span { display: block; }
.war .foot {
  font-family: var(--stamp-face);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ── footer ─────────────────────────────────────────────────────────────── */
footer {
  margin-top: 62px;
  padding-top: 16px;
  border-top: 1px solid var(--ink);
  font-family: var(--stamp-face);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
footer a { color: var(--ink); }

a { color: var(--stamp); }
a:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }

.empty {
  padding: 34px 0;
  color: var(--ink-soft);
  font-size: 15px;
}

@media (max-width: 620px) {
  body { padding: 0 14px 60px; }
  header.masthead { padding-top: 30px; }
  .stats dd { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── readability corrections ──────────────────────────────────────────────
 * The header row read as five aligned columns and then Morale, which sat at a
 * different size and to the left of the bar it labels.
 */
thead th { font-size: 12px; letter-spacing: 1.2px; color: var(--ink-soft); }
thead th:last-child { text-align: right; }
td:last-child { text-align: right; }

/* A family has no accounts, and a zero in the members column reads as a bug
 * rather than as the point. */
.dash { color: var(--ink-faint); }

/* Anything a reader has to read gets ink-soft or better; ink-faint is for
 * rules and marks. */
.pill.open { color: var(--ink-soft); }
footer, .foot, .footer { color: var(--ink-soft); }
