/* ============================================================
   PepRecon Research — index + article styles
   Builds on shared.css for theme tokens
   ============================================================ */

/* ---------- Research section on the root landing page ---------- */
.research-section {
  margin-top: 48px;
  padding-top: 36px;
  border-top: 1px solid var(--border);
}

.research-section__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.research-section__head h2 {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}

.research-section__head .accent {
  color: var(--accent);
}

.research-section__more {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.research-section__more:hover {
  text-decoration: underline;
}

.research-section__lead {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0 0 18px;
  line-height: 1.5;
}

.research-feature {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 20px 22px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.research-feature:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  border-left-color: var(--accent);
}

.research-feature:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.research-feature__tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 10px;
}

.research-feature__title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px;
  line-height: 1.3;
}

.research-feature__desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 12px;
}

.research-feature__cta {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

/* ---------- Main wrapper for research index + article pages ---------- */
body.research-page main {
  width: 100%;
  max-width: 880px;
  min-width: 0;
  margin: 0 auto;
  padding: 90px 22px 60px;
}

@media (max-width: 600px) {
  body.research-page main { padding: 80px 16px 50px; }
}

/* ---------- Breadcrumb ---------- */
.research-breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.research-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.research-breadcrumb a:hover {
  color: var(--accent);
}

.research-breadcrumb span {
  color: var(--text-faint);
}

/* ---------- Index header ---------- */
.research-index__head {
  margin-bottom: 36px;
}

.research-index__head h1 {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 10px;
}

.research-index__head .accent {
  color: var(--accent);
}

.research-index__lead {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0;
  max-width: 640px;
}

/* ---------- Research card grid ---------- */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.research-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.research-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.research-card:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.research-card__cover {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--bg-subtle);
}

.research-card__body {
  padding: 16px 18px 18px;
}

.research-card__date {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.research-card__title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px;
  line-height: 1.3;
}

.research-card__subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 10px;
  line-height: 1.4;
}

.research-card__summary {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 12px;
}

.research-card__tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.research-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Article header ---------- */
.research-article__head {
  margin-bottom: 36px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

/* Accent bar running down the left of the header */
.research-article__head::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 4px;
  bottom: 26px;
  width: 3px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  border-radius: 2px;
}

@media (max-width: 600px) {
  .research-article__head::before { display: none; }
}

.research-article__head h1 {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0 0 10px;
  line-height: 1.15;
}

.research-article__subtitle {
  font-size: 1.12rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 18px;
  max-width: 60ch;
}

.research-article__subtitle:empty { display: none; }

/* Metadata as monospace chips */
.research-article__meta {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.research-article__sep {
  display: none;  /* chips don't need separators */
}

.research-article__author,
.research-article__meta time,
.research-article__meta > span:last-child {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.research-article__author {
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}

/* ---------- Article body ---------- */
.research-article__body {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
}

.research-article__body h2 {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin: 44px 0 16px;
  letter-spacing: -0.02em;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Cyan section marker before each h2 */
.research-article__body h2::before {
  content: "";
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-soft);
}

.research-article__body h3 {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--text);
  margin: 28px 0 10px;
}

.research-article__body p {
  margin: 0 0 16px;
}

.research-article__body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}

.research-article__body a:hover {
  text-decoration-color: var(--accent);
}

.research-article__body strong {
  font-weight: 600;
  color: var(--text);
}

.research-article__body em {
  font-style: italic;
}

.research-article__body code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.88em;
  background: var(--bg-subtle);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text);
}

.research-article__body pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 16px 0;
}

.research-article__body pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.research-article__body ul,
.research-article__body ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.research-article__body li {
  margin-bottom: 6px;
}

.research-article__body blockquote {
  margin: 18px 0;
  padding: 12px 18px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  font-style: italic;
}

.research-article__body blockquote p:last-child { margin-bottom: 0; }

.research-article__body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 20px 0;
  display: block;
}

.research-article__body figure {
  margin: 24px 0;
}

.research-article__body figure img { margin: 0; }

.research-article__body figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
  font-style: italic;
}

