/* Foxwatch Research Library, additional styles */

/* ---- IEEE-style citation links and reference list ---- */
.cite-link {
  display: inline-block;
  color: var(--navy);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.78em;
  vertical-align: super;
  line-height: 1;
  padding: 0 1px;
  transition: color 120ms;
}
.cite-link:hover {
  color: var(--gold-dark);
  text-decoration: underline;
}
.cite-missing {
  color: var(--alert);
  font-weight: 700;
}

.references-ieee {
  margin: 4rem 0 1rem;
  padding: 2rem 0 1rem;
  border-top: 2px solid var(--border);
}
.references-ieee h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--navy-dark);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}
.references-ieee .ieee-note {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--slate);
  margin-bottom: 1.5rem;
  max-width: 70ch;
}
.ieee-refs-list {
  list-style: none;
  counter-reset: ieee-counter;
  padding-left: 0;
  margin: 0;
}
.ieee-ref {
  counter-increment: ieee-counter;
  position: relative;
  padding: 0.6rem 0 0.6rem 3rem;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-soft);
  scroll-margin-top: 80px;
}
.ieee-ref::before {
  content: '[' counter(ieee-counter) ']';
  position: absolute;
  left: 0;
  top: 0.6rem;
  width: 2.6rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  color: var(--navy);
  font-size: 0.85rem;
}
.ieee-ref:target {
  background: rgba(184, 153, 104, 0.10);
  border-radius: var(--radius-sm);
  outline: 2px solid var(--gold);
  padding-left: 3rem;
  padding-right: 0.5rem;
  transition: background 600ms;
}
.ieee-ref a {
  color: var(--navy);
  text-decoration: none;
  border-bottom: 1px dotted var(--navy-light);
  transition: color 120ms, border-color 120ms;
}
.ieee-ref a:hover {
  color: var(--gold-dark);
  border-bottom-color: var(--gold);
}
.ieee-ref em {
  font-style: italic;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.02em;
}
.ieee-ref .ref-link {
  margin-left: 0.5em;
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold-dark);
  border-bottom: none;
}
.ieee-ref .ref-link:hover {
  color: var(--navy-dark);
  text-decoration: underline;
}

.contribution-card {
  background: var(--parchment);
  border-left: 4px solid var(--primary);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.contribution-card .section-eyebrow { margin-bottom: 0.5rem; }
.contribution-card p { margin: 0; font-size: 1.05rem; line-height: 1.55; max-width: 70ch; }

.prompt-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  color: var(--ink-muted);
  font-style: italic;
}
.prompt-block p { margin: 0; max-width: 80ch; }

.page-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0 2rem;
}
.page-thumb {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: all 150ms;
}
.page-thumb:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.page-thumb img { width: 100%; height: auto; display: block; }
.page-num {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(31, 36, 23, 0.8);
  color: white;
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  border-radius: 99px;
  font-weight: 600;
}

.downloads {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0 2rem;
}
.dl-link {
  display: block;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink);
  font-size: 0.92rem;
  transition: all 120ms;
}
.dl-link:hover { background: var(--parchment); border-color: var(--primary); }
.dl-link strong { color: var(--primary-dark); margin-right: 0.5rem; font-family: 'JetBrains Mono', ui-monospace, monospace; }

.captured-charts-block {
  background: var(--parchment);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 1.5rem 0 2rem;
}
.captured-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.captured-chart {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  transition: all 150ms;
}
.captured-chart:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.captured-chart img {
  width: 100%;
  height: auto;
  display: block;
  background: white;
}
.captured-chart-cap {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: var(--ink-muted);
  border-top: 1px solid var(--border);
  line-height: 1.35;
}
figure.md-figure-captured {
  margin: 1.75rem 0;
  text-align: center;
}
figure.md-figure-captured img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  padding: 0.5rem;
}
figure.md-figure-captured figcaption {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-top: 0.4rem;
  font-style: italic;
}

