/* Pigeonhole documentation: shared styles for every page.
   Tokens, both themes and the phone-width layout come from the first single-page site. */
:root {
  --bg: #f6f5f9;
  --surface: #ffffff;
  --fg: #1d1a2b;
  --muted: #5d586f;
  --line: #dcd8e8;
  --accent: #4a2b82;
  --accent-soft: #ece6f7;
  --ok: #1f6f43;
  --warn: #8a5a00;
  --frame: #1d1a2b;
  --frame-edge: #3a3550;
  --shadow: 0 1px 2px rgb(29 26 43 / 0.06), 0 8px 24px rgb(29 26 43 / 0.08);
  --display: "Spectral", Georgia, "Times New Roman", serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15131d;
    --surface: #1f1c2a;
    --fg: #ece9f3;
    --muted: #a9a3bb;
    --line: #352f47;
    --accent: #b9a1ea;
    --accent-soft: #2b2340;
    --ok: #7fd3a0;
    --warn: #f0c674;
    --frame: #0b0a10;
    --frame-edge: #4a4460;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15131d;
  --surface: #1f1c2a;
  --fg: #ece9f3;
  --muted: #a9a3bb;
  --line: #352f47;
  --accent: #b9a1ea;
  --accent-soft: #2b2340;
  --ok: #7fd3a0;
  --warn: #f0c674;
  --frame: #0b0a10;
  --frame-edge: #4a4460;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  scroll-padding-top: 80px;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: 64px;
  overflow-wrap: break-word;
}
.wrap {
  max-width: 1120px;
  margin: 0 auto;
}
.col {
  max-width: 70ch;
}
a {
  color: var(--accent);
  text-underline-offset: 2px;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 10;
}
.skip:focus {
  left: 16px;
}

/* ---- site header and navigation (shared by every page) ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  margin: 0 calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
  padding: 0 max(16px, env(safe-area-inset-left, 0px));
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
  min-height: 56px;
  padding: 8px 0;
}
.brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  color: var(--fg);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand svg {
  flex: none;
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  font-size: 14.5px;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
.site-nav a:hover {
  color: var(--fg);
  background: var(--accent-soft);
}
.site-nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* ---- page header ---- */
.page-head {
  padding: 40px 0 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(34px, 6vw, 52px);
  line-height: 1.08;
  margin: 8px 0 12px;
  text-wrap: balance;
}
h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(26px, 3.5vw, 34px);
  line-height: 1.15;
  margin: 56px 0 12px;
  text-wrap: balance;
}
h3 {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  margin: 36px 0 8px;
}
h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 20px 0 6px;
}
p {
  margin: 0 0 14px;
}
.lead {
  font-size: 19px;
  color: var(--muted);
  max-width: 62ch;
  margin: 0;
}
ul,
ol {
  padding-left: 22px;
  margin: 0 0 14px;
}
li {
  margin-bottom: 6px;
}
code,
kbd {
  font-family: var(--mono);
  font-size: 0.9em;
}
pre {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.5;
  overflow-x: auto;
  margin: 10px 0 18px;
  max-width: 100%;
}
.note {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
  margin: 16px 0 20px;
  font-size: 15px;
  max-width: 70ch;
}
.note p:last-child {
  margin: 0;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
}
.chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}
.chip .dot.run {
  background: var(--warn);
}

