/* Sciev site — adapted from litreview.org v3 design system, sciev palette */
:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: ui-serif, Georgia, "Times New Roman", Times, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --accent-indigo: #4f46e5;
  --accent-sky: #0ea5e9;
  --accent-violet: #8b5cf6;
  --accent-amber: #f59e0b;

  --bg: #f8f9fd;
  --bg-hero: #eef0fc;
  --bg-card: #ffffff;
  --bg-nav: rgba(248, 249, 253, 0.82);
  --bg-code: #eef1fb;

  --text: #141a2e;
  --text-muted: #5b6374;
  --text-faint: #8b93a8;

  --border: #dde2f0;

  --blob-1: rgba(79, 70, 229, 0.40);
  --blob-2: rgba(14, 165, 233, 0.34);
  --blob-3: rgba(139, 92, 246, 0.30);
}

html.dark {
  --bg: #0c0f1c;
  --bg-hero: #111527;
  --bg-card: #141827;
  --bg-nav: rgba(12, 15, 28, 0.82);
  --bg-code: #181d30;

  --text: #eef0fa;
  --text-muted: #9aa3ba;
  --text-faint: #666f88;

  --border: #262c44;

  --blob-1: rgba(79, 70, 229, 0.28);
  --blob-2: rgba(14, 165, 233, 0.22);
  --blob-3: rgba(139, 92, 246, 0.20);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background .25s ease, color .25s ease;
  line-height: 1.6;
}

a { color: var(--accent-indigo); text-decoration: none; }
a:hover { text-decoration: underline; }
html.dark a { color: #a5b4fc; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--accent-sky);
  outline-offset: 4px;
}
.skip-link {
  position: fixed;
  top: .5rem;
  left: .5rem;
  padding: .6rem 1rem;
  background: var(--bg-card);
  z-index: 100;
  transform: translateY(-200%);
}
.skip-link:focus { transform: translateY(0); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--bg-nav);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}
.nav-brand {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.nav-brand span { color: var(--accent-indigo); }
html.dark .nav-brand span { color: #a5b4fc; }
.nav-links {
  display: flex;
  gap: .5rem;
  align-items: center;
  font-size: .9rem;
  font-weight: 500;
}
.nav-links a {
  color: var(--text-muted);
  padding: .5rem .85rem;
  border-radius: 9999px;
  transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--text); background: rgba(0,0,0,.04); text-decoration: none; }
html.dark .nav-links a:hover { background: rgba(255,255,255,.06); }
.nav-links a.active { color: var(--text); background: rgba(0,0,0,.05); font-weight: 600; }
html.dark .nav-links a.active { background: rgba(255,255,255,.07); }

.theme-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9999px;
  width: 2.1rem;
  height: 2.1rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, border-color .15s;
}
.theme-btn:hover { transform: scale(1.08); border-color: var(--accent-indigo); }

@media (max-width: 600px) {
  .nav { padding: .85rem 1rem; flex-wrap: wrap; gap: .6rem; }
  .nav-brand { font-size: 1.15rem; }
  .nav-links { gap: .15rem; flex-wrap: wrap; justify-content: center; }
  .nav-links a { padding: .45rem .55rem; font-size: .82rem; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 88vh;
  padding: 5rem 2rem 4rem;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg-hero);
}
.hero-mark {
  width: 7.5rem;
  height: 7.5rem;
  position: relative;
  z-index: 1;
  margin-bottom: 1.5rem;
}
.hero-mark .ring { transform-origin: center; animation: ringPulse 6s ease-in-out infinite; }
.hero-mark .ring:nth-child(2) { animation-delay: -2s; }
.hero-mark .ring:nth-child(3) { animation-delay: -4s; }
@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: .85; }
  50% { transform: scale(1.12); opacity: .45; }
}
.hero-content { position: relative; z-index: 1; }
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 5vw, 3.4rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.025em;
  max-width: 54rem;
  margin: 0 auto 1.25rem;
}
.hero h1 .sci { color: var(--accent-indigo); }
html.dark .hero h1 .sci { color: #a5b4fc; }
.hero p {
  font-size: clamp(1rem, 2vw, 1.22rem);
  color: var(--text);
  max-width: 40rem;
  margin: 0 auto;
}
.hero .hero-kicker {
  margin-bottom: 1.15rem;
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.hero-types {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .65rem;
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}
.hero-types li {
  padding: .4rem .8rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--bg-nav);
  color: var(--text-muted);
  font-size: .85rem;
}
.hero-types code { background: transparent; color: var(--text); }
.hero-actions {
  margin-top: 2.4rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-blobs {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.hero-blobs span {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .8;
  animation: blobFloat 20s ease-in-out infinite;
}
.hero-blobs span:nth-child(1) {
  width: min(55vw, 42rem); height: min(55vw, 42rem);
  background: var(--blob-1); top: -8%; left: -10%;
}
.hero-blobs span:nth-child(2) {
  width: min(48vw, 36rem); height: min(48vw, 36rem);
  background: var(--blob-2); bottom: -12%; right: -8%;
  animation-delay: -7s;
}
.hero-blobs span:nth-child(3) {
  width: min(42vw, 30rem); height: min(42vw, 30rem);
  background: var(--blob-3); top: 35%; left: 38%;
  animation-delay: -14s; opacity: .55;
}
@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(3%, 5%) scale(1.04); }
  66% { transform: translate(-2%, 3%) scale(0.97); }
}
.hero::before {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 30%, var(--blob-1) 0%, transparent 50%),
    radial-gradient(circle at 70% 70%, var(--blob-2) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, var(--blob-3) 0%, transparent 55%);
  background-size: 140% 140%;
  filter: blur(60px);
  opacity: .55;
  animation: auroraShift 20s ease-in-out infinite alternate;
}
@keyframes auroraShift {
  0% { background-position: 0% 0%; transform: scale(1); }
  50% { background-position: 100% 60%; transform: scale(1.08); }
  100% { background-position: 0% 100%; transform: scale(1); }
}

