/* ========================================
   BouwTag Single Post Styling
   Maakt van TT4's standaard post-rendering
   een BouwTag-style blog post pagina.
   ======================================== */

/* Main container: centrale, constrained layout voor blog posts */
body.single-post .wp-site-blocks > main,
body.single-post main.wp-block-group {
  padding: 3rem 1.5rem 4rem;
  background: var(--bt-color-bg);
}

/* Hero: full-bleed featured image met titel als overlay.
   Geen aspect-ratio gebruiken: in combinatie met max-height krimpt de
   browser de BREEDTE om de ratio te behouden (60vh * 21/9 < 100vw),
   waardoor het plaatje niet meer full-bleed is. Daarom een expliciete
   height met min() — width blijft dan ongemoeid 100%. */
body.single-post main > .wp-block-group.has-global-padding:first-child,
body.single-post main > .wp-block-group:first-of-type {
  position: relative;
  max-width: none;
  margin: -3rem -1.5rem 2.5rem;
  padding: 0;
  height: min(60vh, 43vw);
  min-height: 320px;
  overflow: hidden;
}

/* Featured image vult de hero — max-width: none breekt uit de
   is-layout-constrained content-size cap (620px) van de parent. */
body.single-post .wp-block-post-featured-image {
  position: absolute;
  inset: 0;
  margin: 0;
  max-width: none;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

/* Gradient overlay zodat titel altijd leesbaar is */
body.single-post .wp-block-post-featured-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.75) 100%);
  pointer-events: none;
}

body.single-post .wp-block-post-featured-image img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
}

/* Post titel als witte overlay onderin */
body.single-post .wp-block-post-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  margin: 0 auto;
  padding: 2rem 2rem 2.25rem;
  max-width: 900px;
  font-family: var(--bt-font-family-heading);
  font-size: 2.75rem;
  font-weight: var(--bt-font-weight-extrabold);
  color: #fff;
  line-height: var(--bt-line-height-heading);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

body.single-post .wp-block-post-title strong,
body.single-post .wp-block-post-title b {
  color: var(--bt-color-accent);
  font-weight: inherit;
}

/* Meta-regel (datum, auteur, categorieën) verbergen */
body.single-post .wp-block-post-title + .wp-block-template-part,
body.single-post main > .wp-block-group:first-of-type .wp-block-post-date,
body.single-post main > .wp-block-group:first-of-type .wp-block-post-author-name,
body.single-post main > .wp-block-group:first-of-type .wp-block-post-terms {
  display: none;
}

/* Content wrapper */
body.single-post .entry-content.wp-block-post-content,
body.single-post .wp-block-post-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 0;
  font-family: var(--bt-font-family);
  font-size: var(--bt-font-size-md);
  line-height: var(--bt-line-height-body);
  color: var(--bt-color-body);
}

/* Content typography */
body.single-post .wp-block-post-content h1,
body.single-post .wp-block-post-content h2,
body.single-post .wp-block-post-content h3,
body.single-post .wp-block-post-content h4 {
  font-family: var(--bt-font-family-heading);
  color: var(--bt-color-heading);
  line-height: var(--bt-line-height-heading);
  margin: 2.5rem 0 1rem;
}

body.single-post .wp-block-post-content h1 {
  font-size: 2rem;
  font-weight: var(--bt-font-weight-extrabold);
}

body.single-post .wp-block-post-content h2 {
  font-size: 1.75rem;
  font-weight: var(--bt-font-weight-extrabold);
}

body.single-post .wp-block-post-content h3 {
  font-size: 1.35rem;
  font-weight: var(--bt-font-weight-bold);
}

body.single-post .wp-block-post-content h4 {
  font-size: 1.15rem;
  font-weight: var(--bt-font-weight-bold);
}

/* Oude content gebruikt <b> voor accent: behandel als strong */
body.single-post .wp-block-post-content h1 b,
body.single-post .wp-block-post-content h2 b,
body.single-post .wp-block-post-content h3 b,
body.single-post .wp-block-post-content h4 b,
body.single-post .wp-block-post-content h1 strong,
body.single-post .wp-block-post-content h2 strong,
body.single-post .wp-block-post-content h3 strong,
body.single-post .wp-block-post-content h4 strong {
  color: var(--bt-color-accent);
  font-weight: inherit;
}

body.single-post .wp-block-post-content p {
  margin: 0 0 1.25rem;
}

