/* Havoc Labs — shared design system
   Minimal, technical, dark, engineering-log aesthetic.
   Import this on every public page; keep page-specific overrides small. */

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

:root {
  --bg: #080b0f;
  --bg-raised: #0d1116;
  --text: #e8edf2;
  --muted: rgba(232,237,242,0.55);
  --faint: rgba(232,237,242,0.38);
  --dim: rgba(232,237,242,0.18);
  --border: rgba(232,237,242,0.08);
  --border-strong: rgba(232,237,242,0.16);
  --accent: #c8d8f0;

  --status-planned: rgba(232,237,242,0.4);
  --status-building: #d8b56b;
  --status-testing: #c8d8f0;
  --status-complete: #7fd8a8;
  --status-ongoing: #8fb8e8;

  --mono: ui-monospace, 'SF Mono', 'Fira Code', 'JetBrains Mono', Menlo, Consolas, monospace;
  --sans: 'Inter', system-ui, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100svh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Nav ─────────────────────────────────────────────────────────── */

nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(8,11,15,0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
}

.brand {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.brand span { color: var(--faint); font-weight: 300; }

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

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active { color: var(--text); }

.nav-toggle { display: none; }

@media (max-width: 640px) {
  .nav-links { gap: 16px; }
  .nav-links a { font-size: 0.74rem; }
}

/* ── Page header (non-home pages) ───────────────────────────────── */

.page-head {
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 18px;
}

.page-title {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.page-lede {
  max-width: 560px;
  font-size: 0.98rem;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Hero (home only) ───────────────────────────────────────────── */

.hero {
  padding: 110px 0 80px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: appear 1.1s cubic-bezier(0.16,1,0.3,1) both;
}

.wordmark {
  font-size: clamp(2.6rem, 9vw, 4.6rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 22px;
}

.wordmark span { color: var(--dim); font-weight: 300; }

.tagline {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 20px;
}

.lede {
  max-width: 480px;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  font-weight: 300;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 30px;
}

.hero-ctas {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

@keyframes appear {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Buttons ─────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  padding: 11px 20px;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-radius: 3px;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-primary {
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
}

.btn-primary:hover { background: #dbe6f7; }

.btn-ghost {
  color: var(--muted);
  border: 1px solid var(--border-strong);
}

.btn-ghost:hover { color: var(--text); border-color: var(--faint); }

/* ── Section scaffolding ─────────────────────────────────────────── */

.section {
  padding: 60px 0;
  border-top: 1px solid var(--border);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.section-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.section-more {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
}

.section-more:hover { color: var(--text); }

/* ── Lab record cards (experiments) ─────────────────────────────── */

.lab-grid {
  display: grid;
  gap: 14px;
}

.lab-card {
  display: block;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: 3px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg-raised);
}

.lab-card:hover { border-color: var(--border-strong); }

a.lab-card:not(:hover) { background: var(--bg-raised); }

.lab-card.is-placeholder {
  background: transparent;
  cursor: default;
}

.lab-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.lab-number { color: var(--faint); }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-planned .status-dot { background: var(--status-planned); }
.status-building .status-dot { background: var(--status-building); }
.status-testing .status-dot { background: var(--status-testing); }
.status-complete .status-dot { background: var(--status-complete); }
.status-ongoing .status-dot { background: var(--status-ongoing); }

.status-label { color: var(--faint); text-transform: uppercase; }

.lab-title {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.lab-category {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.lab-desc {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
  font-weight: 300;
}

/* ── Research category cards ─────────────────────────────────────── */

.research-grid {
  display: grid;
  gap: 16px;
}

.research-card {
  padding: 26px 24px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-raised);
}

.research-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.research-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--faint);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px 9px;
}

/* ── Empty states ────────────────────────────────────────────────── */

.empty-state {
  padding: 48px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: 3px;
  text-align: center;
}

.empty-state p {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 300;
  max-width: 440px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Article body (experiment / lab note pages) ─────────────────── */

.record-head {
  padding: 56px 0 36px;
  border-bottom: 1px solid var(--border);
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 20px;
}

.record-title {
  font-size: clamp(1.6rem, 4.5vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.record-dates {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
}

.record-body {
  padding: 40px 0 80px;
  max-width: 680px;
}

.record-body h2 {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 38px 0 14px;
}

.record-body h2:first-child { margin-top: 0; }

.record-body p {
  color: var(--muted);
  font-weight: 300;
  line-height: 1.7;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.record-body ul, .record-body ol {
  color: var(--muted);
  font-weight: 300;
  line-height: 1.7;
  margin: 0 0 16px 20px;
  font-size: 0.95rem;
}

.record-body code {
  font-family: var(--mono);
  background: var(--bg-raised);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.85em;
  color: var(--accent);
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover { color: var(--text); }

/* ── Footer ──────────────────────────────────────────────────────── */

footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px 24px 60px;
  font-size: 0.75rem;
  color: var(--dim);
}

/* ── Responsive ──────────────────────────────────────────────────── */

@media (min-width: 640px) {
  .research-grid { grid-template-columns: repeat(3, 1fr); }
}
