/* ==========================================================================
   Encyclopedia -- shared across hub, category pages, and entry template
   ========================================================================== */

.encyc-search { max-width: 560px; margin: 0 auto 72px; position: relative; }
.encyc-search input { width: 100%; padding: 16px 20px 16px 50px; border-radius: 14px; border: 1px solid var(--border); background: white; font-family: var(--font-body); font-size: 16px; color: var(--ink); }
.encyc-search input::placeholder { color: var(--slate-light); }
.encyc-search input:focus { outline: none; border-color: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-tint); }
.encyc-search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--slate-light); pointer-events: none; }

.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 700px) { .cat-grid { grid-template-columns: 1fr; } }

.cat-card { border: 1px solid var(--border); border-radius: 16px; padding: 28px; background: white; transition: border-color 0.15s ease, transform 0.15s ease; display: block; }
.cat-card:hover { border-color: var(--emerald); transform: translateY(-2px); }
.cat-card .cat-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 16px; }
.cat-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.cat-card .count { font-size: 13px; color: var(--slate-light); font-family: var(--font-mono); }
.cat-card p.cat-intro { font-size: 14.5px; color: var(--slate); line-height: 1.6; margin-top: 12px; }

.cat-questions { list-style: none; padding: 16px 0 0; margin: 16px 0 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 9px; }
.cat-questions li a { font-size: 14px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.cat-questions li a:hover { color: var(--emerald); }
.cat-questions li a svg { flex-shrink: 0; opacity: 0.5; }
.cat-questions li a:hover svg { opacity: 1; }

.cat-browse-all { display: inline-block; margin-top: 18px; font-size: 13.5px; font-weight: 700; color: var(--emerald); }
.cat-browse-all:hover { text-decoration: underline; }

.featured-strip { margin-top: 80px; }

/* ---------- Category page: entry list ---------- */
.entry-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; align-items: start; }
@media (max-width: 700px) { .entry-list { grid-template-columns: 1fr; } }
.entry-card { border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; background: white; }
.entry-card:hover { border-color: var(--emerald); }
.entry-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.entry-card p { font-size: 14px; color: var(--slate); line-height: 1.5; }

.breadcrumb { font-size: 14px; color: var(--dark-slate-dim); margin-bottom: 18px; }
.breadcrumb a { color: var(--dark-slate); }
.breadcrumb a:hover { color: var(--dark-ink); }

/* ---------- Entry page ---------- */
.entry-answer { background: var(--emerald-tint); border: 1px solid var(--emerald-glow); border-radius: 16px; padding: 26px 28px; font-size: 17.5px; line-height: 1.65; color: var(--ink); }
.entry-answer b { color: var(--emerald-deep); }

.key-facts { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 10px; }
/* Was display:flex, which turned any inline <a> into its own flex item and
   split the surrounding sentence into separate boxes with gaps between them.
   The tick is positioned instead, so the text stays one continuous inline flow. */
.key-facts li { position: relative; padding-left: 28px; font-size: 15.5px; color: var(--ink); line-height: 1.5; }
.key-facts li svg { position: absolute; left: 0; top: 3px; }

.benchmark-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 15px; }
/* Wide tables (7+ columns) scroll inside their own container rather than
   pushing the page sideways on narrow screens. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 16px; }
.table-scroll .benchmark-table { margin-top: 0; min-width: 520px; }
@media (max-width: 560px) {
  .table-scroll .benchmark-table { font-size: 13.5px; }
  .table-scroll .benchmark-table th, .table-scroll .benchmark-table td { padding: 9px 10px; }
}
.benchmark-table th { text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--slate); padding: 10px 14px; border-bottom: 2px solid var(--border); }
.benchmark-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--ink); }
.benchmark-table tr:last-child td { border-bottom: none; }
.benchmark-table td.tier { font-weight: 700; color: var(--emerald); }

/* One rule between items, and none at either end: the h2 already separates the
   section above, and a doc-divider follows it below. */
.faq-mini { margin-top: 4px; }
.faq-mini-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.faq-mini-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-mini-item h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.faq-mini-item p { font-size: 16px; color: var(--slate); line-height: 1.7; }

.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 700px) { .related-grid { grid-template-columns: 1fr; } }
.related-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; font-size: 14.5px; font-weight: 700; color: var(--ink); }
.related-card:hover { border-color: var(--emerald); color: var(--emerald); }

.entry-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; color: var(--slate-light); margin-top: 16px; font-family: var(--font-mono); }

.product-tiein { background: var(--ink); border-radius: 16px; padding: 26px 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin: 40px 0 60px; }
.product-tiein p { color: rgba(255,255,255,0.85); font-size: 15.5px; }
.product-tiein p b { color: white; }

/* -------------------------------------------------------------------------
   Entry charts -- inline SVG, zero dependencies, so they render instantly
   with no external library and no load-time cost.
   ------------------------------------------------------------------------- */
.entry-chart { background: white; border: 1px solid var(--border); border-radius: 16px; padding: 24px 24px 16px; margin: 20px 0; }
.entry-chart svg { width: 100%; height: auto; }
.entry-chart-legend { display: flex; gap: 20px; margin-bottom: 4px; flex-wrap: wrap; }
.entry-chart-legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--slate); font-weight: 600; }
.entry-chart-legend .swatch { width: 14px; height: 3px; border-radius: 2px; }
.entry-chart-caption { font-size: 12.5px; color: var(--slate-light); margin-top: 8px; font-style: italic; }

