/* ==========================================================================
   Blog Post — BnBuddy Redesign
   Uses design-system tokens from homepage-v3.css
   Prefix: bp- (blog post)
   ========================================================================== */

/* Scoped border-box reset — mirrors the handoff's global box-sizing so
   padded components (avatars, icons, CTA, buttons) inset correctly. */
[class^="bp-"],
[class*=" bp-"] {
  box-sizing: border-box;
}

/* ---------- Reading Progress Bar ---------- */
.bp-progress-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 60;
  background: transparent;
  pointer-events: none;
}

.bp-progress {
  height: 100%;
  width: 0%;
  background: var(--bb-primary);
  transition: width 80ms linear;
}

/* ---------- Article Header ---------- */
.bp-header {
  max-width: 800px;
  margin: 0 auto;
  padding: 56px 32px 0;
}

.bp-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-family: var(--bb-font-body);
  color: var(--bb-on-surface-variant);
  margin-bottom: 24px;
}

.bp-breadcrumb a {
  color: var(--bb-on-surface-variant);
  text-decoration: none;
  transition: color var(--bb-duration-fast) var(--bb-ease);
}

.bp-breadcrumb a:hover {
  color: var(--bb-primary);
}

.bp-breadcrumb__cat {
  color: var(--bb-primary);
  font-weight: 600;
}

.bp-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: var(--bb-radius-full);
  font-family: var(--bb-font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(86, 69, 205, 0.08);
  color: var(--bb-primary);
  white-space: nowrap;
}

.bp-title {
  margin: 18px 0 0;
  font-family: var(--bb-font-display);
  font-weight: 800;
  font-size: 48px;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--bb-on-surface);
  text-wrap: balance;
}

.bp-subtitle {
  margin: 20px 0 0;
  font-family: var(--bb-font-body);
  font-size: 20px;
  line-height: 1.55;
  color: var(--bb-on-surface-variant);
}

.bp-byline {
  margin: 32px 0 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.bp-byline__avatar {
  width: 46px;
  height: 46px;
  border-radius: var(--bb-radius-full);
  background: var(--bb-primary);
  padding: 9px;
  box-shadow: 0 2px 8px rgba(86, 69, 205, 0.18);
  object-fit: contain;
}

.bp-byline__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--bb-on-surface);
}

.bp-byline__meta {
  font-size: 13px;
  color: var(--bb-on-surface-variant);
}

/* ---------- Hero Image ---------- */
.bp-hero {
  max-width: 1000px;
  margin: 40px auto 0;
  padding: 0 32px;
}

.bp-hero__img-wrap {
  border-radius: var(--bb-radius-xl);
  overflow: hidden;
  aspect-ratio: 21 / 9;
  box-shadow: 0 10px 40px rgba(86, 69, 205, 0.08);
}

.bp-hero__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- Body + TOC Grid ---------- */
.bp-grid {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 32px 0;
  display: grid;
  grid-template-columns: minmax(0, 720px) 240px;
  gap: 64px;
  justify-content: center;
  align-items: start;
}

/* ---------- Article Body Typography ---------- */
.bp-article p {
  margin: 0 0 20px;
  font-family: var(--bb-font-body);
  font-size: 18px;
  line-height: 1.72;
  color: var(--bb-on-surface-variant);
}

.bp-article .bp-lead {
  font-size: 20px;
  line-height: 1.7;
  color: var(--bb-on-surface);
}

.bp-article h2 {
  margin: 52px 0 18px;
  font-family: var(--bb-font-display);
  font-weight: 800;
  font-size: 30px;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--bb-on-surface);
  scroll-margin-top: 96px;
  text-transform: none;
}

.bp-article h3 {
  margin: 34px 0 14px;
  font-family: var(--bb-font-display);
  font-weight: 700;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--bb-on-surface);
  text-transform: none;
}

.bp-article ul,
.bp-article ol {
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bp-article li {
  position: relative;
  padding-left: 30px;
  font-family: var(--bb-font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--bb-on-surface-variant);
}

.bp-article li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bb-primary);
}

.bp-article li strong {
  color: var(--bb-on-surface);
  font-weight: 600;
}

.bp-article a:not(.bp-btn) {
  color: var(--bb-primary);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(86, 69, 205, 0.3);
  transition: border-color var(--bb-duration) var(--bb-ease);
}

.bp-article a:not(.bp-btn):hover {
  border-bottom-color: var(--bb-primary);
}

/* ---------- Inline CTA ---------- */
.bp-cta {
  margin: 40px 0;
  border-radius: var(--bb-radius-xl);
  background: var(--bb-surface);
  border: 1px solid var(--bb-surface-container);
  padding: 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.bp-cta__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--bb-radius-lg);
  background: var(--bb-primary);
  padding: 11px;
  box-shadow: 0 6px 20px rgba(86, 69, 205, 0.20);
  flex-shrink: 0;
  object-fit: contain;
}

.bp-cta__body {
  flex: 1;
  min-width: 220px;
}

.bp-cta__title {
  font-family: var(--bb-font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--bb-on-surface);
}

.bp-cta__desc {
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--bb-on-surface-variant);
}

