/*
 * aethermesh.dev visual language.
 *
 * Dark by default. Flat surfaces, hairline borders, one accent used only for
 * links, active navigation and focus rings — never as a large fill. No
 * gradients, no shadows, no icons in the feature grid. System fonts only: the
 * site fetches nothing from a third party, so there are no webfonts to fetch.
 */

:root {
  --md-text-font:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --md-code-font: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* --------------------------------------------------------------------------
 * Palette — dark (default)
 * -------------------------------------------------------------------------- */

[data-md-color-scheme="slate"] {
  --aether-bg: #0b0e14;
  --aether-surface: #121721;
  --aether-border: #212a38;
  --aether-text: #c8d2df;
  --aether-muted: #7d8a9c;
  --aether-accent: #59c2c9;

  --md-hue: 215;

  --md-default-bg-color: var(--aether-bg);
  --md-default-bg-color--light: var(--aether-bg);
  --md-default-bg-color--lighter: var(--aether-surface);
  --md-default-bg-color--lightest: var(--aether-surface);

  --md-default-fg-color: var(--aether-text);
  --md-default-fg-color--light: var(--aether-muted);
  --md-default-fg-color--lighter: #4d5765;
  --md-default-fg-color--lightest: var(--aether-border);

  --md-primary-fg-color: var(--aether-bg);
  --md-primary-fg-color--light: var(--aether-surface);
  --md-primary-fg-color--dark: var(--aether-bg);
  --md-primary-bg-color: var(--aether-text);
  --md-primary-bg-color--light: var(--aether-muted);

  --md-accent-fg-color: var(--aether-accent);
  --md-accent-fg-color--transparent: rgb(89 194 201 / 10%);
  --md-accent-bg-color: var(--aether-bg);

  --md-typeset-color: var(--aether-text);
  --md-typeset-a-color: var(--aether-accent);
  --md-typeset-mark-color: rgb(89 194 201 / 20%);

  --md-code-bg-color: var(--aether-surface);
  --md-code-fg-color: var(--aether-text);
  --md-code-hl-color: rgb(89 194 201 / 12%);

  --md-footer-bg-color: var(--aether-bg);
  --md-footer-bg-color--dark: var(--aether-bg);
  --md-footer-fg-color: var(--aether-text);
  --md-footer-fg-color--light: var(--aether-muted);
  --md-footer-fg-color--lighter: var(--aether-muted);

  --md-mermaid-font-family: var(--md-text-font), sans-serif;
  --md-mermaid-bg-color: var(--aether-bg);
  --md-mermaid-node-bg-color: var(--aether-surface);
  --md-mermaid-node-fg-color: var(--aether-text);
  --md-mermaid-label-bg-color: var(--aether-surface);
  --md-mermaid-label-fg-color: var(--aether-text);
  --md-mermaid-edge-color: var(--aether-muted);
}

/* --------------------------------------------------------------------------
 * Palette — light
 * -------------------------------------------------------------------------- */

[data-md-color-scheme="default"] {
  --aether-bg: #ffffff;
  --aether-surface: #f5f7fa;
  --aether-border: #e2e7ee;
  --aether-text: #1a1f27;
  --aether-muted: #5b6673;
  --aether-accent: #0f7c86;

  --md-default-bg-color: var(--aether-bg);
  --md-default-bg-color--light: var(--aether-bg);
  --md-default-bg-color--lighter: var(--aether-surface);
  --md-default-bg-color--lightest: var(--aether-surface);

  --md-default-fg-color: var(--aether-text);
  --md-default-fg-color--light: var(--aether-muted);
  --md-default-fg-color--lighter: #97a1ad;
  --md-default-fg-color--lightest: var(--aether-border);

  --md-primary-fg-color: var(--aether-bg);
  --md-primary-fg-color--light: var(--aether-surface);
  --md-primary-fg-color--dark: var(--aether-bg);
  --md-primary-bg-color: var(--aether-text);
  --md-primary-bg-color--light: var(--aether-muted);

  --md-accent-fg-color: var(--aether-accent);
  --md-accent-fg-color--transparent: rgb(15 124 134 / 8%);
  --md-accent-bg-color: var(--aether-bg);

  --md-typeset-color: var(--aether-text);
  --md-typeset-a-color: var(--aether-accent);
  --md-typeset-mark-color: rgb(15 124 134 / 16%);

  --md-code-bg-color: var(--aether-surface);
  --md-code-fg-color: var(--aether-text);

  --md-footer-bg-color: var(--aether-bg);
  --md-footer-bg-color--dark: var(--aether-bg);
  --md-footer-fg-color: var(--aether-text);
  --md-footer-fg-color--light: var(--aether-muted);
  --md-footer-fg-color--lighter: var(--aether-muted);

  --md-mermaid-font-family: var(--md-text-font), sans-serif;
  --md-mermaid-bg-color: var(--aether-bg);
  --md-mermaid-node-bg-color: var(--aether-surface);
  --md-mermaid-node-fg-color: var(--aether-text);
  --md-mermaid-label-bg-color: var(--aether-surface);
  --md-mermaid-label-fg-color: var(--aether-text);
  --md-mermaid-edge-color: var(--aether-muted);
}

/* --------------------------------------------------------------------------
 * Chrome
 * -------------------------------------------------------------------------- */

.md-header {
  border-bottom: 1px solid var(--aether-border);
  box-shadow: none;
}

.md-header--shadow {
  box-shadow: none;
}

.md-tabs {
  border-bottom: 1px solid var(--aether-border);
}

.aether-wordmark {
  font-family: var(--md-code-font);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.aether-wordmark__mesh {
  color: var(--md-primary-bg-color--light);
}

.md-footer-meta {
  border-top: 1px solid var(--aether-border);
}

.md-copyright {
  color: var(--aether-muted);
  font-size: 0.62rem;
  width: 100%;
}

.md-copyright__highlight {
  color: var(--aether-muted);
}

.md-search__form {
  background-color: var(--aether-surface);
  border: 1px solid var(--aether-border);
  box-shadow: none;
}

.md-search__form:hover {
  background-color: var(--aether-surface);
}

.md-nav__link--active,
.md-nav__link:focus,
.md-nav__link:hover {
  color: var(--md-accent-fg-color);
}

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

/* --------------------------------------------------------------------------
 * Content column and typography
 * -------------------------------------------------------------------------- */

.md-content__inner {
  margin-inline: auto;
  max-width: 46rem;
  padding-top: 1.2rem;
}

.md-typeset {
  font-size: 0.76rem;
  line-height: 1.7;
}

.md-typeset h1 {
  color: var(--md-default-fg-color);
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.32;
  margin-bottom: 0.8rem;
}

.md-typeset h2 {
  border-top: 1px solid var(--aether-border);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-top: 2.6rem;
  padding-top: 1.3rem;
}

.md-typeset h3 {
  font-size: 0.85rem;
  font-weight: 500;
}

.md-typeset a {
  text-underline-offset: 0.18em;
}

.md-typeset pre > code,
.md-typeset code {
  border-radius: 2px;
}

.md-typeset .highlight,
.md-typeset pre {
  box-shadow: none;
}

/* --------------------------------------------------------------------------
 * Landing page
 * -------------------------------------------------------------------------- */

.aether-hero {
  padding-bottom: 0.6rem;
}

.aether-hero h1 {
  max-width: 30em;
}

.md-typeset .aether-subline {
  color: var(--aether-muted);
  font-size: 0.8rem;
  margin-bottom: 1.4rem;
  max-width: 34em;
}

.md-typeset .aether-fineprint {
  color: var(--aether-muted);
  font-size: 0.66rem;
  margin-top: 1rem;
}

.md-typeset .aether-caption {
  color: var(--aether-muted);
  font-size: 0.68rem;
}

.md-typeset .md-button.aether-button {
  background: transparent;
  border: 1px solid var(--aether-border);
  border-radius: 2px;
  color: var(--md-default-fg-color);
  font-size: 0.7rem;
  font-weight: 400;
  margin-right: 0.4rem;
  padding: 0.44em 1.1em;
}

.md-typeset .md-button.aether-button:focus,
.md-typeset .md-button.aether-button:hover {
  background: transparent;
  border-color: var(--md-accent-fg-color);
  color: var(--md-accent-fg-color);
}

.md-typeset .aether-grid {
  border-left: 1px solid var(--aether-border);
  border-top: 1px solid var(--aether-border);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1.4rem 0;
}

.md-typeset .aether-grid__cell {
  border-bottom: 1px solid var(--aether-border);
  border-right: 1px solid var(--aether-border);
  padding: 1.1rem 1.2rem;
}

.md-typeset .aether-grid__cell > :first-child {
  margin-top: 0;
}

.md-typeset .aether-grid__cell > :last-child {
  margin-bottom: 0;
}

.md-typeset .aether-grid__cell p {
  font-size: 0.72rem;
}

.md-typeset .aether-grid__cell strong {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.md-typeset .aether-note {
  border-top: 1px solid var(--aether-border);
  color: var(--aether-muted);
  font-size: 0.72rem;
  margin-top: 2.4rem;
  padding-top: 1.2rem;
}

.md-typeset .aether-note a {
  color: var(--aether-muted);
  text-decoration: underline;
}

.md-typeset .aether-note a:focus,
.md-typeset .aether-note a:hover {
  color: var(--md-accent-fg-color);
}

.aether-private-note {
  color: var(--aether-muted);
}

@media screen and (max-width: 44.9375em) {
  .md-typeset .aether-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .md-typeset h1 {
    font-size: 1.2rem;
  }
}

/* --------------------------------------------------------------------------
 * Diagrams
 * -------------------------------------------------------------------------- */

.md-typeset .mermaid {
  background: var(--aether-surface);
  border: 1px solid var(--aether-border);
  border-radius: 2px;
  margin: 1.2rem 0;
  padding: 1rem 0.6rem;
}

/* --------------------------------------------------------------------------
 * Tables
 *
 * docs/configuration.md is a reference page: several of its tables are far
 * wider than a phone. A wide table scrolls inside its own container and the
 * page never scrolls sideways — at 375px or at any other width.
 *
 * Two containers can be that scroller. Material styles the table itself as an
 * inline-block with `overflow: auto`, and its JavaScript additionally wraps
 * each one in .md-typeset__scrollwrap once the page is live. Both are pinned
 * here, so the guarantee survives a theme upgrade and does not depend on
 * JavaScript having run.
 * -------------------------------------------------------------------------- */

.md-typeset__scrollwrap,
.md-typeset table:not([class]) {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

/* Belt and braces for the page itself: no descendant may widen the column. */
.md-content__inner,
.md-typeset {
  min-width: 0;
}

/* A long identifier in a cell wraps rather than setting the table's width. */
.md-typeset table:not([class]) td,
.md-typeset table:not([class]) th {
  overflow-wrap: anywhere;
}

.md-typeset table:not([class]) code {
  overflow-wrap: anywhere;
  white-space: normal;
}

@media screen and (max-width: 44.9375em) {
  .md-typeset table:not([class]) {
    font-size: 0.6rem;
  }

  /* Material reserves 5rem per header cell; on a phone that is most of the
     viewport spent on one column of a six-column table. */
  .md-typeset table:not([class]) th {
    min-width: 3.4rem;
  }

  .md-typeset table:not([class]) td,
  .md-typeset table:not([class]) th {
    padding: 0.55em 0.7em;
  }
}

/* --------------------------------------------------------------------------
 * Status dots
 *
 * Five buckets, shown beside — never instead of — the status a proposal states
 * in its own words. Colour is the only thing the dot carries, so it also has a
 * title attribute and the label is written out on the filter chips.
 * -------------------------------------------------------------------------- */

.md-typeset .aether-dot {
  background: var(--aether-muted);
  border-radius: 50%;
  display: inline-block;
  flex: none;
  height: 0.42rem;
  margin-right: 0.34em;
  vertical-align: 0.04em;
  width: 0.42rem;
}

.md-typeset .aether-dot--implemented {
  background: #7fd18b;
}

.md-typeset .aether-dot--accepted,
.md-typeset .aether-dot--proposed {
  background: #e5b06b;
}

.md-typeset .aether-dot--design {
  background: #8fa3bf;
}

.md-typeset .aether-dot--superseded {
  background: #6b7686;
}

/* --------------------------------------------------------------------------
 * Proposals index
 * -------------------------------------------------------------------------- */

.md-typeset .aether-filter {
  border-bottom: 1px solid var(--aether-border);
  border-top: 1px solid var(--aether-border);
  margin: 1.6rem 0 1.2rem;
  padding: 0.9rem 0;
}

/* Controls that do nothing without JavaScript are not shown; the table below
   them is complete either way. */
.md-typeset .aether-filter:not(.is-live) {
  display: none;
}

.md-typeset .aether-filter__q {
  background: var(--aether-surface);
  border: 1px solid var(--aether-border);
  border-radius: 2px;
  color: var(--md-default-fg-color);
  font-family: inherit;
  font-size: 0.72rem;
  padding: 0.44em 0.7em;
  width: 100%;
}

.md-typeset .aether-filter__q:focus {
  border-color: var(--md-accent-fg-color);
  outline: none;
}

.md-typeset .aether-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.md-typeset .aether-chip {
  align-items: center;
  background: transparent;
  border: 1px solid var(--aether-border);
  border-radius: 2px;
  color: var(--aether-muted);
  cursor: pointer;
  display: inline-flex;
  font-family: inherit;
  font-size: 0.65rem;
  gap: 0.1rem;
  padding: 0.3em 0.6em;
}

.md-typeset .aether-chip span:last-child {
  color: var(--md-default-fg-color--lighter);
  margin-left: 0.35em;
}

.md-typeset .aether-chip:hover {
  border-color: var(--md-accent-fg-color);
  color: var(--md-default-fg-color);
}

.md-typeset .aether-chip.is-on {
  border-color: var(--md-accent-fg-color);
  color: var(--md-default-fg-color);
}

.md-typeset .aether-filter__count {
  color: var(--aether-muted);
  font-size: 0.62rem;
  margin: 0.6rem 0 0;
}

/* The index is a directory, not prose: it gets more width than the 46rem
   reading column. Browsers without :has() simply keep the reading column. */
.md-content__inner:has(.aether-proposals) {
  max-width: 62rem;
}

/* Material shrink-wraps tables (they are inline-block); this one is the page. */
.md-typeset .aether-proposals table:not([class]) {
  font-size: 0.68rem;
  width: 100%;
}

.md-typeset .aether-proposals td,
.md-typeset .aether-proposals th {
  padding: 0.7em 0.9em;
  vertical-align: top;
}

/* Left to itself the browser spends the width on the longest status and wraps
   every title to one word per line. */
.md-typeset .aether-proposals th:nth-child(1) {
  min-width: 0;
  width: 3rem;
}

.md-typeset .aether-proposals th:nth-child(2) {
  width: 32%;
}

.md-typeset .aether-proposals th:nth-child(4) {
  min-width: 0;
  width: 5.6rem;
}

.md-typeset .aether-proposals td:first-child {
  font-family: var(--md-code-font);
  white-space: nowrap;
}

.md-typeset .aether-proposals td:last-child {
  color: var(--aether-muted);
  font-family: var(--md-code-font);
  white-space: nowrap;
}

.md-typeset .aether-proposals td:nth-child(3) {
  color: var(--aether-muted);
}

/* A superseded proposal stays readable and stays in place; it just stops
   competing with the record that replaced it. */
.md-typeset .aether-proposals tbody tr.is-superseded,
.md-typeset .aether-proposals tbody tr:has(.aether-dot--superseded) {
  opacity: 0.58;
}

.md-typeset .aether-proposals tbody tr.is-superseded:hover,
.md-typeset .aether-proposals tbody tr:has(.aether-dot--superseded):hover {
  opacity: 1;
}

/* --------------------------------------------------------------------------
 * Landing page — recent design records
 * -------------------------------------------------------------------------- */

.md-typeset .aether-recent {
  border-top: 1px solid var(--aether-border);
  margin: 1.2rem 0;
}

/* Each row is its own paragraph so mkdocs parses (and validates) the link. */
.md-typeset .aether-recent p {
  margin: 0;
}

.md-typeset .aether-recent__all {
  display: inline-block;
  font-size: 0.7rem;
  margin-top: 0.8rem;
}

.md-typeset a.aether-recent__row {
  align-items: baseline;
  border-bottom: 1px solid var(--aether-border);
  color: var(--md-default-fg-color);
  display: flex;
  gap: 0.7rem;
  padding: 0.55rem 0.1rem;
  text-decoration: none;
}

.md-typeset a.aether-recent__row:hover {
  color: var(--md-accent-fg-color);
}

.md-typeset .aether-recent__n {
  color: var(--aether-muted);
  flex: none;
  font-family: var(--md-code-font);
  font-size: 0.68rem;
}

.md-typeset .aether-recent__t {
  flex: 1 1 auto;
  font-size: 0.72rem;
}

.md-typeset .aether-recent .aether-dot {
  margin: 0;
}
