/* sphinx-autodoc-typehints-gp — neutralise inline-code chip styling
 * for cross-referenced default values and field-list xrefs.
 *
 * Stage C of the default-rendering pipeline wraps identifier
 * defaults in `<code class="xref py py-obj docutils literal
 * notranslate">`, which matches Furo's
 * `code.literal { background, padding, font-size: 81.25% }` chip
 * rule.  In a signature default-value or a field-list parameter
 * row, that chip styling clashes with the surrounding text.  These
 * rules strip the chip back to plain inline content while keeping
 * the xref clickable.
 *
 * All rules land in @layer gp-sphinx so precedence is declarative
 * against Furo's @layer components.  Layer order is established in
 * gp-furo-theme/web/src/styles/index.css.
 */

@layer gp-sphinx {
  /* Default-value spans inside <dt> signatures. */
  .default_value code.literal {
    background: transparent;
    border: none;
    padding: 0;
    font-size: inherit;
  }

  /* Field-list prefix wrapper added by FieldListPrefixWrapTransform.
   * Defaults to inherit so structural content — parameter name,
   * parens, brackets, commas, ellipsis — flows in the body sans
   * font.  Only the inline `<code>` type-name children get
   * monospace, via Furo's `code.literal` rule in
   * gp-furo-theme/.../code.css.  Result: parameter name reads as
   * sans-bold definition term; type expressions stay mono inside
   * chips.  One mono treatment per row, scoped to "this is code." */
  .gp-sphinx-field-prefix {
    font-family: inherit;
    font-size: inherit;
  }

  /* Furo's `code.literal` chip styling (background, padding,
   * border-radius) acts as a cognitive container around each type
   * identifier — preferred to a transparent inline link.  Pin the
   * size to a root-relative `0.8125rem` so chips render at ≈ 13 px
   * regardless of the row's metadata-size parent.  Furo's own
   * `code.literal { font-size: 81.25% }` would otherwise compound
   * to ~11.4 px against a 14 px parent (too small); using `rem`
   * blocks the compounding while still scaling with the root clamp
   * ramp on wide viewports.
   *
   * Keep Furo's `0.2em` horizontal padding so a standalone type chip
   * (`str`, `pathlib.Path`) reads as a chip with breathing room rather
   * than text crammed against its background edge.  The two overrides
   * below cancel that padding only where a chip abuts `.p` punctuation
   * (brackets, inner commas, pipes), so compound expressions still
   * render flush — `list[str]`, not `list[ str ]` — because the
   * brackets live outside the chip and have no padding of their own.
   * Linked chips wrap the `<code>` in `<a>`, so the punctuation is the
   * anchor's sibling; match both the bare and anchored forms. */
  .field-list code.literal {
    font-size: 0.8125rem;
    padding-inline: 0.2em;
  }
  .field-list code.literal:has(+ .p),
  .field-list a.reference:has(+ .p) > code.literal {
    padding-inline-end: 0;
  }
  .field-list .p + code.literal,
  .field-list .p + a.reference > code.literal {
    padding-inline-start: 0;
  }
}
