/* =============================================================
   BIOVA THEME — Article System
   Reusable, component-based editorial layout for biova_article.
   Every component below hides itself gracefully when its markup
   is not rendered (i.e. when the underlying field is empty) —
   see template-parts/article/*.php for the conditional logic.
   ============================================================= */

/* ── Hero / Header ────────────────────────────────────────── */
.article-hero {
  padding-top: 150px;
  padding-bottom: 0;
  background: var(--ivory);
}

.article-shell {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 2rem 6rem;
}

.article-shell.has-toc-rail {
  max-width: 1080px;
  display: grid;
  grid-template-columns: 220px minmax(0, 780px);
  gap: 3rem;
  align-items: start;
}

.article-shell.has-toc-rail .article-main-col {
  max-width: 780px;
}

/* ── Breadcrumbs ──────────────────────────────────────────── */
.article-breadcrumbs {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: rgba(43,42,46,0.78);
  margin-bottom: 1.75rem;
}

.article-breadcrumbs a {
  color: rgba(43,42,46,0.78);
  font-weight: 400;
  text-decoration: none;
  transition: color 0.2s;
}
.article-breadcrumbs a:hover { color: var(--taupe); }
.article-breadcrumbs .crumb-sep { color: rgba(43,42,46,0.4); }
.article-breadcrumbs .crumb-current { color: var(--charcoal); font-weight: 500; }

/* ── Header block ─────────────────────────────────────────── */
.article-header {
  max-width: 780px;
  margin: 0 auto 2.5rem;
  padding: 0 2rem;
}

.article-cluster-label {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--taupe);
  margin-bottom: 0.9rem;
  font-weight: 400;
}

.article-title {
  font-family: 'Cormorant Garant', serif;
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  font-weight: 300;
  line-height: 1.18;
  color: var(--charcoal);
  margin-bottom: 1.1rem;
}

.article-deck {
  font-size: 1.02rem;
  font-weight: 400;
  line-height: 1.65;
  color: rgba(43,42,46,0.88);
  max-width: 620px;
  margin-bottom: 1.5rem;
}

.article-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 400;
  color: rgba(43,42,46,0.72);
  padding-top: 1.25rem;
  border-top: 1px solid var(--warm-beige);
}

.article-meta-row .dot { color: rgba(43,42,46,0.4); }

/* ── Featured image (optional) ───────────────────────────── */
.article-hero-image {
  max-width: 1080px;
  margin: 0 auto 3rem;
  padding: 0 2rem;
}
.article-hero-image img {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  display: block;
}

/* ── Direct Answer ────────────────────────────────────────── */
.article-direct-answer {
  background: var(--white);
  border-left: 3px solid var(--taupe);
  padding: 1.5rem 1.75rem;
  margin-bottom: 2.5rem;
}

.article-direct-answer .module-label {
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--taupe);
  margin-bottom: 0.6rem;
  font-weight: 500;
}

.article-direct-answer p {
  font-size: 0.98rem;
  font-weight: 400;
  line-height: 1.75;
  color: var(--charcoal);
}

/* ── Key Takeaways ────────────────────────────────────────── */
.article-takeaways {
  background: var(--white);
  border: 1px solid var(--warm-beige);
  padding: 1.75rem 2rem;
  margin-bottom: 2.5rem;
}

.article-takeaways .module-label {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--charcoal);
  margin-bottom: 1rem;
}

.article-takeaways ul {
  list-style: none;
}

.article-takeaways li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.65;
  color: rgba(43,42,46,0.88);
  margin-bottom: 0.7rem;
}
.article-takeaways li:last-child { margin-bottom: 0; }

.article-takeaways li::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--taupe);
  flex-shrink: 0;
  margin-top: 0.5rem;
}

/* ── Table of Contents ────────────────────────────────────── */
.article-toc {
  margin-bottom: 2.5rem;
}

.article-toc-inline {
  border: 1px solid var(--warm-beige);
  background: var(--white);
}

