/* kerf.
 *
 * The app is paper-toned and the document is a white sheet on it, so a quote
 * still reads as a thing you could print while the app around it stays quiet.
 * Blue is never decoration: it marks that something happened, or that
 * something is waiting. A count of zero is grey.
 *
 * Type: a grotesque for reading, a mono for labels. Bricolage Grotesque and
 * IBM Plex Mono, both served from this origin, because the site allows no
 * third-party anything. Only the latin subset is carried; anything outside it
 * falls back to the system stack rather than failing. The weights below are
 * the weights the files actually contain, and web/assets/fonts/SOURCES.md
 * says where each one came from.
 */

/* One variable file, 200 to 800. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 100%;
  font-style: normal;
  font-display: swap;
}

/* Two static files. Plex Mono is not variable, so asking for a weight that is
 * not here would have the browser synthesise it, which looks wrong at label
 * sizes. Nothing in this stylesheet asks for one. */
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --ikb: #002FA7;
  --ikb-hover: #00227A;
  --page: #F6F7F7;
  --panel: #ffffff;
  --ink: #101214;
  --muted: #5C6166;
  --border: #DDE0E1;
  --grid: #EEF0F1;
  --bad: #A3261B;
  --good: #16694A;
  --sans: "Bricolage Grotesque", "Helvetica Neue", Inter, Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --wrap: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--page); color: var(--ink); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--ikb); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
::selection { background: #CFD9F2; }

/* A mono label: the smallest unit of the system. Used for column heads, field
 * labels, tile captions and nav, and nowhere else. */
.label, th, nav a, .field span, .tile span, dl.facts dt, .flag, .tagline {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ----------------------------------------------------------------- chrome */
header[hidden] { display: none; }
header {
  display: flex; align-items: center; gap: 22px; padding: 0 24px; height: 58px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.word {
  display: flex; align-items: center; gap: 9px;
  font-size: 21px; font-weight: 800; letter-spacing: -0.055em; color: var(--ink);
}
.word:hover { text-decoration: none; }
.word span { color: var(--ink); }
.word svg { display: block; width: 17px; height: 24px; }
nav { display: flex; gap: 20px; align-items: center; }
nav a { color: var(--muted); }
nav a:hover { color: var(--ink); text-decoration: none; }
nav a.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); padding-bottom: 3px; }
.find { flex: 1; display: flex; justify-content: flex-end; }
.find input {
  width: 100%; max-width: 320px; font: inherit; font-size: 13px; padding: 7px 11px;
  background: var(--page); color: var(--ink); border: 1px solid var(--border); border-radius: 2px;
}
.find input:focus { outline: 2px solid var(--ikb); outline-offset: -1px; border-color: var(--ikb); }
.who { color: var(--muted); font-size: 12px; display: flex; gap: 12px; align-items: center; white-space: nowrap; }

main { max-width: var(--wrap); margin: 0 auto; padding: 30px 24px 90px; }
footer { max-width: var(--wrap); margin: 0 auto; padding: 0 24px 40px; color: var(--muted); font-size: 11.5px; }

h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin: 0 0 4px; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 6px; }
h3 { font-size: 13.5px; font-weight: 600; margin: 22px 0 6px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; max-width: 64ch; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 2px;
  padding: 18px 20px; margin-bottom: 16px;
}
.card > .sub { margin-bottom: 12px; }
.card > table { margin-top: 4px; }

