/* 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);
}

/* The Afleet Home tab (docs/javascripts/home-link.js): the logo before the
   label, sized to the text. */
.md-tabs__link:has(.afleet-home-logo) {
  align-items: center;
  gap: .4em;
}

.afleet-home-logo {
  height: 1.3em;
  width: auto;
}

/* 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 {
  /* The theme makes the page at least a screen tall, which on paper is a
     whole sheet, so a short page spilled onto a blank second sheet. */
  html,
  body {
    height: auto;
    min-height: 0;
  }

  /* 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);
  }

  /* 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;
  }

  /* ...and a short intro under a heading with what follows, so a heading and
     its intro aren't left at the bottom of a page when the steps move on. */
  .md-typeset :is(h2, h3, h4, h5, h6) + p {
    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, topic chips (matching the
     theme's own selector, which would otherwise win) and the cookie banner. */
  .md-content .md-path,
  .md-typeset .admonition.info,
  .md-typeset .md-tags:not([hidden]),
  .md-consent {
    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;
}

/* YouTube videos (docs/javascripts/youtube.js): the player, or the
   placeholder until Marketing cookies are accepted, at 16:9. */
.afleet-video__frame {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  padding: 1rem;
  text-align: center;
  background-color: var(--md-default-fg-color--lightest);
  border-radius: .2rem;
}

.afleet-video__frame:has(iframe) {
  padding: 0;
}

.afleet-video__frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: .2rem;
}

/* The link below is for print and the placeholder: the player shows the title. */
@media screen {
  .afleet-video:has(iframe) > p {
    display: none;
  }
}

/* On paper, the video's address after its title, as a link can't be followed. */
@media print {
  .afleet-video__frame {
    display: none;
  }

  .afleet-video a[href]::after {
    content: " (" attr(href) ")";
  }
}

/* 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);
}
