/* ==========================================================
   FPLF CATEGORY CARDS – Path 2 Layer 1 component
   Card styling comes from .fplf-category-grid / .fplf-category-card
   in Additional CSS (09-category-landing.css). This file only adds
   the 3-column (default) or 2-column layout, list reset, compact
   card spacing and the Show All toggle.
   Base grid rules use !important, so overrides here need
   higher specificity plus !important.
========================================================== */

/* List reset (cards are rendered as <ul>/<li>) */

ul.fplf-category-grid.fplf-category-grid--3col,
ul.fplf-category-grid.fplf-category-grid--2col,
ul.fplf-category-grid.fplf-category-grid--4col {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

ul.fplf-category-grid.fplf-category-grid--3col > li,
ul.fplf-category-grid.fplf-category-grid--2col > li,
ul.fplf-category-grid.fplf-category-grid--4col > li {
    margin: 0;
}


/* 3 / 2 / 1 columns */

.fplf-category-grid.fplf-category-grid--3col {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

@media (max-width: 1024px) {
    .fplf-category-grid.fplf-category-grid--3col {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 767px) {
    .fplf-category-grid.fplf-category-grid--3col {
        grid-template-columns: 1fr !important;
    }
}


/* columns="2": 2 / 2 / 1 columns (e.g. four cards as a balanced 2×2 grid) */

.fplf-category-grid.fplf-category-grid--2col {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

@media (max-width: 767px) {
    .fplf-category-grid.fplf-category-grid--2col {
        grid-template-columns: 1fr !important;
    }
}


/* columns="4": 4 / 2 / 1 columns (Layer 2 type cards; same breakpoints as the base grid) */

.fplf-category-grid.fplf-category-grid--4col {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

@media (max-width: 1024px) {
    .fplf-category-grid.fplf-category-grid--4col {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 767px) {
    .fplf-category-grid.fplf-category-grid--4col {
        grid-template-columns: 1fr !important;
    }
}


/* Compact cards: title / optional description / link.
   Content sets the height; cards in a row stretch to the tallest one
   and the link row absorbs only that difference, so links line up. */

.fplf-category-cards .fplf-category-grid > .fplf-category-card {
    grid-template-rows: auto auto 1fr;
    row-gap: 0;
    padding: 20px !important;
}

.fplf-category-cards .fplf-category-card-title {
    margin: 0 !important;
    font-size: 17px !important;
    line-height: 1.3 !important;
}

.fplf-category-cards .fplf-category-card-text {
    margin: 8px 0 0 !important;
    line-height: 1.5 !important;
}

.fplf-category-cards .fplf-category-card .fplf-category-card-link {
    grid-row: 3;
    margin-top: 12px !important;
}

/* Space before the arrow (flex drops the whitespace text node) */

.fplf-category-cards .fplf-category-card-link > [aria-hidden="true"] {
    margin-left: 0.25em;
}

@media (max-width: 767px) {
    .fplf-category-cards .fplf-category-grid > .fplf-category-card {
        padding: 18px !important;
    }

    .fplf-category-cards .fplf-category-card-title {
        font-size: 16px !important;
    }
}


/* Collapsed cards (base card rule forces display:grid !important) */

.fplf-category-grid > .fplf-category-card[hidden] {
    display: none !important;
}


/* Show All Categories toggle */

.fplf-category-cards-toggle-wrap {
    display: flex;
    justify-content: center;

    margin-top: 28px;
}

.fplf-category-cards-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 46px;
    padding: 12px 22px;

    background: #ffffff;
    border: 1px solid #2f6fdd;
    border-radius: 6px;

    color: #2f6fdd;

    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.fplf-category-cards-toggle:hover,
.fplf-category-cards-toggle:focus {
    background: #2f6fdd;
    color: #ffffff;
}

.fplf-category-cards-toggle:focus-visible {
    outline: 3px solid rgba(47, 111, 221, 0.22);
    outline-offset: 2px;
}

.fplf-category-cards-toggle[hidden] {
    display: none;
}

@media (max-width: 767px) {
    .fplf-category-cards-toggle-wrap {
        margin-top: 22px;
    }

    .fplf-category-cards-toggle {
        width: 100%;
    }
}


/* rest="list": remaining categories as a compact A–Z list (4 / 3 / 2 columns).
   Links keep a 44px minimum tap height. Left-aligned like the cards (the landing
   section centres its text on mobile, which would centre wrapped names). */

.fplf-category-more {
    margin-top: 28px;
    text-align: left;
}

.fplf-category-more[hidden] {
    display: none;
}

.fplf-category-cards .fplf-category-more-title {
    margin: 0 0 8px;
    color: #153a66;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
}

ul.fplf-category-more-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}

ul.fplf-category-more-list > li {
    margin: 0;
    border-bottom: 1px solid #e6edf5;
}

ul.fplf-category-more-list a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 0;
    color: #2f73d9;
    font-size: 15px;
    line-height: 1.35;
    text-decoration: none;
}

ul.fplf-category-more-list a:hover,
ul.fplf-category-more-list a:focus-visible {
    color: #1d5fbf;
    text-decoration: underline;
}

@media (max-width: 1024px) {
    ul.fplf-category-more-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .fplf-category-more {
        margin-top: 22px;
    }

    ul.fplf-category-more-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 16px;
    }

    ul.fplf-category-more-list a {
        font-size: 14px;
    }
}