.article-toc-inline summary {
  cursor: pointer;
  padding: 1rem 1.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--charcoal);
  font-weight: 500;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.article-toc-inline summary::-webkit-details-marker { display: none; }
.article-toc-inline summary::after {
  content: '+';
  font-size: 1rem;
  color: var(--taupe);
  font-weight: 300;
  transition: transform 0.2s;
}
.article-toc-inline[open] summary::after { transform: rotate(45deg); }

.article-toc-inline ol {
  list-style: none;
  padding: 0 1.25rem 1.25rem;
}
.article-toc-inline li { margin-bottom: 0.55rem; }
.article-toc-inline a {
  font-size: 0.84rem;
  font-weight: 400;
  color: rgba(43,42,46,0.76);
  text-decoration: none;
  line-height: 1.5;
  transition: color 0.2s;
}
.article-toc-inline a:hover { color: var(--taupe); }

/* Sticky rail variant — desktop only, wide viewports */
.article-toc-rail {
  display: none;
}

@media (min-width: 1300px) {
  .article-toc-rail {
    display: block;
    position: sticky;
    top: 110px;
  }
  .article-toc-rail .rail-label {
    font-size: 0.64rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--taupe);
    margin-bottom: 0.9rem;
    font-weight: 500;
  }
  .article-toc-rail ol { list-style: none; }
  .article-toc-rail li { margin-bottom: 0.65rem; }
  .article-toc-rail a {
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.5;
    color: rgba(43,42,46,0.72);
    text-decoration: none;
    transition: color 0.2s;
    display: block;
    border-left: 2px solid transparent;
    padding-left: 0.8rem;
  }
  .article-toc-rail a:hover,
  .article-toc-rail a.is-active {
    color: var(--charcoal);
    border-left-color: var(--taupe);
  }
  /* Hide the inline collapsible version once the rail takes over */
  .has-toc-rail .article-toc-inline-wrap { display: none; }
}

/* ── Article Body ─────────────────────────────────────────── */
.article-body {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.85;
  color: var(--charcoal);
}

.article-body > * + * { margin-top: 1.25rem; }

.article-body h2 {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.7rem;
  font-weight: 400;
  color: var(--charcoal);
  line-height: 1.25;
  margin-top: 2.75rem;
  margin-bottom: 0.25rem;
  scroll-margin-top: 110px;
}

.article-body h3 {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.28rem;
  font-weight: 400;
  color: var(--charcoal);
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.25rem;
  scroll-margin-top: 110px;
}

.article-body p { margin-bottom: 0; }

.article-body ul,
.article-body ol {
  padding-left: 1.4rem;
}

.article-body li { margin-bottom: 0.5rem; line-height: 1.75; }

.article-body a {
  color: var(--charcoal);
  text-decoration: underline;
  text-decoration-color: var(--taupe);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.2s;
}
.article-body a:hover { color: var(--taupe); }

.article-body strong { color: var(--charcoal); font-weight: 500; }

.article-body blockquote {
  border-left: 2px solid var(--warm-beige);
  padding-left: 1.5rem;
  font-style: italic;
  color: rgba(43,42,46,0.78);
}

/* ── Definition Module ────────────────────────────────────── */
.article-definition {
  border: 1px solid var(--warm-beige);
  background: var(--white);
  padding: 1.25rem 1.5rem;
}

.article-definition .term-label {
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--taupe);
  margin-bottom: 0.5rem;
}

.article-definition .term-name {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--charcoal);
  margin-bottom: 0.4rem;
}

.article-definition p {
  font-size: 0.86rem;
  font-weight: 400;
  line-height: 1.65;
  color: rgba(43,42,46,0.84);
  margin-bottom: 0.5rem;
}

.article-definition .term-link {
  font-size: 0.78rem;
  color: var(--taupe);
  text-decoration: none;
  border-bottom: 1px solid var(--taupe);
  padding-bottom: 1px;
}

