/* Sticky footer styles
-------------------------------------------------- */
html {
  position: relative;
  min-height: 100%;
}
body {
  /* Margin bottom by footer height */
  margin-bottom: 60px;
}
.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  /* Set the fixed height of the footer here */
  height: 60px;
  background-color: #f5f5f5;
}


/* Custom page CSS
-------------------------------------------------- */
/* Not required for template or sticky footer method. */

body > .container {
  padding: 60px 15px 0;
}
.container .text-muted {
  margin: 20px 0;
}

.footer > .container {
  padding-right: 15px;
  padding-left: 15px;
}

code {
  font-size: 80%;
}

/* comments fixup */
.comment {
    border: none;
    padding: 1em;
    margin: 1em;
    background: #f3f3f3;
}
.actions ul {
    margin: inherit;
    padding: inherit;
    height: inherit;
    /* list-style-type: none; */
}

/* limit main content to ~90 chars per line */
/* update: practical typography recommends 2-3 alphabets */
#content {
  max-width: 35em;              /* this is 2.5 alphabets with Charter */
}

/* limit header as well otherwise logo is out of whack without sidebar */
.navbar-fixed-top .container {
  max-width: 55em;
}

/* Charter Font */

/* This snippet was taken from Butterick's site but modified to add a
   fonts/ prefix to follow local layout */

/* Generated by Font Squirrel (http://www.fontsquirrel.com) on July 10, 2013 */
@font-face {
    font-family: 'Charter webfont';
    src: url('fonts/charter_bold_italic-webfont.eot');
    src: url('fonts/charter_bold_italic-webfont.eot?#iefix') format('embedded-opentype'),
         url('fonts/charter_bold_italic-webfont.woff') format('woff');
    font-weight: bold;
    font-style: italic;
}

