/* Look and feel of tow.whfb.app (Contentful Forma 36 palette) */
:root {
  --gray-100: #f7f9fa;
  --gray-200: #e7ebee;
  --gray-300: #cfd9e0;
  --gray-400: #aec1cc;
  --gray-500: #67728a;
  --gray-800: #1b273a;
  --gray-900: #111b2b;
  --blue: #0059c8;
  --blue-dark: #0041ab;

  --text: var(--gray-900);
  --muted: var(--gray-500);
  --background: #fff;
  --surface: var(--gray-100);
  --border: var(--gray-300);
  --rule: var(--gray-200);
  --link: var(--blue);
  --link-hover: var(--blue-dark);
  --bar: var(--gray-900);
  --todo-background: #fff2e4;
  --todo-text: #b12d00;
  --minimal-border: #5a657c;

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--background);
}

/* Dark: OWB's ?theme=dark, or the system setting unless ?theme=light.
   Colours match tow.whfb.app in OWB's dark mode (invert(1) hue-rotate(175deg)) */
:root[data-theme="dark"] {
  --text: #e4eef5;
  --muted: #818fa5;
  --background: #111;
  --surface: #050708;
  --border: #1f2a2f;
  --rule: #1f2a2f;
  --link: #59c0ff;
  --link-hover: #80ceff;
  --bar: #0b131f;
  --todo-background: #180900;
  --todo-text: #ff9e7d;
  --minimal-border: #8e9cb1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text: #e4eef5;
    --muted: #818fa5;
    --background: #111;
    --surface: #050708;
    --border: #1f2a2f;
    --rule: #1f2a2f;
    --link: #59c0ff;
    --link-hover: #80ceff;
    --bar: #0b131f;
    --todo-background: #180900;
    --todo-text: #ff9e7d;
    --minimal-border: #8e9cb1;
  }
}

body {
  margin: 0;
  padding-bottom: 3rem;
  background: var(--background);
}

a {
  color: var(--link);
  font-weight: 500;
  text-decoration: none;
}

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

/* Header bar */
.site-header {
  display: flex;
  align-items: center;
  height: 70px;
  padding: 0 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}

.site-header a {
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 700;
}

.site-header span {
  margin-left: 0.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 400;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 4rem 1.5rem 2rem;
}

/* Footer bar, fixed like on tow.whfb.app */
.site-footer {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  padding: 0.5rem 0;
  background: var(--bar);
  color: var(--gray-300);
  font-size: 0.75rem;
  text-align: center;
}

.site-footer a {
  margin: 0 0.75rem;
  color: var(--gray-300);
}

.site-footer a:hover {
  color: #fff;
}

/* Embedded in Old World Builder */
.minimal .site-header,
.minimal .site-footer {
  display: none;
}

/* No own background, like tow.whfb.app: OWB inverts the iframe in dark mode */
.minimal,
.minimal body {
  background: none;
}

.minimal body {
  padding-bottom: 0;
}

.minimal main {
  padding: 0;
}

.minimal h1 {
  font-size: 2rem;
}

/* Tables like tow.whfb.app's minimal view */
.minimal thead tr {
  background: none;
}

.minimal th,
.minimal td {
  border-color: var(--minimal-border);
}

/* Typography */
h1,
h2,
h3,
h4 {
  line-height: 1.1;
  font-weight: 700;
}

h1 {
  margin: 0 0 1.5rem;
  font-size: 3rem;
}

h2 {
  margin: 2.5rem 0 1.5rem;
  font-size: 2.25rem;
}

h3 {
  margin: 2rem 0 1rem;
  font-size: 1.25rem;
}

h4 {
  margin: 1.5rem 0 0.75rem;
  font-size: 1rem;
}

p,
ul,
ol {
  margin: 0 0 1rem;
}

li + li {
  margin-top: 0.25rem;
}

em {
  color: var(--muted);
}

strong em,
em strong {
  color: inherit;
}

/* Breadcrumb and source below the title */
.page-meta {
  margin: -0.5rem 0 2rem;
  font-size: 0.8125rem;
  line-height: 1.35;
}

.page-meta .crumbs > * + *::before {
  content: "::";
  display: inline-block;
  margin: 0 0.5rem;
  color: var(--text);
  font-weight: 400;
}

.page-meta .crumbs span {
  color: var(--muted);
}

.page-meta p {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

/* Tables */
.table-wrapper {
  margin: 2rem 0;
  overflow-x: auto;
}

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

th,
td {
  padding: 0.75rem;
  border: 1px solid var(--border);
  text-align: center;
}

thead tr {
  background: var(--surface);
}

th {
  color: var(--muted);
  font-weight: 700;
}

/* Unit profiles: name column left, characteristics narrow */
table.profile td,
table.profile th {
  width: 7%;
  min-width: 42px;
}

table.profile td:first-child,
table.profile th:first-child {
  width: 37%;
  text-align: left;
  white-space: nowrap;
}

/* Army and group pages */
.army-section + .army-section {
  border-top: 1px solid var(--rule);
}

.army-section h3 {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rule-list {
  columns: 3 14rem;
  column-gap: 2rem;
  margin: 0 0 2.5rem;
  padding: 0;
  list-style: none;
}

.rule-list li {
  margin: 0 0 0.25rem;
  break-inside: avoid;
}

/* Not written yet */
.todo {
  padding: 1rem 1.25rem;
  background: var(--todo-background);
  color: var(--todo-text);
  border-radius: 4px;
}

.badge {
  margin-left: 0.25rem;
  padding: 0 0.375rem;
  border-radius: 4px;
  background: var(--todo-background);
  color: var(--todo-text);
  font-size: 0.6875rem;
  font-weight: 500;
  vertical-align: 1px;
}

@media (max-width: 640px) {
  main {
    padding-top: 2rem;
  }

  h1 {
    font-size: 2.25rem;
  }

  h2 {
    font-size: 1.75rem;
  }
}
