/* ---------------------------------------------------------------------------
   Fabula One documentation.

   The tokens are the landing page's, which are the app's. Light is the printed
   page, dark is the editor, and both grounds come from the product — so the
   site, the docs and the thing they describe are visibly one object rather
   than three designs that happen to share a name.

   One stylesheet for every page, linked rather than inlined: there are ten
   pages here and one of them is generated, so a change to the type scale must
   not mean ten edits and a rebuild.
   --------------------------------------------------------------------------- */

/* Served from this site, not from Google: loading a font from a third party
   sends every visitor's IP address to it. See scripts/fonts.mjs. */
@import url('/fonts/fonts.css');

:root {
  --paper: #ffffff;
  --paper-2: #f6f4f0;
  --ink: #16181d;
  --ink-soft: #5a5f6a;
  --ink-faint: #6f737d;
  --rule: #ded9cf;
  --amber: #9c6614;
  --amber-flat: #e0a144;
  --meta: #4a5b8c;
  --shadow: 0 1px 2px rgba(22, 24, 29, 0.06), 0 12px 32px rgba(22, 24, 29, 0.07);

  --measure: 44rem;
  color-scheme: light dark;
}

/* System-dark: the un-stamped default most viewers see. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #1b1d23;
    --paper-2: #23262e;
    --ink: #e7e9ee;
    --ink-soft: #9aa0ab;
    --ink-faint: #8c939f;
    --rule: #33373f;
    --amber: #e0a144;
    --amber-flat: #e0a144;
    --meta: #7c88a8;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme='dark'] {
  --paper: #1b1d23;
  --paper-2: #23262e;
  --ink: #e7e9ee;
  --ink-soft: #9aa0ab;
  --ink-faint: #8c939f;
  --rule: #33373f;
  --amber: #e0a144;
  --amber-flat: #e0a144;
  --meta: #7c88a8;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Archivo, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 24px;
}

/* The template catalogue and the element table both want more room than
   prose does; 44rem is a measure for reading, not for tables. */
.wrap--wide {
  max-width: 54rem;
}

a {
  color: var(--amber);
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------------- Masthead ---------------- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  padding: 22px 0 0;
}

.wordmark {
  font-size: 19px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: var(--ink);
  text-decoration: none;
}

.wordmark b {
  font-weight: 700;
}

.wordmark span {
  font-weight: 400;
}

.wordmark i {
  color: var(--amber-flat);
  font-style: normal;
}

.masthead-nav {
  display: flex;
  gap: 20px;
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 12.5px;
}

.masthead-nav a {
  color: var(--ink-faint);
  text-decoration: none;
}

.masthead-nav a:hover {
  color: var(--amber);
}

/* ---------------- Page furniture ---------------- */

.crumbs {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 12.5px;
  color: var(--ink-faint);
  margin: 40px 0 18px;
}

.crumbs a {
  color: var(--ink-faint);
}

.crumbs span {
  opacity: 0.5;
  margin: 0 4px;
}

h1 {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 700;
  text-wrap: balance;
  margin: 0 0 18px;
}

.lede {
  font-size: 1.13rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 30px;
  text-wrap: pretty;
}

h2 {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--meta);
  font-family: 'Courier Prime', 'Courier New', monospace;
  border-top: 1px solid var(--rule);
  padding-top: 14px;
  margin: 52px 0 20px;
}

h3 {
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 34px 0 8px;
}

h4 {
  font-size: 0.98rem;
  font-weight: 600;
  margin: 24px 0 6px;
}

p {
  margin: 0 0 16px;
  text-wrap: pretty;
}

.prose {
  color: var(--ink-soft);
}

/* The one sentence on a page that is worth reading if you read nothing else. */
.key {
  font-size: 1.06rem;
  color: var(--ink);
  border-left: 3px solid var(--amber-flat);
  padding: 2px 0 2px 18px;
  margin: 26px 0;
}

ul,
ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--ink-soft);
}

li {
  margin: 0 0 8px;
}

li > strong {
  color: var(--ink);
}

/* ---------------- Keys, code, format ---------------- */

kbd {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 0.85em;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 6px;
  color: var(--ink);
  white-space: nowrap;
}