.review-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 2rem;
  margin: 1.5rem 0 2rem;
  max-height: 800px;
  overflow-y: auto;
  font-size: 0.96rem;
  line-height: 1.65;
}
.review-body h2 { font-family: 'Cormorant Garamond', serif; font-size: 1.3rem; margin: 1.5rem 0 0.5rem; color: var(--ink); }
.review-body h3 { font-family: 'Cormorant Garamond', serif; font-size: 1.1rem; margin: 1.25rem 0 0.4rem; color: var(--ink); }
.review-body h4 { font-family: 'Cormorant Garamond', serif; font-size: 1rem; margin: 1rem 0 0.4rem; color: var(--ink); }
.review-body p { margin-bottom: 0.85rem; max-width: 75ch; }
.review-body ul, .review-body ol { margin: 0.75rem 0 1rem 1.5rem; }
.review-body li { margin-bottom: 0.3rem; }
.review-body table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.9rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.review-body th { text-align: left; padding: 0.5rem 0.75rem; background: var(--parchment); font-weight: 700; }
.review-body td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
.review-body blockquote { border-left: 3px solid var(--primary); padding: 0.5rem 1rem; margin: 0.75rem 0; background: var(--parchment); font-style: italic; }
.review-body code { background: var(--parchment); padding: 0.1rem 0.35rem; border-radius: 3px; font-size: 0.88rem; }
.md-cite { color: var(--primary); font-weight: 600; vertical-align: super; font-size: 0.7rem; }
.md-figure-placeholder { background: var(--parchment); border: 1px dashed var(--border); padding: 0.5rem 0.75rem; margin: 0.75rem 0; font-style: italic; color: var(--ink-muted); font-size: 0.88rem; border-radius: var(--radius-sm); }

.related-reviews {
  background: var(--parchment);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
}
.related-reviews h3 { font-family: 'Cormorant Garamond', serif; font-size: 1.05rem; margin-bottom: 0.5rem; }
.related-reviews ul { list-style: none; margin: 0; padding: 0; }
.related-reviews li { margin-bottom: 0.4rem; }
.related-reviews a { color: var(--ink); text-decoration: none; }
.related-reviews a:hover { color: var(--primary-dark); }

.research-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 0 0 2.5rem;
}

.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin: 0 0 2rem;
  flex-wrap: wrap;
}
.filter-bar input, .filter-bar select {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
  flex: 1 1 200px;
}
.filter-bar input { flex: 2 1 320px; }

.research-group {
  margin: 2rem 0 2.5rem;
}
.research-group h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  margin-bottom: 1rem;
  color: var(--primary-dark);
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}
.research-group ul { list-style: none; padding: 0; margin: 0; }
.research-group li { margin-bottom: 1.5rem; }

.research-link {
  display: block;
  text-decoration: none;
  color: var(--ink);
}
.research-link:hover .rev-title { color: var(--primary-dark); }

.rev-num {
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--primary-dark);
  margin-right: 0.5rem;
  font-weight: 700;
}
.rev-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  transition: color 120ms;
}
.rev-meta {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
  background: var(--parchment);
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
}
.rev-contribution {
  font-size: 0.95rem;
  color: var(--ink-muted);
  margin: 0.4rem 0 0 1.5rem;
  line-height: 1.55;
  max-width: 70ch;
}

/* ============================================================
   Top findings synthesis ("so what" before the library)
   ============================================================ */
.findings-section {
  background: linear-gradient(180deg, var(--surface) 0%, var(--silver-light) 100%);
  padding: 4rem 0 3.5rem;
  border-top: 3px solid var(--navy-dark);
  border-bottom: 1px solid var(--border-light);
}

/* Plain-English term hover (for jargon like NSC, DE, GYS1, etc.) */
.findings-section abbr {
  text-decoration: none;
  border-bottom: 2px dashed var(--gold);
  background: rgba(184, 153, 104, 0.14);
  color: var(--navy-dark);
  font-weight: 600;
  font-style: normal;
  padding: 0 4px 1px;
  border-radius: 3px;
  cursor: help;
  transition: background 140ms ease, color 140ms ease, border-bottom-color 140ms ease;
}
.findings-section abbr::after {
  content: "ⓘ";
  font-size: 0.72em;
  margin-left: 3px;
  vertical-align: 0.05em;
  color: var(--gold-dark);
  opacity: 0.75;
  font-weight: 400;
}
.findings-section abbr:hover {
  background: var(--gold);
  color: white;
  border-bottom-color: var(--navy-dark);
}
.findings-section abbr:hover::after {
  color: white;
  opacity: 1;
}
/* Inside table column headers (white text on dark backgrounds) the abbr
   needs inverted defaults so it stays legible. */
