/* ═══════════════════════════════════════════════
   Chaossynergy — Alchemistic OS Landing Page
   The OS is the agent interface.
   ═══════════════════════════════════════════════ */

:root {
  --bg: #050508;
  --bg-alt: #0a0a12;
  --bg-card: #0e0e1a;
  --text: #e4e4e7;
  --text-dim: #7a7a88;
  --text-muted: #555566;
  --accent: #a78bfa;
  --accent-dim: #7c5cbf;
  --accent-glow: rgba(167, 139, 250, 0.15);
  --amber: #f59e0b;
  --amber-dim: #c47b08;
  --amber-glow: rgba(245, 158, 11, 0.12);
  --cyan: #22d3ee;
  --cyan-glow: rgba(34, 211, 238, 0.1);
  --border: rgba(167, 139, 250, 0.1);
  --border-light: rgba(167, 139, 250, 0.2);
  --radius: 6px;
  --radius-lg: 10px;
  --font: "SF Mono", "Fira Code", "Cascadia Code", "JetBrains Mono", monospace;
}

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

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  position: relative;
}

/* ─── Synergy Network Canvas ─── */
#synergy-net {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
}

/* ─── Ambient Glow Orbs ─── */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
}
body::before {
  width: 600px;
  height: 600px;
  top: -200px;
  left: -150px;
  background: var(--accent-glow);
  animation: orb-drift 20s ease-in-out infinite;
}
body::after {
  width: 500px;
  height: 500px;
  bottom: -150px;
  right: -100px;
  background: var(--amber-glow);
  animation: orb-drift 25s ease-in-out infinite reverse;
}

@keyframes orb-drift {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(60px, 40px); }
  66% { transform: translate(-30px, -60px); }
}

/* ─── Noise/Grain Overlay ─── */
.noise {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ─── Alchemical Grid Overlay ─── */
body {
  background-image:
    linear-gradient(rgba(167, 139, 250, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167, 139, 250, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  background-position: -1px -1px;
}

/* ─── Container ─── */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 2rem 3rem;
  position: relative;
  z-index: 1;
}

/* ─── Scroll Reveal ─── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Hero ─── */
.hero {
  text-align: center;
  margin-bottom: 6rem;
  padding-top: 2rem;
}

/* Sigil SVG — the alchemical mark */
.sigil-container {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 2.5rem;
}

.sigil-container svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 40px var(--accent-glow));
  animation: sigil-rotate 30s linear infinite;
}

@keyframes sigil-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Inner elements counter-rotate to keep text upright */
.sigil-container svg .counter-rotate {
  animation: counter-rotate 30s linear infinite;
}

@keyframes counter-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}

.hero h1 {
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--accent) 0%, var(--amber) 50%, var(--cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.75rem;
  position: relative;
  display: inline-block;
}

/* Glitch scan line across the hero title */
.hero h1::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 48%,
    rgba(167, 139, 250, 0.06) 48%,
    rgba(167, 139, 250, 0.06) 52%,
    transparent 52%
  );
  pointer-events: none;
  animation: scanline 8s linear infinite;
}

@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  margin-bottom: 1.5rem;
}

.tagline {
  display: inline-block;
  padding: 0.4rem 1.2rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.12em;
}

.tagline:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  animation: glitch 0.3s ease-in-out;
}

@keyframes glitch {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 1px); }
  40% { transform: translate(2px, -1px); }
  60% { transform: translate(-1px, 1px); }
  80% { transform: translate(1px, -1px); }
  100% { transform: translate(0); }
}

/* ─── Beta Badge ─── */
.beta-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 1rem;
  border: 1px solid var(--amber);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--amber);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.beta-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--amber-glow); }
  50% { opacity: 0.6; box-shadow: 0 0 8px 4px var(--amber-glow); }
}

/* ─── Section Headers ─── */
section {
  margin-bottom: 4.5rem;
}

section h2 {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--amber);
  margin-bottom: 1.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

section h2::before {
  content: '//';
  color: var(--text-muted);
  font-weight: 400;
  opacity: 0.6;
}

section p {
  margin-bottom: 1.2rem;
  color: var(--text);
}

/* ─── Principle Cards ─── */
.principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.principle-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
  position: relative;
  overflow: hidden;
}

.principle-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(167, 139, 250, 0.03));
  pointer-events: none;
}

.principle-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 30px var(--accent-glow), inset 0 0 30px rgba(167, 139, 250, 0.02);
  transform: translateY(-2px);
}

.principle-card .card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  color: var(--accent);
  font-size: 0.9rem;
}

.principle-card h3 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.6rem;
  text-transform: uppercase;
}

.principle-card p {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.65;
}

