:root {
  --bg: #000;
  --fg: #fff;
  --muted: #888;
  --divider: #555;
  --max-width: 700px;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'Fragment Mono', monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  margin: 0;
  padding: 2rem 1rem;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ── Homepage ── */

h1 {
  font-size: 2.5rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.subtitle {
  color: var(--muted);
  font-weight: 400;
  margin: 0 0 1.5rem;
}

#search {
  display: block;
  width: 100%;
  border-radius: 4px;
  background: transparent;
  border: 1px solid #555;
  color: white;
  padding: 0.6rem 1.2rem;
  font-family: inherit;
  font-size: 1rem;
  margin: 5rem 0;
  outline: none;
}

#search::placeholder {
  color: #555;
}

#search:focus {
  border-color: #fff;
}

.howto-list {
  list-style: none;
  padding: 0;
  margin: 0 0 4rem;
  border-bottom: 1px solid var(--divider);
}

.howto-item {
  border-top: 1px solid var(--divider);
  padding: 1rem 0;
}

.howto-item a {
  display: block;
  color: white;
  text-decoration: none;
}

.howto-item a:hover .item-title {
  text-decoration: underline;
}

.item-title {
  font-weight: 500;
}

.item-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

/* ── Back link ── */

.back-link {
  position: fixed;
  top: calc(2rem + 10px);
  left: calc(50% - var(--max-width) / 2 - 2.5rem);
  transform: translateX(-100%);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #555;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid #333;
  border-radius: 4px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.back-link:hover {
  color: white;
  border-color: #888;
}

@media (max-width: 900px) {
  .back-link {
    position: static;
    display: inline-flex;
    transform: none;
    margin-bottom: 2rem;
  }

  .toc {
    display: none;
  }
}

/* ── Table of contents ── */

.toc {
  position: fixed;
  top: calc(2rem + 10px);
  left: calc(50% + var(--max-width) / 2 + 2.5rem);
  max-width: 180px;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toc li[data-level="h3"] a {
  padding-left: 0.75rem;
  font-size: 0.78rem;
}

.toc a {
  display: block;
  color: #444;
  text-decoration: none;
  font-size: 0.8rem;
  line-height: 1.4;
  transition: color 0.15s;
}

.toc a:hover,
.toc a.toc--active {
  color: #fff;
}


/* ── Last updated ── */

.last-updated {
  margin-top: 3rem;
  font-size: 0.8rem;
  color: #444;
}

/* ── Howto page description ── */

.description {
  color: var(--muted);
  font-size: 1rem;
  margin: 0.5rem 0 2rem;
}

/* ── Body / kirbytext ── */

.body h1,
.body h2,
.body h3 {
  color: white;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  scroll-margin-top: 45px;
}

.body h1 { font-size: 1.6rem; }
.body h2 { font-size: 1.3rem; }
.body h3 { font-size: 1.1rem; }

.body p {
  line-height: 1.7;
  color: #ddd;
  margin: 1rem 0;
}

.body a {
  color: white;
  text-decoration: underline;
}

.body code {
  font-family: var(--font-mono);
  background: #111;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
}

.pre-wrap {
  position: relative;
  margin: 1.5rem 0;
}

.body pre {
  background: #111 !important;
  padding: 1.25rem !important;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0;
}

.body pre code {
  background: none !important;
  padding: 0 !important;
  font-size: 0.875rem;
  line-height: 1.6;
  text-shadow: none !important;
}

.copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: #222;
  color: #888;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.15s;
}

.copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  color: #fff;
  border-color: #555;
}


.body pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

.body blockquote {
  border-left: 3px solid #555;
  padding-left: 1rem;
  color: #888;
  margin: 1.5rem 0;
  font-style: italic;
}

.body ul,
.body ol {
  padding-left: 1.5rem;
  line-height: 1.8;
  color: #ddd;
}

.body img {
  max-width: 100%;
  border-radius: 6px;
  margin: 1.5rem 0;
}

.body figure {
  margin: 0;
}

.body figcaption {
  text-align: center;
  font-size: 0.8rem;
  color: #666;
  margin-top: 0.5rem;
}

.body hr {
  border: none;
  border-top: 1px solid #333;
  margin: 2rem 0;
}

.body table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  color: #ddd;
}

.body th,
.body td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #555;
  text-align: left;
}

.body th {
  color: #fff;
  font-weight: 600;
  border-bottom: 1px solid #555;
}

.body tr:last-child td {
  border-bottom: none;
}

.body .callout {
  padding: 1rem 1.25rem;
  border: none;
  border-radius: 6px;
  margin: 1.5rem 0;
}

.body .callout p {
  margin: 0.25rem 0 0;
  color: inherit;
}

.body .callout p:first-of-type {
  margin-top: 0.25rem;
}

.body .callout__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.body .callout--note    { background: #111;          border-color: #555;    color: #aaa; }
.body .callout--note    .callout__label { color: #777; }

.body .callout--info    { background: #0d1a2e;       border-color: #3b82f6; color: #93c5fd; }
.body .callout--info    .callout__label { color: #3b82f6; }

.body .callout--tip     { background: #0a1f18;       border-color: #10b981; color: #6ee7b7; }
.body .callout--tip     .callout__label { color: #10b981; }

.body .callout--success { background: #0a1f10;       border-color: #22c55e; color: #86efac; }
.body .callout--success .callout__label { color: #22c55e; }

.body .callout--warning { background: #1f1700;       border-color: #f59e0b; color: #fcd34d; }
.body .callout--warning .callout__label { color: #f59e0b; }

.body .callout--danger  { background: #1f0f00;       border-color: #f97316; color: #fdba74; }
.body .callout--danger  .callout__label { color: #f97316; }

.body .callout--failure { background: #1f0a0a;       border-color: #ef4444; color: #fca5a5; }
.body .callout--failure .callout__label { color: #ef4444; }

.body .callout--quote   { background: #130d1f;       border-color: #a855f7; color: #d8b4fe; font-style: italic; }
.body .callout--quote   .callout__label { color: #a855f7; }
