/* ==================================================================
   Function & language reference.

   The source documents every function as
       div.Function > h2.Function + h3 Description/Syntax/Arguments
   with a float-right "Back to top" link. The h3s repeat for every
   function — 579 of them across the section — so they are converted to
   labels rather than headings. The contents list then becomes a clean
   index of function names, which is what a function reference wants.
   ================================================================== */

/* ------------------------------------------------------------------
   In-page index of function names
   ------------------------------------------------------------------ */

.md-typeset .fn-index {
  margin: 1.2rem 0 2.4rem;
  padding: 1.1rem 1.3rem 0.6rem;
  background: #f7fafc;
  border: 1px solid var(--rs-rule);
  border-radius: 4px;
}

/* column-width, not a fixed column count: names are monospace identifiers
   of very uneven length ("Check" vs "FuzzyCountryNameLookup"), and four
   fixed columns forced mid-word breaks like "CountryNameL / ookup".
   The browser now fits as many columns as the longest name allows. */
.md-typeset .fn-index ul {
  column-width: 12.5rem;
  column-gap: 1.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.md-typeset .fn-index li {
  break-inside: avoid;
  margin: 0 0 0.42rem;
  padding: 0;
  list-style: none;
  /* an identifier split across two lines is unreadable */
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}

.md-typeset .fn-index a {
  font-family: var(--md-code-font);
  font-size: 0.68rem;
  color: var(--rs-navy);
  border-bottom: none;
  text-decoration: none;
}
.md-typeset .fn-index a:hover {
  color: var(--rs-blue);
  text-decoration: underline;
}

/* column-width is inherently responsive, so no breakpoint overrides are
   needed — the column count falls to 1 naturally on a narrow screen. */

/* ------------------------------------------------------------------
   One card per function
   ------------------------------------------------------------------ */

.md-typeset .fn {
  border: 1px solid var(--rs-rule);
  border-left: 3px solid var(--rs-blue);
  border-radius: 3px;
  padding: 1.15rem 1.4rem 1.1rem;
  margin: 0 0 1rem;
  background: #fff;
  scroll-margin-top: 4rem;   /* so anchor jumps clear the sticky header */
}

/* the function name */
.md-typeset .fn > h2 {
  font-family: var(--md-code-font);
  font-weight: 700;
  font-size: 1rem;
  color: var(--rs-navy);
  margin: 0 0 0.8rem;
  padding: 0;
  border: none;
}
/* Option C gives every h2 an absolutely-positioned sky-blue rule via
   ::before. Inside a function card that pseudo-element is reused for the
   marker, so every inherited property has to be unwound or the glyph
   renders as a blue bar sitting on top of the function name. */
.md-typeset .fn > h2::before {
  content: "\0192";           /* ƒ — escaped so a stylesheet served without
                                 charset=utf-8 cannot mangle it */
  position: static;
  width: auto;
  height: auto;
  background: none;
  display: inline-block;
  margin-right: 0.5rem;
  font-family: var(--rs-body-font);
  font-style: italic;
  font-weight: 700;
  color: var(--rs-blue);
}

/* Description / Syntax / Arguments */
.md-typeset .fn .fn-label {
  font-family: var(--rs-body-font);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--rs-grey-mute);
  margin: 1rem 0 0.3rem;
}
.md-typeset .fn .fn-label:first-of-type {
  margin-top: 0;
}

.md-typeset .fn > p {
  margin: 0 0 0.4rem;
}

.md-typeset .fn pre {
  margin: 0.2rem 0 0.6rem;
}
.md-typeset .fn pre > code {
  background: #f7fafc;
  border: 1px solid var(--rs-rule);
  border-radius: 3px;
}

.md-typeset .fn ul {
  margin: 0.2rem 0 0.5rem;
}
.md-typeset .fn li {
  font-size: 0.73rem;
  margin-bottom: 0.15rem;
}

/* argument names carry weight; their nested explanation does not */
.md-typeset .fn > ul > li {
  font-weight: 700;
  color: var(--rs-navy);
}
.md-typeset .fn > ul > li ul li {
  font-weight: 400;
  color: var(--rs-grey);
}

.md-typeset .fn table {
  margin: 0.3rem 0 0.7rem;
  font-size: 0.68rem;
}

/* ------------------------------------------------------------------
   "Example" labels lifted out of h3.example
   ------------------------------------------------------------------ */

.md-typeset .example-label {
  font-family: var(--rs-body-font);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--rs-blue);
  margin: 1.4rem 0 0.35rem;
}

/* ------------------------------------------------------------------
   Language-guide pages: tables converted from layout tables have no
   header row, so tone the empty header down rather than showing a
   blank navy band.
   ------------------------------------------------------------------ */

.md-typeset table:not([class]) thead:empty,
.md-typeset table:not([class]) tr:first-child:has(th:empty) {
  display: none;
}
