.toc {
    padding-block: 96px 72px;
    background: var(--surface-bg, var(--white, #FFFFFF));
}

.toc .wrap {
    max-width: var(--section-max-width, var(--maxw, 1240px));
    margin-inline: auto;
    padding-inline-start: var(--section-gutter-left, var(--gut-l, max(16px, env(safe-area-inset-left, 0px))));
    padding-inline-end: var(--section-gutter-right, var(--gut-r, max(16px, env(safe-area-inset-right, 0px))));
}

.toc-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
    margin-bottom: 40px;
}

.toc-head h2 {
    font-size: clamp(44px, 8vw, 112px);
    line-height: 0.95;
}

.toc-head p {
    max-width: 38ch;
    color: var(--muted, #5C6168);
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line, rgba(51, 51, 51, 0.14));
}

.toc-item {
    border-bottom: 1px solid var(--line, rgba(51, 51, 51, 0.14));
}

.toc-row {
    position: relative;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 44px;
    gap: 20px;
    align-items: center;
    width: 100%;
    padding: 24px 0;
    background: none;
    border: 0;
    text-align: left;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    overflow: hidden;
}

.toc-row::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--yellow, #FFCC00);
    transform: scaleY(0);
    transform-origin: 50% 100%;
    transition: transform 0.45s var(--ease, cubic-bezier(0.76, 0, 0.24, 1));
    z-index: 0;
}

.toc-row > * {
    position: relative;
    z-index: 1;
}

.toc-row:focus-visible {
    outline: 2px solid var(--blue, #003576);
    outline-offset: -2px;
}

.toc-num {
    font-weight: 500;
    font-size: 22px;
    color: var(--blue, #003576);
}

.toc-title {
    font-weight: 300;
    font-size: clamp(22px, 3.2vw, 40px);
    line-height: 1.1;
    color: var(--blue, #003576);
    transition: transform 0.45s var(--ease, cubic-bezier(0.76, 0, 0.24, 1));
}

.toc-sub {
    display: block;
    font-size: 15px;
    font-weight: 300;
    color: var(--muted, #5C6168);
    margin-top: 6px;
    transition: color 0.3s;
}

.toc-go {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--line, rgba(51, 51, 51, 0.14));
    color: var(--blue, #003576);
    display: grid;
    place-items: center;
    transition:
        background-color 0.3s,
        border-color 0.3s,
        color 0.3s,
        transform 0.45s var(--ease, cubic-bezier(0.76, 0, 0.24, 1));
}

.toc-go svg {
    width: 18px;
    height: 18px;
}

.toc-thumb {
    display: none;
}

.toc-empty {
    color: var(--muted, #5C6168);
}

@media (hover: hover) and (pointer: fine) {
    .toc-row:hover::before,
    .toc-row:focus-visible::before {
        transform: scaleY(1);
    }

    .toc-row:hover .toc-title,
    .toc-row:focus-visible .toc-title {
        transform: translateX(14px);
    }

    .toc-row:hover .toc-sub,
    .toc-row:focus-visible .toc-sub {
        color: var(--blue, #003576);
    }

    .toc-row:hover .toc-go,
    .toc-row:focus-visible .toc-go {
        background-color: var(--blue, #003576);
        border-color: var(--blue, #003576);
        color: var(--white, #FFFFFF);
        transform: rotate(-45deg);
    }
}

.float-img {
    position: fixed;
    left: 0;
    top: 0;
    width: 340px;
    aspect-ratio: 4 / 3;
    max-width: 100%;
    pointer-events: none;
    z-index: 40;
    border-radius: 4px;
    overflow: hidden;
    clip-path: inset(50% 50% 50% 50%);
    transition: clip-path 0.45s var(--ease, cubic-bezier(0.76, 0, 0.24, 1));
    will-change: transform;
    box-shadow: 0 20px 40px rgba(0, 53, 118, 0.25);
}

.float-img.on {
    clip-path: inset(0 0 0 0);
}

.float-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.15);
    transition: transform 0.6s var(--ease, cubic-bezier(0.76, 0, 0.24, 1));
}

.float-img.on img {
    transform: scale(1);
}

@media (max-width: 860px) {
    .toc {
        padding-block: 64px;
    }

    .toc-row {
        grid-template-columns: 44px minmax(0, 1fr) 64px;
        gap: 12px;
        padding: 18px 0;
    }

    .toc-row:not(:has(.toc-thumb)) {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .toc-go {
        display: none;
    }

    .toc-thumb {
        display: block;
        width: 64px;
        height: 64px;
        border-radius: 3px;
        overflow: hidden;
    }

    .toc-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toc-row::before,
    .toc-title,
    .toc-sub,
    .toc-go,
    .float-img,
    .float-img img {
        transition: none;
    }

    .toc-row:hover .toc-title,
    .toc-row:focus-visible .toc-title,
    .toc-row:hover .toc-go,
    .toc-row:focus-visible .toc-go {
        transform: none;
    }

    .float-img {
        display: none;
    }
}
