/* Parseus AI brand colors for MkDocs Material */
:root {
  --md-primary-fg-color:        #2E5BC9;  /* Persian blue */
  --md-primary-fg-color--light: #5478D6;
  --md-primary-fg-color--dark:  #244AA3;
  --md-accent-fg-color:         #A16207;  /* Maestro amber */
}

[data-md-color-scheme="slate"] {
  --md-primary-fg-color:        #5478D6;
  --md-accent-fg-color:         #C98A2B;
}

/* Brand mark (Π) before the site title */
.md-header__title .md-header__topic:first-child .md-ellipsis::before {
  content: "\03A0";
  font-family: Georgia, "Times New Roman", serif;
  margin-right: 0.4rem;
  font-weight: 500;
}

/* ============================================================
   Integrated TOC styling — make the left-nav page sections
   read as a clean nested menu.
   Root fix (per Material docs): the left sidebar is too narrow
   to host the TOC, so WIDEN it first, then style the nesting.
   ============================================================ */

/* 1. Widen the primary (left) sidebar to make room for nested TOC */
@media screen and (min-width: 76.25em) {
  .md-sidebar--primary {
    width: 14rem;            /* default is ~12.1rem */
  }
  /* keep content area balanced */
  .md-main__inner {
    max-width: none;
  }
}

/* 2. Nested page-section links (the integrated TOC items) */
.md-nav__item .md-nav .md-nav__item .md-nav__link {
  font-size: 0.62rem;
  line-height: 1.3;
  padding-top: 0.12rem;
  padding-bottom: 0.12rem;
  color: var(--md-default-fg-color--light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* 3. Indent guide line on the nested block */
.md-nav__item .md-nav .md-nav {
  margin-left: 0.5rem;
  padding-left: 0.4rem;
  border-left: 1px solid var(--md-default-fg-color--lightest);
}

/* 4. Active section in brand blue */
.md-nav__link--active,
.md-nav__link--passed {
  color: var(--md-primary-fg-color) !important;
}

/* 5. The active PAGE title (parent of the nested list) stays bold */
.md-nav__item--active > .md-nav__link:not(.md-nav__link--active) {
  font-weight: 600;
}

/* 6. Branded headings — Persian blue, bold, slightly smaller */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4 {
  color: var(--md-primary-fg-color);
  font-weight: 700;
}
.md-typeset h1 { font-size: 1.85rem; }   /* was ~2rem */
.md-typeset h2 { font-size: 1.35rem; }   /* was ~1.5rem */
.md-typeset h3 { font-size: 1.05rem; }   /* was ~1.25rem */
.md-typeset h4 { font-size: 0.92rem; }

/* 7. Brand byline inline with the page title */
.md-typeset h1 .brand-byline {
  font-size: 0.7rem;        /* ~10pt — fixed, not relative to the H1 */
  font-weight: 600;
  font-style: italic;
  color: var(--md-default-fg-color);   /* "A product of" stays default/black */
  white-space: nowrap;
  vertical-align: middle;
}
.md-typeset h1 .brand-byline a {
  color: var(--md-primary-fg-color);   /* only "Parseus AI" is Persian blue */
  /* Link affordance: a subtle underline at rest so the wordmark doesn't read
     as plain brand-colored text (color alone fails WCAG 1.4.1). The gray
     external-link icon is supplied by the shared rule in section 9. */
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--md-primary-fg-color) 40%, transparent);
  transition: text-decoration-color 0.15s ease, text-decoration-thickness 0.15s ease;
}
.md-typeset h1 .brand-byline a:hover {
  text-decoration-thickness: 2px;
  text-decoration-color: var(--md-primary-fg-color);   /* full-opacity on hover */
}

/* ============================================================
   8. Diagram sizing — constrain SVG diagrams so tall ones
   don't overflow the content column or the viewport height,
   while staying large enough to read on a wide monitor.
   Targets only images served from assets/diagrams/.
   ============================================================ */
