/* Bookclub: Goodreads-style shelves and book pages. Builds on site.css and blog.css. */

/* ---------- Masthead stats ---------- */

.bookclub-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.75rem;
    margin: 1.75rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.9rem;
    color: var(--muted);
}

.bookclub-stats strong { font-weight: 600; color: var(--ink); }

/* ---------- Shelf tabs ---------- */

.bookclub-tabs { padding-top: 0; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }

.bookclub-tab {
    padding: 0.5rem 1rem;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--ink);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 200ms ease-out;
}

.bookclub-tab:hover { background: #ebe9e9; }
.bookclub-tab.is-active { background: linear-gradient(to right, var(--lime), var(--surface-2)); }
.bookclub-tab:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.bookclub-tab__count { margin-left: 0.2rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.bookclub { padding-top: clamp(1.5rem, 4vw, 2.5rem); }

/* ---------- Cover grid ---------- */

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr));
    gap: clamp(1.5rem, 3vw, 2.25rem) clamp(1rem, 2.5vw, 1.75rem);
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (max-width: 479px) {
    .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.book-card[hidden] { display: none; }

.book-card__link { display: block; }

.book-card__cover {
    position: relative;
    margin-bottom: 0.85rem;
    transition: transform 300ms var(--ease-out);
}

.book-card__link:hover .book-card__cover { transform: translateY(-6px) rotate(-1deg); }
.book-card__link:focus-visible { outline: none; }
.book-card__link:focus-visible .book-cover { outline: 3px solid var(--accent); outline-offset: 3px; }

.book-card__title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.book-card__link:hover .book-card__title { color: var(--accent); }

.book-card__author { margin-top: 0.2rem; font-size: var(--text-sm); color: var(--muted); }

/* A book: 2:3, slightly rounded, with a spine highlight down the left edge. */
.book-cover {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 3px 8px 8px 3px;
    box-shadow: 0 0.75rem 1.75rem rgba(15, 12, 21, 0.18), 0 0.15rem 0.35rem rgba(15, 12, 21, 0.12);
}

.book-cover--text {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12% 10% 10% 14%;
    overflow: hidden;
    color: #fff;
}

.book-cover--text::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 7%;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.22), rgba(255, 255, 255, 0.12) 60%, transparent);
}

.book-cover__title {
    font-family: var(--font-display);
    font-size: clamp(0.95rem, 2.2vw, 1.35rem);
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.18);
    overflow-wrap: anywhere;
}

.book-cover--light { color: var(--ink); }
.book-cover--light .book-cover__title { text-shadow: none; }

.book-cover__author {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    opacity: 0.9;
}

/* Which review formats a book has, pinned to the cover's corner. */
.book-badges {
    position: absolute;
    right: 0.4rem;
    bottom: 0.4rem;
    display: flex;
    gap: 0.25rem;
}

.book-badge {
    display: grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--ink);
    color: var(--lime);
    box-shadow: 0 0.25rem 0.6rem rgba(15, 12, 21, 0.25);
}

.book-badge svg { width: 0.85rem; height: 0.85rem; }

.bookclub-empty {
    padding: clamp(2rem, 6vw, 3.5rem);
    border-radius: var(--radius-xl);
    background: var(--surface-2);
    text-align: center;
    color: var(--muted);
}

.bookclub-empty[hidden] { display: none; }

.bookclub-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-top: clamp(2.5rem, 6vw, 4rem);
    padding-top: 1.25rem;
    border-top: 1px solid var(--surface-2);
    font-size: var(--text-sm);
    color: var(--muted);
}

.bookclub-legend > span { display: inline-flex; align-items: center; gap: 0.5rem; }
.bookclub-legend .book-badge { width: 1.35rem; height: 1.35rem; box-shadow: none; }
.bookclub-legend .book-badge svg { width: 0.7rem; height: 0.7rem; }

/* ---------- Book page ---------- */

.book { max-width: 64rem; padding-top: clamp(2.5rem, 7vw, 4.5rem); }

.book .post-back { display: inline-block; margin-bottom: 2rem; }

.book__layout {
    display: grid;
    grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
    align-items: start;
    gap: clamp(2rem, 6vw, 4.5rem);
}

.book__cover {
    position: sticky;
    top: calc(var(--header-h, 5rem) + 1.5rem);
}

.book__main { display: flex; flex-direction: column; gap: clamp(2.5rem, 6vw, 3.5rem); min-width: 0; }

.book__header { display: flex; flex-direction: column; align-items: flex-start; gap: 0.75rem; }

.book__shelf-pill {
    display: inline-block;
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    font-size: var(--text-sm);
    font-weight: 500;
}

.book__shelf-pill--read { background: var(--lime); }
.book__shelf-pill--reading { background: var(--ink); color: var(--ink-inverse); }

.book__title { font-size: clamp(2.25rem, 6vw, 4.25rem); line-height: 0.88; overflow-wrap: anywhere; }

.book__author { font-size: var(--text-md); font-weight: 300; color: var(--muted); }

.book__jumps { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }

.book-jump {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.95rem;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    font-size: 0.85rem;
    font-weight: 500;
    transition: background-color 200ms ease-out;
}

.book-jump:hover { background: #ebe9e9; }
.book-jump svg { width: 1rem; height: 1rem; }

.book-section { display: flex; flex-direction: column; align-items: flex-start; gap: 1.25rem; scroll-margin-top: calc(var(--header-h, 5rem) + 1rem); }
.book-section__title { font-size: var(--text-lg); font-weight: 600; letter-spacing: -0.02em; }
.book-section .prose { width: 100%; }

.book__none { color: var(--muted); }

/* ---------- Click-to-play YouTube ---------- */

.yt-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius-xl);
    background: var(--ink);
}

.yt-embed iframe,
.yt-embed__poster,
.yt-embed__poster img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.yt-embed__poster img { object-fit: cover; transition: transform 600ms var(--ease-out), opacity 300ms ease-out; opacity: 0.9; }
.yt-embed__poster:hover img { transform: scale(1.03); opacity: 1; }

.yt-embed__play {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    background: var(--lime);
    color: var(--ink);
    box-shadow: 0 0.75rem 2rem rgba(15, 12, 21, 0.35);
    transform: translate(-50%, -50%);
    transition: transform 200ms var(--ease-out);
}

.yt-embed__play svg { width: 1.9rem; height: 1.9rem; margin-left: 0.2rem; }
.yt-embed__poster:hover .yt-embed__play { transform: translate(-50%, -50%) scale(1.06); }
.yt-embed__poster:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: inherit; }

/* Phones: cover on top, smaller and centred. */
@media (max-width: 767px) {
    .book__layout { grid-template-columns: minmax(0, 1fr); }
    .book__cover { position: static; width: min(11rem, 55%); }
}
