/*
 * Block Pages CSS
 *
 * Styles WordPress block editor content (pages not using ACF templates)
 * to match the child theme design language. Reuses --hs-* variables.
 *
 * SCOPE: Only applies inside .entry-content on pages that are NOT using
 * the Product Collection or Single Post template.
 *
 * SAFE TO DELETE: Once all pages are rebuilt with ACF templates, this
 * file and its enqueue in theme-settings.php can be removed.
 */

/* ==========================================================================
   0. PAGE LAYOUT — full-width wrapper, 1140px content, centered
   ========================================================================== */

body.page .site-content .content-area {
  width: 100%;
  float: none;
}

body.page .inside-article {
  max-width: 100%;
  padding: 0;
  margin: 0;
}

body.page .entry-content {
  width: min(100% - 40px, 1140px);
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
  padding: 40px 0;
}

/* GP overrides — kill any separate-container padding */
body.page.one-container .inside-article,
body.page.no-sidebar .inside-article {
  padding: 0;
}

/* ==========================================================================
   1. PAGE HERO — first H1 gets banner treatment
   ========================================================================== */

body.page .entry-content > h1:first-child,
body.page .entry-content > .wp-block-group:first-child h1 {
  font-size: 42px;
  font-weight: 700;
  color: var(--hs-title);
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  padding-bottom: 20px;
  border-bottom: 3px solid var(--hs-accent);
}

/* Hero area with background */
body.page .entry-content > .wp-block-group:first-child {
  background: var(--hs-bg-alt);
  border-radius: var(--hs-radius-card);
  padding: 40px 36px;
  margin-bottom: 40px;
}

body.page .entry-content > .wp-block-group:first-child p {
  font-size: 17px;
  color: var(--hs-text);
  max-width: 800px;
}

/* ==========================================================================
   2. HEADINGS
   ========================================================================== */

body.page .entry-content h1 {
  font-size: 42px;
  color: var(--hs-title);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

body.page .entry-content h2 {
  font-size: 32px;
  font-weight: 700;
  color: var(--hs-title);
  line-height: 1.22;
  letter-spacing: -0.015em;
  text-align: center;
  margin: 50px 0 20px;
  padding-top: 10px;
}

body.page .entry-content h2:first-child {
  margin-top: 0;
}

body.page .entry-content h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--hs-title);
  line-height: 1.3;
  margin: 32px 0 12px;
}

body.page .entry-content h4 {
  font-size: 18px;
  font-weight: 700;
  color: var(--hs-title);
  margin: 24px 0 10px;
}

/* ==========================================================================
   3. TEXT & PARAGRAPHS
   ========================================================================== */

body.page .entry-content p {
  color: var(--hs-text);
  font-size: 16px;
  line-height: 1.75;
  margin: 0 0 1em;
}

body.page .entry-content > p + h2 {
  margin-top: 50px;
}

body.page .entry-content a {
  color: var(--hs-accent);
  text-decoration: none;
}

body.page .entry-content a:hover {
  color: var(--hs-accent-dark);
  text-decoration: underline;
}

body.page .entry-content strong {
  color: var(--hs-title);
  font-weight: 700;
}

body.page .entry-content blockquote {
  margin: 24px 0;
  padding: 16px 24px;
  border-left: 4px solid var(--hs-accent);
  background: var(--hs-bg-alt);
  border-radius: 0 var(--hs-radius-btn) var(--hs-radius-btn) 0;
  color: var(--hs-text);
  font-style: italic;
}

body.page .entry-content blockquote p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   4. IMAGES
   ========================================================================== */

body.page .entry-content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--hs-radius-card);
  box-shadow: var(--hs-shadow-card);
}

body.page .entry-content .wp-block-image {
  margin: 24px 0;
}

body.page .entry-content .wp-block-image figcaption {
  margin-top: 10px;
  color: var(--hs-text);
  font-size: 13px;
  text-align: center;
  font-style: italic;
}

/* Images inside columns/groups — less aggressive shadow */
body.page .entry-content .wp-block-columns img,
body.page .entry-content .wp-block-group img {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   5. LISTS
   ========================================================================== */

body.page .entry-content ul,
body.page .entry-content ol {
  margin: 0 0 1.2em;
  padding-left: 1.5em;
  color: var(--hs-text);
}

body.page .entry-content li {
  margin-bottom: 6px;
  line-height: 1.65;
}

body.page .entry-content ul li::marker {
  color: var(--hs-accent);
}

body.page .entry-content ol li::marker {
  color: var(--hs-accent);
  font-weight: 600;
}

/* ==========================================================================
   6. TABLES
   ========================================================================== */

body.page .entry-content table {
  width: 100%;
  margin: 24px 0;
  border-collapse: collapse;
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius-card);
  overflow: hidden;
  font-size: 15px;
}