.md-typeset img[src*="/diagrams/"] {
  display: block;
  margin: 1.5rem auto;
  max-width: 820px;
  max-height: 85vh;
  width: 100%;
  height: auto;
}

/* 8b. Dark mode — give white-background diagrams a clean card
   so they don't clash against the slate scheme. */
[data-md-color-scheme="slate"] .md-typeset img[src*="/diagrams/"] {
  border-radius: 6px;
  padding: 8px;
  background: #FFFFFF;
}

/* ============================================================
   9. Link affordance — a link must be recognizable as a link by
   more than color. Persian blue is a brand color used across the
   page, so color alone fails WCAG 1.4.1. Every rendered-content
   link therefore gets a subtle underline at rest that strengthens
   on hover; external links additionally get a trailing external-link
   icon, while internal doc-to-doc links do NOT (the icon means
   "leaves the site"). Scoped to .md-typeset so theme chrome (nav,
   tabs, footer) is untouched; permalink (¶) anchors are excluded.
   ============================================================ */
.md-typeset a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  transition: text-decoration-color 0.15s ease, text-decoration-thickness 0.15s ease;
}
.md-typeset a:hover {
  text-decoration-thickness: 2px;
  text-decoration-color: currentColor;   /* full-opacity, clearer on hover */
}

/* Permalink (¶) heading anchors are icon affordances, not prose
   links — keep them undecorated and arrow-free. */
.md-typeset a.headerlink,
.md-typeset a.headerlink:hover {
  text-decoration: none;
}
.md-typeset a.headerlink::after {
  content: none;
}

/* Standard mkdocs convention for body headings (h2–h6): the ¶ permalink is
   hidden at rest and appears only when its heading is hovered (or the anchor
   is focused for keyboard users). */
.md-typeset .headerlink {
  opacity: 0;
  transition: opacity 0.15s ease;
}
.md-typeset h2:hover .headerlink,
.md-typeset h3:hover .headerlink,
.md-typeset h4:hover .headerlink,
.md-typeset h5:hover .headerlink,
.md-typeset h6:hover .headerlink,
.md-typeset h2 .headerlink:focus,
.md-typeset h3 .headerlink:focus,
.md-typeset h4 .headerlink:focus,
.md-typeset h5 .headerlink:focus,
.md-typeset h6 .headerlink:focus {
  opacity: 1;
}

/* The top H1 carries the "A product of Parseus AI" byline. Its ¶ permalink is
   suppressed entirely — it must never render, at rest OR on hover — so the
   title/byline reads cleanly with no stray pilcrow. !important beats Material's
   own headerlink rules, and we target both the nested and direct-child forms. */
.md-typeset h1 .headerlink,
.md-typeset h1 > .headerlink,
.md-typeset h1 a.headerlink,
.md-typeset h1:hover .headerlink {
  display: none !important;
}

/* External links (absolute http/https) get a trailing external-link icon —
   a proper box-with-arrow glyph (Lucide "external-link"), NOT the raw ↗
   unicode character (which renders inconsistently across fonts). It is drawn
   via a CSS mask so its color is set by `background-color` (independent of the
   SVG), letting it stay a muted slate-400 gray — a neutral functional
   indicator, not part of the blue wordmark. Relative internal links never
   match this selector, so they stay icon-free. inline-block detaches the
   icon from the link's underline so it isn't underlined. */
.md-typeset a[href^="http://"]::after,
.md-typeset a[href^="https://"]::after {
  --ext-link-icon: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6"/></svg>');
  content: "";
  display: inline-block;
  width: 0.78em;
  height: 0.78em;
  margin-left: 3px;
  vertical-align: -0.05em;          /* vertically centered with the text */
  background-color: #94A3B8;        /* slate-400 — muted gray, not brand blue */
  -webkit-mask: var(--ext-link-icon) no-repeat center / contain;
  mask: var(--ext-link-icon) no-repeat center / contain;
}
