/* HOI4 Field Manual — hand-written. Not touched by tools/hoi4/build.js. */

:root {
  --bg: #141619;
  --panel: #1c1f24;
  --panel-alt: #21252b;
  --border: #2c3138;
  --ink: #d6d2c4;
  --ink-dim: #93968f;
  --accent: #d4a017;
  --accent-ink: #1a1408;
  --warn: #c1441e;
  --link: #e8c04a;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
  --sans: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

a {
  color: var(--link);
}

code,
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-decoration: none;
  font-size: 1.05rem;
}

.search-box {
  position: relative;
  flex: 0 1 320px;
}

.search-box input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: 4px;
  font-family: var(--sans);
}

.search-results {
  position: absolute;
  top: 110%;
  left: 0;
  right: 0;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  max-height: 60vh;
  overflow-y: auto;
  z-index: 20;
}

.search-results a {
  display: block;
  padding: 0.4rem 0.6rem;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}

.search-results a:hover,
.search-results a:focus,
.search-results a.active {
  background: var(--bg);
}

.search-results .meta {
  color: var(--ink-dim);
  font-size: 0.8rem;
}

.search-results mark {
  background: none;
  color: var(--accent);
  font-weight: 600;
}

.search-results .search-footer {
  display: block;
  padding: 0.4rem 0.6rem;
  color: var(--link);
  font-size: 0.85rem;
  text-align: center;
}

.search-results-page {
  position: static;
  max-height: none;
  overflow-y: visible;
  margin-bottom: 1.5rem;
}

.crumbs {
  padding: 0.6rem 1.25rem;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.crumbs a {
  color: var(--ink-dim);
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--link);
}

.crumbs .sep {
  padding: 0 0.35rem;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

h1 {
  color: var(--accent);
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
}

.lede {
  color: var(--ink-dim);
  max-width: 70ch;
}

.version-badge {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-dim);
}

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

.card {
  display: block;
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink);
}

.card:hover {
  border-color: var(--accent);
}

.card h2 {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font-size: 1.1rem;
}

.card p {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.9rem;
}

.topic-group {
  margin-top: 1.75rem;
}

.topic-group h2 {
  color: var(--accent);
  font-size: 1.15rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
  margin-bottom: 0.6rem;
}

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

.topic-list li {
  padding: 0.6rem 0.8rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink-dim);
}

.topic-list a {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
}

.topic-list a:hover {
  text-decoration: underline;
}

.topic-list a.chip {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.05rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
}

.table-scroll {
  overflow-x: auto;
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

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

caption {
  text-align: left;
}

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

thead th {
  background: var(--panel-alt);
  color: var(--accent);
  position: sticky;
  top: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

tbody tr:target {
  background: #33280c;
  outline: 1px solid var(--accent);
}

td.value code {
  color: var(--accent);
}

td.comment {
  color: var(--ink-dim);
}

.doc {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--ink-dim);
  font-style: italic;
}

.elements {
  margin: 0.4rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.85rem;
}

.badge-warn {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.35rem;
  background: var(--warn);
  color: #fff;
  border-radius: 3px;
  font-size: 0.7rem;
  vertical-align: middle;
}

.math-block {
  overflow-x: auto;
  margin: 1rem 0;
  padding: 0.25rem 0;
}

.math-block math {
  margin-inline: auto; /* MathML Core: block math is fit-content width, so this centers it */
}

.math-inline {
  padding: 0 0.1em;
}

.site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  color: var(--ink-dim);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}