@font-face {
    font-family: 'Charter webfont';
    src: url('fonts/charter_bold-webfont.eot');
    src: url('fonts/charter_bold-webfont.eot?#iefix') format('embedded-opentype'),
         url('fonts/charter_bold-webfont.woff') format('woff');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'Charter webfont';
    src: url('fonts/charter_italic-webfont.eot');
    src: url('fonts/charter_italic-webfont.eot?#iefix') format('embedded-opentype'),
         url('fonts/charter_italic-webfont.woff') format('woff');
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: 'Charter webfont';
    src: url('fonts/charter_regular-webfont.eot');
    src: url('fonts/charter_regular-webfont.eot?#iefix') format('embedded-opentype'),
         url('fonts/charter_regular-webfont.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

/* some hacking at typefaces to get some fresh zest in here
 * fallbacks from:
 * https://en.wikipedia.org/wiki/List_of_typefaces_included_with_Microsoft_Windows
 * https://en.wikipedia.org/wiki/List_of_typefaces_included_with_macOS
 */
.navbar, .footer {
    /*
     * Avenir: Mac, quite different but should still be pretty
     * Gill sans: Mac, Windows, somewhat similar to Avenir (indulge me)
     * Noto sans: Android, packaged in Debian
     * Open sans: Texlive extras AKA Linux, packaged in Debian
     * Fira sans: Mozilla's Firefox OS
     * Liberation sans: Linux fallback
     * Helvetica: general fallback
     * Sans-serif: fallback
     */
    font-family: Avenir, "Gill sans", "Noto sans", "Open sans", "Fira sans", "Liberation sans", Helvetica, sans-serif;
    /* Fira is available from https://github.com/mozilla/Fira/ under the SIL Open Font License */
    /* alternatively, just use system fonts for "controls" instead:
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    gitlab uses: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"
    */
}
h1, h2, h3, h4, h5, body {
    /* 
     * Charter: Butterick's favorite, freely available, found on https://practicaltypography.com/free-fonts.html
     * Palatino: Mac OS
     * Palatino Linotype: Windows
     * Noto serif: Android, packaged in Debian
     * Liberation serif: Linux fallback
     * Serif: fallback
     */
    font-family: "Charter webfont", Charter, Palatino, "Palatino Linotype", "Noto serif", "Liberation serif", serif;
    /* Charter is available from https://practicaltypography.com/charter.html under the liberal Bitstream license */
}
h1, h2, h3, h4, h5 {
    font-style: italic;
}
/* for charter, we should inline this: */
/*  <link rel="stylesheet" href="https://paste.anarc.at/publish/charter/stylesheet.css" type="text/css" charset="utf-8" /> */
/* we won't ship fira because it is too big and will hope some other font will kick in for headings, preferably Open sans */

/* no idea why bootstrap makes quotes bigger, not what i want */
blockquote {
    font-size: 14px;
    /* make blockquotes interesting */
    font-style: italic;
}

/* enlarge body point size for charter for larger displays */
@media (min-device-width: 750px) {
    body {
        font-size: 20px;
        line-height: 1.3; /* default in FF is ~1.48, try seems a bit to sparse */
    }
    /* to match the other bootstrap workaround, below */
    blockquote {
        font-size: 20px;
    }
    /* UI elements should be a little less intrusive */
    .navbar, .footer {
        font-size: 16px;
    }
}

pre, code {
    font-family: "Fira Mono", Menlo, Monaco, Consolas, "Courier New", "Liberation mono", monospace;
}

/* don't word-wrap PRE blocks so they are scrolled*/
pre {
    -ms-word-wrap: normal;
    word-wrap: normal;
}
pre code {
      white-space: pre;
}

/* workaround multimarkdown bug:
 * https://github.com/bobtfish/text-multimarkdown/issues/30 */
a.footnote { vertical-align: super; font-size: xx-small; }
div.footnotes { font-size: small; }

/* scale down images so they are centered like the rest of the text */
#content img { max-width: 100%; }

/* format HTML5 captions like ikiwiki's table-based captions
 *
 * those work, but basically need to be entered by hand.
 *
 * https://ikiwiki.info/todo/html5_image_captions/
 */
figure {
    text-align: center;
}
figcaption {
    text-align: center;
    font-size: smaller;
    color: #777;
}

/* right-aligned figures
 *
 * those need a "table" display so that the caption shows up alongside the
 * figured. we also limit the size of the image so that it does not squeeze the
 * text too mucha nd had judicious padding.
 */
figure.align-right {
  float: right;
  padding: 0em 1em;
  display: table;
  max-width: 60%;
}
figure.align-right figcaption {
  display: table-caption;
  caption-side: bottom;
  padding: 0.5em 1em;
}

/* wrap long URLs so that we don't overflow layout
 * this could apply to any element, but we often have to deal with long
 * links so limit to that to avoid unexpected damage */
#content a {
    word-wrap: break-word;
}

/* transparent on top because links disappear behind otherwise */
.navbar-fixed-top { background: none; }
/* .in gets added by bootstrap on pop-up */
.navbar-fixed-top .in { background-color: #f8f8f8; }
/* align drop-down menus to the right */
.navbar-right { text-align: right; }

/* make table scale out to avoid ugly word-wrapping
 * bootstrap should deal with this, but ikiwiki doesn't assign the
 * right style and anyways our width is smaller than necessary
 *
 * pages with tables that should be checked when this is changed:
 *
 * https://anarc.at/blog/2017-10-26-comparison-cryptographic-keycards/
 * https://anarc.at/blog/2018-01-28-large-disk-price-review/
 * https://anarc.at/services/backup/
 * https://anarc.at/services/
 * https://anarc.at/services/dns/registrars/
 * https://anarc.at/services/welcome/
 */
table, table.table { width: 100%; }
table { font-size: inherit; } /* why the heck does chrome override font-size for tables?! */

/* this belongs in ikiwiki's style.css, but that needs the admonition
 * patch to be merged: https://ikiwiki.info/todo/admonitions/ */

/* admonition start */
#content div.caution,
#content div.important,
#content div.note,
#content div.tip,
#content div.warning {
    border: 1pt solid #aaa;
    margin: 1em 3em 1em 3em;
    background-repeat: no-repeat;
    background-position: 8px 8px;
    min-height: 48px; /*48=32+8+8 but doesn't work with IE*/
    padding: 1em 1em 1em 48px;
}
#content div.tip { background-image: url("smileys/admon-tip.png"); }
#content div.note { background-image: url("smileys/admon-note.png"); }
#content div.important { background-image: url("smileys/admon-important.png"); }
#content div.caution { background-image: url("smileys/admon-caution.png"); }
#content div.warning { background-image: url("smileys/admon-warning.png"); }
/* admonition end */

.breadcrumb {
    padding: 1px 0 0 0;
    border-bottom: none;
    padding-inline-start: 0px;
}
.breadcrumb li {
    padding: 8px 0 8px 8px;
}
.breadcrumb li::before {
    padding: 0 5px 0 0;
}
.page-header {
    border-bottom: none;
    margin: 40px 0 0;
}

/* more things to hide in printouts */
@media print {
    .footer { position: relative; }
    .footer .powered-by { display: none; }
    /* https://ikiwiki.info/todo/hide_add_comment_button_in_print/ */
    .addcomment { display: none; }
    /* remove link explosion in footer */
    .pagedate a[href]::after { content: normal; }
    .footer a[href]::after { content: normal; }
    /* reset size constraints, paper takes care of that */
    #content {
        width: auto;
        max-width: inherit;
        padding: 0;
        margin: 0;
    }
    body {
        margin: 0;
    }
}


