/* walker's palette and fonts (walker: src/theme.rs, src/fonts.rs), self-hosted */
@font-face { font-family: "Public Sans"; font-weight: 400; font-display: swap; src: url("/fonts/PublicSans-Regular.ttf") format("truetype"); }
@font-face { font-family: "Public Sans"; font-weight: 600; font-display: swap; src: url("/fonts/PublicSans-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("/fonts/BarlowCondensed-Bold.ttf") format("truetype"); }

/* Light by default, dark when the system asks for it, and either one when the visitor picks it
   with /theme.js's switch, which sets data-theme on <html>. The dark block appears twice because
   CSS can't share it between the media query and the attribute; keep the two the same. */
:root {
  color-scheme: light;
  --bg: #EEF3F5;
  --surf: #FFFFFF;
  --ink: #0D1A23;
  --muted: #4A5B65;
  --line: #C8D5DB;
  --acc: #1A5FD0;
  --ember: #D9531E;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0A1116;
    --surf: #111B21;
    --ink: #E5EEF2;
    --muted: #9DAFB8;
    --line: #27363F;
    --acc: #5B9CFF;
    --ember: #FF7A3D;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A1116;
  --surf: #111B21;
  --ink: #E5EEF2;
  --muted: #9DAFB8;
  --line: #27363F;
  --acc: #5B9CFF;
  --ember: #FF7A3D;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 "Public Sans", system-ui, sans-serif;
}
main, footer { max-width: 42rem; margin: 0 auto; padding: 0 20px; }
main { padding-top: 56px; padding-bottom: 40px; }

h1, h2 { font-family: "Barlow Condensed", "Public Sans", sans-serif; font-weight: 700; line-height: 1.1; letter-spacing: 0.01em; }
h1 { font-size: 3rem; margin: 0 0 12px; }
h2 { font-size: 1.6rem; margin: 40px 0 8px; }
p, ul { margin: 0 0 16px; }
li { margin-bottom: 6px; }
strong { font-weight: 600; }
a { color: var(--acc); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
/* keep an address like support@k-forge.dev from breaking at its hyphen */
a[href^="mailto:"] { white-space: nowrap; }

.lede { font-size: 1.2rem; color: var(--muted); }
.muted { color: var(--muted); font-size: 0.95rem; }
.crumb { font-size: 0.95rem; margin-bottom: 24px; }

/* Home page: the k-forge mark beside the heading. It is inline SVG, so it takes the page's
   colours: rings and anvil in --ink, the k in --ember. brand/ holds it as standalone files. */
.brand { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.brand h1 { margin: 0; }
.mark { width: 76px; height: 76px; flex: none; }
.mark-line { stroke: var(--ink); }
.mark-steel { fill: var(--ink); }
.mark-molten { fill: var(--ember); }

/* The light/dark switch, added by /theme.js at the top right of every page. Above the terrain
   canvas and main, which would otherwise cover it on a phone. */
.theme-toggle {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 44px; height: 44px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surf); color: var(--ink); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--muted); }
.theme-toggle:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.app {
  display: flex; gap: 20px; align-items: center;
  padding: 20px; margin: 24px 0;
  background: var(--surf); border: 1px solid var(--line); border-radius: 16px;
  text-decoration: none; color: inherit;
}
.app:hover { border-color: var(--acc); }
.app img { width: 72px; height: 72px; border-radius: 18px; flex: none; }
.app strong { display: block; font-size: 1.15rem; }
.app span { color: var(--muted); }

/* Home page and walker's page: contour lines behind the top of the page, drawn by /hero.js.
   Decorative only; without the script the page is the same, minus the lines. */
.terrain {
  position: absolute; top: 0; left: 0; width: 100%; height: 520px; pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent);
}
.terrain ~ main, .terrain ~ footer { position: relative; }

.hero { display: flex; gap: 24px; align-items: center; margin-bottom: 24px; }
.hero img { width: 96px; height: 96px; border-radius: 24px; flex: none; }
.hero h1 { margin: 0; }

/* walker's screenshots. The strip scrolls sideways and snaps with CSS alone, centring each
   screenshot; padding of half the width minus half a screenshot lets the first and last centre
   too. It reaches into main's side padding, so it runs edge to edge on a phone. /carousel.js
   adds .ready, shows the buttons and dots, and marks the centred screenshot .is-active. */
.carousel { --shot: 220px; margin: 32px -20px; }
.shots {
  position: relative; display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 4px calc(50% - var(--shot) / 2) 12px;
}
.shots figure { flex: none; width: var(--shot); margin: 0; scroll-snap-align: center; transition: opacity 0.3s, transform 0.3s; }
.shots img { display: block; width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--line); background: var(--surf); }
/* Each screenshot comes in walker's dark and light theme; show the one matching the page's,
   under the same conditions as the colours at the top. Both are loading="lazy", so the
   hidden one is never downloaded. */
