/* Styles for what UDOP Extended Markdown produces (notice boxes, keycaps, code boxes, tables, figures,
   fact panels, spoilers, footnotes). Adapted from udfop's web/style.css to this site's colours in style.css. */

:root {
  --soft: color-mix(in srgb, var(--fg) 6%, var(--bg));
  --al-note: #2563eb;
  --al-tip: #15803d;
  --al-important: #7c3aed;
  --al-warning: #b45309;
  --al-caution: #b91c1c;
}

/* notice boxes: > [!NOTE], [!TIP], [!IMPORTANT], [!WARNING], [!CAUTION] */
.alert { margin: 0 0 1em; padding: 8px 14px 8px 12px; border-left: 4px solid var(--ac); background: color-mix(in srgb, var(--ac) 9%, var(--bg)); }
.alert-note { --ac: var(--al-note); } .alert-tip { --ac: var(--al-tip); } .alert-important { --ac: var(--al-important); }
.alert-warning { --ac: var(--al-warning); } .alert-caution { --ac: var(--al-caution); }
.alert-label { display: block; margin: 0 0 2px; font-weight: 700; font-size: .85rem; color: var(--ac); }
.alert > :last-child { margin-bottom: .1em; }
.alert, .codebox, blockquote { display: flow-root; }   /* sit beside a floated picture or fact panel instead of under it */

blockquote { margin: 0 0 1em; padding: 0 0 0 1em; border-left: 3px solid var(--border); color: var(--muted); }

/* code boxes: ```lang, coloured at build time */
.codebox { margin: 0 0 1em; border: 1px solid var(--border); background: var(--soft); }
.codebox pre { margin: 0; padding: 10px 12px; }
.codebar { padding: 2px 12px; border-bottom: 1px solid var(--border); }
.codelang { font-weight: 700; font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.tk-k { color: #7c3aed; } .tk-s { color: #15803d; } .tk-n { color: #b45309; } .tk-c { color: var(--muted); font-style: italic; }
.tk-f { color: #2563eb; } .tk-a { color: #0e7490; } .tk-t { color: #be185d; } .tk-v { color: #c2410c; } .tk-m { color: var(--muted); } .tk-h { font-weight: 700; }

/* keycaps: {{Ctrl+C}} */
kbd.k { display: inline-block; min-width: 1.5em; padding: 0 .45em; margin: 0 1px; text-align: center; white-space: nowrap; line-height: 1.4;
  font: .85em ui-monospace, Consolas, monospace; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--bg); }
kbd.k-mouse { border-radius: 10px; }
kbd.k-pad { border-radius: 999px; border-color: var(--accent); }
.kplus { margin: 0 2px; color: var(--muted); }
.keys { white-space: nowrap; }

/* tables */
.table-scroll { overflow-x: auto; margin: .5em 0 1em; }
.wikitable { border-collapse: collapse; width: 100%; font-size: .9rem; }
.wikitable th, .wikitable td { border: 1px solid var(--border); padding: 4px 8px; vertical-align: top; }
.wikitable thead th { background: var(--soft); text-align: left; }
.wikitable.lc tbody th[scope=row], .wikitable.kv th[scope=row] { text-align: left; background: var(--soft); }
.wikitable.kv th[scope=row] { width: 32%; color: var(--muted); }

/* pictures with a caption or {left|right|center width} */
figure.fig { margin: .3em 0 .9em; padding: 6px; max-width: 100%; border: 1px solid var(--border); background: var(--soft); font-size: .85rem; line-height: 1.4; }
figure.fig img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
figure.fig figcaption { padding: 6px 2px 0; color: var(--muted); }
figure.fig-right { float: right; clear: right; margin-left: 1.1em; }
figure.fig-left { float: left; clear: left; margin-right: 1.1em; }
figure.fig-center { margin-left: auto; margin-right: auto; clear: both; }
figure.fig-center figcaption { text-align: center; }
img { max-width: 100%; height: auto; }

/* fact panels: > [!INFO] Title */
.factbox { float: right; clear: right; width: 15.5rem; max-width: 100%; margin: 0 0 .9em 1.1em; border: 1px solid var(--border); font-size: .85rem; line-height: 1.4; }
.ib-title { padding: 5px 8px; background: var(--soft); border-bottom: 1px solid var(--border); text-align: center; font-weight: 700; }
.ib-img { display: block; max-width: calc(100% - 16px); height: auto; margin: 8px auto; }
.ib-row { display: flex; border-top: 1px solid var(--border); }
.ib-title + .ib-row, .ib-img + .ib-row { border-top: 0; }
.ib-k { flex: 0 0 38%; padding: 4px 8px; background: var(--soft); color: var(--muted); }
.ib-v { flex: 1; min-width: 0; padding: 4px 8px; overflow-wrap: anywhere; }
.ib-sec { padding: 3px 8px; background: var(--soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; font-weight: 700; font-size: .8rem; }

@media (max-width: 40rem) {
  figure.fig-left, figure.fig-right, .factbox { float: none; width: auto !important; margin-left: 0; margin-right: 0; }
}
h2, h3 { clear: both; }

/* spoilers: >!text!< stays hidden until hovered or focused (no JavaScript) */
.spoiler { cursor: help; border-radius: 3px; background: var(--fg); color: transparent; }
.spoiler * { color: transparent !important; }
.spoiler:hover, .spoiler:focus { background: var(--soft); color: inherit; outline: none; }
.spoiler:hover *, .spoiler:focus * { color: revert !important; }

/* links: ↗ after external ones, and [[links]] to pages that do not exist yet */
sup.lt { font-size: .65em; margin-left: 1px; color: var(--muted); }
.missing { color: var(--al-caution); border-bottom: 1px dashed currentColor; }

/* footnotes: text[^1] and [^1]: the note */
.fnref a { text-decoration: none; }
.footnotes { font-size: .9rem; }
.fnback { text-decoration: none; }
