
/* --- 10) Главный индекс -------------------------------------------------- */
.md-typeset h2.book-home-direction {
    --book-home-soft-line: #f0e8dc;

    align-items: center;
    color: var(--color-heading-text);
    display: flex;
    font-size: 1.28rem;
    font-weight: 700;
    gap: 0.4rem;
    margin: 1.65rem 0 0.75rem;
    padding: 0;
}

.md-typeset h2.book-home-direction::after {
    background: var(--book-home-soft-line);
    content: "";
    flex: 1 1 auto;
    height: 1px;
    min-width: 2rem;
}

.md-typeset h2.book-home-direction + ul {
    --book-direction-color: #2f7d5d;
    --book-direction-soft: #f2f7f3;
    --book-direction-spine: rgba(47, 125, 93, 0.76);
    --book-home-soft-line: #f0e8dc;
    --book-home-neutral-line: #e8dccb;
    --book-home-shadow: 0 12px 30px rgba(17, 17, 17, 0.08);

    display: grid;
    gap: 1.05rem;
    grid-auto-rows: 1fr;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
    list-style: none !important;
    margin: 0 0 1.85rem;
    padding-left: 0;
}

.md-typeset h2.book-home-direction:nth-of-type(2) + ul {
    --book-direction-color: #1f5d9b;
    --book-direction-soft: #eef5f8;
    --book-direction-spine: rgba(31, 93, 155, 0.76);
}

.md-typeset h2.book-home-direction:nth-of-type(3) + ul {
    --book-direction-color: #6a4aa0;
    --book-direction-soft: #f3f0f8;
    --book-direction-spine: rgba(106, 74, 160, 0.76);
}

.md-typeset h2.book-home-direction + ul > li {
    background: var(--color-surface);
    border: 1px solid var(--book-home-soft-line);
    border-radius: 12px;
    box-shadow: var(--book-home-shadow);
    display: flex;
    flex-direction: column;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    padding: 0.78rem 0.84rem 0.9rem;
    position: relative;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.md-typeset h2.book-home-direction + ul > li::before {
    background: var(--book-direction-spine);
    bottom: 0;
    content: "";
    left: 0;
    position: absolute;
    top: 0;
    width: 0.18rem;
}

.md-typeset h2.book-home-direction + ul > li > p {
    margin: 0.45rem 0 0;
}

.md-typeset h2.book-home-direction + ul > li > p:first-child {
    align-items: center;
    aspect-ratio: 16 / 9;
    background: var(--book-direction-soft);
    border-radius: 9px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.64);
    display: flex;
    justify-content: center;
    margin: 0 0 0.62rem;
    overflow: hidden;
    padding: 0.55rem;
    position: relative;
    width: 100%;
}

.md-typeset h2.book-home-direction + ul .book-home-card-image {
    display: block;
    filter: none;
    height: 100%;
    max-height: 100%;
    max-width: 100%;
    mix-blend-mode: normal;
    object-fit: contain;
    opacity: 0.94;
    width: 100%;
}

.md-typeset h2.book-home-direction + ul > li > p:nth-child(2) {
    font-size: 1.12em;
    font-weight: 700;
    line-height: 1.25;
}

.md-typeset h2.book-home-direction + ul > li > p:nth-child(2) a {
    color: var(--color-heading-text);
    display: block;
    text-decoration: none;
}

.md-typeset h2.book-home-direction + ul > li > p:nth-child(2) a:hover {
    color: var(--book-direction-color);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.16em;
}

.md-typeset h2.book-home-direction + ul > li > p:nth-child(3) {
    color: var(--color-muted-text);
    font-size: 0.92em;
    line-height: 1.45;
    min-height: 2.55em;
}

.md-typeset h2.book-home-direction + ul .book-home-section-link {
    align-items: center;
    background: var(--book-direction-color);
    border-radius: 8px;
    color: var(--color-inverse-text);
    display: flex;
    font-weight: 700;
    justify-content: center;
    line-height: 1.2;
    min-height: 2rem;
    padding: 0.42rem 0.7rem;
    text-decoration: none;
    width: 100%;
}

.md-typeset h2.book-home-direction + ul .book-home-section-link:hover {
    color: var(--color-inverse-text);
    filter: brightness(0.95);
}

.md-typeset h2.book-home-direction + ul > li:hover {
    border-color: var(--book-home-neutral-line);
    box-shadow: 0 16px 34px rgba(17, 17, 17, 0.10);
    transform: translateY(-1px);
}

.md-typeset h2.book-home-direction + ul > li > ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.28rem 0.45rem;
    list-style: none;
    margin: 0.78rem 0 0;
    padding-left: 0;
}

.md-typeset h2.book-home-direction + ul > li > ul::before {
    color: var(--color-body-text);
    content: "Главы по порядку:";
    flex-basis: 100%;
    font-size: 0.88em;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.08rem;
}

.md-typeset h2.book-home-direction + ul > li > ul > li {
    margin: 0;
    min-width: 0;
    padding: 0;
}

.md-typeset h2.book-home-direction + ul > li > ul a {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: var(--color-book-blue);
    display: inline-flex;
    gap: 0.2rem;
    justify-content: flex-start;
    line-height: 1.2;
    max-width: 100%;
    min-height: 0;
    overflow-wrap: anywhere;
    padding: 0.1rem 0;
    text-align: left;
    text-decoration: none;
    transition: color 0.16s ease;
    width: auto;
}

.md-typeset h2.book-home-direction + ul > li > ul a::after {
    content: "";
    flex: 0 0 auto;
}

.md-typeset h2.book-home-direction + ul > li > ul > li:not(:last-child)::after {
    color: var(--color-muted-text);
    content: "·";
    margin-left: 0.45rem;
}

.md-typeset h2.book-home-direction + ul > li > ul a:hover {
    color: var(--color-book-blue);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.md-typeset h2.book-home-direction + ul > li > ul a:focus-visible {
    outline: 2px solid var(--color-book-light-blue);
    outline-offset: 2px;
}
