/* ==========================================================================
   blog-post.css — shared styles for every DeepTora blog article.
   Load AFTER /assets/css/style.css (reuses its colour tokens, .glass-card
   and the FAQ accordion).
   ========================================================================== */


/* ==========================================================================
   1. Layout + brand colour
   --brand / --brand-hover  : DeepTora brand blue (buttons)
   --accent-blue(-hover)    : re-pointed to the brand colour for blog pages
                              only, so links, TOC, breadcrumbs, quick-answer
                              box, FAQ etc. all follow the brand automatically
                              without touching the rest of the site.
   ========================================================================== */
.bp-main {
  --brand: #0F46D7;
  --brand-hover: #0C3AB5;
  --accent-blue: var(--brand);
  --accent-blue-hover: var(--brand-hover);

  /* Card border (same values as link-report.css) + soft brand hover tint */
  --bp-card-border: rgba(15, 23, 42, 0.11);
  --bp-hover-bg: rgba(15, 70, 215, 0.05);
  --bp-active-bg: rgba(15, 70, 215, 0.09);

  max-width: 760px;
  align-items: stretch;
  padding-top: 32px;
}

/* #0F46D7 is too dark to read as text on a black background,
   so text/link accents use a lighter tint in dark mode. */
[data-theme="dark"] .bp-main {
  --accent-blue: #6D90FF;
  --accent-blue-hover: #8DA9FF;
  --bp-card-border: rgba(255, 255, 255, 0.13);
  --bp-hover-bg: rgba(109, 144, 255, 0.08);
  --bp-active-bg: rgba(109, 144, 255, 0.14);
}

/* Phones: slightly stronger border (same as link-report.css) */
@media (max-width: 767px) {
  .bp-main { --bp-card-border: rgba(15, 23, 42, 0.14); }
  [data-theme="dark"] .bp-main { --bp-card-border: rgba(255, 255, 255, 0.16); }
}

/* No box-shadows in blog pages: every card uses a clean 1px border instead.
   Only the colour is set, so the 4px accent left border of the quick-answer
   box and callouts keeps working. */
.bp-main .glass-card,
.bp-main .ai-qa-item {
  box-shadow: none;
  border-top-color: var(--bp-card-border);
  border-right-color: var(--bp-card-border);
  border-bottom-color: var(--bp-card-border);
}


/* ==========================================================================
   2. Breadcrumbs: home icon, chevron separators, glass pills, mobile back-link
   ========================================================================== */
.bp-crumbs {
  margin-bottom: 22px;
}

.bp-crumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0;
  margin: 0;
}

.bp-crumbs li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: calc(var(--body-size) * .82);
}

/* Chevron separator between crumbs */
.bp-crumbs li + li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-top: 1.5px solid var(--text-muted);
  border-right: 1.5px solid var(--text-muted);
  transform: rotate(45deg);
  margin-right: 4px;
  opacity: .7;
}

.bp-crumbs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--input-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  line-height: 1.2;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color .2s, border-color .2s, transform .25s cubic-bezier(.34, 1.56, .64, 1);
}

.bp-crumbs a:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  transform: translateY(-1px);
}

.bp-crumbs a:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.bp-crumbs .bp-crumb-home a {
  padding: 6px 9px;
}

.bp-crumbs svg {
  display: block;
}


/* ==========================================================================
   3. Article header
   ========================================================================== */
.bp-header h1 {
  align-items: flex-start;
  text-align: left;
  font-size: var(--h1-size);
  margin-bottom: 14px;
}

.bp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: calc(var(--body-size) * .8);
  color: var(--text-muted);
  margin-bottom: 28px;
}


/* ==========================================================================
   4. Quick-answer box
   ========================================================================== */
.bp-answer {
  border-left: 4px solid var(--accent-blue);
  margin-bottom: 24px;
}

.bp-answer .bp-label {
  font-size: calc(var(--body-size) * .75);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent-blue);
}

/* Shared secondary text colour for article copy */
.bp-answer p,
.bp-section p,
.bp-section li,
.bp-toc li {
  color: var(--text-secondary);
}


/* ==========================================================================
   5. Table of contents
   ========================================================================== */
.bp-toc {
  margin-bottom: 12px;
}

.bp-toc ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bp-toc a {
  color: var(--accent-blue);
  text-decoration: none;
}

.bp-toc a:hover {
  text-decoration: underline;
}


/* ==========================================================================
   6. Article sections: headings, paragraphs, lists, links
   ========================================================================== */
.bp-section {
  margin-top: 44px;
  scroll-margin-top: 80px;
}

.bp-section h2 {
  font-size: var(--h2-size);
  line-height: var(--h2-line-height);
  font-weight: var(--h2-weight);
  letter-spacing: -.01em;
  margin-bottom: 14px;
}

.bp-section h3 {
  font-size: var(--h3-size);
  font-weight: var(--h3-weight);
  margin: 26px 0 10px;
}

/* Spacing between consecutive blocks */
.bp-section p + p,
.bp-section p + ul,
.bp-section p + ol,
.bp-section ul + p,
.bp-section ol + p {
  margin-top: 14px;
}