code {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 0.9em;
  background: var(--paper-2);
  border-radius: 2px;
  padding: 1px 5px;
}

pre {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 20px;
}

pre code {
  background: none;
  padding: 0;
}

/* ---------------- Tables ---------------- */

.table-scroll {
  overflow-x: auto;
  margin: 0 0 22px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

th {
  text-align: left;
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--meta);
  font-weight: 400;
  border-bottom: 1px solid var(--rule);
  padding: 0 16px 8px 0;
  white-space: nowrap;
}

td {
  border-bottom: 1px solid var(--rule);
  padding: 10px 16px 10px 0;
  color: var(--ink-soft);
  vertical-align: top;
}

td:first-child {
  color: var(--ink);
  white-space: nowrap;
}

/* ---------------- Figures ---------------- */

figure {
  margin: 28px 0;
}

figure img,
figure svg {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper-2);
}

/* A diagram draws its own frame; a screenshot needs one. */
figure svg {
  border: 0;
  background: none;
}

figcaption {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: 10px;
  text-wrap: pretty;
}

/* ---------------- A specimen of the page ---------------- */

.script {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
  background: #ffffff;
  color: #16181d;
  border: 1px solid var(--rule);
  border-radius: 2px;
  box-shadow: var(--shadow);
  padding: 26px 24px;
  margin: 0 0 22px;
  overflow-x: auto;
}

.script .slug {
  font-weight: 700;
  margin: 0 0 12px;
}

.script .act {
  color: #4a5b8c;
  font-weight: 700;
  margin: 0 0 4px;
}

.script .syn {
  color: #4a5b8c;
  font-style: italic;
  margin: 0 0 12px;
}

.script .cue {
  margin: 12px 0 0 3.7em;
}

.script .dlg {
  margin: 0 0 0 2.5em;
  max-width: 24em;
}

.script .paren {
  margin: 0 0 0 3.1em;
}

.script p {
  margin: 0 0 12px;
}

/* ---------------- The contents page ---------------- */

.cards {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  gap: 2px;
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid var(--rule);
  padding: 18px 0;
}

.card-link:hover .card-name {
  color: var(--amber);
}

.card-name {
  font-weight: 600;
  font-size: 1.02rem;
  display: block;
  margin-bottom: 3px;
}

.card-what {
  color: var(--ink-soft);
  font-size: 0.95rem;
  display: block;
  text-wrap: pretty;
}

/* ---------------- The template catalogue ---------------- */

.toc {
  display: grid;
  gap: 26px 40px;
  margin: 34px 0 10px;
  padding: 24px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

@media (min-width: 640px) {
  .toc {
    grid-template-columns: 1fr 1fr;
  }
}

.toc-group h3 {
  margin: 0 0 6px;
  font-size: 0.82rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-weight: 400;
  color: var(--meta);
}

.toc-group h3 a {
  color: inherit;
  text-decoration: none;
}

.toc-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
}

.toc-group li {
  margin: 0 0 3px;
}

.group-blurb {
  color: var(--ink-soft);
  margin: -10px 0 6px;
}

.tpl {
  margin: 36px 0 0;
}

.tpl h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.tpl-blurb {
  color: var(--ink-soft);
  margin: 0 0 4px;
}

.tpl-shape {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 12.5px;
  color: var(--ink-faint);
  margin: 0 0 14px;
}

.beats {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--rule);
}

.beat {
  padding: 10px 0 10px 18px;
  margin: 0;
}

/* Nesting shown as indent, the way the app's own outline shows it. */
.beat--2 {
  padding-left: 40px;
}

.beat--3 {
  padding-left: 62px;
}

.beat-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.beat-name {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--ink);
}

.beat-kind,
.at {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 11.5px;
  color: var(--ink-faint);
}

.at {
  color: var(--meta);
}

.beat-note {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  max-width: 40rem;
}

/* ---------------- Foot of the page ---------------- */

.next {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  margin: 64px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  font-size: 0.95rem;
}

.next a {
  text-decoration: none;
}

.next a:hover {
  text-decoration: underline;
}

footer {
  padding: 30px 0 60px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  align-items: baseline;
  justify-content: space-between;
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 12.5px;
  color: var(--ink-faint);
}

footer a {
  color: var(--ink-faint);
}
