/* Only articles containing Bilder opt into the wider block layout. */
body.single-post main#content .content > .wrapper:has(> .lks-article-content .lks-images) {
  max-width: none;
  width: 100%;
  padding-inline: 0;
}
body.single-post main#content .content > .wrapper:has(> .lks-article-content .lks-images) > :is(h1, .published),
/* A Group/Row wrapping Bilder spans the full width so the block's own Bredde setting decides; other children stay at text width. */
body.single-post .lks-article-content:has(.lks-images) > :not(.lks-images, .wp-block-group:has(> .lks-images)),
body.single-post .lks-article-content .wp-block-group:has(> .lks-images) > :not(.lks-images) {
  width: min(calc(100% - 40px), 792px);
  max-width: 792px;
  margin-inline: auto;
}
/* Do not let theme figure resets remove Masonry's vertical spacing. */
body.single-post .lks-article-content .lks-images--masonry .lks-images__item { margin-bottom: var(--lks-gap); }

body.single-post main#content > .lks-article-header .wrapper { max-width: 792px; }
body.single-post main#content > .lks-article-header h1 { margin: 0 0 12px; }
body.single-post main#content > .lks-article-header .published { margin: 0 0 24px; }
body.single-post main#content > .lks-article-header figure { margin: 0; position: relative; }
body.single-post main#content > .lks-article-header figure figcaption { position: absolute; inset: auto 0 0; padding: clamp(20px, 5vw, 56px) clamp(20px, 5vw, 56px) clamp(20px, 4vw, 40px); color: #fff; background: linear-gradient(transparent, rgb(0 0 0 / 78%)); }
body.single-post main#content > .lks-article-header figure figcaption h1 { margin: 0 0 8px; color: inherit; }
body.single-post main#content > .lks-article-header figure figcaption .published { margin: 0; color: inherit; }
body.single-post main#content > .lks-article-header:not(.has-image) h1 { margin-bottom: 12px; }
/* Brødsmulesti på artikler: samme bredde som «Bred» i Bilder-blokken. */
body.single-post #breadcrumbs > .wrapper { max-width: none; padding-inline: 0; }
body.single-post .breadcrumb.above {
  width: min(calc(100% - 40px), 1280px);
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: 0;
}
@media (min-width: 782px) {
  body.single-post main#content > .lks-article-header .wrapper { padding-inline: 0; }
}



/* Row/Stack groups zero child margins (.is-layout-flex > *); restore centring for Bilder inside them. */
body.single-post .lks-article-content .wp-block-group > .lks-images {
  margin-inline: auto;
}

/* Gutenberg Group wrappers reset child margins; give the group Bilder's own spacing, whatever sits above it. */
body.single-post .lks-article-content > .wp-block-group:has(> .lks-images) {
  margin-block: clamp(24px, 4vw, 48px);
}

/* Annonsørinnhold uten fremhevet bilde: like mye luft over tittelen som under (h1 12px + .content margin-block 32/48px). */
body.single-post .lks-sponsored-bar:has(+ .lks-article-header:not(.has-image)) { margin-bottom: 44px; }
@media screen and (min-width: 782px) {
  body.single-post .lks-sponsored-bar:has(+ .lks-article-header:not(.has-image)) { margin-bottom: 60px; }
}

/* Let mobile hero titles determine the height instead of clipping long text. */
@media (max-width: 600px) {
  body.single.single-post main#content > .lks-article-header .wrapper figure { display: grid; aspect-ratio: auto; }
  body.single.single-post main#content > .lks-article-header .wrapper figure > img {
    grid-area: 1 / 1; width: 100%; height: 100%; min-height: 0; object-fit: cover;
  }
  body.single.single-post main#content > .lks-article-header .wrapper figure figcaption {
    grid-area: 1 / 1; position: relative; inset: auto; align-self: end; min-width: 0;
  }
  body.single.single-post main#content > .lks-article-header .wrapper figure figcaption h1 { overflow-wrap: anywhere; }
}
