/* docs/stylesheets/theme.css: the OwnHealth docs site.
 *
 * The colours come from the picked banner, Figtree in the Tide scheme
 * (docs/images/banner.svg): background #eef4f6, teal #0e7490, ink navy
 * #0f1e2e. The web app uses the same family (ui/src/lib/styles/app.css).
 *
 * Light scheme: the page and the header are the Tide background, and links are
 * the banner teal, 4.8:1 on it (5.4:1 on white).
 * Dark scheme: the page is the Tide navy, and links are the teal lightened for
 * a dark page, #3cbadd, 7.4:1 on the navy (the app's --accent).
 *
 * zensical.toml sets `primary: custom` and `accent: custom`, so the theme
 * paints nothing until the Material variables below exist. The modern variant
 * has no coloured header band: the header is the page background seen through
 * a blur, so each scheme sets the page background and its translucent header
 * shades. Telegram-Archive's theme.css is the base; the class prefix here is
 * `oh-`.
 */
:root {
  --oh-tide: #eef4f6; /* banner background */
  --oh-teal: #0e7490; /* banner accent: the O, "Own", light-scheme links */
  --oh-ink: #0f1e2e; /* banner ink: the H, "Health", the dark-scheme page */
  --oh-bg: var(--oh-ink);
  --oh-accent: #3cbadd; /* the teal lightened for the navy page, 7.4:1 */
  --oh-surface: color-mix(in srgb, var(--oh-bg) 88%, #ffffff);
  --oh-text: #e6e8ee;
  --oh-muted: #9aa3b2;

  --md-primary-fg-color: var(--oh-bg);
  --md-primary-fg-color--light: var(--oh-surface);
  --md-primary-fg-color--dark: color-mix(in srgb, var(--oh-bg) 70%, #000000);
  --md-primary-bg-color: var(--oh-text);
  --md-primary-bg-color--light: var(--oh-muted);

  --md-accent-fg-color: var(--oh-accent);
  --md-accent-fg-color--transparent: color-mix(in srgb, var(--oh-accent) 10%, transparent);
}

/* Dark scheme: the page is the Tide navy; the header shades are that navy,
   translucent, so the blur shows the page under it. */
[data-md-color-scheme="slate"] {
  --md-default-bg-color: var(--oh-bg);
  --md-default-bg-color--light: rgb(15 30 46 / 70%);
  --md-default-bg-color--lighter: rgb(15 30 46 / 30%);
  --md-default-bg-color--lightest: rgb(15 30 46 / 12%);
  --md-code-bg-color: var(--oh-surface);
  --md-typeset-a-color: var(--oh-accent);
}

/* Light scheme: the page is the Tide background, links the banner teal. */
[data-md-color-scheme="default"] {
  --md-default-bg-color: var(--oh-tide);
  --md-default-bg-color--light: rgb(238 244 246 / 70%);
  --md-default-bg-color--lighter: rgb(238 244 246 / 30%);
  --md-default-bg-color--lightest: rgb(238 244 246 / 12%);
  --md-typeset-a-color: var(--oh-teal);
  --md-accent-fg-color: var(--oh-teal);
  /* The active nav link's tint: 6% keeps the teal text at 4.6:1 (10% gave 4.49). */
  --md-accent-fg-color--transparent: color-mix(in srgb, var(--oh-accent) 6%, transparent);
}

/* Header: a fixed logo size, the mark and the name close. logo.svg keeps its
   light plate, because the navy H would vanish on the dark-scheme header. */
.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  height: 1.6rem;
  width: 1.6rem;
}

.md-header__button.md-logo {
  padding-right: 0.2rem;
}

.md-header__title {
  margin-left: 0.2rem;
}

/* The site name drawn like the banner wordmark: heavy, "Own" in teal and
   "Health" in ink. Figtree is not loaded (the site uses system fonts, see
   zensical.toml), so the colours and the weight carry the likeness. The two
   halves are pseudo-elements over the hidden name; their alternative text is
   empty, so a screen reader reads the real name once. Only the first topic is
   styled: the second one is the page title, swapped in on scroll. */
.md-header__topic:first-child .md-ellipsis {
  font-size: 0;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.md-header__topic:first-child .md-ellipsis::before,
.md-header__topic:first-child .md-ellipsis::after {
  font-size: 0.9rem;
}

.md-header__topic:first-child .md-ellipsis::before {
  content: "Own";
  content: "Own" / "";
  color: var(--oh-teal);
}

.md-header__topic:first-child .md-ellipsis::after {
  content: "Health";
  content: "Health" / "";
  color: var(--oh-ink);
}

[data-md-color-scheme="slate"] .md-header__topic:first-child .md-ellipsis::before {
  color: var(--oh-accent);
}

[data-md-color-scheme="slate"] .md-header__topic:first-child .md-ellipsis::after {
  color: var(--oh-text);
}

/* The phone drawer repeats the name beside the logo: the same two halves, in
   each scheme's colours. The title is the theme's flex row: the halves go
   after the logo (order 1), and the row gap moves onto "Own" so the hidden
   text in between adds no space. */
.md-nav--primary > .md-nav__title[for="__drawer"] {
  font-size: 0;
  gap: 0;
}

.md-nav--primary > .md-nav__title[for="__drawer"]::before,
.md-nav--primary > .md-nav__title[for="__drawer"]::after {
  font-size: 0.8rem;
  font-weight: 800;
  order: 1;
}

.md-nav--primary > .md-nav__title[for="__drawer"]::before {
  content: "Own";
  content: "Own" / "";
  margin-left: 0.4rem;
  color: var(--oh-teal);
}

.md-nav--primary > .md-nav__title[for="__drawer"]::after {
  content: "Health";
  content: "Health" / "";
  color: var(--oh-ink);
}

[data-md-color-scheme="slate"] .md-nav--primary > .md-nav__title[for="__drawer"]::before {
  color: var(--oh-accent);
}

[data-md-color-scheme="slate"] .md-nav--primary > .md-nav__title[for="__drawer"]::after {
  color: var(--oh-text);
}

/* Buttons: outline in the link colour, on no fill (the theme's grey fill took
   the light-scheme text to 4.3:1). The primary colour is the page background
   in the dark scheme, so a default button would read as text. */
.md-typeset .md-button {
  color: var(--md-typeset-a-color);
  background-color: transparent;
  border: 0.1rem solid var(--md-typeset-a-color);
  border-radius: 0.5rem;
}

.md-typeset .md-button:focus,
.md-typeset .md-button:hover {
  background-color: var(--md-typeset-a-color);
  border-color: var(--md-typeset-a-color);
  color: #ffffff;
}

[data-md-color-scheme="slate"] .md-typeset .md-button:focus,
[data-md-color-scheme="slate"] .md-typeset .md-button:hover,
[data-md-color-scheme="slate"] .md-typeset .md-button--primary {
  color: var(--oh-bg);
}

.md-typeset .md-button--primary {
  background-color: var(--md-typeset-a-color);
  border-color: var(--md-typeset-a-color);
  color: #ffffff;
}

/* Grid cards: the border takes the link colour on hover. */
.md-typeset .grid.cards > ul > li,
.md-typeset .grid > .card {
  border-radius: 0.5rem;
}

.md-typeset .grid.cards > ul > li:focus-within,
.md-typeset .grid.cards > ul > li:hover,
.md-typeset .grid > .card:focus-within,
.md-typeset .grid > .card:hover {
  border-color: var(--md-typeset-a-color);
}

/* The home page keeps an H1 for search, screen readers and the browser tab,
   hidden visually once the banner shows the name.
   Use it as: # OwnHealth { .oh-visually-hidden } */
.md-typeset h1.oh-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Identifiers in tables (LOINC codes, scope names, env vars) do not wrap
   mid-word. */
.md-typeset table:not([class]) code {
  word-break: normal;
}

/* Screenshots: a thin frame so a dark screenshot does not melt into the dark
   page. */
.md-typeset .oh-shot img,
.md-typeset img.oh-shot {
  border: 1px solid color-mix(in srgb, var(--oh-muted) 30%, transparent);
  border-radius: 0.5rem;
}

/* A gallery of screenshots with captions: three in a row on a wide screen,
   one on a phone. */
.md-typeset .oh-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin: 1em 0;
}

.md-typeset .oh-gallery figure {
  margin: 0;
}

.md-typeset .oh-gallery img {
  border: 1px solid color-mix(in srgb, var(--oh-muted) 30%, transparent);
  border-radius: 0.4rem;
}

/* Hero: pitch on the left, the dashboard on the right. */
.md-typeset .oh-hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 1.6rem;
  align-items: center;
  margin: 0.4rem 0 1.6rem;
  /* A grid sits beside the floated edit and copy buttons and loses their
     width; clearing them gives the hero the full column. */
  clear: both;
}

/* The big first line of the home page. */
.md-typeset .oh-hero__title {
  font-size: 2.2em;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.6em;
}

.md-typeset .oh-hero img {
  border: 1px solid color-mix(in srgb, var(--oh-muted) 30%, transparent);
  border-radius: 0.6rem;
}

/* Status line: pre-alpha, version, licence. Always visible, never alarming. */
.md-typeset .oh-status {
  display: inline-block;
  padding: 0.15em 0.7em;
  border: 1px solid color-mix(in srgb, var(--md-typeset-a-color) 50%, transparent);
  border-radius: 1em;
  font-size: 0.8em;
  color: var(--md-typeset-a-color);
}

@media screen and (max-width: 59.9844em) {
  .md-typeset .oh-hero {
    grid-template-columns: 1fr;
  }

  .md-typeset .oh-gallery {
    grid-template-columns: 1fr;
  }
}