/* ---- contents box for long pages ---- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 40px;
}
@media (min-width: 1100px) {
  .layout.with-toc {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .layout.with-toc .toc {
    position: sticky;
    top: 80px;
    align-self: start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }
}
.toc {
  font-size: 14px;
  margin: 24px 0 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.toc h2 {
  font-family: var(--body);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 2 150px;
  column-gap: 20px;
}
@media (min-width: 1100px) {
  .toc ol {
    columns: 1;
  }
}
.toc li {
  margin: 0 0 4px;
  break-inside: avoid;
}
.toc a {
  text-decoration: none;
  display: inline-block;
  padding: 2px 0;
}
.toc a:hover {
  text-decoration: underline;
}
main > section,
.content > section {
  scroll-margin-top: 72px;
}

/* ---- tables ---- */
.tablewrap {
  overflow-x: auto;
  max-width: 100%;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 15px;
  margin: 12px 0 20px;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
th {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
td.num,
th.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* ---- figures ---- */
figure {
  margin: 0;
  min-width: 0;
}
figcaption {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.45;
}
figcaption b {
  color: var(--fg);
  font-weight: 600;
}
picture,
figure img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Phone screenshots inside a simple CSS device frame */
.phones {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 28px 22px;
  margin: 20px 0 12px;
  align-items: start;
}
.phones.few {
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 260px));
}
.device {
  position: relative;
  max-width: 300px;
  margin: 0 auto;
  padding: 9px;
  border-radius: 46px;
  background: var(--frame);
  box-shadow:
    inset 0 0 0 1.5px var(--frame-edge),
    var(--shadow);
}
.device img {
  width: 100%;
  border-radius: 37px;
  background: var(--surface);
}
.phones figcaption {
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

/* Desktop screenshots inside a plain browser window */
.screens {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr));
  gap: 28px 24px;
  margin: 20px 0 12px;
}
.screens.one {
  grid-template-columns: minmax(0, 1fr);
}
.window {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.window::before {
  content: "";
  display: block;
  height: 22px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 14px 11px, #e0605a 4px, transparent 4.5px),
    radial-gradient(circle at 30px 11px, #e3b341 4px, transparent 4.5px),
    radial-gradient(circle at 46px 11px, #5fb85c 4px, transparent 4.5px), var(--accent-soft);
}
.window img {
  width: 100%;
}

/* A numbered sequence of steps with a screenshot each */
.steps {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  counter-reset: step;
  display: grid;
  gap: 32px;
}
.steps > li {
  counter-increment: step;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
@media (min-width: 900px) {
  .steps > li {
    grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
}
.steps > li > div:first-child::before {
  content: "Step " counter(step);
  display: block;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 4px;
}
.steps h4 {
  margin-top: 0;
  font-size: 18px;
}

/* Text beside a phone, for screens that need a few sentences */
.screen-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px 32px;
  margin: 28px 0;
  align-items: start;
}
@media (min-width: 760px) {
  .screen-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .screen-row.phone-right {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  }
}

/* ---- overview cards ---- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: 14px;
  margin: 18px 0 24px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  min-width: 0;
}
.card h3 {
  margin: 0 0 6px;
  font-size: 17px;
}
.card p {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--muted);
}
.card a.more {
  font-weight: 600;
  font-size: 15px;
}
.status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.status.done {
  background: var(--accent-soft);
  color: var(--accent);
}
.status.run {
  background: var(--accent-soft);
  color: var(--warn);
}
.status.todo {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

/* ---- the architecture diagram ---- */
.diagram {
  margin: 20px 0 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  overflow-x: auto;
}
.diagram svg {
  display: block;
  width: 100%;
  min-width: 640px;
  height: auto;
}
.diagram .d-box {
  fill: var(--bg);
  stroke: var(--line);
  stroke-width: 1.5;
}
.diagram .d-core {
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-width: 1.5;
}
.diagram .d-host {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.2;
  stroke-dasharray: 6 5;
}
.diagram .d-title {
  fill: var(--fg);
  font: 600 14px var(--body);
}
.diagram .d-sub {
  fill: var(--muted);
  font: 400 12px var(--body);
}
.diagram .d-label {
  fill: var(--muted);
  font: 500 11.5px var(--body);
}
.diagram .d-line {
  stroke: var(--muted);
  stroke-width: 1.4;
  fill: none;
}
.diagram .d-arrow {
  fill: var(--muted);
}

footer.site-footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--muted);
}
footer.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-bottom: 8px;
}

@media (max-width: 700px) {
  /* the navigation wraps onto two lines here: let it scroll away instead of covering the page */
  .site-header {
    position: static;
  }
  html {
    scroll-padding-top: 16px;
  }
}
.icon {
  width: 128px;
  border-radius: 28px;
  margin: 0 auto;
}
.phones figure:has(.icon) figcaption {
  text-align: center;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.small {
  font-size: 15px;
  color: var(--muted);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
@media print {
  .site-header {
    position: static;
  }
  .toc {
    display: none;
  }
}
