/*
 * tech-pos user guide — one stylesheet for every page.
 *
 * Plain HTML on purpose: no build step, no framework, no CDN. Every page is a
 * file a search engine can read and a shopkeeper can open with no network.
 */

:root {
  color-scheme: light dark;

  --ink: #16130f;
  --ink-soft: #5b5348;
  /* Was #8a8175 — only 3.35:1 on --surface-muted, so it failed WCAG AA for the
     small text it is used on (breadcrumb, figcaption, th, callout labels).
     #6f675b is 4.87 / 5.30 / 5.57 against muted / paper / surface. */
  --ink-faint: #6f675b;
  --paper: #fbf9f6;
  --surface: #ffffff;
  --surface-muted: #f3efe9;
  --line: #e2dbd1;
  --accent: #b4530a;
  --accent-soft: #fdf1e6;
  /* Text printed on top of --accent (step numbers, brand mark). */
  --on-accent: #ffffff;
  --good: #1f6f43;
  --warn: #8a5a00;
  --bad: #a32020;

  --measure: 74ch;
  --nav-width: 17rem;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(22 19 15 / 6%), 0 8px 24px rgb(22 19 15 / 6%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f2ede6;
    --ink-soft: #b8b0a5;
    /* Was #8d8579 — 4.40:1 on --surface-muted, just under AA. */
    --ink-faint: #9a9184;
    --paper: #14120f;
    --surface: #1c1917;
    --surface-muted: #24211d;
    --line: #34302a;
    --accent: #f08a3c;
    --accent-soft: #2a1d12;
    /* White on this orange is 2.50:1. Dark ink on it is 7.42:1. */
    --on-accent: #1a1206;
    --good: #6cc38d;
    --warn: #e0b25f;
    --bad: #ef8080;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "kern", "liga";
}

/* ── Focus and skip link ────────────────────────────────────────────────── */

/* One visible focus ring for everything that takes focus, in both palettes.
   :focus-visible alone would leave older engines with no ring at all, so the
   plain :focus rule is the floor and :focus-visible refines it. */
:focus {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

:focus:not(:focus-visible) { outline: none; }

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

/* The main landmark is focused by the skip link; it should not draw a ring. */
main:focus, main:focus-visible { outline: none; }

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
  transition: top 0.12s ease-out;
}

.skip-link:focus { top: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ── Layout ─────────────────────────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
  gap: 0;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 1.5rem 1.25rem 3rem;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.content {
  padding: 2.5rem clamp(1rem, 4vw, 3.5rem) 6rem;
  max-width: calc(var(--measure) + 8rem);
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .content { padding-top: 1.5rem; }
}

/* ── Brand + navigation ─────────────────────────────────────────────────── */

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.95rem;
  font-weight: 800;
}

.nav-group { margin-bottom: 1.4rem; }

/* A <p>, not an <h2>: these label nav groups, and five of them ahead of the
   <h1> would put the document outline out of order for a screen reader. The
   <ul> below each one points at it with aria-labelledby, so the grouping is
   still announced. */
.nav-group .nav-title {
  margin: 0 0 0.45rem;
  max-width: none;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.nav-group ul { margin: 0; padding: 0; list-style: none; }

.nav-group a {
  display: block;
  padding: 0.3rem 0.55rem;
  margin-left: -0.55rem;
  border-radius: 7px;
  color: var(--ink-soft);
  font-size: 0.94rem;
  text-decoration: none;
}

.nav-group a:hover { background: var(--surface-muted); color: var(--ink); }

.nav-group a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* ── Typography ─────────────────────────────────────────────────────────── */

h1, h2, h3, h4 {
  color: var(--ink);
  line-height: 1.25;
  letter-spacing: -0.015em;
  scroll-margin-top: 1.5rem;
}

h1 { margin: 0 0 0.6rem; font-size: clamp(2rem, 1.4rem + 2vw, 2.6rem); font-weight: 800; }
h2 { margin: 2.6rem 0 0.8rem; font-size: 1.5rem; font-weight: 700; }
h3 { margin: 1.9rem 0 0.5rem; font-size: 1.15rem; font-weight: 700; }

p, li { max-width: var(--measure); }
p { margin: 0 0 1rem; }

.lede {
  max-width: var(--measure);
  margin-bottom: 2rem;
  color: var(--ink-soft);
  font-size: 1.15rem;
  line-height: 1.6;
}

a { color: var(--accent); text-underline-offset: 2px; }

code {
  padding: 0.12em 0.38em;
  border-radius: 5px;
  background: var(--surface-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}

kbd {
  padding: 0.1em 0.45em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82em;
}

/* ── Steps, cards, tables ───────────────────────────────────────────────── */

ol.steps { counter-reset: step; margin: 1.2rem 0; padding: 0; list-style: none; }

ol.steps > li {
  counter-increment: step;
  position: relative;
  margin-bottom: 1.1rem;
  padding-left: 2.6rem;
}

ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.85rem;
  font-weight: 700;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.card {
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.card p { margin: 0; color: var(--ink-soft); font-size: 0.94rem; }
.card a { font-weight: 600; text-decoration: none; }

.table-wrap { overflow-x: auto; margin: 1.2rem 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

tbody tr:hover { background: var(--surface-muted); }

.yes { color: var(--good); font-weight: 700; }
.no { color: var(--ink-faint); }

/* ── Callouts ───────────────────────────────────────────────────────────── */

.note, .warn, .tip {
  margin: 1.3rem 0;
  padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
}

.note p:last-child, .warn p:last-child, .tip p:last-child { margin-bottom: 0; }
.warn { border-left-color: var(--bad); }
.tip { border-left-color: var(--good); }

.callout-label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ── Screenshots ────────────────────────────────────────────────────────── */

figure { margin: 1.5rem 0; }

figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

figcaption {
  margin-top: 0.5rem;
  color: var(--ink-faint);
  font-size: 0.88rem;
}

/* A screenshot we have not taken yet says so, rather than shipping a gap. */
.shot-pending {
  display: grid;
  place-items: center;
  min-height: 11rem;
  padding: 1.5rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--ink-faint);
  font-size: 0.9rem;
  text-align: center;
}

/* ── Page furniture ─────────────────────────────────────────────────────── */

.breadcrumb {
  margin-bottom: 0.75rem;
  color: var(--ink-faint);
  font-size: 0.85rem;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb li { max-width: none; }
.breadcrumb li + li::before { content: "→"; margin-right: 0.4rem; }
.breadcrumb a { color: var(--ink-faint); text-decoration: underline; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb [aria-current="page"] { color: var(--ink-soft); }

/* ── Related pages ──────────────────────────────────────────────────────── */

.related {
  margin-top: 3rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.related h2 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.related ul { margin: 0; padding: 0; list-style: none; }
.related li { margin-bottom: 0.45rem; font-size: 0.95rem; }
.related li:last-child { margin-bottom: 0; }
.related a { font-weight: 600; }
.related .why { color: var(--ink-soft); }

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.page-nav a {
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.role-pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

footer.site {
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 0.85rem;
}

@media print {
  .sidebar, .page-nav, .skip-link { display: none; }
  .layout { display: block; }
  body { background: #fff; color: #000; font-size: 11pt; }
  figure img { box-shadow: none; }
}
