/* ==========================================================================
   PAGE: Single Blog Post
   Hero image → two-column body (content + product sidebar)
   ========================================================================== */


/* ------------------------------------------------------------------
   HERO
   ------------------------------------------------------------------ */

.sp-hero {
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: flex-end;
  background-color: var(--color-primary);
  overflow: hidden;
  /* Rounded box inset from page edges — same as homepage hero */
  border-radius: var(--radius-xl);
  width: calc(100% - var(--space-4) * 2);
  max-width: calc(var(--container-max) + var(--space-12));
  margin-inline: auto;
  margin-top: var(--space-2);
}

.sp-hero--has-image {
  background-image: var(--hero-img);
  background-size: cover;
  background-position: center;
}

.sp-hero__overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.72) 0%,
    rgba(0, 0, 0, 0.30) 50%,
    rgba(0, 0, 0, 0.10) 100%
  );
}

.sp-hero__inner {
  position: relative;
  z-index: 1;
  padding-top: calc(var(--header-offset) + var(--space-8));
  padding-bottom: var(--space-12);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
}

.sp-hero__category {
  background-color: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
  text-decoration: none;
}

.sp-hero__category:hover {
  opacity: 0.85;
}

.sp-hero__title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1.15;
  color: var(--color-on-primary);
  max-width: 22ch;
  margin: 0;
}

.sp-hero__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-body-md);
  color: rgba(255, 255, 255, 0.75); /* intentional alpha on white */
}

.sp-hero__meta-sep {
  opacity: 0.5;
}


/* ------------------------------------------------------------------
   BODY GRID — main | sidebar
   ------------------------------------------------------------------ */

.sp-body {
  padding-block: var(--space-12);
  background-color: var(--color-surface);
}

.sp-body__grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--space-12);
  align-items: start;
}


/* ------------------------------------------------------------------
   MAIN CONTENT
   ------------------------------------------------------------------ */

.sp-main {
  min-width: 0; /* prevent grid blowout */
}

/* Block editor content — extend prose for headings, lists, images */
.sp-main__content.prose h2 {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-on-surface);
  margin-top: var(--space-10);
  margin-bottom: var(--space-4);
}

.sp-main__content.prose h3 {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 400;
  line-height: 1.25;
  color: var(--color-on-surface);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

.sp-main__content.prose ul,
.sp-main__content.prose ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}

.sp-main__content.prose li {
  line-height: var(--text-body-lg-lh);
  margin-bottom: var(--space-2);
}

.sp-main__content.prose blockquote {
  border-left: 3px solid var(--color-secondary-container);
  padding-left: var(--space-6);
  margin-inline: 0;
  margin-block: var(--space-8);
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  color: var(--color-on-surface-variant);
  line-height: 1.5;
}

/* Block images */
.sp-main__content.prose figure {
  margin-block: var(--space-8);
}

.sp-main__content.prose figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  display: block;
}

.sp-main__content.prose figcaption {
  font-size: var(--text-body-sm);
  color: var(--color-on-surface-variant);
  margin-top: var(--space-2);
  text-align: center;
}

/* WordPress gallery block */
.sp-main__content.prose .wp-block-gallery {
  margin-block: var(--space-8);
}

.sp-main__content.prose .wp-block-gallery img {
  border-radius: var(--radius-md);
}


/* ------------------------------------------------------------------
   AUTHOR BIO
   ------------------------------------------------------------------ */

.sp-author {
  display: flex;
  gap: var(--space-5);
  align-items: flex-start;
  margin-top: var(--space-12);
  padding: var(--space-6);
  background-color: var(--color-surface-container-low);
  border-radius: var(--radius-xl);
}

.sp-author__avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
}

.sp-author__info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sp-author__byline {
  color: var(--color-on-surface-variant);
}

.sp-author__name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--color-on-surface);
}

.sp-author__bio {
  font-size: var(--text-body-md);
  color: var(--color-on-surface-variant);
  line-height: var(--text-body-lg-lh);
  margin: 0;
}


/* ------------------------------------------------------------------
   MORE POSTS
   ------------------------------------------------------------------ */

.sp-more {
  margin-top: var(--space-12);
  padding-top: var(--space-10);
  border-top: 1px solid var(--color-outline-variant);
}

.sp-more__heading {
  color: var(--color-on-surface-variant);
  margin-bottom: var(--space-8);
}

.sp-more__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

@media (max-width: 900px) {
  .sp-more__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .sp-more__grid {
    grid-template-columns: 1fr;
  }
}


/* ------------------------------------------------------------------
   SIDEBAR
   ------------------------------------------------------------------ */

.sp-sidebar__inner {
  position: sticky;
  top: var(--space-8);
  background-color: var(--color-surface-container-low);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.sp-sidebar__heading {
  color: var(--color-on-surface-variant);
  margin: 0;
}

.sp-sidebar__products {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Compact card overrides inside the narrow sidebar */
.sp-sidebar__products .c-product-card {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: var(--space-3);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: var(--space-3);
}

.sp-sidebar__products .c-product-card__image-link {
  display: block;
}

.sp-sidebar__products .c-product-card__image-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 1;
}

.sp-sidebar__products .c-product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sp-sidebar__products .c-product-card__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-1);
  padding: 0;
}

.sp-sidebar__products .c-product-card__title {
  font-size: var(--text-body-md);
  font-family: var(--font-body);
  font-weight: 600;
  line-height: 1.3;
}

.sp-sidebar__products .c-product-card__desc {
  display: none;
}

.sp-sidebar__products .c-product-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sp-sidebar__products .c-product-card__price {
  font-size: var(--text-body-md);
  font-weight: 600;
}

.sp-sidebar__products .c-product-card__cart-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sp-sidebar__shop-link {
  width: 100%;
  justify-content: center;
  font-size: var(--text-body-md);
}


/* ------------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------------ */

@media (max-width: 900px) {
  .sp-body__grid {
    grid-template-columns: 1fr;
  }

  .sp-sidebar__inner {
    position: static;
  }

  /* On mobile the sidebar products go back to normal card layout */
  .sp-sidebar__products .c-product-card {
    grid-template-columns: 1fr;
  }

  .sp-sidebar__products .c-product-card__image-wrap {
    aspect-ratio: 4 / 3;
  }
}

@media (max-width: 640px) {
  .sp-hero {
    min-height: 360px;
    width: calc(100% - var(--space-2) * 2);
    border-radius: var(--radius-lg);
  }

  .sp-hero__inner {
    padding-block: var(--space-8);
  }

  .sp-body {
    padding-block: var(--space-8);
  }

  .sp-author {
    flex-direction: column;
    gap: var(--space-4);
  }
}
