/* pico-ate: the public house style from docs/design/tokens.md.
   The admin has its own plain stylesheet in admin.css. */

@font-face {
  font-family: "Silkscreen";
  src: url("/assets/silkscreen-latin-400-normal-a5bef798.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Silkscreen";
  src: url("/assets/silkscreen-latin-700-normal-a40b5299.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/ibm-plex-sans-latin-400-normal-64251e64.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/ibm-plex-sans-latin-500-normal-290aaea2.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/ibm-plex-sans-latin-600-normal-99b2fa32.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/ibm-plex-mono-latin-400-normal-d803141a.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/ibm-plex-mono-latin-500-normal-3f7bbac1.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  /* Palette, PICO-8 by way of docs/design/tokens.md. */
  --blue: #1d2b53;
  --black: #000000;
  --line: #5f574f;
  --ink: #fff1e8;
  --ink-2: #c2c3c7;
  --accent: #ffec27;
  --link: #ff77a8;
  --link-hover: #ffccaa;
  --ok: #00e436;
  --label: #83769c; /* Only ever on black. */
  --pico8: #29adff;
  --picotron: #00e436;
  --both: #ffa300;

  --display: "Silkscreen", monospace;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --pad-x: 18px;
  --sidebar: 250px;
  --gap: 28px;

  --text: #222;
  --background: #fff;
}

body {
  max-width: 64em;
  margin: 0 auto;
  padding: 1rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--background);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Public */

body.public {
  max-width: none;
  margin: 0;
  padding: 0;
  font-family: var(--body);
  font-size: 15px;
  color: var(--ink);
  background: var(--blue);
}

body.public a {
  color: var(--link);
  text-decoration: none;
}

body.public a:hover,
body.public a:focus-visible {
  color: var(--link-hover);
  text-decoration: underline;
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px var(--gap);
  padding: 14px var(--pad-x);
  border-bottom: 2px solid var(--black);
}

.logo {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

body.public .logo,
body.public .logo:hover {
  color: var(--accent);
  text-decoration: none;
}

.wordmark {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1;
}

.tagline {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--ink-2);
}

.pages {
  display: flex;
  gap: 26px;
  font-size: 15px;
  font-weight: 500;
}

body.public .pages a[aria-current] {
  color: var(--accent);
}

.button {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 10px 16px;
  border: 2px solid var(--black);
  font-family: var(--display);
  font-size: 13px;
}

body.public .button,
body.public .button:hover {
  color: var(--blue);
  background: var(--accent);
  text-decoration: none;
}

.intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 24px var(--pad-x) 16px;
}

.intro h1 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 400;
  color: var(--ink);
}

.lede {
  margin: 0;
  max-width: 680px;
  line-height: 1.5;
  color: var(--ink-2);
}

.stamp {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}

.board {
  display: grid;
  gap: 14px;
  padding: 0 var(--pad-x) 24px;
}

.card {
  background: var(--black);
  border: 2px solid var(--line);
}

/* Categories */

.label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--ink-2);
}

.categories {
  align-self: start;
}

.category-select {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 2px solid var(--line);
  font-family: var(--body);
  font-size: 16px;
  color: var(--ink);
  background: var(--black);
}

.toc summary {
  padding: 12px 14px;
  font-weight: 600;
  cursor: pointer;
}

.toc summary .current {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--label);
}

.toc nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

body.public .toc a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  border-left: 4px solid transparent;
  font-size: 13px;
  line-height: 1.3;
  color: var(--ink);
  text-decoration: none;
}

body.public .toc a:hover {
  color: var(--accent);
}

body.public .toc a[aria-current="true"] {
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.toc .count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--label);
}

/* The table of links */

.table .columns,
.table .row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px 14px;
  padding: 12px 14px;
}

.table .columns {
  border-bottom: 2px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--label);
}

.table .row {
  border-bottom: 1px solid var(--line);
}

.table .row:last-child {
  border-bottom: 0;
}

.title {
  font-weight: 600;
}

body.public .title a {
  color: var(--ink);
}

body.public .title a:hover {
  color: var(--link-hover);
}

