/* ── Local Authors & E-books ─────────────────────────────────
   Shared by books.php, book.php, books-submit.php and the
   homepage "From local authors" strip. Uses the colour tokens
   defined in includes/header.php. */

/* ── Hero (matches resources.php) ─────────────────────────── */
.books-hero {
    background: linear-gradient(135deg, var(--ocean) 0%, var(--surf) 60%, var(--seafoam) 100%);
    padding: 56px 24px 48px;
}
.books-hero-inner { max-width: 1200px; margin: 0 auto; }
.books-hero .hero-tag {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    color: var(--seafoam);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 16px;
    border: 1px solid rgba(255,255,255,0.2);
}
.books-hero h1 {
    font-family: "Playfair Display", serif;
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 900;
    color: var(--white);
    line-height: 1.1;
    margin-bottom: 14px;
}
.books-hero h1 em { color: var(--seafoam); font-style: normal; }
.books-hero p {
    color: rgba(255,255,255,0.85);
    font-size: 1.05rem;
    max-width: 620px;
    line-height: 1.6;
}
.books-hero .hero-cta {
    display: inline-block;
    margin-top: 20px;
    background: var(--accent);
    color: var(--white);
    padding: 11px 22px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    transition: background 0.2s;
}
.books-hero .hero-cta:hover { background: #c04a18; }

.books-body {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 56px;
}

.books-section-heading {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-bottom: 18px;
}
.books-section-heading h2 {
    font-family: "Playfair Display", serif;
    font-size: 1.5rem;
    color: var(--ocean);
}
.books-section-heading .count { font-size: 0.82rem; color: var(--txt-mute); }
.books-section-heading .side-link {
    margin-left: auto;
    font-size: 0.82rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.books-section-heading .side-link:hover { text-decoration: underline; }

/* ── Filters ──────────────────────────────────────────────── */
.books-filters {
    background: var(--white);
    border: 1px solid var(--dusk);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.books-search { display: flex; gap: 8px; flex-wrap: wrap; }
.books-search input[type="search"] {
    flex: 1 1 220px;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--dusk);
    border-radius: 8px;
    font-family: "DM Sans", sans-serif;
    font-size: 0.92rem;
    background: var(--sand);
}
.books-search input[type="search"]:focus { outline: none; border-color: var(--surf); background: var(--white); }
.books-search button {
    padding: 10px 18px;
    background: var(--ocean);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-family: "DM Sans", sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
}
.books-search button:hover { background: var(--surf); }
.genre-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.genre-chip {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--dusk);
    background: var(--sand);
    color: var(--txt);
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.15s;
}
.genre-chip:hover { border-color: var(--surf); color: var(--surf); }
.genre-chip.active { background: var(--ocean); border-color: var(--ocean); color: var(--white); }
.genre-chip.free-chip.active { background: #2e8b57; border-color: #2e8b57; }

/* ── Grid + cards ─────────────────────────────────────────── */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 20px;
}
.books-grid--featured { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); margin-bottom: 40px; }

.book-card {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border: 1px solid var(--dusk);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.book-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--seafoam); }
.book-card--featured { border-color: var(--gold); }

.book-cover {
    position: relative;
    aspect-ratio: 2 / 3;
    background: var(--dusk);
    overflow: hidden;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    text-align: center;
    background: linear-gradient(160deg, var(--ocean), var(--surf));
    color: var(--white);
    font-family: "Playfair Display", serif;
    font-size: 1.05rem;
    line-height: 1.3;
}
.book-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--gold);
    color: var(--white);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
}
.book-meta { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.book-title {
    font-family: "Playfair Display", serif;
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--ocean);
    line-height: 1.25;
}
.book-author { font-size: 0.82rem; color: var(--txt-mute); }
.book-foot {
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
}
.book-genre { color: var(--surf); }
.book-price { color: var(--txt); font-weight: 500; white-space: nowrap; }
.book-price.is-free {
    background: #e6f4ea;
    color: #2e7d4f;
    padding: 2px 8px;
    border-radius: 10px;
}

.books-empty {
    background: var(--white);
    border: 1px dashed var(--dusk);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    color: var(--txt-mute);
}
.books-empty a { color: var(--accent); font-weight: 500; }

.books-pager { display: flex; justify-content: center; gap: 8px; margin-top: 32px; flex-wrap: wrap; }
.books-pager a, .books-pager span {
    padding: 7px 13px;
    border-radius: 8px;
    border: 1px solid var(--dusk);
    background: var(--white);
    text-decoration: none;
    color: var(--txt);
    font-size: 0.85rem;
}
.books-pager span.current { background: var(--ocean); border-color: var(--ocean); color: var(--white); }