/* Lege paragraphs (wpautop-artifact rond block-level embeds) verbergen */
body.single-post .wp-block-post-content p:empty {
  display: none;
}

body.single-post .wp-block-post-content p strong,
body.single-post .wp-block-post-content p b {
  color: var(--bt-color-heading);
  font-weight: var(--bt-font-weight-bold);
}

/* Links in content */
body.single-post .wp-block-post-content a {
  color: var(--bt-color-accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(240, 140, 26, 0.3);
  transition: border-color var(--bt-transition-ease);
}

body.single-post .wp-block-post-content a:hover {
  border-bottom-color: var(--bt-color-accent);
}

/* Lijsten */
body.single-post .wp-block-post-content ul,
body.single-post .wp-block-post-content ol {
  margin: 0 0 1.5rem;
  padding-left: 0;
}

body.single-post .wp-block-post-content ol {
  padding-left: 1.5rem;
}

body.single-post .wp-block-post-content ul {
  list-style: none;
}

body.single-post .wp-block-post-content ul > li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.5rem;
}

body.single-post .wp-block-post-content ul > li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.1em;
  width: 1.25em;
  height: 1.25em;
  background-color: var(--bt-color-accent);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center / contain no-repeat;
}

body.single-post .wp-block-post-content ol > li {
  margin-bottom: 0.5rem;
}

/* Blockquote */
body.single-post .wp-block-post-content blockquote {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--bt-color-accent);
  background: var(--bt-color-bg-subtle);
  border-radius: var(--bt-radius-sm);
  font-style: italic;
  color: var(--bt-color-heading);
}

/* Afbeeldingen in content — forceer containment, negeer HTML width attributes */
body.single-post .wp-block-post-content img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  border-radius: var(--bt-radius-md);
  margin: 1.5rem auto;
}

/* WordPress [caption] shortcode wrappers (inline width wordt PHP-side gestript) */
body.single-post .wp-block-post-content .wp-caption,
body.single-post .wp-block-post-content figure {
  max-width: 100%;
  width: auto;
  margin: 1.5rem auto;
}

body.single-post .wp-block-post-content .wp-caption img,
body.single-post .wp-block-post-content figure img {
  margin: 0 auto;
}

body.single-post .wp-block-post-content .wp-caption-text,
body.single-post .wp-block-post-content figcaption {
  font-size: var(--bt-font-size-sm);
  color: var(--bt-color-body);
  text-align: center;
  margin-top: 0.75rem;
  line-height: 1.5;
}

/* Responsieve YouTube embeds voor [embedyt] en [tek_video] */
body.single-post .wp-block-post-content .bt-video-embed {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  margin: 2rem 0;
  border-radius: var(--bt-radius-md);
  overflow: hidden;
  box-shadow: var(--bt-shadow-sm);
  background: #000;
}

body.single-post .wp-block-post-content .bt-video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Heading wrappers die video embeds bevatten: strip heading-styling */
body.single-post .wp-block-post-content h1:has(.bt-video-embed),
body.single-post .wp-block-post-content h2:has(.bt-video-embed),
body.single-post .wp-block-post-content h3:has(.bt-video-embed) {
  font-size: inherit;
  font-weight: inherit;
  margin: 0;
}

/* Legacy vc_separator output */
body.single-post .wp-block-post-content .bt-content-separator {
  border: none;
  border-top: 1px solid var(--bt-color-border);
  margin: 2.5rem 0;
}

body.single-post .wp-block-separator {
  border: none;
  border-top: 1px solid var(--bt-color-border);
  margin: 2rem auto;
  max-width: 760px;
}

/* TT4 rendert onder het content een wrapper met spacer + separator +
   prev/next-navigatie. We hebben de carousel als vervanging, dus de hele
   trailing wrapper verbergen — anders blijft er ~300px lege ruimte staan
   (spacer 4rem + wrapper-padding 6.5rem + main-padding 4rem). */
body.single-post main > .wp-block-group:last-of-type:has(nav[aria-label="Berichten"]) {
  display: none;
}

/* ========================================
   Related posts carousel
   ======================================== */

body.single-post .bt-related-carousel {
  max-width: 1200px;
  margin: 3rem auto 1rem;
  padding: 0 1.5rem;
}

body.single-post .bt-carousel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

body.single-post .bt-carousel__title {
  font-family: var(--bt-font-family-heading);
  font-size: 1.75rem;
  font-weight: var(--bt-font-weight-extrabold);
  color: var(--bt-color-heading);
  line-height: var(--bt-line-height-heading);
  margin: 0;
}

