/* TrustTyped landing page.
   Deliberately plain: one column, serif text, underlined links, a paper
   background. The page should read like a well-kept memo, not a template. */

:root {
  --paper: #fbf8f1;
  --ink: #1d1b16;
  --muted: #5c5648;
  --rule: #d9d1bf;
  --link: #1a4b8c;
  --link-visited: #5b3a7a;
  --accent: #8a2b12;
  --code-bg: #f2eddf;
  --code-key: #1a4b8c;
  --code-str: #0f6b4f;
  --code-num: #8a2b12;
  --code-bool: #7a3a86;
  --code-punct: #8a8272;
  --fill: #fff1a8;
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1a17;
    --ink: #e9e4d8;
    --muted: #a59f90;
    --rule: #3a372f;
    --link: #8db4ea;
    --link-visited: #c3a4e0;
    --accent: #e0896a;
    --code-bg: #25231f;
    --code-key: #8db4ea;
    --code-str: #7ec9a2;
    --code-num: #e0896a;
    --code-bool: #c3a4e0;
    --code-punct: #7d786b;
    --fill: #5a4d10;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.6;
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ---- masthead ------------------------------------------------------- */

.masthead {
  border-bottom: 3px double var(--rule);
  padding: 2.5rem 0 1.25rem;
  margin-bottom: 2rem;
}

.kicker {
  margin: 0 0 .5rem;
  font-size: .8rem;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 83px; letter-spacing: 5px; line-height: 0;
}

h1 {
  margin: 0;
  font-size: 3.2rem;
  line-height: 1;
  font-weight: normal;
  display: flex;
  align-items: center;
  gap: .45rem;
}

.logo {
  border-bottom: 4px solid var(--accent);
  padding-bottom: .1rem;
}

/* Logo mark (logo.png is pre-trimmed to the artwork). The serif's cap height
   is ~0.70em, so matching .7em makes the mark the same height as the capitals. */
.mark {
  height: 1em;
  width: auto;
  flex: none;
  display: block;
  margin-right: 10px;
}

.mark-line {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}

.dek {
  margin: 1rem 0 1.25rem;
  font-size: 1.3rem;
  font-style: italic;
  color: var(--muted);
}

.toc {
  font-size: .85rem;
  line-height: 2;
}

.toc a { margin-right: .9rem; white-space: nowrap; }

/* ---- text ----------------------------------------------------------- */

a { color: var(--link); text-underline-offset: .15em; }
a:visited { color: var(--link-visited); }
a:hover { color: var(--accent); }

h2 {
  font-size: 1.55rem;
  font-weight: normal;
  margin: 0 0 1rem;
}

h2 .num { color: var(--accent); margin-right: .3rem; }

h3 {
  font-size: 1.05rem;
  font-variant: small-caps;
  letter-spacing: .03em;
  margin: 1.75rem 0 .4rem;
}

p { margin: 0 0 1rem; }

.lead p:first-child::first-letter {
  float: left;
  font-size: 3.3rem;
  line-height: .9;
  padding: .2rem .45rem 0 0;
  color: var(--accent);
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.75rem 0;
}

ol.plain, ul.plain { padding-left: 1.4rem; margin: 0 0 1rem; }
ol.plain li, ul.plain li { margin-bottom: .55rem; }

.aside {
  font-size: .85rem;
  color: var(--muted);
}

code {
  font-family: var(--mono);
  font-size: .82em;
  background: var(--code-bg);
  padding: .05em .3em;
}

pre {
  max-width: 100%;
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.45;
  overflow-x: auto;
  margin: 0 0 1.25rem;
}

pre.code, pre.diagram {
  background: var(--code-bg);
  border-left: 3px solid var(--rule);
  padding: .9rem 1rem;
}

pre.diagram { border-left-color: var(--accent); }

pre code { background: none; padding: 0; font-size: inherit; }

pre .c { color: var(--muted); }

/* Plain-CSS JSON colouring — no library, no extra payload.
   Colours are theme variables, so light and dark mode both stay readable. */
pre .k { color: var(--code-key); }
pre .s { color: var(--code-str); }
pre .n { color: var(--code-num); }
pre .b { color: var(--code-bool); }
pre .p { color: var(--code-punct); }
pre .hi { color: var(--accent); font-weight: 700; }

table.spec {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  margin: .5rem 0 1rem;
}

table.spec td code { overflow-wrap: anywhere; }

table.spec th, table.spec td {
  text-align: left;
  vertical-align: top;
  padding: .45rem .6rem .45rem 0;
  border-bottom: 1px solid var(--rule);
}

table.spec th {
  font-weight: normal;
  font-variant: small-caps;
  letter-spacing: .03em;
  color: var(--muted);
  border-bottom-width: 2px;
}

sup a { text-decoration: none; }

/* placeholders the owner must fill before publishing */
.fill-me {
  background: var(--fill);
  padding: 0 .2em;
}

/* ---- race illustration --------------------------------------------- */

.race {
  border: 1px solid var(--rule);
  padding: .9rem 1rem .4rem;
  margin: 1.5rem 0;
}

.race-title { margin: 0 0 .75rem; font-style: italic; }

.race button {
  font: inherit;
  font-size: .8rem;
  font-style: normal;
  margin-left: .5rem;
  padding: .1rem .6rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--muted);
  cursor: pointer;
}