/* Tables — common in research data. Wrapped by build script in .data-table-wrap */
.research-article__body .data-table-wrap {
  margin: 24px 0;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

/* The first table in an article gets the hero treatment */
.research-article__body .data-table-wrap--hero {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  position: relative;
}

.research-article__body .data-table-wrap--hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--accent), transparent 70%);
  z-index: 1;
}

.research-article__body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.92rem;
  background: transparent;
}

.research-article__body thead {
  background: var(--bg-subtle);
}

.research-article__body th {
  text-align: left;
  padding: 12px 14px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 600;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  border-bottom: 1.5px solid var(--border-strong);
}

.research-article__body th.num {
  text-align: right;
  white-space: nowrap;
}

.research-article__body td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

/* Numeric columns: monospace, right-aligned, tabular figures */
.research-article__body td.num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.9rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}

/* First column = row label, slightly emphasized */
.research-article__body td:first-child {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

/* Zebra striping for readability on wide data tables */
.research-article__body tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--bg-subtle) 45%, transparent);
}

.research-article__body tbody tr:hover {
  background: var(--accent-soft);
}

.research-article__body tr:last-child td {
  border-bottom: none;
}

/* Footnotes (auto-generated by markdown extension) */
.research-article__body .footnote,
.research-article__body sup {
  font-size: 0.78em;
}

.research-article__body .footnote-ref,
.research-article__body a.footnote-ref {
  text-decoration: none;
  margin-left: 1px;
}

.research-article__body .footnote-backref {
  margin-left: 4px;
  text-decoration: none;
}

.research-article__body div.footnote {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.research-article__body div.footnote::before {
  content: "References";
  display: block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 12px;
}

.research-article__body div.footnote ol {
  padding-left: 22px;
}

.research-article__body div.footnote li {
  margin-bottom: 8px;
  line-height: 1.55;
}

/* ---------- Finding cards (auto-generated from the Findings section) ---------- */
.research-article__body .findings-grid {
  display: grid;
  gap: 14px;
  margin: 20px 0 8px;
}

.research-article__body .finding-card {
  position: relative;
  padding: 18px 20px 18px 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.research-article__body .finding-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.research-article__body .finding-card:hover {
  border-color: var(--border-strong);
  transform: translateX(2px);
}

.research-article__body .finding-card__claim {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.research-article__body .finding-card__detail {
  font-size: 0.93rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

/* ---------- Disclaimer box (auto-wrapped from the educational-only sentence) ---------- */
.research-article__body .disclaimer-box {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin: 28px 0;
  padding: 16px 18px;
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-left: 3px solid var(--danger);
  border-radius: 10px;
}

.research-article__body .disclaimer-box__icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.research-article__body .disclaimer-box__text {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}

.research-article__body .disclaimer-box__text p { margin: 0; }

.research-article__body .disclaimer-box__text strong {
  color: var(--danger);
}

/* Download / asset callout boxes (use class="downloads" in markdown via attr_list) */
.research-article__body .downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0;
}

.research-article__body .downloads a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.research-article__body .downloads a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.research-article__body .downloads a::before {
  content: "↓";
  font-weight: 700;
  color: var(--accent);
}

/* ---------- Article footer ---------- */
.research-article__foot {
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.research-back-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
}

.research-back-link:hover {
  text-decoration: underline;
}

/* The downloads block wraps links in a <p>; flatten it to a flex row */
.research-article__body .downloads p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 600px) {
  .research-index__head h1 { font-size: 1.7rem; }
  .research-article__head h1 { font-size: 1.7rem; }
  .research-article__subtitle { font-size: 1rem; }
  .research-article__body { font-size: 0.95rem; }
  .research-article__body h2 { font-size: 1.2rem; }
  .research-grid { grid-template-columns: 1fr; }
  .research-card__cover { height: 140px; }
  .research-article__body table { font-size: 0.85rem; }
  .research-article__body th,
  .research-article__body td { padding: 8px 9px; }
  .research-article__body th {
    font-size: 0.66rem;
    letter-spacing: 0.02em;
  }
  .research-article__body td.num { font-size: 0.84rem; }
  .research-article__body .finding-card { padding: 15px 16px 15px 18px; }
  .research-article__body .finding-card__claim { font-size: 0.95rem; }
  .research-article__body .downloads a { font-size: 0.85rem; }
}
