/* ==========================================================================
   Gilbert Tax Center - custom theme styles
   Child of 2020-module/premier. Loaded via settings.php.
   Everything is scoped under .tax-book so nothing leaks into other pages.
   ========================================================================== */

.tax-book {
    --tax-book-max: 1100px;
    --tax-book-gap: 2rem;
    display: block;
    width: 100%;
    margin: 0 auto;
    max-width: var(--tax-book-max);
}

/* --- intro: cover + blurb ------------------------------------------------ */

.tax-book__intro {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--tax-book-gap);
    margin-bottom: var(--tax-book-gap);
}

.tax-book__cover {
    flex: 0 0 auto;
    width: 220px;
    max-width: 45%;
    height: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18), 0 12px 28px rgba(0, 0, 0, 0.12);
}

.tax-book__blurb {
    flex: 1 1 18rem;
    min-width: 0;
}

.tax-book__title {
    margin: 0 0 0.35rem;
}

.tax-book__subtitle {
    margin: 0 0 0.6rem;
    font-style: italic;
}

.tax-book__author {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.85rem;
}

/* --- the salvaged FlipBuilder reader -------------------------------------
   The iframe is injected by script, so .tax-book__viewer is empty and takes no
   space until that happens. The reader letterboxes its own spread inside
   whatever box we give it, so a predictable responsive height is enough.
   ------------------------------------------------------------------------- */

.tax-book__viewer {
    width: 100%;
    margin: 0 auto var(--tax-book-gap);
}

.tax-book__frame {
    display: block;
    width: 100%;
    height: clamp(420px, 78vh, 900px);
    border: 0;
    background: #6b5e53; /* matches the reader's own bgBeginColor, so no flash on load */
}

/* --- no-JS / crawler fallback --------------------------------------------
   Visible by default. Once the script has injected the reader it adds
   .is-enhanced to the wrapper, which hides this visually but leaves it in the
   accessibility tree and in the markup for crawlers.
   ------------------------------------------------------------------------- */

.tax-book__fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.tax-book__page {
    display: block;
    width: 100%;
    max-width: 777px;
    height: auto;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.tax-book.is-enhanced .tax-book__fallback {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- narrow screens ------------------------------------------------------ */

@media screen and (max-width: 40em) {
    .tax-book {
        --tax-book-gap: 1.25rem;
    }

    .tax-book__intro {
        flex-direction: column;
        align-items: flex-start;
    }

    .tax-book__cover {
        width: 160px;
        max-width: 60%;
    }

    /* single-page spread on phones needs a taller box to stay readable */
    .tax-book__frame {
        height: clamp(460px, 72vh, 720px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tax-book * {
        animation: none !important;
        transition: none !important;
    }
}
