/*
 * THE EZ CLOCK - doc.css
 * ez.sy
 *
 * Styles for documentation.html only.
 *
 * That page is a numbered specification rather than a marketing page,
 * so it gets its own measure, its own scale and its own table
 * treatment. It uses the theme variables from themes.css, so it follows
 * the city theme and the light/dark mode like everything else.
 */

/* ------------------------------------------------------------------ *
 * Page shell
 *
 * .document is on <main> and carries its own width, because this page
 * does not use the .wrap grid. One column, narrow measure, because
 * long specification prose is unreadable at full width.
 * ------------------------------------------------------------------ */

.document {
  max-width: 74ch;
  margin: 0 auto;
  padding: 8px 22px 96px;
  color: var(--ink);
  font-size: 1.0625rem;
  line-height: 1.7;
}

/* ------------------------------------------------------------------ *
 * Title block
 * ------------------------------------------------------------------ */

.document > h1 {
  margin: 24px 0 4px;
  font-size: clamp(2rem, 6vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0 0 6px;
  font-size: 1.25rem;
  color: var(--ink-soft);
}

.meta {
  margin: 0 0 22px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.8;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.origin-note {
  font-size: 0.875rem;
  font-style: italic;
  color: var(--ink-faint);
}

/* The attribution. Deliberately given weight: it is a claim of
   authorship, not a footnote. */
.byline {
  margin: 0 0 8px;
  padding: 16px 18px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--bg-raised);
  font-size: 1rem;
  color: var(--ink);
}

/* ------------------------------------------------------------------ *
 * Contents
 * ------------------------------------------------------------------ */

.toc {
  margin: 32px 0;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
}

.toc h2 {
  margin: 0 0 12px;
  border: 0;
  padding: 0;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
  margin: 0;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}

.toc li:last-child { border-bottom: 0; }

.toc a {
  display: block;
  font-size: 0.9375rem;
  text-decoration: none;
  color: var(--ink-soft);
}

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

/* ------------------------------------------------------------------ *
 * Headings
 *
 * Parts get a rule above them, clauses do not. The hierarchy has to be
 * legible at a glance when scrolling a document this long.
 * ------------------------------------------------------------------ */

.document h2 {
  margin: 56px 0 18px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.document h3 {
  margin: 34px 0 10px;
  font-size: 1.1875rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.document h4 {
  margin: 24px 0 8px;
  font-size: 1rem;
  color: var(--ink);
}

/* Anchor targets clear the sticky header when jumped to from contents. */
.document h2[id],
.document h3[id] { scroll-margin-top: 88px; }

/* ------------------------------------------------------------------ *
 * Body copy
 * ------------------------------------------------------------------ */

.document p { margin: 0 0 16px; }

.document ul,
.document ol {
  margin: 0 0 18px;
  padding-left: 1.4em;
}

.document li { margin-bottom: 7px; }

.document strong { color: var(--ink); font-weight: 650; }

.document a { color: var(--accent); }

.document hr {
  margin: 44px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* Pull-quotes carry the system's axioms, so they are set to be read,
   not skipped. */
.document blockquote {
  margin: 24px 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  font-size: 1.1875rem;
  line-height: 1.5;
  color: var(--ink);
}

.document blockquote p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ *
 * Code and equations
 * ------------------------------------------------------------------ */

.document code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-sunk);
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--ink);
}

.document pre {
  margin: 0 0 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-sunk);
  overflow-x: auto;
  line-height: 1.55;
}

.document pre code {
  padding: 0;
  background: none;
  font-size: 0.875rem;
}

/* ------------------------------------------------------------------ *
 * Tables
 *
 * Wrapped in their own scroll context so a wide comparison table does
 * not force the whole page sideways on a phone.
 * ------------------------------------------------------------------ */

.document table {
  width: 100%;
  margin: 0 0 24px;
  border-collapse: collapse;
  font-size: 0.9375rem;
  display: block;
  overflow-x: auto;
}

.document thead th {
  padding: 9px 14px 9px 0;
  border-bottom: 2px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.document tbody td {
  padding: 9px 14px 9px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink-soft);
}

.document tbody tr:last-child td { border-bottom: 0; }
.document tbody td:first-child { color: var(--ink); }

/* ------------------------------------------------------------------ *
 * Footer
 * ------------------------------------------------------------------ */

.copyright {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--ink-faint);
}

.copyright p { margin: 0 0 8px; }

@media (max-width: 640px) {
  .document { padding: 4px 18px 72px; font-size: 1rem; }
  .document h2 { margin-top: 44px; }
}
