/* === MEDS Paper — Dark Violet Theme === */
:root {
  --primary: #be9dff;
  --primary-dim: #8951f0;
  --accent: #7de9ff;
  --accent-dim: #22d3ee;
  --amber: #f59e0b;
  --bg: #170529;
  --surface: #250e3a;
  --surface-container: #2c1343;
  --surface-high: #34184c;
  --text: #f3deff;
  --text-muted: #bba1cf;
  --outline: #836c96;
  --outline-variant: #543f66;
  --error: #ff6e84;
  --font-heading: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-w: 900px;
  --radius: 8px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* === SECTIONS === */
section {
  padding: 72px 0;
}
.section-alt {
  background: #1e0831;
}

h1, h2, h3 { font-family: var(--font-heading); color: var(--text); }
h1 { font-size: 2.8rem; line-height: 1.15; font-weight: 700; }
h2 { font-size: 2rem; line-height: 1.25; font-weight: 600; margin-bottom: 28px; }
h3 { font-size: 1.5rem; line-height: 1.3; font-weight: 600; margin-top: 36px; margin-bottom: 16px; color: var(--primary); }

p { margin-bottom: 1.2em; }
a { color: var(--accent); }

/* === HERO === */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(23,5,41,0.82) 0%, rgba(37,14,58,0.94) 100%);
  z-index: 1;
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: var(--max-w);
  padding: 60px 24px 48px;
  text-align: center;
}
.hero-label {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.hero h1 {
  margin-bottom: 20px;
  text-shadow: 0 2px 40px rgba(137,81,240,0.3);
}
.hero-authors p {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.hero-affiliations {
  font-size: 0.9rem;
  color: var(--outline);
  margin-bottom: 0;
}
.hero-abstract {
  margin: 28px 0;
  background: rgba(37,14,58,0.6);
  border-left: 3px solid var(--primary);
  padding: 20px 24px;
  border-radius: 0 var(--radius) var(--radius) 0;
  text-align: left;
  font-size: 1rem;
}
.hero-abstract p { margin-bottom: 0; }

/* Metrics */
.hero-metrics {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 28px 0;
}
.metric-badge {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 28px;
  text-align: center;
  min-width: 140px;
}
.metric-cyan { border: 1px solid var(--accent); }
.metric-amber { border: 1px solid var(--amber); }
.metric-primary { border: 1px solid var(--primary); }
.metric-value {
  display: block;
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
}
.metric-cyan .metric-value { color: var(--accent); }
.metric-amber .metric-value { color: var(--amber); }
.metric-primary .metric-value { color: var(--primary); }
.metric-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Buttons */
.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
  background: var(--primary-dim);
  color: #fff;
}
.btn:hover { background: var(--primary); color: #1a0035; transform: translateY(-2px); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--outline);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface); color: var(--text); }

/* === CARDS === */
.card {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  padding: 24px 28px;
  transition: box-shadow 0.3s, transform 0.3s;
}
.card:hover {
  box-shadow: 0 8px 32px rgba(137,81,240,0.12);
  transform: translateY(-2px);
}
.card h3 { margin-top: 0; font-size: 1.15rem; }
.card-accent-cyan { border-left: 4px solid var(--accent); }
.card-accent-amber { border-left: 4px solid var(--amber); }

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

/* Lists inside cards */
.card ul, .card ol {
  padding-left: 20px;
  margin: 12px 0;
}
.card li {
  margin-bottom: 6px;
  color: var(--text-muted);
}

/* === CALLOUT === */
.callout {
  padding: 20px 24px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 24px 0;
}
.callout-cyan {
  background: var(--surface);
  border-left: 4px solid var(--accent);
}
.callout p { margin-bottom: 0; }

/* Theorem box */
.theorem-box {
  background: var(--surface);
  border: 1px solid var(--primary);
  padding: 20px 24px;
  border-radius: var(--radius);
  margin: 24px 0;
  font-family: var(--font-body);
}
.theorem-box p { margin-bottom: 0; }

/* === FIGURES === */
.figure-frame {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  padding: 16px;
  margin: 32px 0;
  overflow: hidden;
}
.figure-frame img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 0 auto;
}
.figure-frame figcaption {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-top: 12px;
}
.figure-centered { max-width: 600px; margin-left: auto; margin-right: auto; }
.table-figure img { background: #fff; padding: 8px; border-radius: 4px; }

/* === DATA TABLE === */
.compact-table-wrapper {
  max-width: 500px;
  margin: 24px auto;
}
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius);
  overflow: hidden;
}
.data-table th {
  background: var(--surface-high);
  color: var(--text);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--outline-variant);
}
.data-table td {
  background: var(--surface);
  padding: 10px 16px;
  border-bottom: 1px solid var(--outline-variant);
  font-size: 0.9rem;
  color: var(--text-muted);
}
.data-table .highlight-row td { background: var(--surface-container); }
.data-table .highlight-value { color: var(--accent); font-weight: 700; }

/* === CONCLUSION BOX === */
.conclusion-box {
  background: linear-gradient(135deg, var(--surface), var(--surface-high));
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  padding: 32px;
}
.conclusion-box ul {
  padding-left: 20px;
  margin: 16px 0 0;
}
.conclusion-box li {
  margin-bottom: 10px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* === CHIPS === */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-block;
  background: var(--surface-high);
  color: var(--primary);
  border: 1px solid var(--outline-variant);
  border-radius: 20px;
  padding: 5px 16px;
  font-size: 0.82rem;
}

/* Muted text */
.muted-text { color: var(--text-muted); }

/* === REFERENCES === */
details summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
  font-size: 1.1rem;
  padding: 8px 0;
  list-style: none;
}
details summary::before { content: "\25B6\FE0E "; font-size: 0.8rem; }
details[open] summary::before { content: "\25BC\FE0E "; }
.reference-list {
  padding-left: 28px;
  margin-top: 16px;
}
.reference-list li {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 4px 0;
  line-height: 1.5;
}

/* === FLECTO EXPLANATION UI === */
.flecto-note,
.flecto-callout,
.flecto-card,
.flecto-panel {
  margin: 20px 0;
  border-radius: var(--radius);
  padding: 20px 24px;
}
.flecto-note::before,
.flecto-callout::before,
.flecto-card::before,
.flecto-panel::before {
  content: "\1F916 AI explanation";
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #60a5fa;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 0.5em;
}
.flecto-note {
  background: var(--surface);
  border-left: 3px solid #60a5fa;
  font-size: 0.95rem;
  padding: 14px 18px;
}
.flecto-callout {
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
}
.flecto-card {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.flecto-panel {
  background: var(--surface);
  border: 1px solid var(--primary);
  padding: 24px 28px;
}
.flecto-note h4, .flecto-callout h4, .flecto-card h4, .flecto-panel h4 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  margin-bottom: 8px;
  color: var(--text);
}
.flecto-note p, .flecto-callout p, .flecto-card p, .flecto-panel p {
  margin-bottom: 0.6em;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.flecto-card ul, .flecto-panel ul {
  padding-left: 18px;
  margin: 8px 0;
}
.flecto-card li, .flecto-panel li {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 4px;
}

/* === SCROLL REVEAL === */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* === RESPONSIVE === */
@media (max-width: 600px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.6rem; }
  .hero { min-height: 80vh; }
  .hero-content { padding: 40px 16px 32px; }
  .metric-badge { min-width: 100px; padding: 12px 16px; }
  .metric-value { font-size: 1.6rem; }
  section { padding: 48px 0; }
}