.shots .shot-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shots .shot-dark { display: block; }
  :root:not([data-theme="light"]) .shots .shot-light { display: none; }
}
:root[data-theme="dark"] .shots .shot-dark { display: block; }
:root[data-theme="dark"] .shots .shot-light { display: none; }
.shots figcaption { margin-top: 8px; font-size: 0.95rem; color: var(--muted); text-align: center; }
.shots:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 16px; }

.carousel.ready .shots { scrollbar-width: none; }
.carousel.ready .shots::-webkit-scrollbar { display: none; }
.carousel.ready figure:not(.is-active) { opacity: 0.45; transform: scale(0.92); }
.carousel-nav { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 4px; }
.carousel-nav[hidden] { display: none; }
.carousel-btn {
  flex: none; width: 44px; height: 44px; padding: 0;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  background: var(--surf); color: var(--ink); border: 1px solid var(--line);
}
.carousel-btn:hover:not(:disabled) { border-color: var(--acc); }
.carousel-btn:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.carousel-btn:disabled { opacity: 0.35; cursor: default; }
.dots { display: flex; justify-content: center; gap: 2px; }
.dots button { width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.dots button::before { content: ""; width: 8px; height: 8px; border-radius: 4px; background: var(--line); transition: width 0.3s, background 0.3s; }
.dots button[aria-current="true"]::before { width: 20px; background: var(--acc); }
.dots button:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) {
  .shots figure, .dots button::before { transition: none; }
}

footer { padding-top: 24px; padding-bottom: 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }
footer a { color: inherit; }
footer nav { display: flex; gap: 20px; flex-wrap: wrap; }

@media (max-width: 480px) {
  h1 { font-size: 2.4rem; }
  .mark { width: 60px; height: 60px; }
  .hero { flex-direction: column; align-items: flex-start; }
  .app { gap: 16px; padding: 16px; }
  .app img { width: 56px; height: 56px; border-radius: 14px; }
  .terrain { height: 420px; }
  .carousel { --shot: 62vw; }
}

/* Help pages: a table of contents, questions that open without a script, key/value tables */
.toc { padding: 16px 20px; margin: 24px 0; background: var(--surf); border: 1px solid var(--line); border-radius: 12px; }
.toc ul { margin: 0; padding-left: 20px; }
.toc li { margin-bottom: 2px; }
h3 { font-size: 1.05rem; font-weight: 600; margin: 24px 0 6px; }
ol { margin: 0 0 16px; padding-left: 24px; }
details { border-bottom: 1px solid var(--line); padding: 12px 0; }
details:first-of-type { border-top: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 600; }
summary:focus-visible, a:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; border-radius: 4px; }
details p, details ul, details ol { margin-top: 10px; }
table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
th { font-weight: 600; white-space: nowrap; }
.ui { font-weight: 600; }
.note { padding: 12px 16px; margin: 0 0 16px; border-radius: 12px; background: var(--surf); border: 1px solid var(--line); }
