/* Link List (ui/templates/components/link_list/). A colored header bar over
   divided rows: label, optional badge, chevron. Linked via sekizai so a page
   loads it once however many lists it renders.

   --link-list-header-bg and --link-list-arrow are set inline by the plugin. */

.link-list,
.link-list * {
    box-sizing: border-box;
}

.link-list {
    width: 100%;
    margin-bottom: 48px;
    font-family: "NYU Perstare", system-ui, sans-serif;
    --link-list-text: #161616;
    --link-list-divider: #D7D7D7;
    --link-list-hover: var(--courant-violet, #57068C);
}

/* ---- Header bar ------------------------------------------------------- */

.link-list__title {
    display: flex;
    align-items: center;
    min-height: 64px;
    margin: 0;
    padding: 12px 36px;
    background: var(--link-list-header-bg, var(--courant-violet, #57068C));
    color: #FFFFFF;
    font-size: 26px;
    line-height: 32px;
    font-weight: 400;
    letter-spacing: -0.02em;
}

/* The title is rich text: flatten the editor's block wrappers so they take
   the bar's type scale (same treatment as section-header.html). */
.link-list__title p,
.link-list__title div,
.link-list__title h1,
.link-list__title h2,
.link-list__title h3,
.link-list__title h4,
.link-list__title h5,
.link-list__title h6 {
    display: inline;
    margin: 0;
    font-size: inherit;
    line-height: inherit;
    font-weight: inherit;
    color: inherit;
}

.link-list__title a {
    color: inherit;
}

/* ---- Rows -------------------------------------------------------------- */

.link-list__rows {
    margin: 0;
    padding: 0;
    list-style: none;
}

.link-list__item {
    border-bottom: 1px solid var(--link-list-divider);
}

.link-list__row {
    display: grid;
    /* label | badge | chevron. The chevron column exists even on a row that
       does not link, so badges stay right-aligned down the whole list. */
    grid-template-columns: minmax(0, 1fr) auto 7px;
    align-items: center;
    column-gap: 20px;
    min-height: 40px;
    /* Inset from the divider ends so the label and chevron don't sit flush
       with the edges of the header bar above. */
    padding: 8px 12px;
    color: var(--link-list-text);
    text-decoration: none;
}

.link-list__label {
    grid-column: 1;
    font-size: 16px;
    line-height: 20px;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.link-list__badge {
    grid-column: 2;
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

/* A touch roomier than the department chip's 7px, to match the design.
   Two classes so it outranks the Tailwind padding utility in badge.html. */
.link-list__badge .link-list__chip {
    padding-left: 10px;
    padding-right: 10px;
}

.link-list__arrow {
    grid-column: 3;
    width: 7px;
    height: 11px;
    color: var(--link-list-arrow, #8900E1);
    transition: transform 150ms ease;
}

/* ---- Subheaders -------------------------------------------------------- */

/* Groups the rows after it. No divider of its own: the previous row's
   divider closes the group above, and the gap marks the break. Inset by the
   row padding so it lines up with the labels below it. */
.link-list__subheader {
    margin: 0;
    padding: 28px 12px 6px;
    color: var(--link-list-text);
    font-size: 14px;
    line-height: 18px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Directly under the header bar there is no group above to separate from. */
.link-list__subheader-item:first-child .link-list__subheader {
    padding-top: 22px;
}

/* ---- Interaction ------------------------------------------------------- */

.link-list__row--link:hover .link-list__label,
.link-list__row--link:focus-visible .link-list__label {
    color: var(--link-list-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.link-list__row--link:hover .link-list__arrow,
.link-list__row--link:focus-visible .link-list__arrow {
    transform: translateX(3px);
}

.link-list__row--link:focus-visible {
    outline: 2px solid var(--courant-violet, #57068C);
    outline-offset: 2px;
}

/* ---- Small screens ------------------------------------------------------ */

@media (max-width: 767px) {
    .link-list__title {
        min-height: 52px;
        padding: 10px 20px;
        font-size: 22px;
        line-height: 28px;
    }

    .link-list__label {
        font-size: 15px;
    }
}

/* Too narrow for label and badge side by side: the badge drops under the
   label and the chevron stays centred on the row. */
@media (max-width: 479px) {
    .link-list__row {
        grid-template-columns: minmax(0, 1fr) 7px;
        grid-template-areas:
            "label arrow"
            "badge arrow";
        row-gap: 6px;
    }

    .link-list__label {
        grid-area: label;
    }

    .link-list__badge {
        grid-area: badge;
        justify-content: flex-start;
    }

    .link-list__arrow {
        grid-area: arrow;
    }
}

@media (prefers-reduced-motion: reduce) {
    .link-list__arrow {
        transition: none;
    }
}