.race button:hover { border-color: var(--accent); color: var(--accent); }

.race-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* grid items must be allowed to shrink, or a long <pre> widens the page */
.race-cols > *, .video-grid > * { min-width: 0; }

.race-label { font-size: .8rem; color: var(--muted); margin: 0 0 .3rem; }

.race pre {
  background: var(--code-bg);
  padding: .6rem .7rem;
  min-height: 21.5em;      /* ~20 fields + room, so both columns hold still */
  margin: 0 0 .3rem;
  font-size: .64rem;       /* keys add width; keep both columns from wrapping */
  white-space: pre-wrap;   /* wrap rather than clip if a name is long */
  overflow-wrap: anywhere;
  word-break: normal;
}

.race-time { font-family: var(--mono); font-size: .75rem; margin: 0 0 .6rem; }

/* ---- video slots ----------------------------------------------------- */

.video-slot { margin: 1.5rem 0; }

.video-slot video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--rule);
}

/* Autoplaying clips keep their own aspect ratio (no letterbox bars). */
.video-slot video[autoplay] { aspect-ratio: auto; }

.video-slot figcaption {
  font-size: .82rem;
  color: var(--muted);
  margin-top: .4rem;
}

/* shown by script.js while the video file is not there yet */
.video-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px dashed var(--muted);
  background:
    repeating-linear-gradient(45deg, transparent 0 10px, var(--code-bg) 10px 11px);
  color: var(--muted);
  font-style: italic;
  font-size: .9rem;
  text-align: center;
  padding: 1rem;
}

.video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.25rem;
}

.video-grid .video-slot { margin: 0 0 1.25rem; }

/* ---- closing ---------------------------------------------------------- */

.sig { font-style: italic; }

.notes { font-size: .85rem; }
.notes h2 { font-size: 1.1rem; }
.notes ol { padding-left: 1.2rem; }

footer {
  border-top: 3px double var(--rule);
  margin-top: 3rem;
  padding: 2rem 0 2.5rem;
  font-size: .82rem;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
}

.footer-brand .logo {
  font-size: 1.35rem;
  color: var(--ink);
}

.footer-brand .mark { font-size: 1.35rem; }

.footer-tag {
  margin: .4rem 0 0;
  max-width: 22rem;
  font-style: italic;
}

.footer-meta {
  text-align: right;
  line-height: 1.5;
}

.footer-meta p { margin: 0; }

.footer-meta a { color: var(--link); }

.footer-fine {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem;
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: .74rem;
  letter-spacing: .01em;
}

.footer-fine p { margin: 0; }

@media (max-width: 640px) {
  .footer-inner { flex-direction: column; }
  .footer-meta { text-align: left; }
  .footer-fine { flex-direction: column; }
}

/* ---- small screens ---------------------------------------------------- */

@media (max-width: 640px) {
  body { font-size: 17px; }
  h1 { font-size: 2.5rem; }
  .race-cols, .video-grid { grid-template-columns: 1fr; }
  pre { font-size: .66rem; }
}

@media print {
  .race button, .video-slot { display: none; }
  body { background: #fff; color: #000; }
}