.where {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The suggest form */

.suggest,
.notes {
  padding: 18px;
}

/* The fields of every kind flow in one wrapping row, the way the board sets
   them, so a pair sits side by side even when the two belong to different
   kinds. The groups themselves are only there to be shown or hidden. */
.suggest {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px 12px;
}

.suggest .group {
  display: contents;
}

/* A class beats the browser's own [hidden] rule, so it has to say this. */
.suggest .group[hidden] {
  display: none;
}

.suggest .field,
.suggest .kinds,
.suggest .form-errors {
  flex: 0 0 100%;
}

.kinds {
  margin: 0;
  padding: 0;
  border: 0;
}

.kinds .label {
  margin-bottom: 8px;
}

/* Five on a desktop row, three then two on a phone. */
.kind-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

/* The radio stays where a keyboard and a screen reader can reach it; it is
   only the sight of it that goes, since the label is the button. */
.kind-grid input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.kind {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border: 2px solid var(--line);
  background: var(--black);
  color: var(--ink);
  cursor: pointer;
}

.kind-name {
  font-family: var(--display);
  font-size: 14px;
}

.kind-what {
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-2);
}

/* Which one is chosen is the browser's business, not JavaScript's. */
.kind-grid input:checked + .kind {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--blue);
}

.kind-grid input:checked + .kind .kind-what {
  color: var(--blue);
}

.kind-grid input:focus-visible + .kind {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.suggest input[type="text"],
.suggest input[type="email"],
.suggest select,
.suggest textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  border: 2px solid var(--line);
  font-family: var(--body);
  font-size: 15px;
  color: var(--ink);
  background: var(--blue);
}

.suggest textarea {
  resize: vertical;
}

.suggest .hint {
  margin: 5px 0 0;
  font-size: 13px;
  color: var(--ink-2);
}

.suggest .form-errors {
  margin: 0;
  padding: 12px 14px;
  border: 0;
  border-left: 4px solid var(--link);
  background: var(--blue);
  list-style: none;
  color: var(--ink);
}

.suggest input[type="submit"] {
  padding: 10px 16px;
  border: 2px solid var(--black);
  font-family: var(--display);
  font-size: 13px;
  color: var(--blue);
  background: var(--accent);
  cursor: pointer;
}

.notes h2 {
  margin: 0 0 8px;
  border: 0;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 400;
  color: var(--accent);
}

.notes h2 + ul {
  margin: 0 0 18px;
}

.notes ul {
  padding-left: 18px;
  font-size: 14px;
  color: var(--ink-2);
}

.notes li {
  margin-bottom: 6px;
}

.colophon {
  margin-top: auto;
  padding: 20px var(--pad-x);
  border-top: 2px solid var(--black);
  font-size: 13px;
  color: var(--ink-2);
}

@media (min-width: 48em) {
  :root {
    --pad-x: 56px;
  }

  .kind-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .suggest .field.wide {
    flex-basis: 60%;
  }

  .suggest .field.half {
    flex-basis: calc(50% - 6px);
  }

  .suggest .field.quarter {
    flex-basis: calc(25% - 9px);
  }

  body.public {
    font-size: 14px;
  }

  .masthead {
    padding: 18px var(--pad-x);
    gap: 32px;
  }

  .wordmark {
    font-size: 22px;
  }

  .tagline {
    font-size: 11px;
  }

  .intro {
    padding: 40px var(--pad-x) 24px;
  }

  .intro h1 {
    font-size: 30px;
  }

  .board {
    grid-template-columns: var(--sidebar) 1fr;
    gap: var(--gap);
  }

  /* Two classes, so this outranks .board whatever the order of the two. */
  .board.board-suggest {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }

  .board-suggest .notes {
    align-self: start;
  }

  /* Tall enough windows keep the whole list in view; short ones scroll it. */
  .categories {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }

  .label,
  .toc summary {
    display: none;
  }

  .table .columns,
  .table .row {
    grid-template-columns: 1fr 150px 170px;
    align-items: baseline;
    padding: 12px 18px;
  }
}