/* Comparison table -- side-by-side mechanism/method comparisons */
.compare-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 15px; }
.compare-table th { text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: white; background: var(--ink); padding: 12px 16px; }
.compare-table th:first-child { border-top-left-radius: 10px; }
.compare-table th:last-child { border-top-right-radius: 10px; }
.compare-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--ink); vertical-align: top; }
.compare-table tr:nth-child(even) td { background: var(--paper-alt); }
.compare-table td:first-child { font-weight: 700; color: var(--slate); width: 160px; }

/* Simple physiology/mechanism diagram -- icon row with arrows */
.flow-diagram { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: white; border: 1px solid var(--border); border-radius: 16px; padding: 28px 20px; margin: 20px 0; flex-wrap: wrap; }
.flow-step { display: flex; flex-direction: column; align-items: center; text-align: center; flex: 1; min-width: 100px; }
.flow-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 10px; }
.flow-step .flow-label { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.flow-step .flow-sub { font-size: 11.5px; color: var(--slate-light); margin-top: 2px; }
.flow-arrow { color: var(--slate-light); flex-shrink: 0; }
@media (max-width: 640px) { .flow-diagram { flex-direction: column; } .flow-arrow { transform: rotate(90deg); } }

/* ---------- Category pages: entry cards, mirroring .cat-card ---------- */
.entry-list-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; font-family: var(--font-mono); font-size: 13px; color: var(--slate-light); }
.entry-list-meta b { color: var(--emerald-deep); font-weight: 700; }

.entry-card { border: 1px solid var(--border); border-radius: 16px; padding: 28px; background: white; transition: border-color 0.15s ease, transform 0.15s ease; display: flex; flex-direction: column; }
.entry-card:hover { border-color: var(--emerald); transform: translateY(-2px); }
.entry-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.entry-card-head h3 { font-size: 18px; font-weight: 700; margin: 0; }
.entry-card-head:hover h3 { color: var(--emerald); }
.entry-read { flex: none; font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--emerald-deep); background: var(--emerald-tint); border: 1px solid var(--emerald-glow); border-radius: 999px; padding: 5px 11px; white-space: nowrap; }
.entry-card p.entry-intro { font-size: 14.5px; color: var(--slate); line-height: 1.6; margin-top: 12px; }

.entry-questions { list-style: none; padding: 16px 0 0; margin: 16px 0 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 9px; }
.entry-questions li a { font-size: 14px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.entry-questions li a:hover { color: var(--emerald); }
.entry-questions li a svg { flex-shrink: 0; opacity: 0.5; }
.entry-questions li a:hover svg { opacity: 1; }

.entry-read-more { display: inline-block; margin-top: 18px; font-size: 13.5px; font-weight: 700; color: var(--emerald); align-self: flex-start; }
.entry-read-more:hover { text-decoration: underline; }

/* ---------- Category page: plain-language definition block ---------- */
/* Sits BELOW the entry cards, so the rule separates it from the cards above
   rather than from content beneath it. */
.cat-definition { max-width: 780px; margin: 56px 0 0; padding-top: 32px; border-top: 1px solid var(--border); }
.cat-definition h2 { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.cat-definition p { font-size: 16px; line-height: 1.65; color: var(--slate); margin-bottom: 12px; }
.cat-definition p:last-child { margin-bottom: 0; }
.cat-definition b { color: var(--ink); font-weight: 700; }
.cat-definition a { color: var(--emerald); font-weight: 600; }
.cat-definition a:hover { text-decoration: underline; }

/* ---------- Encyclopedia search results ---------- */
.encyc-search { position: relative; }
.search-results { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 8px);
  background: var(--paper-panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(15,23,42,0.12); overflow: hidden; max-height: 60vh; overflow-y: auto; text-align: left; }
.search-hit { display: block; padding: 12px 18px; border-bottom: 1px solid var(--border); text-decoration: none; }
.search-hit:last-child { border-bottom: none; }
.search-hit:hover, .search-hit.is-active { background: var(--paper-alt); }
.search-hit-title { display: block; font-size: 15px; font-weight: 700; color: var(--ink); }
.search-hit-title mark { background: var(--emerald-tint); color: var(--emerald-deep); padding: 0 1px; border-radius: 3px; }
.search-hit-cat { display: block; font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em; color: var(--emerald); margin-top: 3px; }
.search-hit-blurb { display: block; font-size: 13px; line-height: 1.5; color: var(--slate); margin-top: 5px; }
.search-empty { padding: 18px; font-size: 14.5px; color: var(--slate); text-align: left; }
.search-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cat-grid-heading { font-size: clamp(20px, 2.2vw, 26px); font-weight: 700; color: var(--ink);
  margin: 8px 0 20px; }

/* Plain bullet list inside an entry body. */
.doc-list { margin: 16px 0; padding-left: 20px; display: grid; gap: 9px; }
.doc-list li { font-size: 16px; line-height: 1.7; color: var(--slate); padding-left: 4px; }
.doc-list li::marker { color: var(--emerald); }
.doc-list li b, .doc-list li strong { color: var(--ink); }
