.library-reading-notes {
    container-type: inline-size;
    scroll-margin-top: calc(var(--header-height) + 16px);
}

.reading-notes-list {
    list-style: none;
    margin: 0;
    padding: 0 18px;
    border: 1px solid var(--line-new);
    border-radius: 16px;
    background: var(--panel);
}

.reading-notes-list > li + li {
    border-top: 1px solid var(--line-new);
}

.reading-notes-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 14px;
    padding: 16px 0;
}

.reading-notes-title {
    min-width: 0;
}

.reading-notes-title .library-work-author {
    position: relative;
    z-index: 1;
    display: inline-block;
    max-width: 100%;
    font-size: max(11px, var(--mobile-text-min));
    white-space: normal;
}

.reading-notes-title h3 {
    margin: 4px 0 0;
    color: var(--ink);
    font: 500 clamp(20px, 2vw, 24px)/1.18 Georgia, serif;
    overflow-wrap: anywhere;
}

.reading-notes-row p {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted-new);
    font-size: 15px;
    line-height: 1.5;
}

.reading-notes-row .library-work-open {
    grid-column: 2;
    grid-row: 1;
}

.reading-notes-work {
    color: var(--ink);
    text-decoration: none;
}

/* The row opens the poem; the poet and title keep separate hover targets. */
.reading-notes-work::after {
    position: absolute;
    inset: 0;
    content: "";
}

.reading-notes-work > span {
    position: relative;
    z-index: 1;
}

.reading-notes-work > span:hover,
.reading-notes-work:focus-visible {
    color: var(--violet-dark);
}

.reading-notes-title a:focus-visible {
    outline: 2px solid var(--violet);
    outline-offset: 3px;
    border-radius: 3px;
}

@container (min-width: 560px) {
    .reading-notes-row {
        grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.3fr) auto;
        gap: 20px;
    }

    .reading-notes-row p,
    .reading-notes-row .library-work-open {
        grid-area: auto;
    }
}
