/*
 * The Empathy Paradox — Full Report Stylesheet
 * WCAG 2.2 AA | Dark-mode primary | Eye-strain optimized
 * Rules applied: Separation of Concerns, Modern CSS 2026 tokens,
 *   fluid typography (clamp), container layout, reduced-motion support.
 */

/* ── Design tokens ──────────────────────────────────────────────── */
:root {
  --bg-base:        #06090f;
  --bg-surface:     #0c1220;
  --bg-elevated:    #111a2c;
  --bg-highlight:   #162040;
  --border-subtle:  #1a2840;
  --border-medium:  #243658;

  --text-primary:   #c8d6e8;
  --text-body:      #8fa5bd;
  --text-muted:     #50647a;
  --text-label:     #364e62;

  --cyan:           #00c8e8;
  --cyan-dim:       rgba(0,200,232,.10);
  --cyan-border:    rgba(0,200,232,.25);
  --pink:           #e8527c;
  --pink-dim:       rgba(232,82,124,.10);
  --pink-border:    rgba(232,82,124,.28);
  --amber:          #e8a020;
  --amber-dim:      rgba(232,160,32,.09);
  --purple:         #9060e0;
  --green:          #20d090;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Monaco', 'Consolas', monospace;

  --sidebar-w: 220px;
  --content-max: 730px;
  --progress-h: 3px;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-body);
  line-height: 1.78;
  min-height: 100vh;
}

/* ── Progress bar ───────────────────────────────────────────────── */
#reading-progress {
  position: fixed;
  top: 0; left: 0;
  width: 0%;
  height: var(--progress-h);
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  z-index: 1000;
  transition: width .1s linear;
}

/* ── Skip link (a11y) ───────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: calc(-1 * var(--progress-h) - 3rem);
  left: 1rem;
  background: var(--cyan);
  color: #000;
  padding: .45rem 1rem;
  border-radius: 0 0 6px 6px;
  font-weight: 700;
  font-size: .875rem;
  z-index: 9999;
  text-decoration: none;
  transition: top .15s;
}
.skip-link:focus { top: var(--progress-h); }

/* ── Page layout ────────────────────────────────────────────────── */
.page-wrapper {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-areas: "sidebar main";
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: 1.5rem;
  gap: 0 2.5rem;
}

@media (max-width: 860px) {
  .page-wrapper {
    grid-template-columns: 1fr;
    grid-template-areas: "main";
    padding-inline: 1rem;
  }
  .sidebar { display: none; }
}

/* ── Sidebar TOC ────────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  position: sticky;
  top: calc(var(--progress-h) + 1rem);
  height: calc(100vh - var(--progress-h) - 2rem);
  overflow-y: auto;
  overflow-x: hidden;
  padding-block: 2.5rem .5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-medium) transparent;
}

.toc-label {
  font-family: var(--font-mono);
  font-size: .62rem;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: .14em;
  margin-bottom: .65rem;
  padding-left: .75rem;
  border-left: 2px solid var(--border-medium);
}

.toc-list {
  list-style: none;
  font-size: .78rem;
}

.toc-list li { margin-block: .1rem; }

.toc-list a {
  display: block;
  padding: .28rem .75rem;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  line-height: 1.4;
  transition: color .18s, border-color .18s, background .18s;
}

.toc-list a:hover {
  color: var(--text-body);
  background: var(--bg-elevated);
  border-left-color: var(--border-medium);
}

.toc-list a.active {
  color: var(--cyan);
  border-left-color: var(--cyan);
  background: var(--cyan-dim);
}

/* ── Main content ───────────────────────────────────────────────── */
main {
  grid-area: main;
  max-width: var(--content-max);
  padding-block: 2.5rem 6rem;
}

/* ── Hero ───────────────────────────────────────────────────────── */
.report-hero {
  margin-bottom: 3.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-bottom: 1.1rem;
}

.badge {
  font-family: var(--font-mono);
  font-size: .66rem;
  padding: .22rem .6rem;
  border-radius: 3px;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.badge-cyan   { background: var(--cyan-dim);  color: var(--cyan);   border: 1px solid var(--cyan-border); }
.badge-pink   { background: var(--pink-dim);  color: var(--pink);   border: 1px solid var(--pink-border); }
.badge-muted  { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border-subtle); }

.report-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.18;
  letter-spacing: -.025em;
  margin-bottom: .65rem;
}

.report-subtitle {
  font-size: clamp(.9rem, 2vw, 1.05rem);
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.65;
  margin-bottom: 2rem;
  max-width: 600px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: .85rem;
}

.hero-stat {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: .9rem 1rem;
  text-align: center;
}

.stat-val {
  display: block;
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-weight: 800;
  font-family: var(--font-mono);
  margin-bottom: .2rem;
}
.stat-val.cyan   { color: var(--cyan); }
.stat-val.pink   { color: var(--pink); }
.stat-val.amber  { color: var(--amber); }
.stat-val.purple { color: var(--purple); }
.stat-val.green  { color: var(--green); }

