/* percolate.space — mission control theme
   Shared palette with orrery + calculator */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;800&family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400&family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
  --bg: #0a0e17;
  --card: #131a27;
  --card2: #0f1520;
  --border: #1e2a3a;
  --text: #e2e8f0;
  --dim: #64748b;
  --accent: #38bdf8;
  --accent2: #818cf8;
  --green: #34d399;
  --orange: #fbbf24;
  --red: #f87171;
  --purple: #a78bfa;
  --cyan: #22d3ee;
}

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

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ---- Starfield canvas ---- */
#starfield {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---- Scanline overlay ---- */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(10,14,23,0.03) 2px,
    rgba(10,14,23,0.03) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* ---- Nav ---- */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: rgba(10,14,23,0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 40px);
  z-index: 100;
}

.nav-brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 6px;
  list-style: none;
}

.nav-links a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--dim);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  border-color: var(--border);
  background: rgba(56,189,248,0.05);
}

/* ---- Container ---- */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
  position: relative;
  z-index: 2;
}

/* ---- Hero ---- */
.hero {
  padding: 120px 0 60px;
  text-align: center;
}

.hero-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.2s;
}

.hero h1 {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #fff;
  margin-bottom: 12px;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.35s;
}

.hero .byline {
  font-size: 0.95rem;
  color: var(--dim);
  font-style: italic;
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.5s;
}

.hero .subtitle {
  font-size: 1rem;
  color: var(--dim);
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.65s;
}

/* ---- Equation banner ---- */
.equation-banner {
  background: linear-gradient(135deg, rgba(56,189,248,0.07), rgba(167,139,250,0.07));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 28px;
  margin: 0 auto 60px;
  max-width: 480px;
  text-align: center;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.8s;
}

.equation-banner .eq-main {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
}

.equation-banner .eq-main .eq-var {
  color: var(--accent);
}

.equation-banner .eq-main .eq-sym {
  color: var(--dim);
  margin: 0 4px;
}

.equation-banner .eq-caption {
  font-size: 0.72rem;
  color: var(--dim);
  margin-top: 8px;
  letter-spacing: 0.5px;
}

/* ---- Cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 28px 24px;
  margin-bottom: 20px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  border-color: rgba(56,189,248,0.2);
  box-shadow: 0 4px 30px rgba(56,189,248,0.04);
}

.card h2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h2::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
  display: inline-block;
}

.card p {
  color: var(--text);
  margin-bottom: 12px;
  font-size: 0.95rem;
}

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

/* ---- Finding highlight ---- */
.finding {
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--text);
}

.finding strong {
  color: var(--red);
  font-weight: 700;
}

/* ---- Epistemic note ---- */
.epistemic {
  font-size: 0.78rem;
  color: var(--dim);
  line-height: 1.55;
  border-left: 2px solid var(--border);
  padding-left: 14px;
  margin-top: 4px;
}

/* ---- Phase diagram ---- */
.phase-diagram {
  margin: 0;
}

.phase-diagram img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.phase-diagram figcaption {
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--dim);
  margin-top: 12px;
}

/* ---- Tool cards ---- */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.tool-card:hover::before {
  transform: scaleX(1);
}

.tool-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 40px rgba(56,189,248,0.08);
  transform: translateY(-2px);
}

.tool-card .tool-icon {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 10px;
}

.tool-card h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
}

.tool-card .tool-desc {
  font-size: 0.85rem;
  color: var(--dim);
  line-height: 1.55;
  flex: 1;
}

.tool-card .tool-launch {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--accent);
  margin-top: 16px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.2s ease;
}

.tool-card:hover .tool-launch {
  gap: 10px;
}

/* ---- Links list ---- */
.links-list {
  list-style: none;
  padding: 0;
}

.links-list li {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(30,42,58,0.5);
  font-size: 0.9rem;
}

.links-list li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* ---- Links ---- */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #7dd3fc;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- Footer ---- */
.site-footer {
  padding: 40px 0 60px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--dim);
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

.site-footer p {
  margin-bottom: 4px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
}

.footer-links a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.5px;
  color: var(--dim);
}

.footer-links a:hover {
  color: var(--accent);
}

/* ---- Animations ---- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
}

.card:nth-child(1) { animation-delay: 0.9s; }
.card:nth-child(2) { animation-delay: 1.0s; }
.card:nth-child(3) { animation-delay: 1.1s; }
.card:nth-child(4) { animation-delay: 1.2s; }
.card:nth-child(5) { animation-delay: 1.3s; }
.card:nth-child(6) { animation-delay: 1.4s; }

.tools-grid {
  opacity: 0;
  animation: fadeUp 0.6s ease forwards 1.15s;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  html { font-size: 15px; }
  .hero { padding: 100px 0 40px; }
  .hero h1 { font-size: 2rem; }
  .tools-grid { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  .nav-brand { display: none; }
}

/* ---- Print ---- */
@media print {
  body { background: #fff; color: #111; }
  .site-nav, #starfield, body::after { display: none; }
  .card { border: 1px solid #ccc; background: #fff; box-shadow: none; }
  a { color: #111; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }
}
