/*
 * gene-detail.css
 * Styles for the gene body content rendered inside .gene-body on /gene/<sku>.
 * Edit this file to adjust how the rich-text gene documentation looks.
 * All rules are scoped to .gene-body to avoid bleeding into the rest of the page.
 */

/* ─── Container ─────────────────────────────────────────────────────────────── */
.gene-body {
  max-width: 860px;
  margin: 0 auto;
  padding: 8px 0 40px;
  color: #1e293b;
  font-size: 15.5px;
  line-height: 1.75;
  font-family: inherit;
}

/* ─── Headings ──────────────────────────────────────────────────────────────── */
.gene-body h1,
.gene-body h2,
.gene-body h3,
.gene-body h4,
.gene-body h5,
.gene-body h6 {
  color: #0f172a;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 2em;
  margin-bottom: 0.55em;
}

.gene-body h1 { font-size: 2rem;   letter-spacing: -0.02em; }
.gene-body h2 { font-size: 1.45rem; letter-spacing: -0.01em; border-bottom: 2px solid #e2e8f0; padding-bottom: 0.3em; }
.gene-body h3 { font-size: 1.2rem; color: #1e3a8a; }
.gene-body h4 { font-size: 1.05rem; color: #334155; }
.gene-body h5 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.05em; color: #475569; }
.gene-body h6 { font-size: 0.875rem; color: #64748b; }

/* Anchor fragments inside headings */
.gene-body h2:target,
.gene-body h3:target {
  scroll-margin-top: 80px;
}

/* ─── Paragraphs & spacing ──────────────────────────────────────────────────── */
.gene-body p {
  margin: 0 0 1.1em;
}

.gene-body > *:first-child {
  margin-top: 0;
}

/* ─── Links ─────────────────────────────────────────────────────────────────── */
.gene-body a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(37, 99, 235, 0.35);
  transition: color 0.15s, text-decoration-color 0.15s;
}
.gene-body a:hover {
  color: #1d4ed8;
  text-decoration-color: #1d4ed8;
}

/* ─── Tables ────────────────────────────────────────────────────────────────── */
.gene-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 14px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.07), 0 0 0 1px rgba(15, 23, 42, 0.08);
}
.gene-body table thead {
  background: #1e3a8a;
  color: #fff;
}
.gene-body table thead th {
  padding: 11px 14px;
  font-weight: 600;
  text-align: left;
  font-size: 13px;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  border-bottom: none;
  white-space: nowrap;
}
.gene-body table tbody tr {
  border-bottom: 1px solid #e2e8f0;
  transition: background 0.1s;
}
.gene-body table tbody tr:last-child {
  border-bottom: none;
}
.gene-body table tbody tr:nth-child(even) {
  background: #f8fafc;
}
.gene-body table tbody tr:hover {
  background: #eff6ff;
}
.gene-body table td {
  padding: 10px 14px;
  vertical-align: top;
  color: #334155;
}
.gene-body table td strong {
  color: #0f172a;
}
/* Responsive table wrapper — wrap tables in a scrollable div if needed */
.gene-body .table-wrap,
.gene-body .scroll-table {
  overflow-x: auto;
  border-radius: 8px;
}

/* ─── Code (inline) ─────────────────────────────────────────────────────────── */
.gene-body code {
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
  font-size: 0.87em;
  background: #f1f5f9;
  color: #be185d;
  padding: 0.15em 0.45em;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

/* ─── Code blocks ───────────────────────────────────────────────────────────── */
.gene-body pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 18px 20px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.65;
  margin: 1.5em 0;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.15);
  tab-size: 2;
}
.gene-body pre code {
  /* reset inline code styles when inside a pre block */
  background: none;
  color: inherit;
  padding: 0;
  border: none;
  border-radius: 0;
  font-size: inherit;
}

/* ─── Keyboard keys ─────────────────────────────────────────────────────────── */
.gene-body kbd {
  font-family: 'SFMono-Regular', 'Consolas', monospace;
  font-size: 12px;
  background: #f8fafc;
  color: #1e293b;
  padding: 2px 6px 3px;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 5px;
  box-shadow: inset 0 -1px 0 #94a3b8;
}

/* ─── Blockquotes ───────────────────────────────────────────────────────────── */
.gene-body blockquote {
  border-left: 4px solid #3b82f6;
  background: #eff6ff;
  margin: 1.4em 0;
  padding: 12px 18px;
  border-radius: 0 8px 8px 0;
  color: #1e3a8a;
  font-style: italic;
}
.gene-body blockquote p {
  margin: 0;
}

/* ─── Lists ─────────────────────────────────────────────────────────────────── */
.gene-body ul,
.gene-body ol {
  padding-left: 1.6em;
  margin: 0.6em 0 1em;
}
.gene-body li {
  margin-bottom: 0.35em;
  padding-left: 0.25em;
}
.gene-body ul li::marker {
  color: #3b82f6;
}
.gene-body ol li::marker {
  color: #3b82f6;
  font-weight: 600;
}
/* Nested lists */
.gene-body ul ul,
.gene-body ol ol,
.gene-body ul ol,
.gene-body ol ul {
  margin: 0.3em 0 0.4em;
}

