/* ============ tokens ============ */
:root {
  --bg: #14161b;
  --bg-elevated: #1a1d24;
  --bg-card: #1e2229;
  --bg-card-hover: #242832;
  --border: #2a2f3a;
  --border-soft: #23262f;

  --text: #eae8e3;
  --text-dim: #9aa0ac;
  --text-faint: #656b78;

  --teal: #6fb3a0;
  --teal-soft: rgba(111, 179, 160, 0.14);
  --amber: #d8a662;
  --amber-soft: rgba(216, 166, 98, 0.14);
  --coral: #c9806d;
  --coral-soft: rgba(201, 128, 109, 0.14);
  --violet: #9a8fc9;
  --violet-soft: rgba(154, 143, 201, 0.14);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 20px 60px -20px rgba(0,0,0,0.55);

  font-size: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand {
  font-family: 'Sora', 'Inter', sans-serif;
  letter-spacing: -0.01em;
  margin: 0;
}

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  padding: 0.1em 0.45em;
  border-radius: 5px;
  color: var(--text);
}

a { color: inherit; text-decoration: none; }

main { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ============ background field ============ */
.bg-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--bg);
}
.blob {
  position: absolute;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.16;
  will-change: transform;
}
.blob-teal   { background: var(--teal);  top: -10%; left: -10%; animation: drift1 26s ease-in-out infinite; }
.blob-amber  { background: var(--amber); top: 30%;  right: -15%; animation: drift2 32s ease-in-out infinite; }
.blob-coral  { background: var(--coral); bottom: -20%; left: 20%; animation: drift3 28s ease-in-out infinite; }

@keyframes drift1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(6%, 8%); } }
@keyframes drift2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-8%, 6%); } }
@keyframes drift3 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(5%, -7%); } }

@media (prefers-reduced-motion: reduce) {
  .blob { animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ============ nav ============ */
#topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(20, 22, 27, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand { font-size: 1.05rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.brand span { color: var(--teal); }
.brand.small { font-size: 1rem; margin-bottom: 6px; }

.nav-links { list-style: none; display: flex; gap: 22px; margin: 0; padding: 0; flex: 1; flex-wrap: wrap; }
.nav-links a {
  font-size: 0.88rem;
  color: var(--text-dim);
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.is-active { color: var(--teal); }

.nav-cta {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.nav-cta:hover { border-color: var(--teal); background: var(--teal-soft); }

.nav-progress {
  height: 2px;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  width: 0%;
  transition: width 0.1s linear;
}

/* ============ hero ============ */
#hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: 110px 24px 90px;
}
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--teal);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 14px;
}
#hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 700;
  line-height: 1.05;
  margin-bottom: 22px;
}
.grad-text {
  background: linear-gradient(100deg, var(--teal), var(--amber) 60%, var(--coral));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede {
  max-width: 620px;
  font-size: 1.1rem;
  color: var(--text-dim);
}
.hero-actions { display: flex; gap: 14px; margin-top: 30px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--teal); color: #10221d; box-shadow: 0 10px 30px -8px rgba(111,179,160,0.5); }
.btn-primary:hover { box-shadow: 0 14px 34px -8px rgba(111,179,160,0.65); }
.btn-ghost { border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--text-dim); }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 64px;
  border-top: 1px solid var(--border-soft);
  padding-top: 28px;
}
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-num { font-family: 'Sora', sans-serif; font-size: 2rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.82rem; color: var(--text-faint); }

@media (max-width: 720px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .nav-links { display: none; }
}

/* ============ sections ============ */
section { padding: 70px 0; border-top: 1px solid var(--border-soft); }
.section-head { max-width: 680px; margin-bottom: 36px; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 10px 0 12px; }
.section-sub { color: var(--text-dim); font-size: 1rem; margin: 0; }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ============ filters ============ */
.filters { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}
.filter-btn:hover { color: var(--text); border-color: var(--text-dim); }
.filter-btn.is-active { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); }

/* ============ card grid ============ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
}
.app-card:hover {
  transform: translateY(-3px);
  background: var(--bg-card-hover);
  border-color: var(--tint, var(--teal));
  box-shadow: var(--shadow);
}
.app-card.is-hidden { display: none; }
.app-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.app-card h3 { font-size: 1.05rem; }
.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.tag-core   { background: var(--teal-soft); color: var(--teal); }
.tag-legacy { background: var(--coral-soft); color: var(--coral); }
.tag-new    { background: var(--amber-soft); color: var(--amber); }
.app-card p { margin: 0; font-size: 0.88rem; color: var(--text-dim); flex: 1; }
.app-card .badge { font-size: 0.76rem; color: var(--text-faint); font-family: 'JetBrains Mono', monospace; }
.app-card .goto { font-size: 0.82rem; color: var(--teal); font-weight: 600; }

/* ============ mission ============ */
.mission-quote {
  margin: 0 0 18px;
  padding: 0;
  border: none;
  font-family: 'Sora', sans-serif;
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
.mission-quote strong {
  background: linear-gradient(100deg, var(--teal), var(--amber) 60%, var(--coral));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.mission-sub { max-width: 680px; color: var(--text-dim); font-size: 1rem; margin: 0 0 34px; }
.flywheel-label { font-size: 0.82rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; font-family: 'JetBrains Mono', monospace; margin: 0 0 12px; }
.flow-wheel .flow-step { cursor: default; font-size: 0.82rem; }
.flow-wheel .flow-step:hover { border-color: var(--border); color: var(--text); }
.flow-wheel .flow-step.is-repeat { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }

.habits-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.habit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
}
.habit-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--teal);
  display: block;
  margin-bottom: 10px;
}
.habit-card h3 { font-size: 0.98rem; margin-bottom: 8px; }
.habit-card p { font-size: 0.85rem; color: var(--text-dim); margin: 0; }

