"""summary_stats — Compute descriptive statistics for a numeric list."""

import math
import numpy as np


def summary_stats(values: list[float]) -> dict:
    """Return basic descriptive statistics for a list of floats.

    Args:
        values: List of numeric values.

    Returns:
        Dict with keys:
          "n"      (int):   number of elements.
          "mean"   (float): arithmetic mean, or math.nan if empty.
          "median" (float): median, or math.nan if empty.
          "p25"    (float): 25th percentile, or math.nan if empty.
          "p75"    (float): 75th percentile, or math.nan if empty.
    """
    if not values:
        return {
            "n": 0,
            "mean": math.nan,
            "median": math.nan,
            "p25": math.nan,
            "p75": math.nan,
        }
    arr = np.array(values, dtype=float)
    return {
        "n": int(len(arr)),
        "mean": float(np.mean(arr)),
        "median": float(np.median(arr)),
        "p25": float(np.percentile(arr, 25)),
        "p75": float(np.percentile(arr, 75)),
    }
