/* ============================================================
 * docs.css — layout + theme for every page on docs.wintersalmon.com
 * ============================================================
 *
 * The page contract (enforced by `bun run docs:check`, described in
 * /_guide/index.html):
 *   - every page links this file and ../_theme/docs.js by RELATIVE path, so a
 *     page opens the same from file:// and from the deployed site;
 *   - docs.js always sets <html data-theme="light|dark"> ("auto" resolves to
 *     the OS preference), so this sheet and each game's generated tokens.css
 *     both key off [data-theme] and can never disagree;
 *   - game colours come from the game's own tokens.css, loaded after this
 *     file. The chrome below only uses --wf-* so a game palette never leaks
 *     into it.
 *
 * Components keep the wf-* class names of the old wireframe shell, so pages
 * move here without rewriting their markup.
 * ============================================================ */

:root {
  --wf-bg: #f7f5f0;
  --wf-surface: #ffffff;
  --wf-ink: #23201a;
  --wf-muted: #6b6453;
  --wf-line: #d9d3c4;
  --wf-accent: #2f6f4f;
  --wf-banner-bg: #1d1b16;
  --wf-banner-ink: #f3efe3;
  --wf-banner-muted: #a59c84;
  --wf-radius: 10px;
  --wf-maxw: 1180px;
  --wf-font:
    "Pretendard Variable", Pretendard, system-ui, -apple-system, "Segoe UI",
    Roboto, sans-serif;
  --wf-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --wf-bg: #1a1813;
  --wf-surface: #232019;
  --wf-ink: #ece6d5;
  --wf-muted: #9c9277;
  --wf-line: #3a352a;
  --wf-accent: #5fae84;
  --wf-banner-bg: #110f0c;
  --wf-banner-ink: #ece6d5;
  --wf-banner-muted: #8c8369;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--wf-bg);
  color: var(--wf-ink);
  font-family: var(--wf-font);
  line-height: 1.5;
}

a {
  color: var(--wf-accent);
}

/* ---------- site header: home › game › page + section tabs ---------- */
.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--wf-banner-bg);
  color: var(--wf-banner-ink);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.docs-topbar-inner {
  max-width: var(--wf-maxw);
  margin: 0 auto;
  padding: 10px 20px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}
