/* Site styles layered on Pico CSS. */

@font-face {
    font-family: "Ruwudu";
    src: url("../fonts/ruwudu-700-latin.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Instrument Sans";
    src: url("../fonts/instrument-sans-500-latin.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Instrument Sans";
    src: url("../fonts/instrument-sans-600-latin.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Instrument Sans";
    src: url("../fonts/instrument-sans-400-italic-latin.woff2") format("woff2");
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

/* Shared values and Pico defaults */
:root {
    --color-maroon: #870014;
    --color-sky: #98d7e8;
    --color-blue: #4a53cf;
    --color-indigo: #2931a9;
    --color-gold: #fec80e;
    --font-body: "Instrument Sans", system-ui, sans-serif;
    --font-heading: "Ruwudu", Georgia, serif;
    --space-small: .5rem;
    --space: 1.5rem;
    --space-large: clamp(3rem, 6vw, 6rem);
    --width-content: 80rem;
    --width-reading: 48rem;

    --pico-font-size: 100%;
    --pico-font-family: var(--font-body);
    --pico-font-family-sans-serif: var(--font-body);
    --pico-font-weight: 500;
    --pico-line-height: 1.5;
}
[data-theme=light],
:root:not([data-theme=dark]) {
    --pico-background-color: #f8f8f8;
    --pico-color: #171717;
    --pico-primary: var(--color-blue);
    --pico-primary-hover: var(--color-indigo);
}

/* Global layout and type */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
}
.site-main {
    flex: 1 0 auto;
    padding: 0;
}
.wrap,
.collage,
.feature,
.book-hero,
.dedication,
.poem {
    width: min(var(--width-content), 100% - 2 * var(--space));
    margin-inline: auto;
}
h1, h2, h3 {
    margin: 0 0 var(--space);
    color: var(--color-indigo);
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
}
h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
}
h2 {
    font-size: 2rem;
}
h3 {
    color: var(--color-maroon);
    font-size: 1.5rem;
}
a:focus-visible {
    outline: 2px solid var(--color-blue);
    outline-offset: 3px;
}
.lead,
.page-intro > p:first-of-type,
.page-intro > div > blockquote,
.page-intro > .page-content > p:first-of-type,
.page-intro > .posts-index__intro > p:first-of-type,
.page-intro > .front-page-content > p:first-of-type {
    color: var(--color-blue);
    font-size: 1.5rem;
    line-height: 1.5;
}
.page-intro > div > blockquote {
    border-left: none;
}
.lead a {
    color: inherit;
}

/* Header and footer */
.site-header {
    padding-block: var(--space);
    background: var(--color-maroon);
}
.site-header__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space);
}
.brand,
.brand:hover {
    color: var(--color-sky);
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    text-decoration: none;
}
.site-branding {
    max-width: 100%;
    overflow-wrap: anywhere;
}
.site-branding .custom-logo-link {
    display: inline-block;
    max-width: 100%;
}
.site-branding .custom-logo {
    display: block;
    width: auto;
    height: auto;
    max-width: min(20rem, 100%);
    max-height: 6rem;
}
.site-tagline {
    margin: var(--space-small) 0 0;
    color: #fff;
}
/* Pico adds negative margins and link padding to nav lists. */
.site-nav ul:first-of-type,
.site-nav ul:last-of-type,
.footer-nav ul:first-of-type,
.footer-nav ul:last-of-type {
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space);
    margin: 0;
    padding: 0;
}
.site-nav li,
.footer-nav li {
    padding: 0;
}
.site-nav a,
.footer-nav a {
    margin: 0;
    padding: 0;
}
.site-nav a {
    color: #fff;
    text-decoration: none;
}
.site-nav a:hover {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: .25em;
}
.site-nav .sub-menu:first-of-type,
.site-nav .sub-menu:last-of-type,
.footer-nav .sub-menu:first-of-type,
.footer-nav .sub-menu:last-of-type {
    display: block;
    margin: var(--space-small) 0 0;
    padding-left: var(--space);
}
.site-nav .sub-menu li,
.footer-nav .sub-menu li {
    display: block;
}
.site-nav .customize-partial-edit-shortcut,
.footer-nav .customize-partial-edit-shortcut {
    display: none;
}
.site-footer {
    flex-shrink: 0;
    padding: var(--space-large) var(--space);
    text-align: center;
    background: var(--color-gold);
}
.footer-nav {
    justify-content: center;
    margin-bottom: var(--space);
}
.site-footer p {
    margin: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-small);
    padding: var(--space-small) var(--space);
    border-radius: 1rem;
    background: var(--color-indigo);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.btn:hover {
    color: #fff;
    filter: brightness(1.1);
    text-decoration: none;
}
.btn img {
    display: block;
    width: var(--space);
    height: var(--space);
}

/* Page introductions and post index */
.display-title {
    text-align:center;
}
.page-intro {
    padding-top: var(--space-large);
}
.site-main > .page-intro:last-child {
    padding-bottom: var(--space-large);
}
.wp-block-paragraph + .wp-block-paragraph {
    margin-block-start: calc(var(--space) + var(--space-small));
}
.posts-index__list {
    margin-top: var(--space);
    border-top: 1px solid var(--color-sky);
}
/* Posts and poems are lists, not Pico cards. */
.posts-index__entry,
.poem {
    border-radius: 0;
    background: none;
    box-shadow: none;
}
.posts-index__entry {
    margin: 0;
    padding: var(--space) 0;
    border-bottom: 1px solid var(--color-sky);
}
.posts-index__excerpt > :last-child {
    margin-bottom: 0;
}
.posts-index .pagination {
    margin-top: var(--space);
}

