/* =========================================================
   Article category menu: shared component
   Positioning (sticky, scroll height) is owned by each page.
   ========================================================= */
.article-menu {
    --am-accent: #006699;
    --am-text: #333;
    --am-muted: #666;
    --am-surface: #fff;
    --am-hover-bg: #f4f6f9;
    --am-badge-bg: #eef1f5;
    --am-border: #e3e6ea;
    --am-well: #edf2f6;
    --am-well-line: rgb(0 51 77 / 9%);

    text-align: left;
}

/* Reset any global list styling from the site theme */
.article-menu ul,
.article-menu li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.article-menu__nav {
    box-sizing: border-box;
    border: 1px solid var(--am-border);
    border-radius: 12px;
    background: var(--am-surface);
    box-shadow: 0 1px 2px rgb(16 24 40 / 4%), 0 8px 24px rgb(16 24 40 / 8%);
    scrollbar-width: thin;
}

/* Header strip */
.article-menu__title {
    margin: 0;
    padding: 1rem 1.25rem 0.9rem;
    border-bottom: 1px solid var(--am-border);
    font-family: Poppins, sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--am-muted);
}

.article-menu__description {
    margin: 0;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--am-border);
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--am-muted);
}

/* Top-level sections: full-width rows with dividers */
.article-menu__nav > .article-menu__list > .article-menu__item + .article-menu__item {
    border-top: 1px solid var(--am-border);
}

/* Category heading */
.article-menu__summary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.25rem;
    font-family: Poppins, sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--am-text);
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.article-menu__summary::-webkit-details-marker {
    display: none;
}

.article-menu__summary:hover {
    background: var(--am-hover-bg);
}

/* Chevron on the left: points right when closed, down when open */
.article-menu__summary::before {
    content: "";
    flex: none;
    width: 0.4rem;
    height: 0.4rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateX(-1px) rotate(-45deg);
    opacity: 0.5;
    transition: transform 0.2s ease, opacity 0.15s ease;
}

.article-menu__summary-text {
    flex: 1 1 auto;
    min-width: 0;
}

.article-menu__count {
    flex: none;
    min-width: 1.6rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--am-badge-bg);
    color: var(--am-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

/* Open section: darker panel with an accent bar, distinct from closed rows */
.article-menu__nav > .article-menu__list > .article-menu__item > .article-menu__branch[open] {
    background: var(--am-well);
    box-shadow: inset 3px 0 0 var(--am-accent);
}

.article-menu__branch[open] > .article-menu__summary {
    color: var(--am-accent);
    font-weight: 600;
}

.article-menu__branch[open] > .article-menu__summary:hover {
    background: transparent;
}

.article-menu__branch[open] > .article-menu__summary::before {
    transform: translateY(-2px) rotate(45deg);
    opacity: 1;
}

.article-menu__branch[open] > .article-menu__summary .article-menu__count {
    background: var(--am-surface);
    color: var(--am-accent);
}

/* Articles inside an open section */
.article-menu .article-menu__branch > .article-menu__list {
    padding: 0 0.75rem 0.75rem 1.5rem;
}

.article-menu .article-menu__branch > .article-menu__list > .article-menu__item + .article-menu__item {
    border-top: 1px solid var(--am-well-line);
}

.article-menu__link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 2px 0;
    padding: 0.55rem 0.65rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--am-text);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.article-menu__link-text {
    flex: 1 1 auto;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    min-width: 0;
    text-wrap: pretty;
}

/* Arrow: hidden at rest, slides in on hover / current page */
.article-menu__link::after {
    content: "\2192";       /* → */
    flex: none;
    font-size: 0.875rem;
    color: var(--am-accent);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.article-menu__link:hover {
    background: var(--am-surface);
    color: var(--am-accent);
    box-shadow: 0 1px 3px rgb(16 24 40 / 8%);
}

.article-menu__link:hover::after,
.article-menu__link[aria-current="page"]::after {
    opacity: 1;
    transform: none;
}

.article-menu__link[aria-current="page"] {
    background: var(--am-surface);
    color: var(--am-accent);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--am-accent), 0 1px 3px rgb(16 24 40 / 8%);
}

/* Sub-categories inside an open section: quieter headings, no second panel */
.article-menu__branch .article-menu__branch .article-menu__summary {
    padding: 0.55rem 0.65rem;
    font-size: 0.8125rem;
}

.article-menu__branch .article-menu__branch[open] {
    background: transparent;
    box-shadow: none;
}

.article-menu__branch .article-menu__branch > .article-menu__list {
    padding: 0 0 0.25rem 0.75rem;
}

.article-menu__link:focus-visible,
.article-menu__summary:focus-visible {
    outline: 2px solid var(--am-accent);
    outline-offset: -2px;   /* inset: rows run edge to edge */
}

@media (prefers-reduced-motion: reduce) {
    .article-menu__summary,
    .article-menu__summary::before,
    .article-menu__link,
    .article-menu__link::after {
        transition: none;
    }
}