/* ================================
   SITE SPACING: tighter containers
   ================================ */

/* Global: tighten content container spacing */
.site-content > .ast-container {
  padding-top: 30px !important;
  padding-bottom: 30px !important;
}

/* Home + About: slightly tighter top spacing */
.home .site-content > .ast-container,
.page-id-2258 .site-content > .ast-container {
  padding-top: 20px !important;
}


/* ================================
   HOMEPAGE: hero scale + rhythm
   ================================ */

/* Reduce oversized H1 on homepage hero */
.home h1 {
  font-size: 56px !important;
  line-height: 1.05 !important;
  margin-bottom: 16px !important;
}

/* Tighten spacing between hero paragraph and buttons */
.home h1 + p {
  margin-top: 0 !important;
  margin-bottom: 18px !important;
}

/* Remove extra top space above the buttons block */
.home .wp-block-buttons {
  margin-top: 0 !important;
}

/* Fix the big gap AFTER the hero */
.home .entry-content > *:nth-child(2) {
  margin-top: 0 !important;
}

/* If that first post-hero section is a Group with padding, keep it sane */
.home .entry-content > *:nth-child(2) {
  padding-top: 20px !important;
}


/* ================================
   ABOUT (page ID 2258): scale
   ================================ */

.page-id-2258 h1 {
  font-size: 44px !important;
  line-height: 1.15 !important;
  margin-bottom: 12px !important;
}

.page-id-2258 h2 {
  font-size: 32px !important;
  line-height: 1.2 !important;
  margin-top: 28px !important;
  margin-bottom: 12px !important;
}


/* ================================
   ASTRA + GUTENBERG: global rhythm
   ================================ */

/* Reduce the default top margins Gutenberg adds between blocks */
.site-content .entry-content > * + * {
  margin-top: 1em !important;
}

/* Tighten headings so they stop creating "air gaps" */
.site-content .entry-content h1,
.site-content .entry-content h2,
.site-content .entry-content h3 {
  margin-top: 1.2em !important;
  margin-bottom: 0.5em !important;
}

/* Paragraphs */
.site-content .entry-content p {
  margin-top: 0 !important;
  margin-bottom: 1em !important;
}

/* Buttons block spacing */
.site-content .entry-content .wp-block-buttons {
  margin-top: 0.75em !important;
  margin-bottom: 1.25em !important;
}


/* ================================
   HOMEPAGE: hero spacing (robust)
   ================================ */

/* H1 scale on home */
body.home .site-content .entry-content h1 {
  font-size: 56px !important;
  line-height: 1.05 !important;
  margin-bottom: 0.35em !important;
}

/* Gutenberg-safe: tighten the first paragraph after the first H1 */
body.home .site-content .entry-content h1 + .wp-block-paragraph,
body.home .site-content .entry-content .wp-block-heading + .wp-block-paragraph {
  margin-top: 0 !important;
  margin-bottom: 0.9em !important;
}

/* Remove surprise top margin above the first buttons block */
body.home .site-content .entry-content .wp-block-buttons:first-of-type {
  margin-top: 0 !important;
}

/* If your hero is a Group block */
body.home .site-content .entry-content .wp-block-group {
  margin-top: 0 !important;
}


/* ================================
   ABOUT (ID 2258): typography + rhythm
   ================================ */

body.page-id-2258 .site-content .entry-content h1 {
  font-size: 44px !important;
  line-height: 1.15 !important;
  margin-bottom: 0.4em !important;
}

body.page-id-2258 .site-content .entry-content h2 {
  font-size: 32px !important;
  line-height: 1.2 !important;
  margin-top: 1.4em !important;
  margin-bottom: 0.5em !important;
}


/* ================================
   BOOKS "SHELF" SECTION
   ================================ */

/* Make each book column behave like a neat vertical card */
body.home .books-shelf .wp-block-columns .wp-block-column {
  display: flex;
  flex-direction: column;
}

/* Make all book covers the same visual height */
body.home .books-shelf .wp-block-image img {
  width: 100%;
  height: 380px;
  object-fit: contain;
  background: #ffffff;
  display: block;
}

/* Push the button(s) to the bottom so all buttons line up */
body.home .books-shelf .wp-block-buttons {
  margin-top: auto !important;
}

/* Turn the Separator into a "shelf" */
body.home .books-shelf .wp-block-separator {
  margin-top: 18px !important;
  margin-bottom: 0 !important;
  opacity: 1;
  height: 6px;
  border: 0;
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
  border-radius: 6px;
}


/* ================================
   CONTACT PAGE
   ================================ */

/* Contact page: style the "Elsewhere" social line */
body.page-id-2499 .contact-elsewhere {
  margin-top: 18px !important;
  font-size: 0.95rem;
  opacity: 0.85;
}

/* Make the social links look clean */
body.page-id-2499 .contact-elsewhere a {
  text-decoration: none;
  font-weight: 600;
}

/* Add underline only on hover */
body.page-id-2499 .contact-elsewhere a:hover {
  text-decoration: underline;
}


/* ================================
   ABOUT PAGE: heading spacing
   ================================ */

body.page-id-2258 .entry-content h2,
body.page-id-2258 .entry-content h3 {
  margin-top: 1.3em !important;
  margin-bottom: 0.4em !important;
}

body.page-id-2258 .entry-content > * + h2,
body.page-id-2258 .entry-content > * + h3 {
  margin-top: 1.4em !important;
}


/* Remove gap between header and homepage/About hero */
.home .site-content > .ast-container,
.page-id-2258 .site-content > .ast-container {
  padding-top: 0 !important;
}


/* Replace old purple text labels on homepage */
.home p[style*="color:#5b2cff"] {
  color: #F12C7B !important;
}


/* Tighten space below homepage Books section */
.home .entry-content > .wp-block-group:nth-of-type(3) {
  min-height: auto !important;
  padding-bottom: 80px !important;
}


/* SPFBO accolade */
.home .entry-content > .wp-block-group:nth-of-type(3)
.wp-block-columns > .wp-block-column:first-child
.wp-block-group > p:nth-of-type(3) {
  color: #B77900 !important;
}


/* Remove unwanted gaps on Contact page */
.page-id-2499 .site-content > .ast-container {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.page-id-2499 .entry-content > .wp-block-group + .wp-block-group {
  margin-block-start: 0 !important;
}

/* WooCommerce single product page background */
body.single-product .site-content {
    background-color: #F5F0E8 !important;
}

/* Limit reading width of WooCommerce product description */
.single-product .woocommerce-Tabs-panel--description {
    max-width: 900px;
}

add_filter( 'woocommerce_product_tabs', function( $tabs ) {

    // Remove Additional Information tab.
    unset( $tabs['additional_information'] );

    // Hide Reviews tab when there are no reviews.
    global $product;

    if ( $product && 0 === (int) $product->get_review_count() ) {
        unset( $tabs['reviews'] );
    }

    return $tabs;

}, 98 );