.finding-table thead th abbr {
  color: white;
  background: rgba(255, 255, 255, 0.14);
  border-bottom-color: var(--gold);
}
.finding-table thead th abbr::after { color: var(--gold); }
.finding-table thead th abbr:hover {
  background: var(--gold);
  color: var(--navy-dark);
}
.finding-table thead th abbr:hover::after { color: var(--navy-dark); }

/* Tap / click popover (works on mobile, desktop, and keyboard) */
.abbr-popover {
  position: absolute;
  z-index: 9999;
  background: #1B2D4F;
  color: white;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  line-height: 1.5;
  font-weight: 400;
  font-style: normal;
  max-width: 320px;
  min-width: 180px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.18);
  border-left: 4px solid #B89968;
  animation: abbrPopFade 140ms ease-out;
}
@keyframes abbrPopFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.abbr-popover::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 22px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 7px solid #1B2D4F;
}
.abbr-popover-term {
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #B89968;
  margin-bottom: 0.35rem;
}
.abbr-popover-def {
  color: rgba(255, 255, 255, 0.95);
}
@media (max-width: 540px) {
  .abbr-popover { max-width: calc(100vw - 24px); font-size: 0.95rem; }
}

/* Headline punchline panel */
.finding-punchline {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 2fr;
  gap: 2rem;
  align-items: center;
  background: white;
  border: 1px solid var(--border-light);
  border-left: 6px solid var(--navy-dark);
  border-radius: var(--radius-md);
  padding: 1.75rem 2rem;
  margin: 2rem 0 2.5rem;
  box-shadow: var(--shadow-sm);
}
@media (max-width: 720px) {
  .finding-punchline { grid-template-columns: 1fr; gap: 1rem; }
}
.finding-punchline-num {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 4rem;
  line-height: 1;
  color: var(--navy-dark);
  letter-spacing: -0.02em;
}
.finding-punchline-label {
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--gold-dark);
  font-weight: 700;
  margin-top: 0.5rem;
}
.finding-punchline-body p {
  font-size: 1.05rem;
  line-height: 1.55;
  margin: 0 0 0.75rem;
  color: var(--ink);
}
.finding-punchline-body p:last-child { margin-bottom: 0; }
.finding-punchline-body strong { color: var(--navy-dark); }

