/* MotorHub imported posts — gallery centering + justified body text */

.motorhub-gallery {
  text-align: center;
  margin: 1.5em 0;
}

.motorhub-gallery figure {
  margin: 1em auto;
  max-width: 100%;
}

.motorhub-gallery img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

/* Blog / archive list — excerpt full card width (matches title + preview image) */
body:not(.single-post) .entry-summary,
body:not(.single-post) .entry-summary p {
  width: 100%;
  max-width: 100%;
  text-align: justify;
  text-align-last: left;
  line-height: 1.65;
}

/* Inline photos — same width as text column on single posts (theme style.css) */
.motorhub-inline-image {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1.75em 0;
  padding: 0;
  clear: both;
}

.motorhub-inline-image img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  margin: 0;
  border-radius: 4px;
}

.single-post .entry-content .motorhub-inline-image,
.single-post .entry-content .motorhub-gallery {
  max-width: 48rem;
  margin-left: 0;
  margin-right: 0;
}

.single-post .entry-content .motorhub-inline-image {
  cursor: zoom-in;
}

/* Featured / single-post thumbnails */
.single-post .featured-image img,
.single-post img.wp-post-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

/* Archive / home list previews — contained in card column (theme style.css) */
body:not(.single-post) .post-image img,
body:not(.single-post) .post-image-aligned img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.motorhub-article-body .motorhub-inline-image:first-child {
  margin-top: 0.5em;
}

.motorhub-article-body {
  text-align: justify;
  text-align-last: left;
  line-height: 1.65;
}

.motorhub-article-body p {
  text-align: justify;
  text-align-last: left;
  margin: 0 0 1em;
}

.motorhub-cta,
.motorhub-source {
  text-align: left;
  text-align-last: auto;
}

/* YouTube / oEmbed — full column width, 16:9 */
.motorhub-video {
  display: flex;
  flex-direction: column;
  gap: 1.5em;
  width: 100%;
  max-width: 100%;
  margin: 1.5em 0;
  clear: both;
}

.motorhub-video__wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0;
  overflow: hidden;
  background: #000;
  border-radius: 4px;
}

.motorhub-video__wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  border: 0;
}

/* Legacy imports: bare URL → WP oEmbed block */
.motorhub-video .wp-block-embed,
.motorhub-video .wp-block-embed__wrapper,
.single-post .entry-content .motorhub-video .wp-block-embed,
.single-post .entry-content .motorhub-video .wp-block-embed__wrapper {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
}

.single-post .entry-content .motorhub-video .wp-block-embed__wrapper {
  aspect-ratio: 16 / 9;
}

.single-post .entry-content .motorhub-video iframe,
.single-post .entry-content .wp-block-embed-youtube iframe {
  width: 100% !important;
  max-width: 100% !important;
  aspect-ratio: 16 / 9;
  height: auto;
  min-height: 200px;
}

/* Posts imported before body wrapper existed */
.single-post .entry-content > .motorhub-gallery,
.single-post .entry-content > p:not(.motorhub-cta):not(.motorhub-source) {
  text-align: justify;
  text-align-last: left;
}

.single-post .entry-content > .motorhub-gallery {
  text-align: center;
  text-align-last: center;
}

/* Entity comparison hero gallery — lightbox targets figures via article-lightbox.js */
.single-entity_article .entry-content .mh-entity-heroes figure,
.single-post .entry-content .mh-entity-heroes figure {
  cursor: zoom-in;
}

/* Fullscreen lightbox (article-lightbox.js) */
.motorhub-lightbox {
  padding: 0;
  margin: 0;
  border: none;
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  background: transparent;
}

.motorhub-lightbox::backdrop {
  background: rgba(0, 0, 0, 0.92);
}

.motorhub-lightbox__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  box-sizing: border-box;
  padding: 3rem 4rem;
}

.motorhub-lightbox__figure {
  margin: 0;
  max-width: min(96vw, 1400px);
  max-height: calc(100vh - 6rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.motorhub-lightbox__img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  width: auto;
  height: auto;
  object-fit: contain;
}

.motorhub-lightbox__caption {
  margin-top: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  text-align: center;
  max-width: 48rem;
}

.motorhub-lightbox__counter {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
}

.motorhub-lightbox__close,
.motorhub-lightbox__nav {
  position: absolute;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.motorhub-lightbox__close:hover,
.motorhub-lightbox__close:focus-visible,
.motorhub-lightbox__nav:hover,
.motorhub-lightbox__nav:focus-visible {
  background: rgba(255, 255, 255, 0.22);
}

.motorhub-lightbox__close {
  top: 1rem;
  right: 1rem;
  font-size: 2rem;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
}

.motorhub-lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.5rem;
  width: 2.75rem;
  height: 3.5rem;
  padding: 0;
}

.motorhub-lightbox__nav--prev {
  left: 0.75rem;
}

.motorhub-lightbox__nav--next {
  right: 0.75rem;
}

@media (max-width: 768px) {
  .motorhub-lightbox__stage {
    padding: 2.5rem 0.5rem;
  }

  .motorhub-lightbox__nav {
    width: 2.25rem;
    height: 3rem;
    font-size: 2rem;
  }
}