body.page .entry-content table th,
body.page .entry-content table td {
  padding: 12px 16px;
  border: 1px solid var(--hs-border);
  text-align: left;
  vertical-align: top;
}

body.page .entry-content table th {
  background: var(--hs-accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
}

body.page .entry-content table tbody tr:nth-child(even) {
  background: var(--hs-bg-alt);
}

body.page .entry-content table tbody tr:hover {
  background: var(--hs-accent-soft);
}

body.page .entry-content .wp-block-table {
  margin: 24px 0;
  overflow-x: auto;
}

body.page .entry-content .wp-block-table table {
  margin: 0;
}

body.page .entry-content .wp-block-table figcaption {
  margin-top: 8px;
  color: var(--hs-text);
  font-size: 13px;
  text-align: center;
}

/* ==========================================================================
   7. COLUMNS (wp-block-columns)
   ========================================================================== */

body.page .entry-content .wp-block-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 30px 0;
}

body.page .entry-content .wp-block-column {
  flex: 1 1 0;
  min-width: 0;
}

/* Column as card */
body.page .entry-content .wp-block-column:has(img) {
  background: var(--hs-surface);
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius-card);
  overflow: hidden;
  box-shadow: var(--hs-shadow-card);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

body.page .entry-content .wp-block-column:has(img):hover {
  transform: translateY(-3px);
  box-shadow: var(--hs-shadow-card-hover);
}

body.page .entry-content .wp-block-column:has(img) img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0;
  box-shadow: none;
}

body.page .entry-content .wp-block-column:has(img) h3,
body.page .entry-content .wp-block-column:has(img) h4 {
  padding: 0 16px;
  margin: 14px 0 6px;
  text-align: center;
  font-size: 17px;
}

body.page .entry-content .wp-block-column:has(img) p {
  padding: 0 16px 16px;
  font-size: 14px;
  color: var(--hs-text);
  text-align: center;
}

/* ==========================================================================
   8. GROUPS (wp-block-group)
   ========================================================================== */

body.page .entry-content > .wp-block-group {
  margin: 30px 0;
}

/* Group with background as section */
body.page .entry-content > .wp-block-group.has-background {
  padding: 40px 36px;
  border-radius: var(--hs-radius-card);
}

body.page .entry-content .wp-block-group__inner-container > :last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   9. BUTTONS
   ========================================================================== */

body.page .entry-content .wp-block-button__link,
body.page .entry-content .wp-block-button a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 28px;
  border: 1px solid var(--hs-accent);
  border-radius: var(--hs-radius-btn);
  background: #ffffff;
  color: var(--hs-accent);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color 0.22s ease, color 0.22s ease;
}

body.page .entry-content .wp-block-button__link:hover,
body.page .entry-content .wp-block-button a:hover {
  background: var(--hs-accent);
  color: #ffffff;
  text-decoration: none;
}

body.page .entry-content .wp-block-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0;
}

/* Filled button variant */
body.page .entry-content .wp-block-button.is-style-fill .wp-block-button__link {
  background: var(--hs-accent);
  color: #ffffff;
}

body.page .entry-content .wp-block-button.is-style-fill .wp-block-button__link:hover {
  background: var(--hs-accent-dark);
}

/* ==========================================================================
   10. SEPARATOR / HR
   ========================================================================== */

body.page .entry-content hr,
body.page .entry-content .wp-block-separator {
  border: 0;
  border-top: 1px solid var(--hs-border);
  margin: 36px auto;
  max-width: 100px;
}

body.page .entry-content .wp-block-separator.is-style-wide {
  max-width: none;
}

/* ==========================================================================
   11. GALLERY
   ========================================================================== */