.docs-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  flex: 1;
  min-width: 0;
}
.docs-crumbs a {
  color: var(--wf-banner-muted);
  text-decoration: none;
  white-space: nowrap;
}
.docs-crumbs a:hover {
  color: var(--wf-banner-ink);
  text-decoration: underline;
}
.docs-crumbs .sep {
  color: var(--wf-banner-muted);
  opacity: 0.6;
}
.docs-crumbs .current {
  color: var(--wf-banner-ink);
  font-weight: 600;
}
.docs-theme-btn {
  background: transparent;
  color: var(--wf-banner-muted);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 4px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.docs-theme-btn:hover {
  color: var(--wf-banner-ink);
}
.docs-tabs {
  flex-basis: 100%;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.docs-tabs a {
  padding: 8px 14px 9px;
  font-size: 14px;
  color: var(--wf-banner-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.docs-tabs a:hover {
  color: var(--wf-banner-ink);
}
.docs-tabs a[aria-current="page"] {
  color: var(--wf-banner-ink);
  border-bottom-color: var(--wf-accent);
  font-weight: 600;
}

/* ---------- page container ---------- */
.wf-main {
  max-width: var(--wf-maxw);
  margin: 0 auto;
  padding: 28px 20px 96px;
}
.wf-page-title {
  margin: 6px 0 4px;
  font-size: 26px;
}
.wf-page-sub {
  margin: 0 0 22px;
  color: var(--wf-muted);
  font-size: 14px;
}

/* ---------- table of contents ---------- */
.wf-toc {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.wf-toc-card {
  display: block;
  background: var(--wf-surface);
  border: 1px solid var(--wf-line);
  border-radius: var(--wf-radius);
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.15s,
    transform 0.15s;
}
.wf-toc-card:hover {
  border-color: var(--wf-accent);
  transform: translateY(-2px);
}
.wf-toc-card .num {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--wf-accent);
}
.wf-toc-card h3 {
  margin: 6px 0 4px;
  font-size: 17px;
}
.wf-toc-card p {
  margin: 0;
  font-size: 13px;
  color: var(--wf-muted);
}
.wf-toc-card.is-common .num::after {
  content: " · COMMON";
  color: var(--wf-muted);
}
.wf-toc-card.is-legacy {
  opacity: 0.72;
}
.wf-toc-card.is-legacy .num::after {
  content: " · LEGACY";
  color: var(--wf-muted);
}

/* ---------- section card ---------- */
.wf-section {
  background: var(--wf-surface);
  border: 1px solid var(--wf-line);
  border-radius: var(--wf-radius);
  padding: 22px 24px;
  margin: 18px 0;
}
.wf-section > h2 {
  margin: 0 0 4px;
  font-size: 20px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.wf-section > h2 .num {
  font-size: 13px;
  color: var(--wf-accent);
  font-weight: 700;
}
.wf-section-note {
  color: var(--wf-muted);
  font-size: 14px;
  margin: 4px 0 16px;
}
.wf-subhead {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wf-muted);
  margin: 22px 0 10px;
}

/* generic data table */
.wf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.wf-table th,
.wf-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--wf-line);
  vertical-align: top;
}
.wf-table th {
  color: var(--wf-muted);
  font-weight: 600;
}
code,
.mono {
  font-family: var(--wf-mono);
  font-size: 0.92em;
}
pre {
  overflow-x: auto;
  background: var(--wf-bg);
  border: 1px solid var(--wf-line);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
}

/* ---------- changelog entries (changelog.html) ---------- */
.docs-entry {
  background: var(--wf-surface);
  border: 1px solid var(--wf-line);
  border-radius: var(--wf-radius);
  padding: 18px 22px;
  margin: 14px 0;
}
.docs-entry > h2 {
  margin: 0 0 6px;
  font-size: 17px;
}
.docs-entry time {
  color: var(--wf-muted);
  font-size: 13px;
  font-weight: 400;
}
.docs-entry ul {
  margin: 6px 0;
  padding-left: 20px;
}
.docs-tag {
  display: inline-block;
  min-width: 64px;
  font-family: var(--wf-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--wf-accent);
}

/* ---------- catalog (site root) ---------- */
.docs-catalog-group {
  margin: 26px 0 10px;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wf-muted);
}

/* ---------- sticky bottom step-nav / state switcher ---------- */
.wf-stepnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--wf-surface);
  border-top: 1px solid var(--wf-line);
}
.wf-stepnav-inner {
  max-width: var(--wf-maxw);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.wf-stepnav .grow {
  flex: 1;
  min-width: 0;
}
.wf-step-btn {
  background: var(--wf-surface);
  color: var(--wf-ink);
  border: 1px solid var(--wf-line);
  border-radius: 8px;
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}
.wf-step-btn:hover:not([disabled]) {
  border-color: var(--wf-accent);
}
.wf-step-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.wf-step-btn.primary {
  background: var(--wf-accent);
  border-color: var(--wf-accent);
  color: #fff;
}
.wf-state-label {
  font-size: 12px;
  color: var(--wf-muted);
}
.wf-state-label strong {
  color: var(--wf-ink);
}
.wf-state-switch {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.wf-state-switch button {
  background: transparent;
  border: 1px solid var(--wf-line);
  color: var(--wf-muted);
  border-radius: 999px;
  padding: 4px 11px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.wf-state-switch button[aria-pressed="true"] {
  background: var(--wf-accent);
  border-color: var(--wf-accent);
  color: #fff;
}

.wf-table code {
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .wf-main {
    padding: 20px 16px 96px;
  }
  /* Wide tables scroll inside themselves instead of widening the page. */
  .wf-table {
    display: block;
    overflow-x: auto;
  }
  .docs-topbar-inner {
    padding: 8px 16px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wf-toc-card {
    transition: none;
  }
}
