:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #16202e;
  --muted: #5a6778;
  --border: #dde3ec;
  --blue: #3d8ef0;
  --blue-strong: #1f6fd1;
  --yellow: #f5c518;
  --code-bg: #eef2f7;
  --warn-bg: #fff7db;
  --warn-border: #f0d36b;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d131c;
    --surface: #151d29;
    --text: #e6ebf2;
    --muted: #9aa7b8;
    --border: #273246;
    --blue: #5ea3f5;
    --blue-strong: #8bbcf8;
    --code-bg: #1c2636;
    --warn-bg: #2a2410;
    --warn-border: #6b5a1c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d131c;
  --surface: #151d29;
  --text: #e6ebf2;
  --muted: #9aa7b8;
  --border: #273246;
  --blue: #5ea3f5;
  --blue-strong: #8bbcf8;
  --code-bg: #1c2636;
  --warn-bg: #2a2410;
  --warn-border: #6b5a1c;
  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.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--blue-strong); }
a:hover { color: var(--blue); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }

header.site {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
header.site .wrap {
  display: flex; align-items: center; gap: 12px;
  padding-top: 14px; padding-bottom: 14px;
}
header.site img { width: 40px; height: 40px; }
header.site .brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
header.site nav { margin-left: auto; display: flex; gap: 16px; flex-wrap: wrap; font-size: .95rem; }
header.site nav a { color: var(--muted); text-decoration: none; }
header.site nav a:hover, header.site nav a[aria-current] { color: var(--text); }

.hero { padding: 48px 0 24px; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.2; margin: 0 0 12px; }
.hero p { color: var(--muted); font-size: 1.1rem; margin: 0; max-width: 40em; }

.cards {
  display: grid; gap: 16px; margin: 24px 0 40px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.card {
  display: block; padding: 20px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--blue); transform: translateY(-2px); color: var(--text); }
.card h2 { font-size: 1.15rem; margin: 0 0 6px; }
.card p { margin: 0 0 10px; color: var(--muted); font-size: .95rem; }
.card .url { font-size: .85rem; color: var(--blue-strong); word-break: break-all; }

section { margin: 32px 0; }
section h2 { font-size: 1.35rem; margin: 0 0 12px; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px;
}
dl.settings { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 0; }
dl.settings dt { color: var(--muted); }
dl.settings dd { margin: 0; min-width: 0; }
code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em;
  background: var(--code-bg); padding: 2px 6px; border-radius: 6px;
  /* Break long values (URLs, addresses) only when they don't fit the line,
     never short ones like port numbers. */
  overflow-wrap: anywhere;
}
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
/* Keep values such as port numbers on one line in table cells. */
td code { white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
.table-scroll { overflow-x: auto; }
.note {
  background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: var(--radius);
  padding: 14px 18px; margin: 16px 0;
}
ul.plain { padding-left: 1.2em; margin: 0; }
ul.plain li { margin: 6px 0; }
section h3 { font-size: 1.1rem; margin: 24px 0 8px; }
section h4 { font-size: 1rem; margin: 18px 0 6px; }

/* A command to copy: one line, scrolls sideways if long, with a Copy button (added by the page's script). */
.cmd {
  display: flex; align-items: center; gap: 10px; margin: 14px 0;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 8px 8px 14px;
}
.cmd code { background: none; padding: 0; flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; overflow-wrap: normal; }
.cmd button {
  flex: none; font: inherit; font-size: .85rem; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 4px 12px;
}
.cmd button:hover { border-color: var(--blue); }
pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; overflow-x: auto; font-size: .85rem; line-height: 1.5;
}
pre code { background: none; padding: 0; overflow-wrap: normal; }

/* Numbered steps in headings, and numbered lists. */
.num {
  display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; margin-right: 8px;
  border-radius: 50%; background: var(--blue-strong); color: var(--surface); font-size: .85em; vertical-align: 2px;
}
ol.flow { padding-left: 1.4em; }
ol.flow li { margin: 8px 0; }

/* Links to the sections of a long page. */
nav.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 8px; }
nav.toc a {
  font-size: .9rem; text-decoration: none; color: var(--text);
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 12px;
}
nav.toc a:hover { border-color: var(--blue); }

/* A box that stands out from the page, e.g. "Powered by DigiNode Seeder". */
.powered {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--blue);
  border-radius: var(--radius); padding: 4px 20px 8px;
}
.powered h2 { margin-top: 16px; }
.hero .powered-by { font-size: .95rem; margin-top: 4px; }

/* Fold-out sections. */
details {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 18px; margin: 20px 0;
}
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 8px; }

footer.site {
  border-top: 1px solid var(--border); margin-top: 48px; padding: 24px 0 40px;
  color: var(--muted); font-size: .9rem;
}
footer.site p { margin: 4px 0; }

@media (max-width: 560px) {
  header.site nav { display: none; }
  dl.settings { grid-template-columns: 1fr; gap: 2px; }
  dl.settings dd { margin-bottom: 10px; }
}