/* ── Author CTA ───────────────────────────────────────────── */
.author-cta {
    margin-top: 48px;
    background: linear-gradient(135deg, var(--bark), #4a3020);
    color: rgba(255,255,255,0.85);
    border-radius: var(--radius);
    padding: 28px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.author-cta h3 { font-family: "Playfair Display", serif; color: var(--white); font-size: 1.3rem; margin-bottom: 4px; }
.author-cta p { font-size: 0.9rem; line-height: 1.5; }
.author-cta .cta-text { flex: 1 1 280px; }
.author-cta a {
    background: var(--accent);
    color: var(--white);
    padding: 11px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}
.author-cta a:hover { background: #c04a18; }

/* ── Detail page ──────────────────────────────────────────── */
.book-detail {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px 56px;
}
.book-breadcrumb { font-size: 0.82rem; color: var(--txt-mute); margin-bottom: 20px; }
.book-breadcrumb a { color: var(--surf); text-decoration: none; }
.book-breadcrumb a:hover { text-decoration: underline; }
.book-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}
.book-detail-cover {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 12px 36px rgba(10,79,110,0.2);
    aspect-ratio: 2 / 3;
    background: var(--dusk);
}
.book-detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-detail-cover .book-cover-placeholder { font-size: 1.5rem; }
.book-detail h1 {
    font-family: "Playfair Display", serif;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    color: var(--ocean);
    line-height: 1.15;
}
.book-detail .subtitle { font-size: 1.1rem; color: var(--txt-mute); margin-top: 6px; }
.book-detail .byline { margin-top: 12px; font-size: 1rem; }
.book-detail .byline strong { color: var(--txt); }
.book-detail .byline span { color: var(--txt-mute); }
.book-facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.book-fact {
    background: var(--white);
    border: 1px solid var(--dusk);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.78rem;
    color: var(--txt-mute);
}
.book-fact.featured { border-color: var(--gold); color: var(--gold); font-weight: 600; }
.book-fact.free { border-color: #2e7d4f; color: #2e7d4f; font-weight: 600; }
.book-buy { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 28px; }
.book-buy a {
    padding: 12px 22px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
}
.book-buy .primary { background: var(--accent); color: var(--white); }
.book-buy .primary:hover { background: #c04a18; }
.book-buy .secondary { background: var(--white); color: var(--ocean); border: 1px solid var(--ocean); }
.book-buy .secondary:hover { background: var(--ocean); color: var(--white); }
.book-detail h2 {
    font-family: "Playfair Display", serif;
    font-size: 1.2rem;
    color: var(--ocean);
    margin: 24px 0 10px;
}
.book-detail .prose { font-size: 0.98rem; line-height: 1.75; color: var(--txt); overflow-wrap: anywhere; }
.book-detail .isbn { font-size: 0.8rem; color: var(--txt-mute); margin-top: 18px; }
.book-disclaimer { font-size: 0.75rem; color: var(--txt-mute); margin-top: 8px; font-style: italic; }

/* ── Submit form ──────────────────────────────────────────── */
.book-form-wrap { max-width: 780px; margin: 0 auto; padding: 36px 24px 56px; }
.book-form {
    background: var(--white);
    border: 1px solid var(--dusk);
    border-radius: var(--radius);
    padding: 28px;
}
.book-form fieldset { border: none; margin: 0 0 22px; padding: 0; }
.book-form legend {
    font-family: "Playfair Display", serif;
    font-size: 1.15rem;
    color: var(--ocean);
    font-weight: 700;
    margin-bottom: 12px;
}
.bf-row { margin-bottom: 14px; }
.bf-row label, .bf-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--txt-mute);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 5px;
}
.bf-row input[type="text"], .bf-row input[type="url"], .bf-row input[type="email"],
.bf-row input[type="number"], .bf-row input[type="file"], .bf-row select, .bf-row textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--dusk);
    border-radius: 8px;
    font-family: "DM Sans", sans-serif;
    font-size: 0.92rem;
    color: var(--txt);
    background: var(--sand);
}
.bf-row textarea { min-height: 120px; resize: vertical; }
.bf-row input:focus, .bf-row select:focus, .bf-row textarea:focus { outline: none; border-color: var(--surf); background: var(--white); }
.bf-hint { font-size: 0.75rem; color: var(--txt-mute); margin-top: 4px; }
.bf-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bf-grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.bf-checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.bf-check { display: flex; align-items: flex-start; gap: 8px; font-size: 0.9rem; cursor: pointer; line-height: 1.4; }
.bf-check input { margin-top: 3px; flex-shrink: 0; }
.bf-feature {
    border: 2px solid var(--gold);
    background: #fffaf0;
    border-radius: var(--radius);
    padding: 16px 18px;
}
.bf-feature strong { color: var(--gold); }
.bf-eligibility {
    background: var(--sand);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 0.88rem;
    line-height: 1.6;
    margin-bottom: 14px;
}
.bf-submit {
    width: 100%;
    padding: 13px;
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-family: "DM Sans", sans-serif;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}
.bf-submit:hover { background: #c04a18; }
.bf-hp { position: absolute; left: -9999px; top: -9999px; }
.bf-or {
    text-align: center;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--txt-mute);
    margin: -4px 0 10px;
}
.bf-current-cover { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.bf-current-cover img { width: 80px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--dusk); }

