/*
 * The look every page shares: colours for day and night, type, the header with its day/night
 * switch, the footer, and a few small parts (buttons, cards, the coloured dot).
 *
 *   lines.css   adds the topic pages: the strip, the top bar, the panel, the home cards
 *   pages.css   adds the written pages: API and About
 *
 * A page is in day mode unless <html data-theme="dark">, which js/site.js sets from the
 * visitor's device or from the switch. Design: docs/site-design.md.
 */

:root {
  /* day: warm paper, ink, a deep teal */
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece5;
  --border: #dcd8ce;
  --text: #1c1f26;
  --soft: #3a3f49;        /* body text that should sit back a little */
  --muted: #5a616d;
  --faint: #868c96;
  --accent: #0b7d69;
  --on-accent: #ffffff;
  --line: #1c1f26;        /* the main line of a topic */
  --tint: rgba(11, 125, 105, 0.08);     /* a wash of the accent: the step being read, a callout */
  --tint-edge: rgba(11, 125, 105, 0.35);
  --shadow: 0 10px 28px rgba(28, 31, 38, 0.14);
  --warn: #9a5b00;
  --bad: #b3371f;
  /* the eight branch colours, dark enough to read as text on paper */
  --b0: #0b7d69; --b1: #6650d6; --b2: #a15c00; --b3: #c8472b;
  --b4: #1b74c2; --b5: #c03d80; --b6: #3f7f1b; --b7: #806a1f;
  --gutter: 20px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  /* night: blue-black, warm white, a bright teal */
  --bg: #0f1218;
  --surface: #171b23;
  --surface-2: #1f242e;
  --border: #2a303b;
  --text: #ecebe6;
  --soft: #d6d4ce;
  --muted: #9aa1ad;
  --faint: #6b7280;
  --accent: #4fd1b5;
  --on-accent: #06231d;
  --line: #f2f0ea;
  --tint: rgba(79, 209, 181, 0.09);
  --tint-edge: rgba(79, 209, 181, 0.4);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  --warn: #f2b866;
  --bad: #f08a70;
  --b0: #4fd1b5; --b1: #a79af0; --b2: #f2b866; --b3: #f08a70;
  --b4: #6fb7f2; --b5: #ee8fbf; --b6: #9bd36a; --b7: #d9c48a;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: inherit; }

h1, h2, h3, h4, h5, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }

button { font: inherit; color: inherit; cursor: pointer; }

h1 { font-size: 30px; line-height: 1.15; font-weight: 650; letter-spacing: -0.01em; }

.wrap, .top, .mini-wrap, .under, .panel, .cards, .foot {
  max-width: 1080px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.skip-link { position: absolute; left: -999px; top: 0; padding: 8px 12px; background: var(--accent); color: var(--on-accent); }
.skip-link:focus { left: 8px; top: 8px; z-index: 10; border-radius: 8px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- the header ---------- */
.site-head { border-bottom: 1px solid var(--border); }
.site-head .wrap { display: flex; align-items: center; gap: 8px 22px; min-height: 54px; }

.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: -0.01em; text-decoration: none; }
.brand svg { display: block; flex: none; }
.mark-line { fill: none; stroke: var(--line); stroke-width: 2.6; stroke-linecap: round; }
.mark-branch { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; }
.mark-now { fill: var(--accent); }

.site-nav { display: flex; gap: 2px; margin-left: auto; }
.site-nav a {
  padding: 6px 11px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14.5px;
  text-decoration: none;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); font-weight: 600; }

/* day and night: the knob slides from a sun to a moon */
.theme-switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}
.theme-switch::before {   /* the knob: a sun */
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e8a53a;
  box-shadow: 0 0 0 3px rgba(232, 165, 58, 0.22);
  transition: transform 0.22s ease, background-color 0.22s, box-shadow 0.22s;
}
[data-theme="dark"] .theme-switch::before {   /* ... or a crescent moon */
  transform: translateX(20px);
  background: transparent;
  box-shadow: inset -6px -2px 0 0 var(--line);
}

/* ---------- how every page opens: its title and one quiet line, with room for controls beside them ---------- */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 24px;
  padding-top: 20px;
  padding-bottom: 14px;
}

/* ---------- the footer ---------- */
.foot { padding-top: 8px; padding-bottom: 30px; color: var(--faint); font-size: 12.5px; }
.foot p + p { margin-top: 2px; }

/* ---------- small shared parts ---------- */
.labels { margin-top: 4px; color: var(--muted); font-size: 14px; }

.swatch { flex: none; display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.c0 { background: var(--b0); } .c1 { background: var(--b1); } .c2 { background: var(--b2); } .c3 { background: var(--b3); }
.c4 { background: var(--b4); } .c5 { background: var(--b5); } .c6 { background: var(--b6); } .c7 { background: var(--b7); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.quiet { border-color: var(--border); background: var(--surface); color: var(--text); }
.btn.quiet:hover { border-color: var(--accent); filter: none; }

/* the page for an address that does not exist (templates/not_found.html) */
.not-found { padding-top: 4px; padding-bottom: 40px; }

@media (max-width: 600px) {
  :root { --gutter: 16px; }
  h1 { font-size: 26px; }
  .site-head .wrap { min-height: 48px; gap: 6px 10px; }
  .site-nav a { padding: 6px 9px; }
}
