/* Mobile-first: one column, widening on larger screens. The colour tokens are the Punto family's, as
   PuntoHunter's web/src/app.css has them. Dark is the default. theme.js applies a saved theme before paint. */
:root {
  --bg: #141412;
  --fg: #ecece6;
  --muted: #a3a39c;
  --card: #1e1e1b;
  --border: #33332f;
  --accent: #fb923c;
  --good: #4ade80;
  --warn: #fbbf24;
  --radius: 0.5rem;
  color-scheme: dark;
}

:root[data-theme="light"], :root[data-theme="auto"] {
  --bg: #fafaf7;
  --fg: #1d1d1b;
  --muted: #6b6b66;
  --card: #ffffff;
  --border: #e2e2dc;
  --accent: #c2410c;
  --good: #15803d;
  --warn: #b45309;
  color-scheme: light;
}

:root[data-theme="auto"] { color-scheme: light dark; }

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #141412;
    --fg: #ecece6;
    --muted: #a3a39c;
    --card: #1e1e1b;
    --border: #33332f;
    --accent: #fb923c;
    --good: #4ade80;
    --warn: #fbbf24;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

header, .site-layout, footer {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

/* A phone puts the brand and the theme button on the first row and the nav on a full-width row of its own,
   scrolling sideways rather than wrapping when it does not fit; a wider screen puts all three on one row. */
header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
header .brand { margin-right: auto; }
header nav {
  order: 1;
  flex-basis: 100%;
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  white-space: nowrap;
}
nav a { text-decoration: none; }
nav a:hover { text-decoration: underline; }
@media (min-width: 40rem) {
  header nav { order: 0; flex-basis: auto; }
}

.theme {
  padding: 0.5rem;
  margin-right: -0.5rem;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
}
.theme svg { display: block; }

main { min-width: 0; overflow-wrap: anywhere; }

.sidebar {
  position: sticky;
  top: 0;
  z-index: 1;
  align-self: start;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0;
  font-size: 0.875rem;
}
.sidebar ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.125rem 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar a {
  display: block;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
}
.sidebar a[aria-current="page"] { color: var(--fg); background: var(--card); font-weight: 600; }

@media (width < 48rem) {
  html { scroll-padding-top: min(7rem, 30vh); }
  .sidebar { max-height: 30vh; overflow: auto; padding-inline: 0.25rem; }
}
@media (min-width: 48rem) {
  .site-layout { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 2rem; }
  .sidebar {
    top: 1rem;
    padding: 0.75rem 1rem 0.75rem 0;
    border-bottom: 0;
    border-right: 1px solid var(--border);
    font-size: 1rem;
  }
  .sidebar ul { flex-direction: column; }
}

footer {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.875rem;
}
footer p { margin: 0.5rem 0; }
.disclaimer { font-size: 0.8125rem; }

a { color: var(--accent); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--fg);
  font-weight: 700;
  text-decoration: none;
  font-size: 1.125rem;
}
.brand img { display: block; }
h1 { font-size: 1.5rem; line-height: 1.25; }
h2 { font-size: 1.125rem; margin-top: 0; }
h3 { font-size: 1rem; margin: 0 0 0.25rem; }
.muted { color: var(--muted); }

code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
code { overflow-wrap: anywhere; }
:not(pre) > code {
  padding: 0.1em 0.3em;
  background: var(--card);
  border-radius: 0.25rem;
  font-size: 0.9em;
}
pre {
  overflow-x: auto;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  line-height: 1.45;
}
pre code { overflow-wrap: normal; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
}
.card :not(pre) > code { background: var(--bg); }
.card > :last-child { margin-bottom: 0; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td {
  text-align: left;
  padding: 0.375rem 0.75rem 0.375rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 500; }
th:last-child, td:last-child { padding-right: 0; }
.scroll { overflow-x: auto; }

/* The product page. */
.intro { padding: 1.5rem 0 0.5rem; }
.intro h1 { font-size: 1.875rem; margin: 0 0 0.75rem; }
@media (min-width: 40rem) {
  .intro h1 { font-size: 2.25rem; }
}
.lead { font-size: 1.125rem; color: var(--muted); margin: 0 0 1.25rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; }
.button {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}
.button.secondary { background: none; color: var(--accent); }
.button:hover { filter: brightness(1.1); }

.features { display: grid; gap: 1rem; margin: 1rem 0; }
.features .card { margin: 0; }
.features p { margin: 0; color: var(--muted); }
@media (min-width: 58rem) {
  .features { grid-template-columns: repeat(3, 1fr); }
}

.expect { border-left: 3px solid var(--accent); }
.warning {
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  margin: 0.75rem 0;
}
.warning strong { color: var(--warn); }
.figures td:last-child, .figures th:last-child { text-align: right; white-space: nowrap; }
.steps { padding-left: 1.25rem; }
.steps li { margin: 0.25rem 0; }