/* ─── Horizontal rule ───────────────────────────────────────────────────────── */
.gene-body hr {
  border: none;
  border-top: 2px solid #e2e8f0;
  margin: 2.5em 0;
  border-radius: 999px;
}

/* ─── Images ────────────────────────────────────────────────────────────────── */
.gene-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
  margin: 1em 0;
  display: block;
}

/* ─── Details / summary (collapsible sections) ──────────────────────────────── */
.gene-body details {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 1.2em 0;
}
.gene-body details[open] {
  background: #fff;
}
.gene-body summary {
  cursor: pointer;
  font-weight: 600;
  color: #1e3a8a;
  user-select: none;
  padding: 2px 0;
  list-style: none;
}
.gene-body summary::-webkit-details-marker { display: none; }
.gene-body summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 8px;
  font-size: 11px;
  transition: transform 0.2s;
  color: #3b82f6;
}
.gene-body details[open] summary::before {
  transform: rotate(90deg);
}
.gene-body details > *:not(summary) {
  margin-top: 10px;
}

/* ─── Callout boxes (.note, .warning, .tip, .danger) ───────────────────────── */
.gene-body .note,
.gene-body .tip,
.gene-body .warning,
.gene-body .danger,
.gene-body .info {
  border-radius: 8px;
  padding: 14px 18px;
  margin: 1.4em 0;
  font-size: 14.5px;
  line-height: 1.65;
  border-left: 4px solid;
}
.gene-body .note,
.gene-body .info {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1e3a8a;
}
.gene-body .tip {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #14532d;
}
.gene-body .warning {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #78350f;
}
.gene-body .danger {
  background: #fef2f2;
  border-color: #ef4444;
  color: #7f1d1d;
}

/* ─── Definition lists ──────────────────────────────────────────────────────── */
.gene-body dl {
  margin: 1em 0;
}
.gene-body dt {
  font-weight: 700;
  color: #0f172a;
  margin-top: 0.8em;
}
.gene-body dd {
  margin-left: 1.5em;
  color: #475569;
}

/* ─── Mark / highlight ──────────────────────────────────────────────────────── */
.gene-body mark {
  background: #fef08a;
  color: #713f12;
  border-radius: 3px;
  padding: 0 3px;
}

/* ─── Section divider labels (optional convention) ──────────────────────────── */
.gene-body .section-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 8px;
  margin-bottom: 6px;
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .gene-body {
    font-size: 15px;
    padding-bottom: 28px;
  }
  .gene-body h1 { font-size: 1.6rem; }
  .gene-body h2 { font-size: 1.25rem; }
  .gene-body table {
    font-size: 13px;
  }
  .gene-body pre {
    font-size: 12.5px;
    padding: 14px 14px;
    border-radius: 8px;
  }
}

/* ─── Content layout: body + sidebar TOC ─────────────────────────────────────
   Desktop  (≥1024px): two-column grid, TOC sticky on the right.
   Mobile / tablet    : single column, TOC collapses to a thin bar above body.
────────────────────────────────────────────────────────────────────────────── */
.gene-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  grid-template-areas: "body toc";
  gap: 0 48px;
  align-items: start;
}
.gene-layout .gene-body {
  grid-area: body;
  min-width: 0;          /* prevent flex/grid blowout */
}
.gene-layout .gene-toc {
  grid-area: toc;
  position: sticky;
  top: 88px;             /* clears the sticky site header */
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  margin: 0;             /* override inline-mode bottom margin */
  max-width: none;       /* override the 560px cap */
  border-radius: 10px;   /* all corners rounded in sidebar */
  font-size: 13px;
  /* thin custom scrollbar when list is long */
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.gene-layout .gene-toc::-webkit-scrollbar { width: 4px; }
.gene-layout .gene-toc::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

/* Below 1024px: single column; TOC goes above body and starts collapsed */
@media (max-width: 1023px) {
  .gene-layout {
    display: block;
  }
  .gene-layout .gene-toc {
    position: static;
    max-height: none;
    overflow-y: visible;
    max-width: 100%;
    margin: 0 0 1.6em;
    border-radius: 0 10px 10px 0;
    font-size: 13.5px;
  }
  /* On narrow screens the TOC is pushed into normal flow BEFORE the body
     by switching to flex-column and reversing visual order via order. */
  .gene-layout {
    display: flex;
    flex-direction: column;
  }
  .gene-layout .gene-toc  { order: 1; }
  .gene-layout .gene-body { order: 2; }
}

/* ─── Table of Contents ─────────────────────────────────────────────────────── */
.gene-toc {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #2563eb;
  border-radius: 0 10px 10px 0;
  padding: 14px 16px 16px;
  font-size: 14px;
}

.gene-toc .toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.gene-toc .toc-title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1e3a8a;
}