.bp-section ul,
.bp-section ol {
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bp-section strong {
  color: var(--text-primary);
  font-weight: 600;
}

.bp-section a {
  color: var(--accent-blue);
}

.bp-section p,
.bp-section li {
  overflow-wrap: break-word;
}


/* ==========================================================================
   7. Inline code
   ========================================================================== */
code {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
  background: var(--border-subtle);
  padding: 2px 6px;
  border-radius: 6px;
}


/* ==========================================================================
   8. Code blocks (+ copy button)
   ========================================================================== */
.bp-code {
  margin: 16px 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  overflow: hidden;
}

.bp-code-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  font-size: calc(var(--body-size) * .75);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.bp-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: calc(var(--body-size) * .78);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  transition: color .2s, background .2s;
}

.bp-copy:hover {
  color: var(--accent-blue);
  background: var(--border-subtle);
}

.bp-copy:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 1px;
}

.bp-copy.copied {
  color: var(--accent-green);
}

.bp-copy.failed {
  color: #ff453a;
}

.bp-code pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  tab-size: 2;
}

.bp-code pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  white-space: inherit;
  overflow: visible;
  overflow-wrap: inherit;
  word-break: inherit;
}


/* ==========================================================================
   9. Tables
   ========================================================================== */
.bp-table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

.bp-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: calc(var(--body-size) * .92);
}

.bp-table th,
.bp-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.bp-table thead th {
  font-size: calc(var(--body-size) * .75);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.bp-table tbody th {
  color: var(--text-primary);
  white-space: nowrap;
}

.bp-table td {
  color: var(--text-secondary);
}


/* ==========================================================================
   10. Callouts
   ========================================================================== */
.bp-callout {
  margin-top: 18px;
  border-left: 4px solid var(--accent-green);
}

.bp-callout.warn {
  border-left-color: #ff9f0a;
}


/* ==========================================================================
   11. Call-to-action card + button
   ========================================================================== */
.bp-cta {
  margin-top: 48px;
  text-align: center;
  align-items: center;
  padding: 32px 24px;
}

.bp-cta h2 {
  font-size: var(--h3-size);
}

.bp-cta p {
  color: var(--text-secondary);
  max-width: 460px;
}

.bp-cta-after {
  margin-top: 12px;
  text-align: center;
  font-size: calc(var(--body-size) * .88);
  color: var(--text-secondary);
}

.bp-cta-after a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Button uses the real brand colour in both light and dark mode */
.bp-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 14px 28px;
  background: var(--brand);
  color: #fff !important;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none !important;
}

.bp-btn:hover {
  background: var(--brand-hover);
}


/* ==========================================================================
   12. CTA form: link input + button (GET form to the homepage with ?url=)
   ========================================================================== */
.bp-cta-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  margin-top: 6px;
}

.bp-cta-input {
  flex: 1 1 260px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
}

.bp-cta-input::placeholder {
  color: var(--text-muted);
}

/* Single focus indicator (outline only; the border colour does NOT change).
   Offset of -1px draws the 2px ring over the 1px border, so it reads as one
   clean ring instead of ring + border. */
.bp-cta-input:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: -1px;
}

.bp-cta-form .bp-btn {
  margin-top: 0;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  flex: 0 0 auto;
}

@media (max-width: 600px) {
  .bp-cta-form .bp-btn {
    flex: 1 1 100%;
  }
}


/* ==========================================================================
   13. FAQ items (reuse .ai-qa-* from style.css)
   Neutralise their scroll-reveal start state.
   ========================================================================== */
.bp-main .ai-qa-item {
  opacity: 1;
  transform: none;
  animation: none;
}


/* ==========================================================================
   14. Article figures
   Illustration under the analogy paragraph (white art, so keep a light
   frame in dark mode).
   ========================================================================== */
.bp-figure {
  margin: clamp(28px, 5vw, 40px) 0;
  text-align: center;
}

.bp-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

/* ==========================================================================
   15. Related posts
   Card grid at the end of the article (after the FAQ). Reuses .glass-card.
   Resets the generic .bp-section list/link styles for this block only.
   ========================================================================== */
.bp-related-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.bp-related-list li {
  display: block;
}

.bp-section a.bp-related-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  height: 100%;
  padding: 20px;
  text-decoration: none;
  color: var(--text-primary);
  border-color: var(--bp-card-border);
  transition: border-color .2s, background .2s, transform .25s cubic-bezier(.34, 1.56, .64, 1);
}

/* Hover / tap: brand-blue border + soft blue tint (no shadow, no gray) */
.bp-section a.bp-related-card:hover {
  border-color: var(--accent-blue);
  background: var(--bp-hover-bg);
  transform: translateY(-2px);
}

.bp-section a.bp-related-card:active {
  border-color: var(--accent-blue);
  background: var(--bp-active-bg);
  transform: translateY(0);
}

.bp-section a.bp-related-card:hover .bp-related-title,
.bp-section a.bp-related-card:active .bp-related-title {
  color: var(--accent-blue);
}

/* Keyboard focus: brand-blue ring */
.bp-section a.bp-related-card:focus {
  outline: none;
}

.bp-section a.bp-related-card:focus-visible {
  border-color: var(--accent-blue);
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.bp-related-title {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

.bp-related-desc {
  font-size: calc(var(--body-size) * .9);
  color: var(--text-secondary);
}

.bp-related-all {
  margin-top: 16px;
}

.bp-related-all a::after {
  content: " \2192";
}

@media (max-width: 600px) {
  .bp-related-list {
    grid-template-columns: 1fr;
  }
}