body.single-post .bt-carousel__arrows {
  display: flex;
  gap: 0.5rem;
}

body.single-post .bt-carousel__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--bt-color-border);
  border-radius: var(--bt-radius-circle);
  background: var(--bt-color-bg);
  color: var(--bt-color-heading);
  cursor: pointer;
  transition: border-color var(--bt-transition-ease), color var(--bt-transition-ease), background var(--bt-transition-ease);
}

body.single-post .bt-carousel__arrow:hover:not(:disabled) {
  border-color: var(--bt-color-accent);
  color: var(--bt-color-accent);
}

body.single-post .bt-carousel__arrow:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

body.single-post .bt-carousel__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 2 * 1.25rem) / 3);
  gap: 1.25rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body.single-post .bt-carousel__track::-webkit-scrollbar {
  display: none;
}

body.single-post .bt-carousel__card {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  background: var(--bt-color-bg);
  border: 1px solid var(--bt-color-border);
  border-radius: var(--bt-radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: var(--bt-color-heading);
  transition: border-color var(--bt-transition-ease), transform var(--bt-transition-ease), box-shadow var(--bt-transition-ease);
}

body.single-post .bt-carousel__card:hover {
  border-color: var(--bt-color-accent);
  transform: translateY(-3px);
  box-shadow: var(--bt-shadow-md);
}

body.single-post .bt-carousel__thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bt-color-bg-subtle);
}

body.single-post .bt-carousel__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: 0;
  border-radius: 0;
}

body.single-post .bt-carousel__image--placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--bt-color-bg-subtle), var(--bt-color-border));
}

body.single-post .bt-carousel__body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

body.single-post .bt-carousel__date {
  font-size: var(--bt-font-size-xs);
  color: var(--bt-color-body);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

body.single-post .bt-carousel__card-title {
  font-family: var(--bt-font-family-heading);
  font-size: 1.1rem;
  font-weight: var(--bt-font-weight-bold);
  color: var(--bt-color-heading);
  line-height: 1.3;
  margin: 0;
}

body.single-post .bt-carousel__excerpt {
  font-size: var(--bt-font-size-sm);
  color: var(--bt-color-body);
  line-height: 1.5;
  margin: 0;
}

body.single-post .bt-carousel__dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

body.single-post .bt-carousel__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: var(--bt-radius-circle);
  background: var(--bt-color-border);
  cursor: pointer;
  transition: background var(--bt-transition-ease), transform var(--bt-transition-ease);
}

body.single-post .bt-carousel__dot:hover {
  background: var(--bt-color-body);
}

body.single-post .bt-carousel__dot.is-active {
  background: var(--bt-color-accent);
  transform: scale(1.3);
}

@media (max-width: 1023px) {
  body.single-post .bt-carousel__track {
    grid-auto-columns: calc((100% - 1.25rem) / 2);
  }
}

@media (max-width: 639px) {
  body.single-post .bt-related-carousel {
    padding: 0 1rem;
  }

  body.single-post .bt-carousel__title {
    font-size: 1.4rem;
  }

  body.single-post .bt-carousel__track {
    grid-auto-columns: 85%;
    gap: 1rem;
  }
}

/* Responsive */
@media (max-width: 767px) {
  body.single-post .wp-site-blocks > main,
  body.single-post main.wp-block-group {
    padding: 2rem 1rem 3rem;
  }

  body.single-post main > .wp-block-group.has-global-padding:first-child,
  body.single-post main > .wp-block-group:first-of-type {
    margin: -2rem -1rem 2rem;
    height: min(70vh, 75vw);
    min-height: 280px;
  }

  body.single-post .wp-block-post-title {
    font-size: 1.85rem;
    padding: 1.5rem 1.25rem 1.75rem;
  }

  body.single-post .wp-block-post-content {
    font-size: var(--bt-font-size-base);
  }

  body.single-post .wp-block-post-content h1 {
    font-size: 1.65rem;
  }

  body.single-post .wp-block-post-content h2 {
    font-size: 1.4rem;
  }

  body.single-post .wp-block-post-content h3 {
    font-size: 1.2rem;
  }

  body.single-post nav.wp-block-group[aria-label="Berichten"] {
    flex-direction: column;
  }

  body.single-post .wp-block-post-navigation-link {
    max-width: 100%;
  }

  body.single-post .post-navigation-link-next {
    text-align: left;
  }
}