/* Color-coded protocol comparison table (the centerpiece) */
.finding-protocol {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 2rem 2rem 1.5rem;
  margin: 0 0 3rem;
  box-shadow: var(--shadow-md);
}
.finding-protocol h3 {
  font-family: 'Cormorant Garamond', serif;
  color: var(--navy-dark);
  font-size: 1.85rem;
  margin: 0 0 0.5rem;
  letter-spacing: 0.005em;
}
.finding-protocol-lede {
  font-size: 1rem;
  color: var(--ink-soft);
  margin: 0 0 1.75rem;
  max-width: 78ch;
  line-height: 1.55;
}
.finding-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}
.finding-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  min-width: 720px;
}
.finding-table thead th {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1rem 1rem;
  text-align: left;
  vertical-align: bottom;
  color: white;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
}
.finding-table thead th:last-child { border-right: none; }
.finding-table thead th.col-param  { background: #1a1a1a; width: 22%; }
.finding-table thead th.col-pssm1  { background: #1B2D4F; }
.finding-table thead th.col-pssm2  { background: #2A6373; }
.finding-table thead th.col-epm    { background: #8B6A3F; }
.finding-table thead th .th-sub {
  display: block;
  font-weight: 400;
  font-size: 0.7rem;
  margin-top: 0.25rem;
  opacity: 0.85;
  text-transform: none;
  letter-spacing: 0.02em;
}
.finding-table tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  vertical-align: top;
  line-height: 1.5;
  background: white;
}
.finding-table tbody td:last-child { border-right: none; }
.finding-table tbody td.cell-param {
  font-weight: 600;
  color: var(--navy-dark);
  background: var(--silver-light);
  border-right: 2px solid var(--border);
}
.finding-table tbody td.cell-pssm1 { background: rgba(27, 45, 79, 0.04); }
.finding-table tbody td.cell-pssm2 { background: rgba(42, 99, 115, 0.04); }
.finding-table tbody td.cell-epm   { background: rgba(139, 106, 63, 0.04); }
.finding-table tbody tr:hover td.cell-pssm1 { background: rgba(27, 45, 79, 0.10); }
.finding-table tbody tr:hover td.cell-pssm2 { background: rgba(42, 99, 115, 0.10); }
.finding-table tbody tr:hover td.cell-epm   { background: rgba(139, 106, 63, 0.10); }
.finding-table tbody tr:last-child td { border-bottom: none; }
.finding-table tbody tr.anchor-row td {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--ink-muted);
}
.finding-cell-key {
  font-weight: 600;
  color: var(--navy-dark);
}
.finding-cell-detail {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-top: 0.2rem;
  line-height: 1.45;
  display: block;
}

.finding-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0 0;
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--border-light);
  font-size: 0.82rem;
  color: var(--ink-muted);
}
.finding-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.finding-legend-chip::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}
.legend-pssm1::before { background: #1B2D4F; }
.legend-pssm2::before { background: #2A6373; }
.legend-epm::before   { background: #8B6A3F; }

/* Dose-response chart with PSSM-safe zone */
.finding-chart {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 2.5rem;
  align-items: center;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 2rem;
  margin: 0 0 3rem;
  box-shadow: var(--shadow-sm);
}
@media (max-width: 820px) {
  .finding-chart { grid-template-columns: 1fr; gap: 1.5rem; }
}
.finding-chart-text h3 {
  font-family: 'Cormorant Garamond', serif;
  color: var(--navy-dark);
  font-size: 1.55rem;
  margin: 0 0 0.85rem;
  line-height: 1.25;
}
.finding-chart-text p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 0.85rem;
}
.finding-chart-text p:last-child { margin-bottom: 0; }
.finding-chart-text .chart-tip {
  background: rgba(94, 134, 98, 0.10);
  border-left: 4px solid #5E8662;
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.95rem;
  color: var(--ink);
  margin: 0.75rem 0;
}
.finding-chart-text .chart-tip strong { color: #3F6843; }
.finding-cite {
  font-size: 0.82rem !important;
  color: var(--ink-muted) !important;
  font-style: italic;
}
.finding-chart-svg svg {
  width: 100%;
  height: auto;
  display: block;
}

/* For-vets navy callout block */
.finding-vet {
  background: linear-gradient(135deg, var(--navy-dark) 0%, #122035 100%);
  color: white;
  border-radius: var(--radius-md);
  padding: 2.5rem 2.25rem;
  margin: 0;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.finding-vet::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold) 0%, #D4B98A 100%);
}
.finding-vet-eyebrow {
  font-family: 'Inter', sans-serif;
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  margin: 0 0 0.6rem;
}
.finding-vet h3 {
  font-family: 'Cormorant Garamond', serif;
  color: white;
  font-size: 2rem;
  margin: 0 0 1.5rem;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.finding-vet-list {
  margin: 0 0 1.5rem;
  padding: 0;
  counter-reset: vet-counter;
  list-style: none;
}
.finding-vet-list li {
  position: relative;
  margin: 0 0 1.25rem;
  padding: 0 0 1.25rem 3rem;
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.92);
  counter-increment: vet-counter;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.finding-vet-list li:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.finding-vet-list li::before {
  content: counter(vet-counter);
  position: absolute;
  left: 0;
  top: -0.15rem;
  width: 2.2rem;
  height: 2.2rem;
  background: var(--gold);
  color: var(--navy-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-weight: 700;
}
.finding-vet-list li strong {
  color: white;
  font-weight: 700;
  display: block;
  margin-bottom: 0.2rem;
}
.finding-vet-list li .vet-detail {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
  display: block;
}
.finding-vet-list li .vet-source {
  display: block;
  margin-top: 0.4rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  color: var(--gold);
  letter-spacing: 0.05em;
}
.finding-vet-foot {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.72);
  font-style: italic;
  margin: 0;
  padding-top: 0.5rem;
}
.finding-vet-foot a { color: var(--gold); }