.stat-lbl {
  font-size: .65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-family: var(--font-mono);
}

/* ── Sections ───────────────────────────────────────────────────── */
.report-section {
  margin-bottom: 3.5rem;
  scroll-margin-top: 1.5rem;
}

.section-eyebrow {
  font-family: var(--font-mono);
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  margin-bottom: .35rem;
  opacity: .75;
}
.section-eyebrow.cyan   { color: var(--cyan); }
.section-eyebrow.pink   { color: var(--pink); }
.section-eyebrow.amber  { color: var(--amber); }
.section-eyebrow.purple { color: var(--purple); }
.section-eyebrow.green  { color: var(--green); }
.section-eyebrow.muted  { color: var(--text-label); }

h2.section-heading {
  font-size: clamp(1.1rem, 2.5vw, 1.45rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.015em;
  line-height: 1.25;
  margin-bottom: 1.2rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid var(--border-subtle);
}

h3.sub-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -.01em;
  margin: 2rem 0 .65rem;
  line-height: 1.35;
}

h3.sub-heading::before {
  content: '// ';
  color: var(--text-label);
  font-family: var(--font-mono);
  font-size: .82em;
}

p {
  margin-bottom: 1rem;
  color: var(--text-body);
}

p:last-child { margin-bottom: 0; }

sup {
  color: var(--cyan);
  font-size: .68em;
  opacity: .7;
  font-family: var(--font-mono);
}

strong { color: var(--text-primary); font-weight: 600; }

/* ── Pull quotes ────────────────────────────────────────────────── */
.pull-quote {
  margin: 1.75rem 0;
  padding: 1.1rem 1.4rem;
  background: var(--amber-dim);
  border-left: 3px solid var(--amber);
  border-radius: 0 8px 8px 0;
}

.pull-quote p {
  font-style: italic;
  color: var(--text-primary);
  font-size: .92rem;
  line-height: 1.75;
  margin-bottom: 0;
}

.pull-quote cite {
  display: block;
  margin-top: .55rem;
  font-style: normal;
  font-size: .72rem;
  color: var(--amber);
  font-family: var(--font-mono);
  opacity: .85;
}

/* ── Stat callouts ──────────────────────────────────────────────── */
.stat-callout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--cyan-dim);
  border: 1px solid var(--cyan-border);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  margin: 1.5rem 0;
}

.sc-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--cyan);
  font-family: var(--font-mono);
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.1;
}

.sc-text {
  font-size: .86rem;
  color: var(--text-body);
  line-height: 1.6;
}

.sc-text strong {
  display: block;
  margin-bottom: .2rem;
  color: var(--text-primary);
}

/* ── Callout boxes ──────────────────────────────────────────────── */
.callout {
  border-radius: 8px;
  padding: .9rem 1.15rem;
  margin: 1.5rem 0;
  font-size: .86rem;
  line-height: 1.65;
}

.callout-warn {
  background: var(--pink-dim);
  border: 1px solid var(--pink-border);
  color: var(--text-body);
}
.callout-warn strong { color: var(--pink); }

.callout-info {
  background: rgba(144,96,224,.08);
  border: 1px solid rgba(144,96,224,.25);
  color: var(--text-body);
}
.callout-info strong { color: var(--purple); }

.callout-note {
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: .78rem;
}

/* ── Tables ─────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: 8px;
  border: 1px solid var(--border-medium);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
}

thead tr { background: var(--bg-elevated); }

thead th {
  padding: .7rem 1rem;
  text-align: left;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  font-weight: 600;
  border-bottom: 1px solid var(--border-medium);
}

tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background .12s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-elevated); }

td {
  padding: .8rem 1rem;
  vertical-align: top;
  color: var(--text-body);
  line-height: 1.55;
}

td strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: .15rem;
  font-size: .85rem;
}

.risk-high     { color: var(--amber); }
.risk-extreme  { color: var(--pink); font-weight: 600; }

/* ── Timeline ───────────────────────────────────────────────────── */
.timeline {
  position: relative;
  margin: 1.25rem 0 2rem;
  padding-left: 1.75rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: .3rem;
  top: .55rem;
  bottom: .55rem;
  width: 2px;
  background: linear-gradient(to bottom, var(--cyan), var(--pink), var(--purple));
}

.tl-item {
  position: relative;
  margin-bottom: 1.4rem;
}

.tl-item::before {
  content: '';
  position: absolute;
  left: -1.46rem;
  top: .38rem;
  width: .6rem;
  height: .6rem;
  border-radius: 50%;
  background: var(--cyan);
  border: 2px solid var(--bg-base);
  box-shadow: 0 0 6px var(--cyan);
}

.tl-item:nth-child(2)::before { background: var(--pink);   box-shadow: 0 0 6px var(--pink); }
.tl-item:nth-child(3)::before { background: var(--purple); box-shadow: 0 0 6px var(--purple); }
.tl-item:nth-child(4)::before { background: var(--amber);  box-shadow: 0 0 6px var(--amber); }
.tl-item:nth-child(5)::before { background: var(--green);  box-shadow: 0 0 6px var(--green); }
.tl-item:nth-child(6)::before { background: var(--cyan);   box-shadow: 0 0 6px var(--cyan); }