/* ============ flow (files) ============ */
.flow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.flow-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  flex: 1 1 160px;
  text-align: center;
}
.flow-step:hover { border-color: var(--teal); color: var(--teal); }
.flow-step.is-active { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); }
.flow-arrow { color: var(--text-faint); font-size: 1.2rem; flex: 0 0 auto; }
.flow-detail {
  margin-top: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  color: var(--text-dim);
  font-size: 0.95rem;
  min-height: 60px;
}
.flow-detail strong { color: var(--text); }

/* ============ hosting ============ */
.hosting-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.host-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--tint);
  border-radius: var(--radius);
  padding: 22px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.host-panel:hover { background: var(--bg-card-hover); }
.host-panel-top { display: flex; justify-content: space-between; align-items: center; }
.host-panel h3 { font-size: 1.15rem; }
.host-panel .chev { color: var(--text-faint); transition: transform 0.2s ease; }
.host-panel.is-open .chev { transform: rotate(180deg); }
.host-panel-sub { color: var(--text-dim); font-size: 0.88rem; margin: 6px 0 0; }
.host-panel-body { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.host-panel.is-open .host-panel-body { max-height: 500px; }
.host-panel-list { margin: 16px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.host-panel-list li { font-size: 0.86rem; color: var(--text-dim); padding-left: 16px; position: relative; }
.host-panel-list li::before { content: '›'; position: absolute; left: 0; color: var(--tint); font-weight: 700; }
.host-links { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ============ link-out chip ============ */
.link-out {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.link-out:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-soft); }

/* ============ pipeline ============ */
.pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-bottom: 30px;
}
.pipe-node {
  flex: 0 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  min-width: 140px;
  text-align: center;
  transition: all 0.15s ease;
  position: relative;
}
.pipe-node.has-link { cursor: pointer; }
.pipe-node.has-link:hover { border-color: var(--amber); background: var(--amber-soft); }
.pipe-node .pipe-title { font-weight: 600; font-size: 0.88rem; }
.pipe-node .pipe-sub { font-size: 0.72rem; color: var(--text-faint); margin-top: 4px; }
.pipe-connector { color: var(--text-faint); align-self: center; font-size: 1.1rem; flex: 0 0 auto; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.info-card h3 { margin-bottom: 8px; font-size: 1.05rem; }
.info-card p { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 14px; }

@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }

/* ============ data grid (redis/rabbit) ============ */
.data-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.data-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--tint);
  border-radius: var(--radius);
  padding: 22px;
}
.data-card h3 { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; margin-bottom: 10px; }
.data-card ul { margin: 12px 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.data-card li { font-size: 0.87rem; color: var(--text-dim); padding-left: 16px; position: relative; }
.data-card li::before { content: '›'; position: absolute; left: 0; color: var(--tint); font-weight: 700; }

/* ============ cdn layers ============ */
.layers { display: flex; flex-direction: column; gap: 10px; }
.layer {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.15s ease;
}
.layer:hover { transform: translateX(4px); }
.layer-index {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-faint);
  flex: 0 0 24px;
}
.layer-body { flex: 1; }
.layer-title { font-weight: 600; font-size: 0.94rem; }
.layer-desc { font-size: 0.84rem; color: var(--text-dim); margin-top: 2px; }

/* ============ timeline (e2e) ============ */
.timeline { display: flex; flex-direction: column; gap: 0; margin-bottom: 26px; }
.tl-item { display: flex; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--border-soft); }
.tl-item:last-child { border-bottom: none; }
.tl-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--amber);
  flex: 0 0 90px;
  padding-top: 2px;
}
.tl-body h4 { margin: 0 0 4px; font-size: 0.96rem; }
.tl-body p { margin: 0; font-size: 0.86rem; color: var(--text-dim); }

.callout {
  background: var(--coral-soft);
  border: 1px solid rgba(201,128,109,0.35);
  border-radius: var(--radius);
  padding: 20px 22px;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.7;
}
.callout .link-out { margin: 10px 8px 0 0; }

/* ============ footer ============ */
footer { border-top: 1px solid var(--border-soft); padding: 50px 0 60px; }
.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  gap: 30px;
  flex-wrap: wrap;
}
.footer-note { color: var(--text-faint); font-size: 0.85rem; max-width: 380px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; align-self: center; }
.footer-links a { font-size: 0.86rem; color: var(--text-dim); }
.footer-links a:hover { color: var(--teal); }
