/**
 * Sitemap Stylesheet
 *
 * BEM naming: .wp-sitemap__[element]--[modifier]
 *
 * @package    AW_Theme
 * @subpackage Sitemap
 * @since      1.0.0
 */

/* ─── Wrapper ─────────────────────────────────────────────── */
.wp-sitemap {
    margin: 2rem 0;
    font-size: 0.9375rem; /* 15px */
    line-height: 1.6;
}

/* ─── Section (pages, or standalone CPT) ─────────────────── */
.wp-sitemap__section {
    margin-bottom: 2.5rem;
}

/* ─── Lists ───────────────────────────────────────────────── */
.wp-sitemap__list {
    list-style: disc;
    margin: 0.375rem 0 0 0;
    padding-left: 1.5rem;
}

/* Children of a page */
.wp-sitemap__list--children {
    list-style: circle;
}

/* Year grouping */
.wp-sitemap__list--year {
    list-style: none;
    padding-left: 1.25rem;
}

/* Month grouping */
.wp-sitemap__list--month {
    list-style: disc;
    padding-left: 1.5rem;
}

/* Category / taxonomy grouping */
.wp-sitemap__list--category,
.wp-sitemap__list--taxonomy {
    list-style: disc;
    padding-left: 1.5rem;
}

/* ─── Items ───────────────────────────────────────────────── */
.wp-sitemap__item {
    margin-bottom: 0.3rem;
}

/* ─── Group (year, month, category label rows) ────────────── */
.wp-sitemap__group {
    margin-bottom: 0.5rem;
    list-style: none;
}

.wp-sitemap__group-label {
    display: inline-block;
    font-weight: 600;
    color: inherit;
    margin-bottom: 0.2rem;
}

/* Year label slightly larger */
.wp-sitemap__group--year > .wp-sitemap__group-label {
    font-size: 1rem;
}

/* Month label slightly muted */
.wp-sitemap__group--month > .wp-sitemap__group-label {
    font-weight: 500;
    opacity: 0.85;
}

/* ─── Links ───────────────────────────────────────────────── */
.wp-sitemap__link {
    --wp-sitemap-link-color: var(--aw-link-color);
    --wp-sitemap-link-hover-color: var(--aw-link-hover-color);
    color: var(--wp-sitemap-link-color);
    text-decoration: underline;
}

.wp-sitemap__link:hover,
.wp-sitemap__link:focus {
    color: var(--wp-sitemap-link-hover-color);
    text-decoration: none;
}

/* ─── Excerpt ─────────────────────────────────────────────── */
.wp-sitemap__excerpt {
    display: block;
    font-size: 0.8125rem; /* 13px */
    opacity: 0.7;
    margin-top: 0.15rem;
}

/* ─── Card grid (top-level pages) ────────────────────────── */
.wp-sitemap__cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.5rem;
}

.wp-sitemap__card {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: var(--aw-white, #fff);
    border: 1px solid var(--aw-black-10, #e5e5e5);
    border-radius: 12px;
    overflow: hidden;
}

.wp-sitemap__card-bar {
    display: block;
    height: 6px;
    background-color: var(--wp-sitemap-card-color, var(--brand-primary));
}

.wp-sitemap__card-inner {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 1.5rem;
}

.wp-sitemap__card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.wp-sitemap__card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    flex: 0 0 auto;
    border-radius: 10px;
    background-color: var(--wp-sitemap-card-color, var(--brand-primary));
    color: var(--aw-white, #fff);
    font-weight: 700;
    font-size: 1.125rem;
}

.wp-sitemap__card-count {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--aw-black-20, #ccc);
    border-radius: 999px;
    color: var(--aw-text-color, #333);
    white-space: nowrap;
}

.wp-sitemap__card-title {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    line-height: 1.3;
}

.wp-sitemap__card-title a {
    color: inherit;
    text-decoration: none;
}

.wp-sitemap__card-title a:hover,
.wp-sitemap__card-title a:focus {
    text-decoration: underline;
}

.wp-sitemap__card-desc {
    font-size: 0.875rem;
    line-height: 1.5;
    opacity: 0.75;
    margin: 0 0 1.25rem;
}

/* List of direct children rendered inside a card, and any nested sub-list. */
.wp-sitemap__list--card {
    list-style: none;
    margin: auto 0 0;
    padding: 0.75rem 0 0;
    border-top: 1px solid var(--aw-black-10, #eee);
}

.wp-sitemap__list--nested {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0 0.25rem 1rem;
}

.wp-sitemap__list--card > .wp-sitemap__item {
    border-bottom: 1px dashed var(--aw-black-10, #e5e5e5);
}

.wp-sitemap__list--card > .wp-sitemap__item:last-child {
    border-bottom: none;
}

.wp-sitemap__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.wp-sitemap__list--card > .wp-sitemap__item > .wp-sitemap__row {
    padding: 0.6rem 0;
}

.wp-sitemap__list--nested > .wp-sitemap__item > .wp-sitemap__row {
    padding: 0.4rem 0;
}

.wp-sitemap__link {
    color: var(--aw-heading-color, inherit);
    font-weight: 600;
    text-decoration: none;
}

.wp-sitemap__link:hover,
.wp-sitemap__link:focus {
    color: var(--wp-sitemap-link-hover-color);
}

/* Deepest level (grandchildren+) reads as plain leaf content, not a section heading. */
.wp-sitemap__item--leaf-level > .wp-sitemap__row .wp-sitemap__link {
    font-weight: 400;
    color: var(--aw-text-color, #555);
    opacity: 0.85;
}

.wp-sitemap__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--aw-black-40, #999);
    cursor: pointer;
}

.wp-sitemap__toggle i {
    font-size: 0.75rem;
    transition: transform 0.15s ease;
}

.wp-sitemap__toggle:not(.collapsed) i {
    transform: rotate(90deg);
}

/* Highlight the row whose sub-list is currently expanded. */
.wp-sitemap__item--active > .wp-sitemap__row .wp-sitemap__link,
.wp-sitemap__item--active > .wp-sitemap__row .wp-sitemap__toggle {
    color: var(--wp-sitemap-card-color, var(--brand-primary));
}
