/* Optimized CSS for book_preview.html - Only essential styles */

/* Reset and base styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--wp--preset--font-family--system-font, system-ui, -apple-system, sans-serif);
    line-height: 1.6;
}

/* Layout containers */
.mhp-site-blocks {
    min-height: 100vh;
}

.mhp-block-group {
    margin: 0;
}

.mhp-block-columns {
    align-items: normal !important;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap !important;
}

@media (min-width: 782px) {
    .mhp-block-columns {
        flex-wrap: nowrap !important;
    }
}

.mhp-block-columns.are-vertically-aligned-top {
    align-items: flex-start;
}

.mhp-block-columns.are-vertically-aligned-center {
    align-items: center;
}

.mhp-block-columns.are-vertically-aligned-bottom {
    align-items: flex-end;
}

.mhp-block-column {
    flex-grow: 1;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Cover block - Essential for book cover */
.mhp-block-cover {
    align-items: center;
    background-position: 50%;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    min-height: 430px;
    overflow: hidden;
    padding: 1em;
    position: relative;
}

.mhp-block-cover.has-aspect-ratio {
    aspect-ratio: 2/3;
    min-height: unset;
}

.mhp-block-cover__image-background {
    border: none;
    bottom: 0;
    box-shadow: none;
    height: 100%;
    left: 0;
    margin: 0;
    max-height: none;
    max-width: none;
    object-fit: cover;
    outline: none;
    padding: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: 100%;
}

.mhp-block-cover__background {
    bottom: 0;
    left: 0;
    opacity: 0.5;
    position: absolute;
    right: 0;
    top: 0;
}

.mhp-block-cover__background.has-background-dim-0 {
    opacity: 0;
}

.mhp-block-cover__background.has-background-dim-100 {
    opacity: 1;
}

.mhp-block-cover__inner-container {
    color: inherit;
    position: relative;
    width: 100%;
    z-index: 1;
}

/* Image block */
.mhp-block-image {
    margin: 0;
}

.mhp-block-image img {
    box-sizing: border-box;
    height: auto;
    max-width: 100%;
    vertical-align: bottom;
}

.size-full {
    width: 100%;
    height: auto;
}

/* Button styles */
.mhp-block-button__link {
    background-color: var(--wp--preset--color--primary, #007cba);
    border: none;
    border-radius: 0;
    color: var(--wp--preset--color--contrast, #fff);
    cursor: pointer;
    display: inline-block;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    padding: 0.5em 1em;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.mhp-block-button__link:hover {
    background-color: var(--wp--preset--color--primary-dark, #005a87);
}

.mhp-block-button.is-style-outline .mhp-block-button__link {
    background-color: transparent;
    border: 2px solid var(--wp--preset--color--primary, #007cba);
    color: var(--wp--preset--color--primary, #007cba);
}

.mhp-block-button.is-style-outline .mhp-block-button__link:hover {
    background-color: var(--wp--preset--color--primary, #007cba);
    color: var(--wp--preset--color--contrast, #fff);
}

.mhp-block-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
}

.mhp-block-buttons.is-horizontal {
    flex-direction: row;
}

.mhp-block-button__width-100 {
    width: 100%;
}

/* Typography */
.mhp-block-heading {
    margin: 0 0 1em 0;
    font-weight: 600;
    line-height: 1.2;
}

h1.mhp-block-heading {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
}

.has-large-font-size {
    font-size: var(--wp--preset--font-size--large, 1.125em);
}

.has-xx-large-font-size {
    font-size: var(--wp--preset--font-size--xx-large, 2.25em);
}

.has-text-align-center {
    text-align: center;
}

.has-text-align-left {
    text-align: left;
}

/* Spacer */
.mhp-block-spacer {
    clear: both;
}

/* Social links */
.mhp-block-social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mhp-block-social-link {
    display: block;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mhp-block-social-link-anchor {
    display: block;
    text-decoration: none;
}

.mhp-block-social-link-anchor svg {
    fill: currentColor;
    height: 1em;
    width: 1em;
}

.has-small-icon-size .mhp-block-social-link-anchor svg {
    height: 1em;
    width: 1em;
}

/* Layout utilities */
.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.alignwide {
    width: 100%;
    max-width: var(--wp--style--global--wide-size, 1200px);
    margin-left: auto;
    margin-right: auto;
}

.aligncenter {
    text-align: center;
}

.is-layout-flex {
    display: flex;
}

.is-layout-constrained {
    max-width: 100%;
}

.is-layout-flow {
    display: flow-root;
}

.is-vertical {
    flex-direction: column;
}

.is-horizontal {
    flex-direction: row;
}

.is-nowrap {
    flex-wrap: nowrap;
}

.are-vertically-aligned-center {
    align-items: center;
}

.is-vertically-aligned-center {
    align-self: center;
}

.is-vertically-aligned-stretch {
    align-self: stretch;
}

.is-content-justification-center {
    justify-content: center;
}

.is-content-justification-left {
    justify-content: flex-start;
}

.is-content-justification-right {
    justify-content: flex-end;
}

.is-content-justification-stretch {
    justify-content: stretch;
}

.is-position-sticky {
    position: sticky;
    top: 0;
}

/* Background colors */
.has-background {
    background-color: var(--wp--preset--color--background, #fff);
}

.has-primary-background-color {
    background-color: var(--wp--preset--color--primary, #007cba);
}

.has-secondary-background-color {
    background-color: var(--wp--preset--color--secondary, #f0f0f0);
}

.has-quaternary-background-color {
    background-color: var(--wp--preset--color--quaternary, #f8f8f8);
}

.has-background-background-color {
    background-color: var(--wp--preset--color--background, #fff);
}

/* Text colors */
.has-text-color {
    color: var(--wp--preset--color--foreground, #000);
}

.has-base-color {
    color: var(--wp--preset--color--base, #000);
}

.has-contrast-color {
    color: var(--wp--preset--color--contrast, #fff);
}

.has-link-color {
    color: var(--wp--preset--color--link, #007cba);
}

/* Padding */
.has-global-padding {
    padding: var(--wp--preset--spacing--50, 1.5rem);
}

/* Gradients */
.has-background-gradient {
    background: var(--wp--preset--gradient--hard-gradient, linear-gradient(135deg, #ff6b6b, #ffa500));
}

.has-hard-gradient-gradient-background {
    background: var(--wp--preset--gradient--hard-gradient, linear-gradient(135deg, #ff6b6b, #ffa500));
}

/* Screen reader text */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute !important;
    width: 1px;
    word-wrap: normal !important;
}

/* Skip link */
.skip-link {
    position: absolute;
    left: -9999px;
    top: -9999px;
    z-index: 999999;
}

.skip-link:focus {
    left: 6px;
    top: 7px;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
}

/* Responsive design - Inherited from WordPress reference */
@media (max-width: 781px) {
    .mhp-block-columns:not(.is-not-stacked-on-mobile) > .mhp-block-column {
        flex-basis: 100% !important;
    }
}

@media (min-width: 782px) {
    .mhp-block-columns:not(.is-not-stacked-on-mobile) > .mhp-block-column {
        flex-basis: 0;
        flex-grow: 1;
    }
    
    .mhp-block-columns:not(.is-not-stacked-on-mobile) > .mhp-block-column[style*=flex-basis] {
        flex-grow: 0;
    }
}

.mhp-block-columns.is-not-stacked-on-mobile {
    flex-wrap: nowrap !important;
}

.mhp-block-columns.is-not-stacked-on-mobile > .mhp-block-column {
    flex-basis: 0;
    flex-grow: 1;
}

.mhp-block-columns.is-not-stacked-on-mobile > .mhp-block-column[style*=flex-basis] {
    flex-grow: 0;
}

:where(.mhp-block-columns) {
    margin-bottom: 1.75em;
}

:where(.mhp-block-columns.has-background) {
    padding: 1.25em 2.375em;
}

/* Author Books Section Styles */
.author-books-section {
    border-top: 1px solid var(--wp--preset--color--tertiary, #ded7c5);
}

.author-book-item a:hover .book-cover-container {
    transform: translateY(-5px) !important;
}

.author-book-item a:hover img {
    transform: scale(1.05) !important;
}

.author-book-item a:hover h3 {
    color: var(--wp--preset--color--primary, #007cba) !important;
}

/* Responsive adjustments for author books */
@media (max-width: 768px) {
    .author-books-grid {
        gap: 2rem !important;
        flex-direction: row !important;
        justify-content: center !important;
    }
    
    .author-book-item {
        max-width: 200px !important;
        flex: 0 0 auto !important;
    }
    
    .author-book-item img {
        width: 160px !important;
        height: 240px !important;
    }
}

@media (max-width: 480px) {
    .author-books-grid {
        gap: 1.5rem !important;
    }
    
    .author-book-item {
        max-width: 180px !important;
    }
    
    .author-book-item img {
        width: 140px !important;
        height: 210px !important;
    }
}

/* Custom fixes for book_preview.html to match correct production proportions */
/* Book covers container for side-by-side layout */
.book-covers-container {
    display: flex;
    flex-direction: column;
    gap: var(--wp--preset--spacing--30, 1.5rem);
    align-items: center;
}

/* Default desktop sizing - increased to better fill column space */
@media (min-width: 769px) {
    .mhp-block-cover.has-aspect-ratio {
        max-width: 280px !important;
        width: 100% !important;
        margin: 0 auto !important;
    }

    .mhp-block-cover[style*="aspect-ratio:2/3"] {
        max-width: 280px !important;
        width: 100% !important;
        margin: 0 auto !important;
    }

    .mhp-block-cover .mhp-block-cover__image-background {
        max-width: 280px !important;
        width: 100% !important;
        display: block !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 2 !important;
    }

    .mhp-block-cover figure.mhp-block-image {
        max-width: 280px !important;
        width: 100% !important;
        position: relative !important;
        z-index: 3 !important;
    }

    .mhp-block-cover figure.mhp-block-image img {
        max-width: 280px !important;
        width: 100% !important;
        display: block !important;
        opacity: 1 !important;
    }
}

.mhp-block-column[style*="flex-basis:40%"] {
    flex-basis: 40% !important;
    max-width: 40% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
}

.mhp-block-column[style*="flex-basis:60%"] {
    flex-basis: 60% !important;
    max-width: 60% !important;
}

h1.mhp-block-heading {
    font-size: clamp(1.5rem, 3vw, 2.5rem) !important;
}

/* Mobile layout - side-by-side covers */
@media (max-width: 781px) {
    .book-covers-container {
        flex-direction: row !important;
        justify-content: center !important;
        gap: var(--wp--preset--spacing--20, 1rem) !important;
    }
    
    .mhp-block-cover.has-aspect-ratio,
    .mhp-block-cover[style*="aspect-ratio:2/3"] {
        max-width: 45% !important;
        width: 45% !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
    }

    .mhp-block-cover .mhp-block-cover__image-background {
        max-width: 100% !important;
        width: 100% !important;
        display: block !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 2 !important;
    }

    .mhp-block-cover figure.mhp-block-image {
        max-width: 100% !important;
        width: 100% !important;
        position: relative !important;
        z-index: 3 !important;
    }

    .mhp-block-cover figure.mhp-block-image img {
        max-width: 100% !important;
        width: 100% !important;
        display: block !important;
        opacity: 1 !important;
    }
}

@media (min-width: 782px) and (max-width: 1024px) {
    .mhp-block-cover.has-aspect-ratio,
    .mhp-block-cover[style*="aspect-ratio:2/3"] {
        max-width: 260px !important;
    }
}

@media (min-width: 1025px) and (max-width: 1199px) {
    .mhp-block-cover.has-aspect-ratio,
    .mhp-block-cover[style*="aspect-ratio:2/3"] {
        max-width: 300px !important;
    }
}

@media (min-width: 1200px) {
    .mhp-block-cover.has-aspect-ratio,
    .mhp-block-cover[style*="aspect-ratio:2/3"] {
        max-width: 320px !important;
    }
}

.mhp-block-cover .mhp-block-cover__background.has-hard-gradient-gradient-background {
    display: block !important;
    opacity: 1 !important;
    background: var(--wp--preset--gradient--hard-gradient) !important;
    z-index: 1 !important;
}