body.page .entry-content .wp-block-gallery {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

body.page .entry-content .wp-block-gallery.columns-2 { grid-template-columns: repeat(2, 1fr); }
body.page .entry-content .wp-block-gallery.columns-3 { grid-template-columns: repeat(3, 1fr); }
body.page .entry-content .wp-block-gallery.columns-4 { grid-template-columns: repeat(4, 1fr); }

body.page .entry-content .wp-block-gallery .wp-block-image {
  margin: 0;
}

body.page .entry-content .wp-block-gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   12. COVER BLOCK
   ========================================================================== */

body.page .entry-content .wp-block-cover {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  margin: 30px 0;
  padding: 40px;
  border-radius: var(--hs-radius-card);
  overflow: hidden;
  color: #ffffff;
}

body.page .entry-content .wp-block-cover__inner-container {
  position: relative;
  z-index: 1;
  max-width: 800px;
  text-align: center;
}

body.page .entry-content .wp-block-cover__inner-container h2,
body.page .entry-content .wp-block-cover__inner-container h3 {
  color: #ffffff;
}

body.page .entry-content .wp-block-cover__inner-container p {
  color: rgba(255, 255, 255, 0.9);
}

/* ==========================================================================
   13. DETAILS / ACCORDION (WP 6.3+ <details> block)
   ========================================================================== */

body.page .entry-content details {
  border: 1px solid var(--hs-border);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

body.page .entry-content details[open] {
  border-color: var(--hs-accent);
}

body.page .entry-content details:hover {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.07);
}

body.page .entry-content details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 700;
  color: var(--hs-title);
  list-style: none;
  transition: background-color 0.22s ease;
}

body.page .entry-content details summary::-webkit-details-marker {
  display: none;
}

body.page .entry-content details summary::after {
  content: "+";
  flex-shrink: 0;
  font-size: 24px;
  font-weight: 300;
  color: var(--hs-accent);
}

body.page .entry-content details[open] summary::after {
  content: "\2212";
}

body.page .entry-content details summary:hover,
body.page .entry-content details[open] summary {
  background: var(--hs-accent-soft);
}

body.page .entry-content details > :not(summary) {
  padding: 0 20px 16px;
}

/* ==========================================================================
   14. VIDEO EMBED
   ========================================================================== */

body.page .entry-content .wp-block-embed {
  margin: 24px 0;
}

body.page .entry-content .wp-block-embed .wp-block-embed__wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--hs-radius-card);
  box-shadow: var(--hs-shadow-card);
}

body.page .entry-content .wp-block-embed .wp-block-embed__wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ==========================================================================
   15. SECTION RHYTHM — alternating background for h2 groups
   ========================================================================== */

body.page .entry-content > h2 {
  padding-top: 40px;
  margin-top: 0;
  border-top: 1px solid var(--hs-border);
}

body.page .entry-content > h2:first-child,
body.page .entry-content > .wp-block-group:first-child + h2 {
  border-top: 0;
  padding-top: 10px;
}

/* ==========================================================================
   16. RESPONSIVE — Tablet
   ========================================================================== */

@media (max-width: 1024px) {
  body.page .entry-content .wp-block-columns {
    gap: 16px;
  }

  body.page .entry-content .wp-block-gallery.columns-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   17. RESPONSIVE — Mobile
   ========================================================================== */

@media (max-width: 767px) {
  body.page .entry-content {
    width: min(100% - 24px, 1140px);
    padding: 24px 0;
  }

  body.page .entry-content > .wp-block-group:first-child {
    padding: 28px 20px;
  }

  body.page .entry-content h1 {
    font-size: 30px;
  }

  body.page .entry-content > h1:first-child,
  body.page .entry-content > .wp-block-group:first-child h1 {
    font-size: 30px;
  }

  body.page .entry-content h2 {
    font-size: 26px;
    margin-top: 36px;
    padding-top: 30px;
  }

  body.page .entry-content h3 {
    font-size: 20px;
  }

  body.page .entry-content .wp-block-columns {
    flex-direction: column;
  }

  body.page .entry-content .wp-block-column {
    flex-basis: 100% !important;
  }

  body.page .entry-content .wp-block-gallery.columns-2,
  body.page .entry-content .wp-block-gallery.columns-3,
  body.page .entry-content .wp-block-gallery.columns-4 {
    grid-template-columns: 1fr;
  }

  body.page .entry-content table {
    font-size: 13px;
  }

  body.page .entry-content table th,
  body.page .entry-content table td {
    padding: 8px 10px;
  }

  body.page .entry-content .wp-block-cover {
    min-height: 200px;
    padding: 28px 20px;
  }
}

/* ==========================================================================
   18. PRINT
   ========================================================================== */

@media print {
  body.page .entry-content img {
    box-shadow: none;
    border-radius: 0;
  }

  body.page .entry-content .wp-block-column:has(img) {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  body.page .entry-content .wp-block-button,
  body.page .entry-content .wp-block-embed {
    display: none !important;
  }
}
