/*
Theme Name:  Tim E Koch
Theme URI:   https://timekoch.com
Description: Author site for Tim E Koch — paranormal, horror, dystopian, and post-apocalyptic fiction.
Version:     1.0.8
Author:      Tim E Koch
Text Domain: timekoch
*/

/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

/* ── Reset / Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0d0d12;
    --bg-alt:    #13131a;
    --border:    #2a2a35;
    --text:      #d4d0c8;
    --text-muted:#8a8680;
    --accent:    #8b2020;
    --accent-lt: #b03030;
    --accent-dim:#3d1010;
    --heading:   #ece8e0;
    --link:      #c87070;
    --link-hover:#e09090;
    --font-serif:   'Playfair Display', Georgia, serif;
    --font-body:    'Lora', Georgia, serif;
    --max-width: 1100px;
    --section-gap: 3.5rem;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    min-height: 100vh;
}

a { color: var(--link); text-decoration: none; transition: color .2s; }
a:hover { color: var(--link-hover); }

img { display: block; max-width: 100%; height: auto; }

/* ── Layout wrapper ───────────────────────────────────────────────────────── */
.site-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Site Header ──────────────────────────────────────────────────────────── */
.site-header {
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 2.5rem 0 2rem;
}

.site-header .site-wrapper {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.author-headshot {
    flex-shrink: 0;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    border: 2px solid var(--accent);
    box-shadow: 0 0 20px rgba(139,32,32,.35);
}

.author-headshot-placeholder {
    flex-shrink: 0;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: var(--accent-dim);
    border: 2px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.3;
}

.author-bio .author-name {
    font-family: var(--font-serif);
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--heading);
    letter-spacing: .03em;
    line-height: 1.15;
    margin-bottom: .4rem;
}

.author-bio .author-tagline {
    font-size: .95rem;
    color: var(--text-muted);
    font-style: italic;
    max-width: 540px;
    line-height: 1.55;
}

/* ── Site Nav (optional) ──────────────────────────────────────────────────── */
.site-nav {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: .6rem 0;
}

.site-nav ul {
    list-style: none;
    display: flex;
    gap: 1.8rem;
}

.site-nav a {
    font-size: .85rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.site-nav a:hover { color: var(--link-hover); }

/* ── Main content ─────────────────────────────────────────────────────────── */
.site-main {
    padding: var(--section-gap) 0;
}

/* ── Catalog section heading ──────────────────────────────────────────────── */
.catalog-heading {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 2.5rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid var(--border);
}

/* ── Book Section ─────────────────────────────────────────────────────────── */
/*
 * Layout: cover occupies left 50%, info right 50%.
 * This layout does NOT stack on mobile — it stays side-by-side at all sizes.
 * To reorder titles: move the entire <section class="book-section"> block.
 * To add a title:    duplicate a block and update its content.
 */

.book-section {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-bottom: var(--section-gap);
    border: 1px solid var(--border);
    background: var(--bg-alt);
    overflow: hidden;
    min-height: 260px;
}

.book-cover {
    flex: 0 0 50%;
    max-width: 50%;
    position: relative;
    overflow: hidden;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    transition: transform .4s ease;
    border: 2px solid rgba(255,255,255,0.30);
}

.book-section:hover .book-cover img {
    transform: scale(1.03);
}

.book-cover-placeholder {
    width: 100%;
    height: 100%;
    min-height: 260px;
    background: linear-gradient(160deg, var(--accent-dim) 0%, var(--bg) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: .8rem;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.book-info {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 1.8rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
}

.book-title {
    font-family: var(--font-serif);
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--heading);
    line-height: 1.2;
    margin-bottom: .15rem;
}

.book-subtitle {
    font-size: .9rem;
    font-style: italic;
    color: var(--text-muted);
    margin-bottom: .6rem;
}

.book-tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .6rem;
    padding: 0;
    margin: 0;
}

.book-tags li {
    font-size: .78rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--accent-lt);
    border: 1px solid var(--accent-dim);
    padding: .2rem .55rem;
    line-height: 1;
}

