/* Afleet colours, from the app theme (Color.kt): LightBlue header with Navy
   text, AfleetBlue links. The app has no dark theme; in dark mode the header
   is Navy and links a lighter blue. */
:root > * {
  --afleet-blue: #1E57EA;
  --afleet-light-blue: #D7EFFE;
  --afleet-navy: #073042;
  --md-primary-fg-color: var(--afleet-blue);
  --md-primary-fg-color--light: #5C86F0;
  --md-primary-fg-color--dark: #1544BB;
  --md-accent-fg-color: var(--afleet-blue);
  --md-accent-fg-color--transparent: #1E57EA1A;
  --md-typeset-a-color: var(--afleet-blue);
  --afleet-header-bg: var(--afleet-light-blue);
  --afleet-header-fg: var(--afleet-navy);
}

[data-md-color-scheme="slate"] {
  --md-primary-fg-color: #8AB4FF;
  --md-accent-fg-color: #8AB4FF;
  --md-accent-fg-color--transparent: #8AB4FF1A;
  --md-typeset-a-color: #8AB4FF;
  --afleet-header-bg: var(--afleet-navy);
  --afleet-header-fg: #FFFFFF;
}

.md-header {
  background-color: var(--afleet-header-bg);
  color: var(--afleet-header-fg);
}

[data-md-color-scheme="slate"] .md-header__title {
  color: var(--afleet-header-fg);
}

/* Darker text in light mode, for reading on a phone outdoors (README
   Decisions: Colours and contrast). Theme defaults: 0.87 / 0.55 / 0.32;
   delete this block to go back to them. */
body[data-md-color-scheme="default"] {
  --md-default-fg-color: rgba(0, 0, 0, 0.95);
  --md-default-fg-color--light: rgba(0, 0, 0, 0.72);
  --md-default-fg-color--lighter: rgba(0, 0, 0, 0.45);
}

/* Section headings inside tips and definitions. The theme's #### is body size
   (reads like a bold sentence) and its ##### is small, faded and in capitals
   (capitals mean an app label here). README Decisions: Colours and contrast. */
.md-typeset h4 {
  margin-top: 1.6em;
  font-size: 1.1em;
}

.md-typeset h5 {
  font-size: 1em;
  color: var(--md-default-fg-color);
  text-transform: none;
}

/* Tables: same text size as the page (the theme's is about 15% smaller, too
   small outdoors), and column dividers as well as row dividers. */
.md-typeset table:not([class]) {
  font-size: inherit;
}

.md-typeset table:not([class]) :is(th, td) + :is(th, td) {
  border-left: .05rem solid var(--md-typeset-table-color);
}

/* On phones, less padding in table cells and a smaller bullet indent, so the
   narrow columns keep more room for words. (The theme's phone breakpoint.) */
@media screen and (max-width: 44.984375em) {
  .md-typeset table:not([class]) :is(th, td) {
    padding: .6em .7em;
  }

  .md-typeset table:not([class]) td ul {
    margin: 0;
  }

  [dir=ltr] .md-typeset table:not([class]) td ul li {
    margin-left: 1em;
  }
}

/* Printing (browser Print / Save as PDF), mainly for manuals. The theme
   already hides the header, sidebars, footer and buttons. */
@page {
  margin: 15mm;

  /* Page numbers (Chrome and Edge; other browsers can add their own). */
  @bottom-center {
    content: counter(page) " / " counter(pages);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12pt;
    color: #333333;
  }
}

@media print {
  /* Dark text on white, even when printed from dark mode. */
  body {
    --md-default-fg-color: rgba(0, 0, 0, 0.95);
    --md-default-fg-color--light: rgba(0, 0, 0, 0.72);
    --md-default-fg-color--lighter: rgba(0, 0, 0, 0.45);
    --md-default-bg-color: #FFFFFF;
    --md-typeset-color: rgba(0, 0, 0, 0.95);
    --md-typeset-a-color: var(--afleet-blue);
  }

  .md-typeset :is(h1, h2, h3, h4, h5, h6) {
    color: var(--md-default-fg-color);
  }

  /* Each manual chapter (##) starts a new page, except the first one, which
     follows the title. "See also" (screen definitions) doesn't. */
  .md-typeset h2:not(h1 + h2):not(#see-also) {
    break-before: page;
  }

  /* Keep headings with what follows; don't split notes, table rows,
     steps or images across pages. */
  .md-typeset :is(h2, h3, h4, h5, h6) {
    break-after: avoid;
  }

  /* A list of steps moves to the next page as a whole, so a step isn't left
     alone at the bottom of a page (a list longer than a page still splits). */
  .md-typeset :is(.admonition, details, tr, li, img, ol) {
    break-inside: avoid;
  }

  /* A table moves to the next page as a whole, with the heading above it
     (headings stay with what follows). One longer than a page still splits. */
  .md-typeset :is(.md-typeset__scrollwrap, .md-typeset__table, table) {
    break-inside: avoid;
  }

  /* Tooltips don't work on paper: no dotted underline. */
  .md-typeset abbr,
  .md-typeset .no-tooltips a abbr {
    border-bottom: none;
    text-decoration: none;
  }

  /* Website-only: breadcrumb, "Appears in" boxes and topic chips. */
  .md-content .md-path,
  .md-typeset .admonition.info,
  .md-tags {
    display: none;
  }
}

/* No definition tooltips in headings (e.g. a definition's own title) or
   inside definitions themselves. */
.md-typeset :is(h1, h2, h3, h4, h5, h6) abbr,
.no-tooltips abbr {
  text-decoration: none;
  border-bottom: none;
  cursor: inherit;
  pointer-events: none;
}

/* ...accept a link to another definition, e.g. a Main Menu item. */
.no-tooltips a abbr {
  border-bottom: .05rem dotted var(--md-default-fg-color--light);
  cursor: help;
  pointer-events: auto;
}

/* Screenshots ({ .screenshot }): a full phone screen would fill the page, so
   cap the height; landscape screenshots still shrink to the page width. */
.md-typeset img.screenshot {
  display: block;
  margin: 0 auto;
  max-height: 32rem;
  width: auto;
  border: .05rem solid var(--md-default-fg-color--lightest);
}
