/*
 * The look (owner, 18 November 2026): the app's eight themes, Business Blue unless the reader picks another, light or
 * dark by Material's own switch, no scenery. Every colour is a variable made by tools/themes.py into themes.css, each
 * checked for contrast there: dark text on a light ground in light, light text on a dark ground in dark. What follows
 * places those colours: the reading panel, the side panes in their own colour, the heading's accent, the header and the
 * footer, and the system's own fonts, as the app and the website use.
 */
:root {
  --md-text-font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial,
    sans-serif;
  --md-code-font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
body, input { font-family: var(--md-text-font-family); }
.md-typeset code, .md-typeset kbd, .md-typeset pre { font-family: var(--md-code-font-family); }

/* The header: the theme's signature colour, its two tones as a gentle sweep, the tabs beneath in the same. */
.md-header, .md-tabs {
  background: linear-gradient(100deg, var(--pp-head-a), var(--pp-head-b));
  color: var(--md-primary-bg-color);
}
/* The Mac app's icon, its corners already see-through (owner, 2026-11-18), so it needs no rounding of its own here
   or in the phone's menu. */
.md-header__button.md-logo img { height: 1.9rem; width: 1.9rem; }
/* On a phone and other narrow screens (owner, 2026-11-19): the icon and the name are in the open menu's top, not the
   page's header, which keeps the menu button and, as the page scrolls, the page's own title, on up to two lines and
   centred in the header's height. */
@media screen and (max-width: 76.2344em) {
  .md-header__button.md-logo { display: none; }
  /* only the name: the version picker (v1.0) sits beside it in the same place and stays */
  .md-header__topic:first-child > .md-ellipsis { display: none; }
  .md-header__title { height: 2.4rem; }
  .md-header__ellipsis, .md-header__topic { height: 100%; }
  .md-header__topic { align-items: center; }
  .md-header__topic .md-ellipsis {
    white-space: normal; line-height: 1.15;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  }
  /* The open menu's top (owner, 2026-11-19: "when the menu bar is open"): the icon, and beside it the name on two
     lines, "Private" over "Passwords", centred on it, instead of the icon above the name. */
  .md-nav--primary > .md-nav__title[for="__drawer"] {
    display: grid; grid-template-columns: max-content min-content; justify-content: start; align-items: center;
    column-gap: 0.7rem;
    height: auto; padding: 0.8rem 0.8rem; line-height: 1.2; font-weight: 700; white-space: normal;
  }
  .md-nav--primary > .md-nav__title[for="__drawer"] .md-logo { position: static; margin: 0; padding: 0; }
  .md-nav--primary > .md-nav__title[for="__drawer"] .md-logo img { height: 2.6rem; width: 2.6rem; }
}
.md-tabs__link { opacity: 0.85; }
.md-tabs__item--active .md-tabs__link, .md-tabs__link:hover { opacity: 1; color: inherit; }

/* The reading panel: the page itself on a rounded panel of its own, a shade apart from the ground round it. */
.md-main__inner { margin-top: 1.2rem; }
.md-content {
  background: var(--pp-panel);
  border-radius: 1rem;
  box-shadow: 0 0.1rem 0.6rem var(--pp-hairline);
  margin-bottom: 1.2rem;
}
.md-content__inner { padding-bottom: 1rem; }
@media screen and (max-width: 76.2344em) {
  .md-content { border-radius: 0; box-shadow: none; }
}

/* The page's title in the theme's signature colours, as the website's headings are. */
.md-typeset h1 {
  background: linear-gradient(100deg, var(--pp-title-a), var(--pp-title-b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
  letter-spacing: -0.01em;
}
/* The title's coloured letters would show its link mark at all times, so the title has none; every other heading
   keeps its own. */
.md-typeset h1 .headerlink { display: none; }
.md-typeset h2, .md-typeset h3 { color: var(--md-default-fg-color); font-weight: 700; }

/* The side panes, the menu on the left and "On this page" on the right, in their own colour beside the page's. The
   page being read, and the part of it in view, take the link colour and stand out. */
.md-sidebar .md-nav__link, .md-sidebar .md-nav__title, .md-sidebar .md-nav__item--section > .md-nav__link {
  color: var(--pp-side);
}
.md-sidebar .md-nav__link--active, .md-sidebar .md-nav__link:hover,
.md-sidebar .md-nav__link:focus { color: var(--md-typeset-a-color); }
.md-sidebar .md-nav__link--active { font-weight: 700; }
.md-sidebar .md-nav__item--section > .md-nav__link { font-weight: 700; }
/* On a phone the menu slides over the page: its own ground, so the side colour reads there too. */
@media screen and (max-width: 76.2344em) {
  .md-nav--primary .md-nav__title { background: var(--md-default-bg-color); color: var(--pp-side); }
  .md-nav--primary .md-nav__title[for="__drawer"] {
    background: linear-gradient(100deg, var(--pp-head-a), var(--pp-head-b)); color: var(--md-primary-bg-color);
  }
}

/* On Home, the left pane lists every topic (owner, 2026-11-18: it was blank, Home having no pages under it). With the
   menu tabs, Material shows there only the open tab's pages; while Home's tab is open it shows the topics instead, each
   leading to its own first page (javascripts/home-topics.js, for a topic with no opening page of its own), without the
   arrows that would unfold nothing here. */
@media screen and (min-width: 76.25em) {
  body:has(.md-tabs__item--active:first-child) .md-nav--lifted > .md-nav__list > .md-nav__item { display: block; }
  body:has(.md-tabs__item--active:first-child) .md-nav--lifted > .md-nav__list > .md-nav__item > .md-nav,
  body:has(.md-tabs__item--active:first-child) .md-nav--lifted > .md-nav__list > .md-nav__item .md-nav__icon {
    display: none;
  }
  body:has(.md-tabs__item--active:first-child) .md-nav--lifted > .md-nav__list > .md-nav__item > label.md-nav__link {
    cursor: pointer;
  }
  /* every topic in the side colour, Home itself in the link colour, as any page being read */
  body:has(.md-tabs__item--active:first-child) .md-nav--lifted > .md-nav__list > .md-nav__item > .md-nav__link,
  body:has(.md-tabs__item--active:first-child) .md-nav--lifted > .md-nav__list > .md-nav__item .md-nav__container > a {
    color: var(--pp-side);
  }
  body:has(.md-tabs__item--active:first-child) .md-nav--lifted > .md-nav__list > .md-nav__item--active > .md-nav__link,
  body:has(.md-tabs__item--active:first-child) .md-nav--lifted > .md-nav__list > .md-nav__item > .md-nav__link:hover,
  body:has(.md-tabs__item--active:first-child) .md-nav--lifted > .md-nav__list > .md-nav__item .md-nav__container > a:hover {
    color: var(--md-typeset-a-color);
  }
}

/* Rounded corners, as everywhere in the app. */
.md-typeset .admonition, .md-typeset details { border-radius: 0.7rem; }
.md-typeset pre > code, .md-typeset code { border-radius: 0.4rem; }
.md-search__form { border-radius: 0.6rem; }
.md-typeset table:not([class]) { border-radius: 0.6rem; }

/* The theme picker beside the light/dark switch (javascripts/theme-picker.js). */
.pp-theme-button svg { fill: currentColor; }
.pp-theme-list {
  margin: 0; inset: 3rem 0.6rem auto auto; position: fixed;
  padding: 0.4rem; border: 1px solid var(--pp-hairline); border-radius: 0.8rem;
  background: var(--pp-panel); color: var(--md-default-fg-color);
  box-shadow: 0 0.6rem 1.6rem rgba(0, 0, 0, 0.28);
  min-width: 13rem;
}
.pp-theme-list:popover-open { display: grid; gap: 0.15rem; }
.pp-theme-list button {
  display: flex; align-items: center; gap: 0.7rem; width: 100%;
  padding: 0.5rem 0.7rem; border: 0; border-radius: 0.55rem; cursor: pointer;
  font: inherit; font-size: 0.75rem; text-align: left;
  background: transparent; color: var(--md-default-fg-color);
}
.pp-theme-list button:hover { background: var(--md-default-fg-color--lightest); }
.pp-theme-list button[aria-pressed="true"] { font-weight: 700; background: var(--md-accent-fg-color--transparent); }
.pp-swatch {
  flex: none; width: 1.3rem; height: 1.3rem; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

/* The footer: the theme's colour, then a strip in the page's text colour with the ground's colour on it. */
.md-footer-meta {
  --md-footer-fg-color: var(--pp-strip-fg);
  --md-footer-fg-color--light: var(--pp-strip-fg);
  --md-footer-fg-color--lighter: var(--pp-strip-fg);
}

/*
 * Collapse/expand toggle for the absolute footer (.md-footer-meta).
 * Height is a pure CSS class toggle between a generous fixed max-height
 * and a thin 6px one — no JS-measured scrollHeight involved, so it can't
 * get stuck after an instant-navigation page swap.
 *
 * The button itself is a child of .md-footer (the outer bar), not of
 * .md-footer-meta — .md-footer-meta needs overflow:hidden to clip its own
 * collapsing content, which would also clip a button straddling its top
 * edge. Positioning and click-handling live in javascripts/footer-collapse.js.
 */
.md-footer {
  position: relative;
}

.md-footer-meta {
  overflow: hidden;
  max-height: 6.25rem; /* comfortably above the copyright strip's natural height */
  transition: max-height 0.25s ease, padding-top 0.25s ease, padding-bottom 0.25s ease;
}

.md-footer-meta__inner {
  transition: opacity 0.2s ease;
}

.md-footer-meta--collapsed {
  max-height: 6px;
  padding-top: 0;
  padding-bottom: 0;
}

.md-footer-meta--collapsed .md-footer-meta__inner {
  opacity: 0;
  pointer-events: none;
}

.md-footer-collapse-toggle {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 2px solid var(--md-footer-fg-color);
  border-radius: 50%;
  background-color: var(--md-footer-bg-color--dark);
  color: var(--pp-strip-fg);
  font-size: 0.75rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0.1rem 0.3rem rgba(0, 0, 0, 0.5);
  z-index: 10;
}

.md-footer-collapse-toggle:hover {
  filter: brightness(0.92);
}

.md-footer-collapse-toggle:focus-visible {
  outline: 2px solid var(--md-accent-fg-color);
  outline-offset: 2px;
}

/* Every picture in a page (the owner's rule, 2026-09-27): half the column's
   width, centred, with a dark navy border, rounded corners and a soft shadow,
   so a white screenshot has a clear edge on a white page. On a narrow phone
   screen the picture keeps a readable minimum width instead of shrinking to
   half of very little. Material's emoji are <img> too and are left alone. */
.md-typeset img:not(.twemoji) {
  display: block;
  /* 75% of the half column they had, now that a click enlarges any picture (owner, 2026-11-18). */
  width: 37.5%;
  min-width: min(100%, 12rem);
  height: auto;
  margin: 1.2rem auto;
  border: 3px solid var(--md-primary-fg-color--dark);
  border-radius: 0.8rem;
  box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.25);
}

/* Off-site sidebar links (the Home tab's "Other Pebble IT Apps", once shown)
   get a trailing arrow so they read as leaving this site. The class is set
   by javascripts/external-links.js. */
.md-nav__link--external::after {
  content: " \2197";
  font-size: 0.8em;
  opacity: 0.7;
}

/* The home page's picture (owner, 2026-11-18): one picture holding the iPhone and the Mac, each in its own black device
   border drawn in the picture, so the page adds no border or shadow of its own around the whole. */
.md-typeset img.pp-devices-picture {
  width: 60%;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Every picture enlarges when clicked (owner, 2026-11-18): javascripts/image-zoom.js opens it over a dimmed page, as
   tall as 80% of the screen where the width allows; a click anywhere, or Escape, closes it. */
.md-typeset img:not(.twemoji):not(.emojione) { cursor: zoom-in; }
.pp-zoom {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  cursor: zoom-out;
  animation: pp-zoom-in 0.15s ease-out;
}
.pp-zoom img {
  max-height: 80vh;
  max-width: 92vw;
  width: auto;
  height: auto;
  border-radius: 0.8rem;
  box-shadow: 0 0.6rem 2rem rgba(0, 0, 0, 0.5);
  background: #fff;
}
/* On a phone's narrow screen, up to 92% of the height where the width allows (owner, 2026-11-18). */
@media screen and (max-width: 44em) {
  .pp-zoom img { max-height: 92vh; max-width: 96vw; }
}
@keyframes pp-zoom-in { from { opacity: 0; } to { opacity: 1; } }
