:root {
    color-scheme: light;
    --page-width: 1100px;
    --header-bg: #222;
    --header-active: #080808;
    --header-text: #ddd;
    --panel-border: #ddd;
    --panel-bg: #f5f5f5;
    --panel-hover: #ececec;
    --body-text: #333;
    --muted-text: #666;
    --focus: #1675d1;
    --accordion-duration: 300ms;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--body-text);
    background: #fff;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.page-shell {
    width: min(var(--page-width), calc(100% - 32px));
    margin-inline: auto;
}

.site-header {
    position: sticky;
    z-index: 20;
    top: 0;
    min-height: 50px;
    background: var(--header-bg);
}

.navbar {
    display: flex;
    align-items: stretch;
    min-height: 50px;
}

.navbar a,
.authors-menu > summary {
    display: flex;
    align-items: center;
    min-height: 50px;
    padding: 0 16px;
    color: var(--header-text);
    text-decoration: none;
    cursor: pointer;
}

.navbar a:hover,
.navbar a:focus-visible,
.authors-menu > summary:hover,
.authors-menu > summary:focus-visible,
.authors-menu[open] > summary,
.navbar__all {
    color: #fff;
    background: var(--header-active);
}

.authors-menu {
    position: relative;
}

.authors-menu > summary {
    list-style: none;
}

.authors-menu > summary::-webkit-details-marker,
.author-card > summary::-webkit-details-marker,
.poem-card > summary::-webkit-details-marker {
    display: none;
}

.authors-menu > summary::after {
    margin-left: 5px;
    border: 4px solid transparent;
    border-top-color: currentColor;
    content: "";
    transform: translateY(3px);
}

.authors-menu ul {
    position: absolute;
    top: 50px;
    left: 0;
    width: min(330px, calc(100vw - 32px));
    max-height: min(70vh, 520px);
    margin: 0;
    padding: 6px 0;
    overflow-y: auto;
    list-style: none;
    border: 1px solid #ccc;
    border-radius: 0 0 4px 4px;
    background: #fff;
    box-shadow: 0 6px 18px rgb(0 0 0 / 18%);
}

.authors-menu li a {
    min-height: 36px;
    padding: 7px 16px;
    color: #333;
    background: #fff;
}

.authors-menu li a:hover,
.authors-menu li a:focus-visible {
    color: #111;
    background: #f1f1f1;
}

main.page-shell {
    padding-block: 38px 64px;
}

.authors,
.poems {
    display: grid;
    gap: 6px;
}

.author-card,
.poem-card {
    scroll-margin-top: 66px;
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 1px 1px rgb(0 0 0 / 5%);
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 14px;
    list-style: none;
    background: var(--panel-bg);
    cursor: pointer;
    user-select: none;
}

.panel-heading:hover {
    background: var(--panel-hover);
}

.panel-heading:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--focus), transparent 35%);
    outline-offset: 2px;
}

.panel-heading__marker {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-right: 2px solid #777;
    border-bottom: 2px solid #777;
    transform: rotate(45deg) translateY(-2px);
    transition: transform var(--accordion-duration) ease-in-out;
}

details[open] > .panel-heading .panel-heading__marker {
    transform: rotate(225deg) translate(-2px, -2px);
}

.author-card__body {
    padding: 14px;
    overflow: hidden;
    border-top: 1px solid var(--panel-border);
    transition: height var(--accordion-duration) ease-in-out,
        opacity var(--accordion-duration) ease-in-out;
}

.author-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.author-photo {
    display: block;
    width: 70px;
    height: 90px;
    border-radius: 3px;
    background: #ececec;
    object-fit: cover;
    object-position: center;
}

.poem-card__heading {
    padding-block: 9px;
}

.poem-card__body {
    padding: 14px;
    overflow: hidden;
    border-top: 1px solid var(--panel-border);
    transition: height var(--accordion-duration) ease-in-out,
        opacity var(--accordion-duration) ease-in-out;
}

.poem-text {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.author-card__empty {
    margin: 0;
    padding: 12px;
    color: var(--muted-text);
    border: 1px dashed #ccc;
    border-radius: 4px;
}

.status {
    margin-bottom: 18px;
    padding: 16px 18px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f7f7f7;
}

.status h1,
.status p:last-child,
.status ul:last-child {
    margin-bottom: 0;
}

.status--warning {
    border-color: #e4bf64;
    background: #fff8e5;
}

.status--error {
    border-color: #dc8585;
    background: #fff0f0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 20px, var(--page-width));
    }

    .navbar {
        width: 100%;
    }

    .navbar a,
    .authors-menu > summary {
        padding-inline: 12px;
    }

    main.page-shell {
        padding-top: 22px;
    }

    .author-layout {
        gap: 10px;
    }

    .author-card__body,
    .poem-card__body {
        padding: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --accordion-duration: 0s;
    }

    html {
        scroll-behavior: auto;
    }

}