/* scroll-triggered animations */
.scroll-animate {
  animation-fill-mode: both;
  animation-duration: 1.1s;
  animation-timing-function: cubic-bezier(.46,0,.02,1);
}
html.scroll-reveal .scroll-animate { opacity: 0; }
html.scroll-reveal .scroll-animate.animated { opacity: 1; }
html.scroll-reveal .scroll-animate:focus-within { opacity: 1; animation: none !important; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(2rem); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInScale { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* ---------- Layout ---------- */
.container {
  flex: 1;
  width: 100%;
  max-width: 70rem;
  margin: 0 auto;
  padding: 4rem 2rem 5rem;
}
.container.narrow { max-width: 50rem; }
.spaced { margin-top: 4rem; }
.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3.2vw, 2.5rem);
  font-weight: 400;
  margin: 0 0 1.5rem;
  letter-spacing: -0.015em;
}
.subtitle {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin: 0 0 2rem;
  max-width: 46rem;
  line-height: 1.65;
}
.lead { font-size: 1.1rem; color: var(--text-muted); max-width: 46rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .85rem 1.75rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: .95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s, border-color .15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-indigo), #0369a1);
  color: #fff;
  box-shadow: 0 6px 22px rgba(79, 70, 229, .28);
}
html.dark a.btn-primary { color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(79, 70, 229, .38); }
.btn-outline {
  border-color: var(--border);
  color: var(--text);
  background: rgba(255,255,255,.45);
}
html.dark .btn-outline { background: rgba(255,255,255,.05); }
.btn-outline:hover { border-color: var(--accent-indigo); color: var(--accent-indigo); transform: translateY(-2px); }

/* ---------- Cards ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.5rem; }
.feature-card {
  position: relative;
  padding: 1.75rem;
  border-radius: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
}
.feature-card::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -30%;
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  filter: blur(50px);
  opacity: .35;
  pointer-events: none;
}
.feature-card:nth-child(1)::before { background: var(--accent-indigo); }
.feature-card:nth-child(2)::before { background: var(--accent-sky); }
.feature-card:nth-child(3)::before { background: var(--accent-violet); }
.feature-card h3 { margin: .5rem 0 .5rem; font-size: 1.1rem; font-weight: 600; }
.feature-card p { margin: 0; font-size: .92rem; color: var(--text-muted); }
.feature-icon { font-size: 1.75rem; margin-bottom: .5rem; display: inline-block; }

.card {
  display: block;
  padding: 1.35rem 1.5rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: border-color .2s, transform .2s, box-shadow .2s;
  color: var(--text);
}
a.card:hover { text-decoration: none; border-color: var(--accent-indigo); transform: translateY(-4px); box-shadow: 0 14px 32px rgba(0,0,0,.07); }
html.dark a.card:hover { box-shadow: 0 14px 32px rgba(0,0,0,.25); }

/* ---------- Tables ---------- */
.table-scroll { max-width: 100%; overflow-x: auto; }
.tbl caption { text-align: left; color: var(--text-muted); padding: 0 0 .8rem; }
.table-scroll .tbl { min-width: 38rem; }
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
  margin: 1rem 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: .75rem;
  overflow: hidden;
}
.tbl th, .tbl td { padding: .55rem .8rem; text-align: left; border-bottom: 1px solid var(--border); }
.tbl th { font-weight: 600; font-size: .82rem; color: var(--text-muted); background: var(--bg-code); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .best { font-weight: 700; color: var(--accent-indigo); }
html.dark .tbl .best { color: #a5b4fc; }

/* ---------- Code ---------- */
pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: .75rem;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .85rem;
  line-height: 1.55;
}
code {
  font-family: var(--font-mono);
  background: var(--bg-code);
  border-radius: .3rem;
  padding: .12em .38em;
  font-size: .88em;
}
pre code { background: none; padding: 0; }

/* ---------- Pills / typography helpers ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  padding: .3rem .85rem;
  border-radius: 9999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  background: rgba(79, 70, 229, .10);
  color: var(--accent-indigo);
}
html.dark .pill { background: rgba(129, 140, 248, .15); color: #a5b4fc; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: .875rem; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.row-between > * { min-width: 0; }

/* ---------- Footer ---------- */
.footer {
  margin-top: auto;
  padding: 2.5rem 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: .85rem;
  color: var(--text-faint);
}
.footer a { color: var(--text-muted); }

@media (max-width: 600px) {
  .hero { min-height: auto; padding: 3rem 1.25rem; }
  .hero-mark { width: 5.5rem; height: 5.5rem; }
  .hero-actions { margin-top: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  html.scroll-reveal .scroll-animate { opacity: 1; visibility: visible; }
}
