/* ===== palette: midnight_aurora ===== */
:root {
  --bg: #F0EFF5;
  --surface: #FFFFFF;
  --primary: #2E1065;
  --secondary: #4C1D95;
  --accent: #6D28D9;
  --text: #1A0B3E;
  --muted: #8B85A0;
  --line: #D5D0E5;
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 1.05rem; line-height: 1.75; }

/* ===== layout ===== */
.container { max-width: 920px; margin: 0 auto; padding: 0 1.5rem; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 4rem 0; }
.section-light { background: var(--surface); }
.section-tint { background: #EDE8F5; }

/* ===== typography ===== */
h1, h2, h3 { font-family: var(--font-heading); }
h1 { font-size: 2.8rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.9rem; font-weight: 600; color: var(--primary); margin-bottom: 1.2rem; }
h3 { font-size: 1.2rem; font-weight: 600; color: var(--secondary); margin-bottom: 0.6rem; }
p { margin-bottom: 1rem; }
strong { font-weight: 600; }
em { font-style: italic; }
ul, ol { padding-left: 1.4rem; margin-bottom: 1rem; }
li { margin-bottom: 0.4rem; }

/* ===== hero ===== */
.hero {
  position: relative;
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(46,16,101,0.88) 0%, rgba(26,11,62,0.78) 100%);
}
.hero-content {
  position: relative; z-index: 2;
  text-align: center;
  max-width: 800px;
  padding: 2rem 1.5rem;
}
.hero-badge {
  display: inline-block;
  background: rgba(109,40,217,0.5);
  border: 1px solid rgba(109,40,217,0.8);
  border-radius: 20px;
  padding: 0.3rem 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
  color: #c4b5fd;
}
.hero h1 { color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,0.5); margin-bottom: 0.8rem; }
.hero-authors { font-size: 0.95rem; color: #c4b5fd; margin-bottom: 0.3rem; }
.hero-affil { font-size: 0.85rem; color: #a78bfa; margin-bottom: 1.4rem; }
.hero-teaser { font-size: 1.1rem; color: #e9d5ff; max-width: 620px; margin: 0 auto 2rem; line-height: 1.7; }

/* ===== buttons ===== */
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-block;
  padding: 0.65rem 1.6rem;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #7c3aed; transform: translateY(-2px); }
.btn-outline { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,0.6); }
.btn-outline:hover { background: rgba(255,255,255,0.1); transform: translateY(-2px); }

/* ===== cards ===== */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.6rem;
  box-shadow: 0 2px 16px rgba(46,16,101,0.1);
  border-top: 3px solid var(--accent);
}
.card-icon { font-size: 1.8rem; margin-bottom: 0.7rem; }
.card h3 { font-size: 1rem; }
.card p { font-size: 0.95rem; color: #4a4065; margin-bottom: 0; }

/* ===== abstract ===== */
.abstract-text {
  border-left: 4px solid var(--accent);
  padding: 1.2rem 1.6rem;
  background: rgba(109,40,217,0.06);
  border-radius: 0 8px 8px 0;
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text);
  margin-top: 0.5rem;
}

/* ===== two-col ===== */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; align-items: start; }
@media(max-width:680px) { .two-col { grid-template-columns: 1fr; } }

/* ===== callout ===== */
.callout {
  background: #faf5ff;
  border: 1.5px solid var(--line);
  border-left: 4px solid #f59e0b;
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.4rem;
  margin: 1.2rem 0;
}
.callout strong { color: var(--secondary); display: block; margin-bottom: 0.4rem; }