/* ─── Terminal Window ─── */
.terminal-window {
  background: #0a0a14;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 1.25rem 0;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-dot:nth-child(1) { background: #ff5f56; }
.terminal-dot:nth-child(2) { background: #ffbd2e; }
.terminal-dot:nth-child(3) { background: #27c93f; }

.terminal-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: auto;
  letter-spacing: 0.05em;
}

.terminal-body {
  padding: 1rem 1.25rem;
  overflow-x: auto;
}

.terminal-body pre {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #cdd6f4;
}

.terminal-body pre code {
  color: inherit;
}

.terminal-prompt {
  color: var(--cyan);
}

.terminal-cursor {
  display: inline-block;
  width: 8px;
  height: 1em;
  background: var(--accent);
  animation: cursor-blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

@keyframes cursor-blink {
  50% { opacity: 0; }
}

/* ─── Architecture Grid ─── */
.arch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.arch-layer {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
}

.arch-layer:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.arch-layer .layer-label {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.arch-layer .layer-label.host {
  background: rgba(167, 139, 250, 0.12);
  color: var(--accent);
  border: 1px solid rgba(167, 139, 250, 0.2);
}

.arch-layer .layer-label.agent {
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.arch-layer .layer-label.orchestrator {
  background: rgba(34, 211, 238, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.2);
}

.arch-layer h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.arch-layer p {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.6;
}

/* ─── Links Grid ─── */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ─── Lightbox ─── */
.lightbox {
  display: none;
  position: fixed;
  z-index: 9999;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
.lightbox.visible {
  display: flex;
}
.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 0.5rem;
  box-shadow: 0 0 40px rgba(0,0,0,0.5);
  cursor: default;
}
.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1.5rem;
  font-size: 2.5rem;
  color: #e4e4e7;
  cursor: pointer;
  z-index: 10000;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.lightbox-close:hover { opacity: 1; }

@media (max-width: 640px) {
  .lightbox-content { max-width: 95vw; max-height: 85vh; }
}

/* ─── Screenshot gallery ─── */
.screenshot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
}

.screenshot-grid figure {
  margin: 0;
  border-radius: 0.5rem;
  overflow: hidden;
  background: rgba(167, 139, 250, 0.05);
  border: 1px solid rgba(167, 139, 250, 0.15);
  transition: border-color 0.3s;
}

.screenshot-grid figure:hover {
  border-color: rgba(167, 139, 250, 0.5);
}

.screenshot-grid img {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

.screenshot-grid figcaption {
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid rgba(167, 139, 250, 0.1);
}

.link-card {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
  position: relative;
}

.link-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  color: var(--accent);
  transform: translateY(-2px);
}

.link-card .label {
  display: block;
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
}

/* ─── ADR List ─── */
.adr-list {
  list-style: none;
  margin-top: 1rem;
}

.adr-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.adr-list li:last-child { border-bottom: none; }

.adr-list .adr-num {
  color: var(--amber);
  font-weight: 600;
  font-size: 0.75rem;
  white-space: nowrap;
  letter-spacing: 0.05em;
}

.adr-list a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

.adr-list a:hover {
  color: var(--amber);
  text-decoration: underline;
}

/* ─── Inline Code ─── */
code {
  font-family: var(--font);
  font-size: 0.82rem;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

pre code {
  background: none;
  padding: 0;
}

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

a:hover {
  color: var(--amber);
}

/* ─── Footer ─── */
footer {
  text-align: center;
  padding: 3rem 2rem 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
}

footer a {
  color: var(--text-muted);
}

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

/* ─── Privacy Page ─── */
.privacy-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 4rem 2rem;
  position: relative;
  z-index: 1;
}

.privacy-page h1 {
  font-size: 1.8rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.privacy-page .prose {
  color: var(--text-dim);
  line-height: 1.8;
}

.privacy-page .prose h2 {
  font-size: 1.1rem;
  color: var(--text);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.privacy-page .prose h3 {
  font-size: 0.95rem;
  color: var(--text);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.privacy-page .prose p {
  margin-bottom: 1rem;
}

.privacy-page .prose ul {
  list-style: none;
  margin-bottom: 1rem;
}

.privacy-page .prose ul li {
  padding: 0.2rem 0;
}

.privacy-page .prose a {
  color: var(--accent);
}

.privacy-page .prose a:hover {
  color: var(--amber);
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  html { font-size: 14px; }
  .container { padding: 1.5rem 1rem 2rem; }
  .hero h1 { font-size: 2rem; }
  .sigil-container { width: 140px; height: 140px; }
  .principles { grid-template-columns: 1fr; }
  .arch-grid { grid-template-columns: 1fr; }
  .links-grid { grid-template-columns: 1fr; }
  .screenshot-grid { grid-template-columns: 1fr; }
  .terminal-body pre { font-size: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  .sigil-container svg { animation: none; }
  .hero h1::after { animation: none; }
  #synergy-net { display: none; }
}