/* ------------------------------------------------------- the desk's tiles */
.tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px; margin: 0 0 22px;
}
.tile {
  display: block; width: 100%; text-align: left; font: inherit;
  background: var(--panel); border: 1px solid var(--border); border-radius: 2px;
  padding: 12px 14px 11px; color: inherit;
}
button.tile { cursor: pointer; }
button.tile:hover { background: var(--panel); border-color: var(--ikb); }
button.tile:focus-visible { outline: 2px solid var(--ikb); outline-offset: 1px; }
.tile b {
  display: block; font-size: 27px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.1;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.tile b.on { color: var(--ikb); }
.tile span { display: block; color: var(--muted); margin-top: 3px; }

/* ----------------------------------------------------------------- tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); border-bottom: 1px solid var(--border); padding: 7px 8px; }
td { padding: 9px 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
tbody tr:last-child td, table tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.blocked td { color: var(--bad); }
tr.option td { color: var(--muted); }
.cite { color: var(--muted); font-size: 11.5px; font-family: var(--mono); }

/* ------------------------------------------------------------------ flags */
.flag {
  display: inline-block; letter-spacing: 0.14em; border: 1px solid var(--border);
  border-radius: 2px; padding: 2px 6px; color: var(--muted); margin-left: 6px;
}
.flag:first-child { margin-left: 0; }
.flag.blocked { color: var(--bad); border-color: currentColor; }
.flag.sub { color: var(--ikb); border-color: currentColor; }
.flag.ok { color: var(--good); border-color: currentColor; }
.pill { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 99px; padding: 2px 10px; }

/* ---------------------------------------------------------------- controls */
button, .button {
  font: inherit; font-size: 13px; font-weight: 500; background: var(--ikb); color: #fff;
  border: 1px solid var(--ikb); border-radius: 2px; padding: 8px 15px; cursor: pointer;
}
button:hover { background: var(--ikb-hover); border-color: var(--ikb-hover); }
button.quiet { background: var(--panel); border-color: var(--border); color: var(--ink); }
button.quiet:hover { background: var(--page); border-color: var(--ink); }
button[disabled] { opacity: 0.4; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; color: var(--muted); margin-bottom: 5px; }
.field small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 4px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 8px 10px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--border); border-radius: 2px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ikb); outline-offset: -1px; border-color: var(--ikb); }
textarea { min-height: 90px; font-family: var(--mono); font-size: 12.5px; }

/* A note is where the app tells you something. Blue when it is news, red when
 * it is a refusal, green when something completed. */
.note { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--ikb);
        padding: 11px 14px; margin: 10px 0; font-size: 13px; }
.note.warn { border-left-color: var(--bad); }
.note.good { border-left-color: var(--good); }
.loading { color: var(--muted); }

.signin { max-width: 380px; margin: 12vh auto; }
.signin .word { font-size: 32px; display: flex; margin-bottom: 4px; }
.signin .word svg { width: 25px; height: 36px; }
.tagline { color: var(--muted); letter-spacing: 0.2em; margin-bottom: 26px; }
.totals { margin-left: auto; max-width: 360px; }
.totals td { border: 0; padding: 4px 8px; }
code.path { color: var(--muted); font-size: 11.5px; font-family: var(--mono); word-break: break-all; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 5px 18px; margin: 0; font-size: 13px; }
dl.facts dt { color: var(--muted); padding-top: 2px; }
dl.facts dd { margin: 0; }
dl.facts.totals { max-width: 380px; margin-left: auto; margin-top: 20px; }
ul.trail { list-style: none; padding: 0; margin: 0; }
ul.trail li { border-left: 2px solid var(--border); padding: 6px 0 10px 14px; }
ul.trail li.unread { border-left-color: var(--ikb); }
ul.trail li.read strong { font-weight: 400; color: var(--muted); }

@media (max-width: 860px) {
  header { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px 16px; }
  .find { order: 3; flex-basis: 100%; justify-content: stretch; }
  .find input { max-width: none; }
  .who { order: 2; margin-left: auto; }
  main { padding: 20px 14px 60px; }
  nav { gap: 14px; }
  dl.facts { grid-template-columns: 1fr; }
  dl.facts dt { margin-top: 8px; }
}

/* -------------------------------------------------------- the document view
 * A white sheet on the app's paper ground, and the only place a rule is
 * drawn in blue: the sheet's head, because a released quote is a thing that
 * happened. */
.document { max-width: 900px; margin: 0 auto; }
.paper { background: var(--panel); color: var(--ink); padding: 46px 48px; border: 1px solid var(--border); border-radius: 2px; }
.paper .word { font-size: 25px; }
.paper .word svg { width: 20px; height: 29px; }
.paper-head { border-bottom: 3px solid var(--ikb); padding-bottom: 14px; margin-bottom: 18px; }
.paper .meta { display: flex; flex-wrap: wrap; gap: 8px 36px; margin-top: 14px; font-size: 13px; }
.paper .meta b { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em;
                 text-transform: uppercase; font-weight: 500; color: var(--muted); }
.paper h3 { font-size: 14px; margin: 26px 0 6px; }
.paper th { border-bottom: 1px solid var(--ink); }
.paper td { border-bottom: 1px solid var(--grid); }
.paper .note { background: var(--page); }
.paper-totals table { max-width: 380px; margin: 24px 0 0 auto; }
.paper-totals td { border: 0; padding: 4px 8px; }
.paper-foot { margin-top: 32px; border-top: 1px solid var(--border); padding-top: 12px; color: var(--muted); font-size: 11.5px; }
@media print {
  header, footer, .document > .row { display: none; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .paper { padding: 0; border: 0; border-radius: 0; }
}