/* hierarchical heading numbers */

/* this uses CSS3 to show headings like:
 *
 * 1. one
 * 2. two
 *    2.1. two point one
 * 3. three
 *
 * This is based on https://developer.mozilla.org/en-US/docs/Web/CSS/counter-reset
 * ... and inspired by https://practicaltypography.com/hierarchical-headings.html
 *
 * This overrides the default in ikiwiki, which is *roman* numerals (!)
 */
/* make a counter for ordered lists in the table of contents */
.toc ol {
    /* this will break ikiwiki unless the following patch is applied: https://ikiwiki.info/todo/allow_toc_to_skip_entries/ */
    counter-reset: section;
    list-style-type: none;
}
/* override bootstrap */
.toc li.L1, .toc li.L2, .toc li.L3, .toc li.L4, .toc li.L5, .toc li.L6 {
    list-style-type: none;
}
.toc li::before {
    /* increment the counter when we hit a new li */
    counter-increment: section;
    /* Combines the values of all instances of the section counter,
       separated and followed by a period */
    content: counters(section, ".") ". ";
}
/* except in notebox, we don't want to have numbers there. that is used
 * in the blog archive, in blog.md */
.notebox .toc ol {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    /* override LI's built-in padding */
    padding-inline-start: 0px;
}
.notebox .toc li::before {
    counter-increment: none;
    content: "";
}
.notebox .toc li.L1, .notebox .toc li.L2, .notebox .toc li.L3, .notebox .toc li.L4, .notebox .toc li.L5, .notebox .toc li.L6 {
    list-style-type: none;
}

/* another counter for headings, but one which should follow the one generated by the ikiwiki toc */

/* this was taken from https://philarcher.org/diary/2013/headingnumbers/ */
body {counter-reset: h1}
h1 {counter-reset: h2}
h2 {counter-reset: h3}
h3 {counter-reset: h4}
h4 {counter-reset: h5}
h5 {counter-reset: h6}

h1:before {counter-increment: h1; content: counter(h1) ". "}
h2:before {counter-increment: h2; content: counter(h1) "." counter(h2) ". "}
h3:before {counter-increment: h3; content: counter(h1) "." counter(h2) "." counter(h3) ". "}
h4:before {counter-increment: h4; content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) ". "}
h5:before {counter-increment: h5; content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) ". "}
h6:before {counter-increment: h6; content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) ". "}

h1.nocount:before, h2.nocount:before, h3.nocount:before, h4.nocount:before, h5.nocount:before, h6.nocount:before, div.nocount h1:before, div.nocount h2:before, div.nocount h3:before, div.nocount h4:before, div.nocount h5:before, div.nocount h6:before {
    content: ""; counter-increment: none
}

/* ... except main title, we don't want a number there */
header h1::before {
    content: "";
}