/* ── Evidence Callout ─────────────────────────────────────── */
.article-evidence {
  background: var(--white);
  border-left: 3px solid #BDB7C9;
  padding: 1.5rem 1.75rem;
}

.article-evidence .module-label {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--charcoal);
  margin-bottom: 0.6rem;
}

.article-evidence p {
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.7;
  color: rgba(43,42,46,0.90);
}

.article-evidence .evidence-tag {
  display: inline-block;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #5B5563;
  background: rgba(200,195,210,0.4);
  padding: 0.3rem 0.7rem;
  margin-bottom: 0.75rem;
  font-weight: 500;
}

/* ── Safety / Important Context ───────────────────────────── */
.article-safety {
  background: var(--white);
  border-left: 3px solid var(--taupe);
  padding: 1.5rem 1.75rem;
}

.article-safety .module-label {
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--taupe);
  margin-bottom: 0.6rem;
  font-weight: 500;
}

.article-safety p {
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.7;
  color: rgba(43,42,46,0.85);
}

/* ── Comparison Table ─────────────────────────────────────── */
.article-comparison { overflow-x: auto; }

.article-comparison .table-caption {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--charcoal);
  margin-bottom: 1rem;
}

.article-comparison table {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--warm-beige);
  border-collapse: collapse;
  min-width: 480px;
}

.article-comparison th,
.article-comparison td {
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  border-bottom: 1px solid var(--warm-beige);
}

.article-comparison thead th {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--taupe);
  font-weight: 500;
  background: var(--white);
  border-bottom: 2px solid var(--taupe);
}

.article-comparison tbody th {
  font-weight: 500;
  color: var(--charcoal);
  white-space: nowrap;
}

.article-comparison td { font-weight: 400; color: rgba(43,42,46,0.85); }

/* ── How to Choose ────────────────────────────────────────── */
.article-how-to-choose {
  background: var(--white);
  border: 1px solid var(--warm-beige);
}

.article-how-to-choose .module-label {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--charcoal);
  padding: 1.25rem 1.5rem 0.5rem;
}

.htc-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  border-top: 1px solid var(--warm-beige);
}

.htc-row .htc-label {
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--taupe);
  font-weight: 500;
}

.htc-row .htc-detail {
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.6;
  color: rgba(43,42,46,0.90);
}

@media (max-width: 600px) {
  .htc-row { grid-template-columns: 1fr; gap: 0.3rem; }
}

/* ── Product Module ───────────────────────────────────────── */
.article-product {
  background: var(--charcoal);
  color: var(--ivory);
  padding: 2rem 2.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.article-product .module-label {
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--taupe);
  margin-bottom: 0.5rem;
}

.article-product .product-name {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 0.35rem;
}

.article-product .product-blurb {
  font-size: 0.85rem;
  color: rgba(242,237,230,0.70);
  max-width: 420px;
  line-height: 1.55;
}

.article-product .product-link {
  flex-shrink: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ivory);
  text-decoration: none;
  border-bottom: 1px solid var(--taupe);
  padding-bottom: 2px;
  white-space: nowrap;
}
.article-product .product-link:hover { color: var(--warm-beige); }

/* ── FAQ ───────────────────────────────────────────────────── */
.article-faq .module-title {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--charcoal);
  margin-bottom: 1.25rem;
}

.faq-item {
  border-bottom: 1px solid var(--warm-beige);
}
.faq-item:first-of-type { border-top: 1px solid var(--warm-beige); }

.faq-item summary {
  cursor: pointer;
  padding: 1.1rem 0;
  font-size: 0.92rem;
  color: var(--charcoal);
  font-weight: 400;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--taupe);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: rotate(45deg); }

.faq-item p {
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.7;
  color: rgba(43,42,46,0.90);
  padding-bottom: 1.25rem;
  max-width: 640px;
}

