/* ZITon handbook theme layer.
   Everything here sits on top of the Zensical "modern" variant: brand colours,
   a wider reading column for the architecture diagrams, and figure/table
   surfaces that match the AWS-style diagrams. No webfonts, no external assets. */

[data-md-color-scheme="default"] {
  --md-primary-fg-color: #0a3470;
  --md-accent-fg-color: #08747c;
  --md-typeset-a-color: #0a4a91;
  --ziton-border: #dbe2ea;
  --ziton-surface: #f6f8fb;
  --ziton-surface-strong: #eef3f9;
  --ziton-shadow: 0 1px 2px rgba(16, 39, 68, 0.06), 0 6px 16px rgba(16, 39, 68, 0.04);
}

[data-md-color-scheme="slate"] {
  --md-primary-fg-color: #a9c9f7;
  --md-accent-fg-color: #74e0dc;
  --md-typeset-a-color: #a9c9f7;
  --ziton-border: #2c3746;
  --ziton-surface: #1a222c;
  --ziton-surface-strong: #202a36;
  --ziton-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* The diagrams are 1000-1200 px wide; the default column scales them down to
   the point where their labels stop being legible. */
.md-grid {
  max-width: 76rem;
}

/* ---------------------------------------------------------------- typography */

.md-typeset h1 {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.md-typeset h2 {
  margin-top: 2.4em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--ziton-border);
  font-weight: 700;
}

.md-typeset h3 {
  margin-top: 1.9em;
}

/* Lead paragraph: the first paragraph on every page states the conclusion. */
.md-typeset > p:first-of-type {
  font-size: 1.02rem;
  line-height: 1.65;
}

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

.md-typeset a:hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------------ figures */

/* Diagrams are linked to their full-size SVG; the wrapper reads as a plate. */
.md-typeset p:has(> a > img) {
  margin: 1.6em 0;
}

.md-typeset p > a:has(> img) {
  display: block;
  padding: 0.5rem;
  border: 1px solid var(--ziton-border);
  border-radius: 0.6rem;
  background: var(--md-default-bg-color);
  box-shadow: var(--ziton-shadow);
  transition: border-color 120ms ease, transform 120ms ease;
}

.md-typeset p > a:has(> img):hover {
  border-color: var(--md-accent-fg-color);
}

.md-typeset p > a:has(> img):focus-visible {
  outline: 2px solid var(--md-accent-fg-color);
  outline-offset: 2px;
}

.md-typeset p > a > img {
  display: block;
  border-radius: 0.35rem;
}

/* ------------------------------------------------------------------- tables */

/* Zensical sizes the scroll wrapper to its content; block makes every table
   span the column so narrow tables do not float half-width. */
.md-typeset .md-typeset__table {
  display: block;
  width: 100%;
}

.md-typeset table:not([class]) {
  display: table;
  width: 100%;
  border: 1px solid var(--ziton-border);
  border-radius: 0.5rem;
  font-size: 0.76rem;
  overflow: hidden;
}

.md-typeset table:not([class]) th {
  background: var(--ziton-surface-strong);
  color: var(--md-default-fg-color);
  font-weight: 700;
}

.md-typeset table:not([class]) td {
  border-top: 1px solid var(--ziton-border);
}

.md-typeset table:not([class]) tbody tr:nth-child(even) td {
  background: var(--ziton-surface);
}

/* ------------------------------------------------------------------- header */

.md-header__button.md-logo img {
  width: 1.45rem;
  height: 1.45rem;
  padding: 0.12rem;
  border-radius: 0.25rem;
  background: #0a3470;
}

/* Active navigation entry reads as a marker, not a button. */
.md-nav__link--active,
.md-nav__item--active > .md-nav__link {
  font-weight: 700;
}

/* Keep the reading rhythm on narrow screens. */
@media screen and (max-width: 44.9375em) {
  .md-typeset > p:first-of-type {
    font-size: 0.94rem;
  }

  .md-typeset table:not([class]) {
    font-size: 0.72rem;
  }
}