.tl-date {
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: .2rem;
}
.tl-item:nth-child(2) .tl-date { color: var(--pink); }
.tl-item:nth-child(3) .tl-date { color: var(--purple); }
.tl-item:nth-child(4) .tl-date { color: var(--amber); }
.tl-item:nth-child(5) .tl-date { color: var(--green); }

.tl-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: .92rem;
  margin-bottom: .3rem;
}

.tl-body {
  font-size: .83rem;
  color: var(--text-body);
  line-height: 1.6;
}

/* ── Hypothesis cards ───────────────────────────────────────────── */
.hypo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.hypo-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.1rem;
  font-size: .83rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.hypo-status {
  font-family: var(--font-mono);
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.hypo-status.rejected  { color: var(--pink); }
.hypo-status.mixed     { color: var(--amber); }
.hypo-status.supported { color: var(--green); }

.hypo-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: .88rem;
  line-height: 1.3;
}

.hypo-detail {
  color: var(--text-muted);
  font-size: .8rem;
  line-height: 1.55;
}

/* ── Lists ──────────────────────────────────────────────────────── */
ul.r-list, ol.r-list {
  padding-left: 1.4rem;
  margin: .65rem 0 1rem;
}

ul.r-list li, ol.r-list li {
  margin-bottom: .55rem;
  color: var(--text-body);
  line-height: 1.65;
}

ul.r-list li::marker { color: var(--cyan); }
ol.r-list li::marker {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: .82em;
}

/* ── Perspectives grid ──────────────────────────────────────────── */
.perspectives {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

@media (max-width: 600px) {
  .perspectives { grid-template-columns: 1fr; }
}

.perspective-card {
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 1.25rem;
  font-size: .85rem;
  line-height: 1.65;
}

.perspective-card.optimistic {
  border: 1px solid rgba(32,208,144,.25);
  background: rgba(32,208,144,.05);
}

.perspective-card.cautious {
  border: 1px solid var(--pink-border);
  background: var(--pink-dim);
}

.perspective-card .pv-label {
  font-family: var(--font-mono);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: .6rem;
}

.perspective-card.optimistic .pv-label { color: var(--green); }
.perspective-card.cautious   .pv-label { color: var(--pink); }

.perspective-card p { font-size: .85rem; color: var(--text-body); }

/* ── Glossary ───────────────────────────────────────────────────── */
.gloss-entry {
  margin-bottom: 1.15rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
}
.gloss-entry:last-child { border-bottom: none; }

.gloss-term {
  font-weight: 700;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: .88rem;
  margin-bottom: .28rem;
}

.gloss-def {
  font-size: .85rem;
  color: var(--text-body);
  line-height: 1.65;
}

/* ── Works cited ────────────────────────────────────────────────── */
.cite-list {
  list-style: none;
  counter-reset: cite;
  padding: 0;
}

.cite-list li {
  counter-increment: cite;
  padding: .48rem 0 .48rem 2.2rem;
  position: relative;
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.6;
  border-bottom: 1px solid var(--border-subtle);
}

.cite-list li:last-child { border-bottom: none; }

.cite-list li::before {
  content: counter(cite) '.';
  position: absolute;
  left: 0;
  color: var(--text-label);
  font-family: var(--font-mono);
  font-size: .72rem;
  top: .55rem;
}

.cite-list a {
  color: var(--cyan);
  opacity: .65;
  text-decoration: none;
  word-break: break-all;
}
.cite-list a:hover { opacity: 1; text-decoration: underline; }

/* ── Bias disclosure ────────────────────────────────────────────── */
.bias-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  padding: 1.1rem 1.35rem;
  margin-top: 1.75rem;
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.bias-box strong {
  display: block;
  margin-bottom: .4rem;
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .09em;
}

/* ── Footer ─────────────────────────────────────────────────────── */
.report-footer {
  text-align: center;
  padding: 2.5rem 1rem 3rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: 3rem;
}

.report-footer p {
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: .3rem;
}

.report-footer a {
  color: var(--cyan);
  opacity: .6;
  text-decoration: none;
}
.report-footer a:hover { opacity: 1; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-top: 1.5rem;
  padding: .45rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: 5px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .78rem;
  font-family: var(--font-mono);
  transition: color .18s, border-color .18s;
}
.back-btn:hover { color: var(--cyan); border-color: var(--cyan); }

/* ── Focus (WCAG 2.2 2.4.11 / 2.4.13) ──────────────────────────── */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 3px; }

/* ── Print ──────────────────────────────────────────────────────── */
@media print {
  .sidebar, #reading-progress, .back-btn { display: none; }
  .page-wrapper { display: block; max-width: 100%; }
  body { background: #fff; color: #111; font-size: 11pt; }
  a::after { content: " (" attr(href) ")"; font-size: .75em; color: #555; }
}
