/* ── sphinx_autodoc_api_style ─────────────────────────────
 * Card treatment and layout for Python API entries.
 *
 * Badge colour tokens have moved to sab_palettes.css in
 * sphinx-ux-badges.  This file only contains the
 * card-level and field-list layout rules.
 *
 * 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 {

/* ── Deprecated entry muting ───────────────────────────── */
dl.py.gp-sphinx-badge--state-deprecated > dt {
  opacity: 0.7;
}

/* ── Card treatment for top-level API entries ──────────── */
dl.py:not(.fixture) {
  border: 1px solid var(--color-background-border);
  border-radius: 0.5rem;
  padding: 0;
  margin-bottom: 1.5rem;
  overflow: visible;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

dl.py:not(.fixture) > dt {
  background: var(--color-background-secondary);
  border-bottom: 1px solid var(--color-background-border);
  padding: 0.5rem 0.75rem;
  text-indent: 0;
  margin: 0;
  padding-left: 1rem;
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
  min-height: 2rem;
}

dl.py:not(.fixture) > dt:hover {
  background: var(--color-api-background-hover);
}

dl.py:not(.fixture) > dd {
  padding: 0.75rem 1rem;
  margin-left: 0 !important;
}

/* Nested API entries (methods inside classes) get lighter treatment */
dl.py:not(.fixture) dd dl.py:not(.fixture) {
  border-color: var(--color-background-border);
  box-shadow: none;
  margin-bottom: 1rem;
}

dl.py:not(.fixture) dd dl.py:not(.fixture) > dt {
  background: transparent;
  border-bottom-color: var(--color-background-border);
  padding-left: 0.75rem;
}

dl.py:not(.fixture) dd dl.py:not(.fixture) > dt:hover {
  background: var(--color-api-background-hover);
}

/* ── Metadata fields (compact grid) — STANDALONE FALLBACK ──
 * These rules use a direct-child chain `> dd > dl.field-list` that
 * intentionally only fires when sphinx-autodoc-api-style is installed
 * WITHOUT sphinx-ux-autodoc-layout. When the layout package is
 * present, _wrap_content_runs inserts a `<div class="gp-sphinx-api-
 * parameters">` between `<dd>` and `<dl class="field-list">`, which
 * breaks this direct-child path; the authoritative styling for the
 * transformed DOM lives in
 * `packages/sphinx-ux-autodoc-layout/.../layout.css`.
 *
 * Per CLAUDE.md "Package self-containment," sphinx-autodoc-api-style
 * must render the classes its Python emits even when consumed alone,
 * so this fallback stays. Keep it visually identical to the
 * authoritative layout.css block. */
dl.py:not(.fixture) > dd > dl.field-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.25rem 1rem;
  border-top: 1px solid var(--color-background-border);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

dl.py:not(.fixture) > dd > dl.field-list > dt {
  grid-column: 1;
  font-size: var(--gp-sphinx-type-metadata);
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: var(--color-foreground-muted);
}

dl.py:not(.fixture) > dd > dl.field-list > dd {
  grid-column: 2;
  margin-top: 0.25rem;
  margin-left: 0;
  font-size: var(--gp-sphinx-type-metadata);
  line-height: 1.5;
}

/* `margin-left: 0` cancels Furo's `api.css` rule that pulls the
 * `<ul>` 1.2rem to the left (`dl[class]:not(...).field-list dd > ul
 * { margin-left: -1.2rem }`).  Combined with the inherited
 * `padding-left: 1.2rem`, that negative margin would leak the first
 * `<li>` marker into the column gap while subsequent markers stay at
 * the dd's edge. */
dl.py:not(.fixture) > dd > dl.field-list > dd > ul.simple {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0;
  margin-bottom: 0;
  margin-left: 0;
}

dl.py:not(.fixture) > dd > dl.field-list > dd > p,
dl.py:not(.fixture) > dd > dl.field-list > dd > ul.simple > li > p {
  margin: 0;
}

@media (max-width: 52rem) {
  dl.py:not(.fixture) > dd > dl.field-list {
    grid-template-columns: 1fr;
  }
  dl.py:not(.fixture) > dd > dl.field-list > dt,
  dl.py:not(.fixture) > dd > dl.field-list > dd {
    grid-column: 1;
  }
}


}  /* end @layer gp-sphinx */
