/* Apis wiki — static HTML5 */

:root,
html[data-theme="light"] {
  color-scheme: light;
  --bg-page: #fafafa;
  --bg-main: #fff;
  --fg: #111;
  --fg-muted: #666;
  --border: #111;
  --border-soft: #ccc;
  --link: #000;
  --accent: #b22;
  --accent-contrast: #fff;
  --title-mark: yellow;
  --control-bg: #eee;
  --control-bg-hover: #ddd;
  --control-border: #888;
  --toc-border: #11141a;
  --pre-border: #ccc;
  --table-em: #ccc;
  --brand-shadow: -5px 7px 10px rgba(0, 0, 0, 0.28), -10px 14px 22px rgba(0, 0, 0, 0.18);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #12141a;
  --bg-main: #1a1d26;
  --fg: #e6e6e6;
  --fg-muted: #9a9a9a;
  --border: #6a6e78;
  --border-soft: #3a3f4a;
  --link: #e8e8e8;
  --accent: #e05555;
  --accent-contrast: #1a1d26;
  --title-mark: #c4a000;
  --control-bg: #2a2e38;
  --control-bg-hover: #353a46;
  --control-border: #6a6e78;
  --toc-border: #6a6e78;
  --pre-border: #4a5060;
  --table-em: #2f3440;
  --brand-shadow: -5px 7px 12px rgba(0, 0, 0, 0.55), -10px 14px 24px rgba(0, 0, 0, 0.4);
}

table.wikitable {
  border-collapse: collapse;
  border: 1px solid var(--border-soft);
}

table.wikitable td {
  border: 1px solid var(--border-soft);
  text-align: center;
  vertical-align: middle;
  padding: 2px;
}

table.wikitable td.em {
  background: var(--table-em);
  font-weight: bold;
}

.toc {
  border: 1px dashed var(--toc-border);
  float: right;
  margin: 0 0 1em 1em;
  padding: 0.5em 1.5em 0.5em 0.75em;
  max-width: 14em;
  font-size: 0.85em;
}

.toc h3 {
  font-size: 0.9em;
  margin: 0 0 0.4em;
}

.toc ol {
  margin: 0;
  padding-left: 1.2em;
}

.toc li {
  list-style-type: square;
  margin: 0.15em 0;
}

.toc a {
  text-decoration: none;
}

img {
  border: 0;
  max-width: 100%;
  height: auto;
}

pre {
  border: 1px dotted var(--pre-border);
  padding: 4px;
  max-width: 100%;
  overflow: auto;
}

code {
  font-family: "Courier New", monospace;
  font-size: 12px;
}

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

a:hover {
  color: var(--accent-contrast);
  background-color: var(--accent);
  text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "DejaVu Sans", Verdana, sans-serif;
}

li {
  list-style-type: square;
}

.main {
  --brand-width: 76px;
  --brand-gap: 1.5rem;
  --head-gap: 1.5rem;
  --main-inline: 0.75rem;
  position: relative;
  width: min(800px, 100%);
  margin: 0 auto;
  padding: 0 var(--main-inline);
  background-color: var(--bg-main);
  box-sizing: border-box;
}

.brand-mark {
  position: absolute;
  top: 0.5rem;
  /* Same right edge as .head / .head-end */
  right: var(--main-inline);
  width: var(--brand-width);
  height: 84px;
  display: block;
  z-index: 1;
  pointer-events: none;
  /* Shadow casts southwest (left + down) */
  box-shadow: var(--brand-shadow);
}

.prehead,
.postfoot {
  height: 84px;
}

.prehead {
  /* Keep title clear of the bee + gap */
  padding-right: calc(var(--brand-width) + var(--brand-gap));
  box-sizing: border-box;
}

.head,
.foot {
  padding: 1em;
  font-size: small;
}

.head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--brand-gap);
  margin-top: var(--head-gap);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.head > .title {
  flex: 1 1 auto;
  min-width: 0;
}

.head-end {
  flex: 0 0 auto;
  min-width: var(--brand-width);
  display: flex;
  justify-content: flex-end;
}

#theme-toggle {
  white-space: nowrap;
}

.foot {
  border-top: 1px solid var(--border);
  clear: both;
}

.foot-credit {
  margin-top: 1.25rem;
}

.pivot {
  background-color: var(--bg-main);
  padding: 1em;
  min-height: 12em;
}

body {
  padding: 0;
  margin: 0;
  font-family: "Trebuchet MS", "Trebuchet", sans-serif;
  color: var(--fg);
  background: var(--bg-page);
}

.premaintitle {
  background-color: var(--title-mark);
}

.maintitle,
.premaintitle {
  font-family: "DejaVu Sans", Verdana, sans-serif;
  color: var(--accent);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#search-form {
  display: inline-flex;
  gap: 0.35em;
  align-items: center;
  flex-wrap: wrap;
}

#search-query,
.editor-input,
.editor-body {
  font: inherit;
  color: var(--fg);
  background: var(--bg-main);
  border: 1px solid var(--border-soft);
  padding: 0.25em 0.4em;
}

#search-query {
  width: 12em;
  max-width: 100%;
}

button,
.foot button,
.head button {
  font: inherit;
  cursor: pointer;
  color: var(--fg);
  border: 1px solid var(--control-border);
  background: var(--control-bg);
  padding: 0.2em 0.55em;
}

button:hover {
  background: var(--control-bg-hover);
}

button.danger {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--bg-main);
}

#foot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em 0.75em;
  align-items: center;
}

.edit-hint {
  color: var(--fg-muted);
  font-size: 0.9em;
}

html.editable .edit-hint {
  color: var(--accent);
}

.editor {
  margin-top: 1em;
}

.editor-label {
  display: block;
  font-size: small;
  margin: 0.75em 0 0.25em;
}

.editor-input {
  width: min(20em, 100%);
  box-sizing: border-box;
}

.editor-body {
  width: 100%;
  box-sizing: border-box;
  min-height: 16em;
  font-family: "Courier New", monospace;
  font-size: 13px;
  line-height: 1.4;
  resize: vertical;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  align-items: center;
  margin-top: 0.75em;
}

.editor-status {
  font-size: small;
  color: var(--fg-muted);
}

.editor-status.error {
  color: var(--accent);
  font-weight: bold;
}

.page-list,
.search-results {
  list-style: none;
  padding: 0;
}

.page-list li,
.search-results li {
  margin: 0.4em 0;
  list-style: none;
}

.page-meta {
  color: var(--fg-muted);
  font-size: 0.85em;
  margin-left: 0.5em;
}

.content.missing {
  color: var(--fg-muted);
  font-style: italic;
}

@media (max-width: 640px) {
  .toc {
    float: none;
    max-width: none;
    margin: 0 0 1em;
  }

  .main {
    --brand-width: 56px;
    --brand-gap: 1rem;
  }

  .prehead,
  .postfoot {
    height: 64px;
  }

  .brand-mark {
    height: 62px;
    box-shadow: -4px 5px 8px rgba(0, 0, 0, 0.28), -7px 10px 16px rgba(0, 0, 0, 0.16);
  }

  html[data-theme="dark"] .brand-mark {
    box-shadow: -4px 5px 10px rgba(0, 0, 0, 0.55), -7px 10px 18px rgba(0, 0, 0, 0.4);
  }
}
