/* Departments and Academic Departments lists — scoped styles (prefix: .dl-)
   Shared by department_list.html and academic_department_list.html through
   university/includes/department_grid.html. The brand blue comes from the site
   theme (--bs-primary in styles.css); the Roboto Slab font is inherited from the
   body. styles.css loads after this file, so every rule here is scoped under
   .dl-page to win over its element rules (`a` colour). */

.dl-page {
    --dl-primary: var(--bs-primary);
    --dl-primary-rgb: var(--bs-primary-rgb);
    --dl-primary-dark: #0987c2;
    --dl-ink: #1e293b;
    --dl-muted: #64748b;
    --dl-line: #e2e8f0;
    --dl-bg: #f4f8fb;
    --dl-surface: #fff;
    --dl-radius: 16px;
    --dl-shadow: 0 4px 16px -10px rgba(2, 74, 110, .25);
    --dl-shadow-hover: 0 18px 40px -16px rgba(2, 74, 110, .35);
    background: var(--dl-bg);
    color: var(--dl-ink);
}

.dl-page [hidden] {
    display: none !important;
}

.dl-page .container {
    max-width: 1200px;
}

/* ---------- Count and search ---------- */
.dl-toolbar {
    padding: 48px 0 32px;
    text-align: center;
}

.dl-toolbar__count {
    margin: 0;
    font-size: 16px;
    color: var(--dl-muted);
}

.dl-search {
    position: relative;
    max-width: 640px;
    margin: 24px auto 0;
}

.dl-search__icon {
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--dl-muted);
    pointer-events: none;
}

.dl-search__input {
    width: 100%;
    height: 56px;
    padding: 0 20px 0 52px;
    /* 16px keeps iOS from zooming into the field */
    font-size: 16px;
    color: var(--dl-ink);
    background: var(--dl-surface);
    border: 1px solid var(--dl-line);
    border-radius: var(--dl-radius);
    box-shadow: var(--dl-shadow);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.dl-search__input::placeholder {
    color: var(--dl-muted);
}

.dl-search__input:focus {
    outline: none;
    border-color: var(--dl-primary);
    box-shadow: 0 0 0 4px rgba(var(--dl-primary-rgb), .18);
}

/* ---------- Department cards ---------- */
.dl-body {
    padding: 0 0 80px;
}

.dl-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.dl-grid__item {
    display: flex;
    min-width: 0;
}

.dl-page .dl-card {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px 16px 16px;
    color: var(--dl-ink);
    text-decoration: none;
    background: var(--dl-surface);
    border: 1px solid var(--dl-line);
    border-radius: var(--dl-radius);
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.dl-page .dl-card:hover {
    color: var(--dl-ink);
    border-color: rgba(var(--dl-primary-rgb), .5);
    box-shadow: var(--dl-shadow-hover);
    transform: translateY(-2px);
}

.dl-page .dl-card:focus-visible,
.dl-page .dl-empty .btn:focus-visible {
    outline: 3px solid var(--dl-primary);
    outline-offset: 3px;
}

/* the first letter of the name keeps the alphabetical order easy to scan */
.dl-card__letter {
    flex: none;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    color: var(--dl-primary-dark);
    background: rgba(var(--dl-primary-rgb), .1);
    border-radius: 12px;
}

.dl-card__name {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    overflow-wrap: anywhere;
    transition: color .2s ease;
}

.dl-card:hover .dl-card__name {
    color: var(--dl-primary-dark);
}

.dl-card__arrow {
    flex: none;
    font-size: 14px;
    color: var(--dl-muted);
    transition: color .2s ease, transform .2s ease;
}

.dl-card:hover .dl-card__arrow {
    color: var(--dl-primary-dark);
    transform: translateX(4px);
}

/* ---------- Empty states ---------- */
.dl-empty {
    padding: 48px 16px;
    text-align: center;
    color: var(--dl-muted);
}

.dl-empty__icon {
    display: block;
    margin-bottom: 16px;
    font-size: 40px;
    opacity: .5;
}

.dl-empty__text {
    margin: 0 0 20px;
    font-size: 17px;
}

/* ---------- Columns ---------- */
@media (min-width: 768px) {
    .dl-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1200px) {
    .dl-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767.98px) {
    .dl-toolbar {
        padding: 40px 0 24px;
    }

    .dl-body {
        padding-bottom: 56px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dl-page .dl-card,
    .dl-card__arrow {
        transition: none;
    }

    .dl-page .dl-card:hover,
    .dl-card:hover .dl-card__arrow {
        transform: none;
    }
}