/* ===== tables ===== */
.table-wrap { overflow-x: auto; margin: 0.5rem 0 1.5rem; }
.comparison-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.comparison-table th { background: var(--primary); color: #fff; padding: 0.55rem 0.9rem; text-align: left; font-weight: 600; }
.comparison-table td { padding: 0.5rem 0.9rem; border-bottom: 1px solid var(--line); }
.comparison-table tr:last-child td { border-bottom: none; }
.comparison-table tr:hover td { background: #f3f0ff; }
.highlight-row td { background: #f3e8ff; font-weight: 500; }
.highlight-row:hover td { background: #ede0ff !important; }

/* ===== badges ===== */
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.8rem; font-weight: 500; }
.badge.good { background: #d1fae5; color: #065f46; }
.badge.bad { background: #fee2e2; color: #991b1b; }
.badge.neutral { background: #e0e7ff; color: #3730a3; }

/* ===== figures ===== */
figure { margin: 1.5rem 0; }
.fig-center { text-align: center; }
.fig-center img { max-width: 100%; border-radius: 8px; box-shadow: 0 2px 16px rgba(46,16,101,0.12); }
figcaption { font-size: 0.88rem; color: var(--muted); margin-top: 0.6rem; line-height: 1.6; }
.col-figure figure { margin: 0; }
.col-figure img { width: 100%; border-radius: 8px; box-shadow: 0 2px 12px rgba(46,16,101,0.1); }

/* ===== steps ===== */
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.4rem; margin: 2rem 0; }
.step-card {
  background: var(--surface);
  border-radius: 10px;
  padding: 1.4rem;
  box-shadow: 0 1px 12px rgba(46,16,101,0.08);
  border-top: 3px solid var(--secondary);
  position: relative;
}
.step-num {
  position: absolute;
  top: -14px; left: 1.2rem;
  background: var(--accent);
  color: #fff;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
}

/* ===== algorithm block ===== */
.algo-block { margin: 1.5rem 0; border-radius: 10px; overflow: hidden; }
.algo-title {
  background: var(--primary);
  color: #e9d5ff;
  padding: 0.6rem 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
}
.algo-code {
  background: #1A0B3E;
  color: #e0d8ef;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
  white-space: pre;
}

/* ===== theorem boxes ===== */
.theorem-box {
  background: #faf5ff;
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  padding: 1.3rem 1.6rem;
  margin: 1.5rem 0;
}
.theorem-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
}
.math-block { margin: 0.8rem 0; overflow-x: auto; }

/* ===== metrics grid ===== */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin: 1.5rem 0 2rem; }
.metric-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  border-radius: 10px;
  padding: 1.2rem;
  text-align: center;
}
.metric-val { font-size: 2.2rem; font-weight: 700; font-family: var(--font-heading); color: #e9d5ff; }
.metric-name { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #c4b5fd; }
.metric-delta { font-size: 0.78rem; color: #a78bfa; margin-top: 0.3rem; }

/* ===== details / accordion ===== */
details summary { cursor: pointer; list-style: none; }
details summary h2 { display: inline; }
details summary::marker, details summary::-webkit-details-marker { display: none; }
details summary h2::after { content: " ▼"; font-size: 0.7em; color: var(--muted); }
details[open] summary h2::after { content: " ▲"; }

/* ===== references ===== */
.references-list { font-size: 0.86rem; color: var(--muted); padding-left: 1.4rem; }
.references-list li { margin-bottom: 0.5rem; line-height: 1.5; }

/* ===== section subtitle ===== */
.section-subtitle { font-size: 1.05rem; color: var(--muted); margin-bottom: 1.5rem; }

/* ===== reveal animation ===== */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ===== flecto-note / callout / card / panel AI explanation UI ===== */
.flecto-note, .flecto-callout, .flecto-card, .flecto-panel {
  position: relative;
  margin: 1.2rem 0;
  padding: 1rem 1.2rem;
  border-radius: 8px;
  background: rgba(109,40,217,0.05);
  border: 1px solid var(--line);
}
.flecto-note { border-left: 4px solid var(--accent); font-size: 0.92rem; }
.flecto-callout { background: #f5f3ff; border: 1.5px solid #a78bfa; }
.flecto-card { background: var(--surface); box-shadow: 0 2px 10px rgba(46,16,101,0.1); border: 1px solid var(--line); }
.flecto-panel { background: #faf5ff; border: 1.5px solid var(--accent); }
.flecto-note::before, .flecto-callout::before, .flecto-card::before, .flecto-panel::before {
  content: "🤖 AI explanation";
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #60a5fa;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 0.5em;
}

/* ===== responsive ===== */
@media (max-width: 600px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  .hero { min-height: 70vh; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
}
