/* Спільне оформлення сторінок-переліків: викладачі, аудиторії. */
.dir {
    --d-primary: #0062cc;
    --d-dark: #004a99;
    --d-ink: #1d2b3d;
    --d-muted: #6b7a8f;
    --d-line: #dce5f1;
    --d-chip: #f1f6fd;
    --d-page: #f7f9fc;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 4px 48px;
}

.dir [hidden],
.dir .is-hidden {
    display: none !important;
}

/* ---------- Шапка ---------- */
.dir-head {
    padding: 4px 0 16px;
    text-align: center;
}

.dir-eyebrow {
    margin: 0;
    font-size: .78rem;
    font-weight: 500;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--d-muted);
}

.dir .dir-head h1 {
    margin: 8px 0 0;
    font-size: clamp(1.45rem, 1.05rem + 1.7vw, 2.1rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--d-dark);
}

/* ---------- Пошук ---------- */
.dir-search-wrap {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 10px 0 8px;
    background: linear-gradient(var(--d-page) 72%, rgba(247, 249, 252, 0));
}

.dir-search {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid var(--d-line);
    border-radius: 999px;
    box-shadow: 0 2px 12px rgba(16, 42, 74, .06);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.dir-search:focus-within {
    border-color: var(--d-primary);
    box-shadow: 0 0 0 4px rgba(0, 98, 204, .13);
}

.dir-search .dir-ico {
    flex: none;
    margin-left: 16px;
    color: var(--d-muted);
}

.dir-search input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 13px 6px;
    border: 0;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 1rem;
    color: var(--d-ink);
}

.dir-search input::placeholder {
    color: #9aa7b8;
}

.dir-kbd {
    flex: none;
    margin-right: 14px;
    padding: 2px 7px;
    border: 1px solid var(--d-line);
    border-bottom-width: 2px;
    border-radius: 6px;
    background: #fbfcfe;
    font-size: .72rem;
    color: var(--d-muted);
}

.dir-clear {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-right: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--d-chip);
    color: var(--d-muted);
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.dir-clear:hover {
    background: #e2ecfb;
    color: var(--d-dark);
}

.dir-status {
    min-height: 21px;
    margin: 6px 0 0;
    padding: 0 18px;
    font-size: .85rem;
    color: var(--d-muted);
}

/* ---------- Абетковий покажчик ---------- */
.dir-alpha {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--d-line);
    border-radius: 12px;
    background: #fff;
}

.dir-alpha a {
    min-width: 30px;
    padding: 4px 8px;
    border-radius: 7px;
    color: var(--d-dark);
    font-size: .85rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.dir-alpha a:hover {
    background: var(--d-chip);
    color: var(--d-primary);
}

/* ---------- Секції ---------- */
.dir-section {
    margin-bottom: 10px;
    overflow: hidden;
    border: 1px solid var(--d-line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16, 42, 74, .04);
    scroll-margin-top: 78px;
}

.dir .dir-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 13px 18px;
    background: #eef4fe;
    color: var(--d-dark);
    font-size: .95rem;
    font-weight: 700;
    text-align: left;
}

.dir-fold > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 18px;
    background: #eef4fe;
    cursor: pointer;
    list-style: none;
}

.dir-fold > summary::-webkit-details-marker {
    display: none;
}

.dir-fold > summary::before {
    content: '';
    flex: none;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--d-muted);
    border-bottom: 2px solid var(--d-muted);
    transform: rotate(-45deg);
    transition: transform .15s ease;
}

.dir-fold[open] > summary::before {
    transform: rotate(45deg);
}

.dir-fold > summary .dir-section-title {
    padding: 0;
    background: transparent;
}

.dir-fold > summary:focus-visible {
    outline: 2px solid var(--d-primary);
    outline-offset: -2px;
}

/* ---------- Переліки ---------- */
.dir-names {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 2px 10px;
    padding: 10px 14px 16px;
}

.dir-names a {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--d-ink);
    font-size: .92rem;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.dir-names a:hover {
    background: var(--d-chip);
    color: var(--d-primary);
}

.dir-chips {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    gap: 8px;
    padding: 12px 16px 16px;
}

.dir-chips a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--d-chip);
    color: var(--d-dark);
    font-size: .9rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.dir-chips a:hover,
.dir-chips a:focus-visible {
    background: #fff;
    border-color: var(--d-primary);
    color: var(--d-primary);
    box-shadow: 0 4px 12px rgba(0, 98, 204, .15);
    transform: translateY(-1px);
}

/* Вибір аудиторії для пари: під назвою — місткість, зеленим — ті,
   куди вміщається потік. */
.dir-chips.is-rooms a {
    flex-direction: column;
    gap: 1px;
    line-height: 1.25;
}

.dir-chip-cap {
    color: var(--d-muted);
    font-size: .74rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.dir-chips a.is-fit {
    color: #1d7a35;
    font-weight: 700;
}

.dir-chips a.is-fit .dir-chip-cap {
    color: #2f9149;
    font-weight: 600;
}

.dir-chips a.is-fit:hover,
.dir-chips a.is-fit:focus-visible {
    border-color: #2f9149;
    color: #1d7a35;
    box-shadow: 0 4px 12px rgba(47, 145, 73, .18);
}

/* ---------- Швидкі посилання ---------- */
.dir-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.dir-quick a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    border: 1px solid var(--d-line);
    border-radius: 10px;
    background: #fff;
    color: var(--d-dark);
    font-size: .92rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.dir-quick a:hover {
    border-color: var(--d-primary);
    background: var(--d-chip);
    color: var(--d-primary);
}

.dir-empty {
    margin: 0 0 14px;
    padding: 34px 20px;
    border: 1px dashed var(--d-line);
    border-radius: 14px;
    background: #fff;
    color: var(--d-muted);
    text-align: center;
}

@media (max-width: 575.98px) {
    .dir-kbd {
        display: none;
    }

    .dir-names {
        grid-template-columns: 1fr;
        padding: 8px 10px 12px;
    }

    .dir-chips {
        grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
        gap: 6px;
        padding: 10px 12px 14px;
    }

    .dir .dir-section-title,
    .dir-fold > summary {
        padding: 12px 13px;
        font-size: .92rem;
    }

    .dir-alpha {
        gap: 2px;
        padding: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dir * {
        transition: none !important;
    }

    .dir-chips a:hover {
        transform: none;
    }
}

/* Під час пошуку згорнутий блок має розкриватись, інакше знайдене в ньому не видно */
.dir.is-searching .dir-fold > .dir-chips,
.dir.is-searching .dir-fold > .dir-names {
    display: grid !important;
}

.dir.is-searching .dir-fold > summary::before {
    transform: rotate(45deg);
}