/* ── My books ─────────────────────────────────────────────── */
.my-books { display: flex; flex-direction: column; gap: 14px; }
.my-book {
    display: flex;
    gap: 16px;
    background: var(--white);
    border: 1px solid var(--dusk);
    border-radius: var(--radius);
    padding: 14px;
    align-items: flex-start;
}
.my-book-cover { width: 72px; flex-shrink: 0; aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden; background: var(--dusk); }
.my-book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.my-book-cover .book-cover-placeholder { font-size: 0.6rem; padding: 6px; }
.my-book-body { flex: 1; min-width: 0; }
.my-book-title { font-family: "Playfair Display", serif; font-weight: 700; color: var(--ocean); font-size: 1.05rem; }
.my-book-meta { font-size: 0.8rem; color: var(--txt-mute); margin-top: 2px; }
.my-book-note { font-size: 0.8rem; margin-top: 8px; line-height: 1.5; }
.my-book-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.my-book-actions a {
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 7px;
    text-decoration: none;
    border: 1px solid var(--dusk);
    color: var(--ocean);
    background: var(--white);
}
.my-book-actions a:hover { border-color: var(--surf); color: var(--surf); }
.my-book-actions a.primary { background: var(--ocean); border-color: var(--ocean); color: var(--white); }
.my-book-actions a.feature { border-color: var(--gold); color: var(--gold); }
.status-pill { display: inline-block; font-size: 0.7rem; font-weight: 600; padding: 2px 9px; border-radius: 10px; margin-left: 6px; vertical-align: middle; }
.status-pill.pending  { background: #fef3e2; color: #a06010; }
.status-pill.approved { background: #d4f0e4; color: #1a7a47; }
.status-pill.rejected { background: #fde8e6; color: #a03025; }
.status-pill.archived { background: var(--dusk); color: var(--txt-mute); }
.status-pill.featured { background: #fff4d6; color: var(--gold); }

/* ── Homepage banner (sits in the quicknav section, styled like the competition banner) ── */
.books-banner-covers {
    position: relative;
    min-height: 200px;
    background: linear-gradient(135deg, var(--ocean) 0%, var(--surf) 70%, var(--seafoam) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.books-banner-covers img, .books-banner-covers .book-cover-placeholder {
    position: absolute;
    height: 78%;
    aspect-ratio: 2 / 3;
    width: auto;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 8px 22px rgba(0,0,0,0.35);
}
.books-banner-covers .c0 { z-index: 3; }
.books-banner-covers .c1 { z-index: 2; transform: translateX(-58%) rotate(-7deg) scale(0.88); }
.books-banner-covers .c2 { z-index: 1; transform: translateX(58%) rotate(7deg) scale(0.88); }
.books-banner-covers .empty-icon { font-size: 4rem; filter: drop-shadow(0 6px 12px rgba(0,0,0,0.3)); }

.book-alert { padding: 14px 18px; border-radius: 8px; margin-bottom: 20px; font-size: 0.92rem; line-height: 1.55; }
.book-alert.success { background: #e6f4ea; color: #1e5b36; border: 1px solid #b7dfc3; }
.book-alert.error   { background: #fdecea; color: #8a2a1c; border: 1px solid #f3c1b8; }
.book-alert ul { margin: 6px 0 0 18px; }
.book-alert a { color: inherit; font-weight: 600; }

/* ── Homepage / resources promo strip ─────────────────────── */
.books-strip { max-width: 1200px; margin: 0 auto; padding: 8px 24px 48px; }
.books-strip .books-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.books-promo {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--white);
    border: 1px solid var(--dusk);
    border-left: 4px solid var(--gold);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 32px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s;
}
.books-promo:hover { box-shadow: var(--shadow); }
.books-promo .icon { font-size: 1.8rem; }
.books-promo .txt { flex: 1; }
.books-promo strong { display: block; font-family: "Playfair Display", serif; color: var(--ocean); font-size: 1.05rem; }
.books-promo span.sub { font-size: 0.85rem; color: var(--txt-mute); }
.books-promo .go { color: var(--accent); font-weight: 500; font-size: 0.88rem; white-space: nowrap; }

@media (max-width: 760px) {
    .book-detail-grid { grid-template-columns: 1fr; gap: 24px; }
    .book-detail-cover { max-width: 240px; }
    .bf-grid-2, .bf-grid-2-1 { grid-template-columns: 1fr; }
    .book-form { padding: 20px 16px; }
    .books-body, .book-detail, .book-form-wrap { padding-left: 16px; padding-right: 16px; }
    .books-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
    .books-strip { padding-left: 16px; padding-right: 16px; }
    .books-strip .books-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .books-promo .go { display: none; }
}