/* Home cover collage */
.collage {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    place-items: center;
    gap: var(--space);
    margin-block: var(--space-large);
}
.collage > .cover {
    display: block;
    width: 100%;
    transition: transform .2s ease, box-shadow .2s ease;
}
.cover img {
    display: block;
    width: 100%;
    height: auto;
}
.cover--shadow,
.cover--shadow-lg,
.cover--shadow-xl,
.cover--band {
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}
.cover--band {
    --cover-inset: .25rem;
    padding: var(--cover-inset);
    background: rgba(0, 0, 0, .15);
}
a.cover:hover,
a.cover:focus-visible {
    transform: translateY(-.25rem);
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .2);
}
/* Book pages */
.book-hero,
.feature {
    display: grid;
    gap: var(--space);
    margin-top: var(--space-large);
}
.book-hero {
    justify-items: center;
    text-align: center;
}
.book-hero__title {
    margin: 0;
}
.poetry-page .book-hero__title {
    color: var(--color-maroon);
}
.book-hero__cover {
    width: 100%;
}
.book-hero__cover img {
    display: block;
    width: 100%;
    height: auto;
}
.book-about,
.dedication {
    margin-top: var(--space-large);
}
.dedication {
    text-align: center;
}
.feature {
    margin-bottom: var(--space-large);
}
.feature,
.wp-block-columns {
    align-items: stretch;
}
.feature__body {
    max-width: var(--width-reading);
}
.feature__card,
.wp-block-pullquote {
    padding: var(--space);
    border: 1px solid var(--color-sky);
    border-radius: 1rem;
    text-align: center;
}
.feature__card p,
.feature__body > :last-child,
.wp-block-pullquote > :last-child {
    margin-bottom: 0;
}
.feature__card p,
.feature__body > :last-child:not(.wp-block-pullquote),
.wp-block-pullquote > :last-child {
    border: 0;
}
div:has(> .wp-block-pullquote:last-child) {
    display: flex;
    flex-direction: column;
}
div > .wp-block-pullquote:last-child {
    flex: 1;
}
.wp-block-pullquote blockquote {
    color: var(--color-maroon);
    font-family: var(--font-heading);
}

/* Poetry */
.poems {
    margin-top: var(--space-large);
}
.poem {
    max-width: var(--width-reading);
    /*margin-bottom: 0;*/
    padding: var(--space) 0;
    border-bottom: 1px solid var(--color-sky);
    text-align: center;
}
.poem h2,
.poem p:not(.poem__chord):not(.poem__lines) {
    margin: 0;
}
.poem__ornament {
    display: block;
    margin: 0 auto var(--space);
}
.poem__title {
    color: var(--color-maroon);
}
.poem .poem__chord {
    margin: var(--space-small) 0 0;
    color: var(--color-blue);
    font-style: italic;
    font-weight: 400;
}
.poem .poem__lines {
    margin: var(--space) 0 0;
}
.keep-reading {
    display: flex;
    justify-content: center;
    padding: var(--space);
}

/* Responsive layouts */
@media (max-width: 47.99rem) {
    .site-header__inner {
        justify-content: center;
    }
    .book-hero__cover {
        grid-row: 1;
        max-width: 24rem;
    }
    .collage > .cover:first-child,
    .collage > .cover:last-child:nth-child(even) {
        grid-column: 1 / -1;
    }
    .collage > .cover:first-child {
        width: 72%;
    }
    .collage > .cover:last-child:nth-child(even) {
        width: calc((100% - var(--space)) / 2);
    }
}
@media (min-width: 48rem) {
    .collage {
        --collage-row: clamp(6rem, 18vw, 15rem);
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-auto-rows: var(--collage-row);
        align-items: start;
    }
    .collage > .cover {
        --cover-rows: 2;
        grid-column: span 2;
        grid-row: span var(--cover-rows);
        width: fit-content;
        max-width: 100%;
    }
    .collage > .cover img {
        width: auto;
        max-height: calc(
            var(--cover-rows) * var(--collage-row)
            + (var(--cover-rows) - 1) * var(--space)
            - 2 * var(--cover-inset, 0px)
        );
        object-fit: contain;
    }
    /* Repeat the staggered arrangement as books are added. */
    .collage > .cover:is(:nth-child(11n + 2), :nth-child(11n + 6), :nth-child(11n + 7), :nth-child(11n + 10), :nth-child(11n + 11)) {
        --cover-rows: 1;
        grid-column: span 1;
    }
    .collage > .cover:nth-child(11n + 2) {
        grid-column: span 2;
        max-width: calc((100% - var(--space)) / 2);
        justify-self: start;
    }
    .collage > .cover:only-child {
        grid-column: 3 / span 2;
    }
    .book-hero,
    .feature {
        gap: calc(2 * var(--space));
        text-align: left;
    }
    .book-hero {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: center;
    }
    .feature {
        grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    }
}