.gene-toc .toc-toggle {
  background: none;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 16px;
  line-height: 1.4;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.gene-toc .toc-toggle:hover {
  background: #e2e8f0;
  color: #1e293b;
}

/* Top-level list */
.gene-toc ol {
  margin: 0;
  padding: 0 0 0 1.3em;
  list-style: decimal;
}

.gene-toc ol li {
  margin: 4px 0;
  padding: 0;
  color: #334155;
}

/* Nested H3 list */
.gene-toc .toc-sub-list {
  list-style: lower-alpha;
  padding-left: 1.3em;
  margin: 3px 0 0;
}

/* Links */
.gene-toc a.toc-link {
  color: #1d4ed8;
  text-decoration: none;
  transition: color 0.15s;
  display: inline-block;
  padding: 1px 0;
}
.gene-toc a.toc-link:hover {
  color: #1e3a8a;
  text-decoration: underline;
}

/* Sub-section (H3) link — slightly muted */
.gene-toc a.toc-link.toc-sub {
  color: #3b5bdb;
  font-size: 13px;
}
.gene-toc a.toc-link.toc-sub:hover {
  color: #1e3a8a;
}

/* Active link highlight (set by IntersectionObserver in JS) */
.gene-toc a.toc-link.toc-active {
  color: #1e3a8a;
  font-weight: 700;
}
.gene-toc a.toc-link.toc-active::before {
  content: '›';
  margin-right: 4px;
  color: #2563eb;
  font-weight: 700;
}

/* Responsive: handled by .gene-layout block above */

/* ─── Activation count (social proof) ──────────────────────────────────────── */
.activation-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #475569;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 4px 10px;
  margin: 4px 0 10px;
  border: 1px solid #e2e8f0;
}
.activation-count svg { flex-shrink: 0; color: #64748b; }

/* ─── Logged-out dual CTA ────────────────────────────────────────────────────  */
.logged-out-cta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

/* ─── Trust badge row ───────────────────────────────────────────────────────── */
.product-trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 20px 0 0;
}
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 5px 12px;
}
.trust-badge svg { flex-shrink: 0; color: #3b82f6; }

/* ─── Related genes ─────────────────────────────────────────────────────────── */
.related-genes {
  margin-top: 56px;
  padding-top: 36px;
  border-top: 2px solid #e2e8f0;
}
.related-genes__heading {
  font-size: 1.2rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 18px;
  border-bottom: none;       /* override gene-body h2 rule */
  padding-bottom: 0;
}
.related-genes__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.related-gene-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  border: 1px solid rgba(15,23,42,0.09);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #fafbfc);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.related-gene-card:hover {
  box-shadow: 0 8px 24px rgba(37,99,235,0.13);
  transform: translateY(-3px);
  border-color: rgba(37,99,235,0.2);
}
.related-gene-card__thumb {
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  height: 110px;
  overflow: hidden;
}
.related-gene-card__thumb img {
  max-height: 90px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: none;    /* override .gene-body img shadow */
  margin: 0;
}
.related-gene-card__body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}
.related-gene-card__title {
  font-weight: 700;
  color: #0f172a;
  font-size: 14.5px;
  line-height: 1.3;
}
.related-gene-card__excerpt {
  font-size: 13px;
  color: #64748b;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.related-gene-card__cost {
  font-size: 12.5px;
  color: #3730a3;
  background: #eef2ff;
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  margin-top: 4px;
}

/* ─── FAQ accordion ─────────────────────────────────────────────────────────── */
.product-faq {
  margin-top: 56px;
  padding-top: 36px;
  border-top: 2px solid #e2e8f0;
  max-width: 860px;
}
.product-faq__heading {
  font-size: 1.2rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 14px;
}
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 720px;
}
.faq-item {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s;
}
.faq-item[open] { border-color: #bfdbfe; }
.faq-question {
  cursor: pointer;
  font-weight: 600;
  font-size: 14.5px;
  color: #1e293b;
  padding: 13px 16px;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.faq-question::-webkit-details-marker { display: none; }
.faq-question::after {
  content: '+';
  font-size: 18px;
  font-weight: 400;
  color: #64748b;
  flex-shrink: 0;
}
.faq-item[open] .faq-question::after { content: '−'; }
.faq-answer {
  padding: 0 16px 14px;
  font-size: 14.5px;
  color: #475569;
  line-height: 1.65;
  border-top: 1px solid #f1f5f9;
}
.faq-answer a { color: #2563eb; text-decoration: underline; }

/* ─── Sticky CTA bar ────────────────────────────────────────────────────────── */
.sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -4px 18px rgba(15,23,42,0.10);
  padding: 10px 20px;
}
.sticky-cta__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.sticky-cta__title {
  font-weight: 700;
  color: #0f172a;
  font-size: 15px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sticky-cta__price {
  font-size: 14px;
  color: #475569;
  white-space: nowrap;
}
.sticky-cta__action { flex-shrink: 0; }
.btn-sm {
  padding: 7px 16px !important;
  font-size: 13.5px !important;
}
@media (max-width: 480px) {
  .sticky-cta__title { display: none; }
  .sticky-cta__inner { justify-content: space-between; }
}