.book-description {
    font-size: .92rem;
    color: var(--text);
    line-height: 1.65;
    flex-grow: 1;
}

.book-links {
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
    margin-top: .5rem;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    font-family: var(--font-body);
    font-size: .82rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: .5rem 1.1rem;
    border: 1px solid;
    line-height: 1;
    transition: background .2s, color .2s;
    cursor: pointer;
}

.btn-amazon {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-amazon:hover {
    background: var(--accent-lt);
    border-color: var(--accent-lt);
    color: #fff;
}

.btn-read {
    background: transparent;
    border-color: var(--border);
    color: var(--link);
}
.btn-read:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--link-hover);
}

/* ── Site Footer ──────────────────────────────────────────────────────────── */
.site-footer {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    padding: 1.8rem 0;
    text-align: center;
    font-size: .8rem;
    color: var(--text-muted);
    letter-spacing: .04em;
}

.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--link); }

/* ── Ereader home button ──────────────────────────────────────────────────── */
.ereader-home-btn {
    position: fixed;
    top:   12px;
    right: 12px;
    z-index: 25;

    display: flex;
    align-items: center;
    justify-content: center;
    width:  34px;
    height: 34px;
    border-radius: 5px;

    background: rgba(30, 30, 30, 0.55);
    color: #fff;
    opacity: 0.75;
    transition: opacity 0.15s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.ereader-home-btn:hover {
    opacity: 1;
    background: rgba(30, 30, 30, 0.85);
    color: #fff;
}

.desc-short { display: none; }

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 599px) {
    .desc-long  { display: none; }
    .desc-short { display: block; }


    .site-header {
        padding: 1.2rem 0 1rem;
    }

    .author-headshot,
    .author-headshot-placeholder {
        width: 60px;
        height: 60px;
    }

    .author-bio .author-name {
        font-size: 1.3rem;
    }

    .author-bio .author-tagline {
        font-size: .82rem;
    }

    .site-header .site-wrapper {
        gap: 1rem;
    }

    .book-cover {
        flex: 0 0 42%;
        max-width: 42%;
    }

    .book-cover img {
        object-fit: contain;
        object-position: top;
        height: auto;
    }

    .book-info {
        flex: 0 0 58%;
        max-width: 58%;
        padding: .75rem;
    }

    .book-title {
        font-size: 1.1rem;
    }

    .book-subtitle {
        font-size: .8rem;
    }

    .book-description {
        font-size: .82rem;
    }
}

/* ── Ereader page ─────────────────────────────────────────────────────────── */
.ereader-page .site-main,
.page-template-page-ereader .site-main {
    padding: 0;
}

.ereader-wrap {
    width: 100%;
    /* Height fills viewport minus the slim header */
    height: calc(100vh - 56px);
    overflow: hidden;
}

/* Strip padding/margin/max-width from any Gutenberg wrappers inside the ereader.
   Targets the block layout containers and shortcode block wrapper. */
.ereader-wrap,
.ereader-wrap > *,
.ereader-wrap .wp-block-shortcode,
.ereader-wrap .wp-block-group,
.ereader-wrap .wp-block-post-content,
.ereader-wrap .is-layout-constrained,
.ereader-wrap .is-layout-flow {
    padding-left:  0 !important;
    padding-right: 0 !important;
    margin-left:   0 !important;
    margin-right:  0 !important;
    max-width:     none !important;
}

@media (max-width: 599px) {
    /* Let the epub reader break out of the padded container */
    .ereader-page .site-wrapper,
    .page-template-page-ereader .site-wrapper {
        padding: 0;
    }
    .ereader-wrap {
        height: 100svh;
        height: 100vh; /* fallback */
        overflow: visible;
    }
}