/* ── Sources / References ─────────────────────────────────── */
.article-sources .module-title {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--charcoal);
  margin-bottom: 1.1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--warm-beige);
}

.article-sources ol {
  list-style: none;
  counter-reset: source-counter;
}

.article-sources li {
  counter-increment: source-counter;
  display: flex;
  gap: 0.75rem;
  font-size: 0.82rem;
  line-height: 1.6;
  color: rgba(43,42,46,0.62);
  margin-bottom: 0.7rem;
}

.article-sources li::before {
  content: counter(source-counter) '.';
  color: var(--taupe);
  flex-shrink: 0;
  font-weight: 500;
}

.article-sources a {
  color: rgba(43,42,46,0.62);
  text-decoration: underline;
  text-decoration-color: var(--warm-beige);
  text-underline-offset: 2px;
}
.article-sources a:hover { color: var(--taupe); }

/* ── Author / Editorial Review ────────────────────────────── */
.article-authorship {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2.5rem;
  padding: 1.5rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--warm-beige);
  border-bottom: 1px solid var(--warm-beige);
}

.article-authorship .who-block { font-size: 0.8rem; font-weight: 400; line-height: 1.5; }
.article-authorship .who-label {
  display: block;
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(43,42,46,0.58);
  margin-bottom: 0.2rem;
}
.article-authorship .who-name { color: var(--charcoal); font-weight: 500; }
.article-authorship .who-credentials { font-weight: 400; color: rgba(43,42,46,0.74); }
.article-authorship a.who-name { text-decoration: none; }
.article-authorship a.who-name:hover { color: var(--taupe); }

/* ── Related Knowledge ────────────────────────────────────── */
.article-related {
  margin-top: 3rem;
}

.article-related .module-title {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--charcoal);
  margin-bottom: 1.5rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.related-card {
  background: var(--white);
  border: 1px solid var(--warm-beige);
  padding: 1.25rem 1.4rem;
  text-decoration: none;
  display: block;
  transition: border-color 0.2s, transform 0.2s;
}
.related-card:hover {
  border-color: var(--taupe);
  transform: translateY(-2px);
}

.related-card .related-cluster {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--taupe);
  margin-bottom: 0.5rem;
}

.related-card .related-title {
  font-family: 'Cormorant Garant', serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--charcoal);
  line-height: 1.3;
}

/* ── Parent Topic Navigation ──────────────────────────────── */
.article-parent-nav {
  margin-top: 2.5rem;
}

.article-parent-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  color: var(--taupe);
  text-decoration: none;
}
.article-parent-nav a:hover { color: #8f7868; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .article-hero { padding-top: 120px; }
  .article-shell,
  .article-header,
  .article-breadcrumbs { padding-left: 1.5rem; padding-right: 1.5rem; }
  .article-shell.has-toc-rail { grid-template-columns: 1fr; }
  .article-direct-answer,
  .article-takeaways,
  .article-evidence,
  .article-safety { padding: 1.25rem 1.4rem; }
  .article-product { flex-direction: column; align-items: flex-start; text-align: left; }
  .related-grid { grid-template-columns: 1fr; }
}

/* ── Mobile overflow fix ─────────────────────────────────── */
@media (max-width: 900px) {

  /* Allow the article grid/content column to shrink to viewport width */
  .article-shell.has-toc-rail {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-main-col,
  .article-shell.has-toc-rail .article-main-col,
  .article-body {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  /* Keep wide comparison tables scrollable INSIDE the article */
  .article-comparison {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Prevent images / Gutenberg wrappers from creating overflow */
  .article-body img,
  .article-body figure,
  .article-main-col img {
    max-width: 100%;
    height: auto;
  }
}

/* Cleaner breadcrumbs on narrow phones */
@media (max-width: 600px) {

  .article-breadcrumbs {
    gap: 0.4rem 0.5rem;
  }

  .article-breadcrumbs .crumb-current {
    flex-basis: 100%;
    overflow-wrap: anywhere;
  }
}