/* ---------- Button ---------- */
.bp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: var(--bb-radius-lg);
  background: var(--bb-primary);
  color: var(--bb-on-primary);
  font-family: var(--bb-font-body);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--bb-duration) var(--bb-ease),
              transform var(--bb-duration) var(--bb-ease),
              box-shadow var(--bb-duration) var(--bb-ease);
}

.bp-btn:hover {
  background: var(--bb-action-hover);
  transform: var(--bb-lift);
  box-shadow: var(--bb-shadow-pill);
}

/* Keep the button label white — overrides the global `.breakdance a`
   link color (which otherwise tints anchor buttons brand-blue). */
.breakdance a.bp-btn,
a.bp-btn {
  color: var(--bb-on-primary);
}

/* ---------- Author Card ---------- */
.bp-author-card {
  margin: 48px 0 0;
  padding: 28px;
  border-radius: var(--bb-radius-xl);
  background: var(--bb-surface-card);
  box-shadow: var(--bb-shadow-card);
  display: flex;
  gap: 18px;
  align-items: center;
}

.bp-author-card__avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--bb-radius-full);
  background: var(--bb-primary);
  padding: 11px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(86, 69, 205, 0.18);
  object-fit: contain;
}

.bp-author-card__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bb-primary);
}

.bp-author-card__name {
  margin-top: 3px;
  font-family: var(--bb-font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--bb-on-surface);
}

.bp-author-card__bio {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--bb-on-surface-variant);
}

/* ---------- TOC Sidebar ---------- */
.bp-toc {
  position: sticky;
  top: 88px;
  align-self: start;
}

.bp-toc__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bb-on-surface-variant);
  margin-bottom: 16px;
}

.bp-toc__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 2px solid var(--bb-surface-container);
}

.bp-toc__link {
  padding: 7px 0 7px 16px;
  margin-left: -2px;
  font-size: 14px;
  line-height: 1.4;
  border-left: 2px solid transparent;
  color: var(--bb-on-surface-variant);
  font-weight: 400;
  text-decoration: none;
  transition: color var(--bb-duration-fast) var(--bb-ease),
              border-color var(--bb-duration-fast) var(--bb-ease);
}

.bp-toc__link:hover {
  color: var(--bb-on-surface);
}

.bp-toc__link.is-active {
  border-left-color: var(--bb-primary);
  color: var(--bb-primary);
  font-weight: 600;
}

/* ---------- Related Posts ---------- */
.bp-related {
  max-width: 1120px;
  margin: 72px auto 0;
  padding: 0 32px 80px;
}

.bp-related__title {
  margin: 0 0 24px;
  font-family: var(--bb-font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.01em;
  color: var(--bb-on-surface);
}

.bp-related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.bp-related__card {
  display: flex;
  flex-direction: column;
  background: var(--bb-surface-card);
  border-radius: var(--bb-radius-xl);
  overflow: hidden;
  box-shadow: var(--bb-shadow-card);
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--bb-duration) var(--bb-ease),
              transform var(--bb-duration) var(--bb-ease);
}

.bp-related__card:hover {
  box-shadow: var(--bb-shadow-card-hover);
  transform: translateY(-4px);
}

.bp-related__card-img {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
}

.bp-related__card-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--bb-duration-slow) var(--bb-ease);
}

.bp-related__card:hover .bp-related__card-img img {
  transform: scale(1.07);
}

.bp-related__card-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--bb-radius-full);
  font-family: var(--bb-font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}

.bp-related__card-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.bp-related__card-title {
  margin: 0;
  font-family: var(--bb-font-display);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--bb-on-surface);
  text-wrap: balance;
}

.bp-related__card-meta {
  margin-top: auto;
  padding-top: 18px;
  font-size: 13px;
  color: var(--bb-on-surface-variant);
}

/* ---------- Responsive: Tablet ---------- */
@media (max-width: 1023px) {
  .bp-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .bp-toc {
    position: static;
    order: -1;
    padding: 24px;
    background: var(--bb-surface);
    border-radius: var(--bb-radius-xl);
  }
}

/* ---------- Responsive: Phone ---------- */
@media (max-width: 767px) {
  .bp-header {
    padding: 40px 20px 0;
  }

  .bp-title {
    font-size: 32px;
    line-height: 1.12;
    letter-spacing: -0.02em;
  }

  .bp-subtitle {
    font-size: 17px;
  }

  .bp-hero {
    padding: 0 20px;
    margin-top: 32px;
  }

  .bp-hero__img-wrap {
    aspect-ratio: 16 / 9;
  }

  .bp-grid {
    padding: 32px 20px 0;
  }

  .bp-article h2 {
    font-size: 24px;
    margin: 40px 0 14px;
  }

  .bp-article h3 {
    font-size: 18px;
  }

  .bp-article p {
    font-size: 16px;
  }

  .bp-article li {
    font-size: 15px;
  }

  .bp-cta {
    padding: 24px;
    gap: 16px;
  }

  .bp-related {
    padding: 0 20px;
    margin-top: 48px;
  }

  .bp-related__grid {
    grid-template-columns: 1fr;
  }

  .bp-author-card {
    flex-direction: column;
    text-align: center;
    padding: 24px;
  }
}
