/* ==========================================================================
   CoStage — technical site visual system
   Dark, engineering-grade, zero dependencies.
   ========================================================================== */

:root {
  --bg: #0a0e17;
  --bg-raise: #101625;
  --bg-panel: #131b2e;
  --line: #1e2a44;
  --line-soft: #182238;
  --ink: #e8eefc;
  --ink-dim: #9aa8c7;
  --ink-faint: #5d6b8c;
  --accent: #3b5bd6;
  --accent-hi: #6f8dff;
  --accent-glow: rgba(90, 130, 255, .35);
  --cyan: #3fd0c9;
  --green: #4ade80;
  --amber: #f5b453;
  --radius: 10px;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
}

.mono { font-family: var(--mono); }

/* ---- backdrop: engineering grid + vignette ---- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(70, 100, 180, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 100, 180, .07) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 100%);
}
.bg-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 40% at 70% 8%, rgba(59, 91, 214, .14), transparent 70%);
}

::selection { background: rgba(111, 141, 255, .35); }

/* ==========================================================================
   Nav
   ========================================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 32px;
  background: rgba(10, 14, 23, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .3px;
}
.brand b { color: var(--accent-hi); }
.brand svg { filter: drop-shadow(0 0 8px var(--accent-glow)); }

.nav-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.nav-links a {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 14px;
  padding: 7px 13px;
  border-radius: 7px;
  transition: color .18s, background .18s;
}
.nav-links a:hover { color: var(--ink); background: rgba(111, 141, 255, .1); }

.lang-btn {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-hi);
  background: rgba(59, 91, 214, .14);
  border: 1px solid rgba(111, 141, 255, .35);
  border-radius: 7px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background .18s, box-shadow .18s;
  white-space: nowrap;
}
.lang-btn:hover {
  background: rgba(59, 91, 214, .28);
  box-shadow: 0 0 14px var(--accent-glow);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: 110px 32px 90px;
  text-align: center;
}

.badge {
  display: inline-block;
  font-size: 12.5px;
  color: var(--cyan);
  background: rgba(63, 208, 201, .09);
  border: 1px solid rgba(63, 208, 201, .3);
  border-radius: 100px;
  padding: 5px 16px;
  margin-bottom: 30px;
  letter-spacing: .6px;
}

.hero h1 {
  font-size: clamp(34px, 5.4vw, 60px);
  line-height: 1.14;
  font-weight: 750;
  letter-spacing: -1px;
  margin: 0 0 24px;
  background: linear-gradient(160deg, #fff 35%, #9db4f2 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-wrap: balance;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(120deg, var(--accent-hi), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  max-width: 720px;
  margin: 0 auto 38px;
  color: var(--ink-dim);
  font-size: 17.5px;
  text-wrap: pretty;
}

.hero-cta {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.btn {
  display: inline-block;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 30px;
  border-radius: 9px;
  transition: transform .16s, box-shadow .18s, background .18s;
}
.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #2f49b8);
  box-shadow: 0 6px 24px rgba(59, 91, 214, .4);
}
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 10px 32px rgba(59, 91, 214, .55); }
.btn.ghost {
  color: var(--ink-dim);
  border: 1px solid var(--line);
  background: var(--bg-raise);
}
.btn.ghost:hover { color: var(--ink); border-color: var(--accent-hi); }

.hero-chips {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}
.hero-chips span {
  font-size: 12.5px;
  color: var(--ink-faint);
  border: 1px solid var(--line-soft);
  background: rgba(19, 27, 46, .6);
  border-radius: 6px;
  padding: 5px 12px;
  letter-spacing: .3px;
}

/* ==========================================================================
   Sections
   ========================================================================== */
.section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 84px 32px 30px;
}

.sec-title {
  font-size: clamp(26px, 3.4vw, 36px);
  font-weight: 700;
  letter-spacing: -.5px;
  margin: 0 0 12px;
}
.sec-sub {
  color: var(--ink-dim);
  max-width: 680px;
  margin: 0 0 44px;
}

/* ---- feature / usecase cards ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  background: linear-gradient(170deg, var(--bg-panel), var(--bg-raise));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 24px 24px 22px;
  overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .25s;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(111, 141, 255, .55), transparent);
  opacity: 0;
  transition: opacity .25s;
}
.card:hover {
  border-color: rgba(111, 141, 255, .35);
  transform: translateY(-3px);
  box-shadow: 0 14px 40px rgba(4, 8, 20, .6);
}
.card:hover::before { opacity: 1; }

.card .ico {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  margin-bottom: 16px;
  background: rgba(59, 91, 214, .14);
  border: 1px solid rgba(111, 141, 255, .25);
  color: var(--accent-hi);
}
.card .ico svg { width: 21px; height: 21px; }

.card h3 {
  font-size: 16.5px;
  font-weight: 650;
  margin: 0 0 8px;
}
.card p {
  font-size: 14px;
  color: var(--ink-dim);
  margin: 0;
}
.card .tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  margin-top: 14px;
  padding: 2px 9px;
  border: 1px solid rgba(63, 208, 201, .25);
  border-radius: 5px;
  background: rgba(63, 208, 201, .07);
}

/* ==========================================================================
   Architecture diagram
   ========================================================================== */
.arch {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 22px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.arch-col {
  flex: 1;
  min-width: 190px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.arch-col-label {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
  padding-bottom: 4px;
}

.arch-node {
  background: linear-gradient(165deg, var(--bg-panel), var(--bg-raise));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: border-color .2s, box-shadow .2s;
}
.arch-node:hover { border-color: rgba(111, 141, 255, .4); box-shadow: 0 0 22px rgba(59, 91, 214, .16); }
.arch-node .n-name {
  font-weight: 650;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.arch-node .n-name .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: none;
}
.arch-node .n-desc {
  font-size: 12.5px;
  color: var(--ink-dim);
  margin-top: 6px;
  line-height: 1.5;
}
.arch-node .n-tech {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 8px;
}

.dot.blue { background: var(--accent-hi); box-shadow: 0 0 8px var(--accent-glow); }
.dot.cyan { background: var(--cyan); box-shadow: 0 0 8px rgba(63, 208, 201, .5); }
.dot.green { background: var(--green); box-shadow: 0 0 8px rgba(74, 222, 128, .45); }
.dot.amber { background: var(--amber); box-shadow: 0 0 8px rgba(245, 180, 83, .45); }

.arch-flow {
  flex: none;
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px 6px 0;
}
.arch-flow .flow-lane {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 92px;
}
.arch-flow .flow-label {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  white-space: nowrap;
  letter-spacing: .5px;
}
.arch-flow .flow-arrow {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--accent-hi);
  text-shadow: 0 0 10px var(--accent-glow);
  animation: flowPulse 2.2s ease-in-out infinite;
}
@keyframes flowPulse {
  0%, 100% { opacity: .45; }
  50% { opacity: 1; }
}

.arch-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 12px;
  color: var(--ink-faint);
}
.arch-legend .lg { display: flex; align-items: center; gap: 7px; }
.arch-legend .sw {
  width: 22px; height: 0;
  border-top: 2px dashed var(--accent-hi);
}
.arch-legend .sw.solid { border-top-style: solid; }
.arch-legend .sw.cyan { border-top-color: var(--cyan); }
.arch-legend .sw.dim { border-top-color: var(--ink-faint); }

/* ==========================================================================
   Deploy
   ========================================================================== */
.deploy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-bottom: 44px;
}

.deploy-steps { display: flex; flex-direction: column; gap: 0; }

.step {
  display: flex;
  gap: 16px;
  position: relative;
  padding-bottom: 26px;
}
.step:last-child { padding-bottom: 0; }
.step::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: 2px;
  width: 2px;
  background: linear-gradient(var(--line), var(--line-soft));
}
.step:last-child::before { display: none; }

.step .num {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-hi);
  background: var(--bg-panel);
  border: 1px solid rgba(111, 141, 255, .35);
  box-shadow: 0 0 12px rgba(59, 91, 214, .18);
}
.step h4 { margin: 5px 0 5px; font-size: 15.5px; }
.step p { margin: 0; font-size: 13.5px; color: var(--ink-dim); }
.step code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--cyan);
  background: rgba(63, 208, 201, .08);
  border-radius: 5px;
  padding: 1px 7px;
}

/* ---- terminal mock ---- */
.terminal {
  background: #0b101d;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(3, 6, 15, .65);
  position: sticky;
  top: 84px;
}
.terminal .t-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 15px;
  background: rgba(255, 255, 255, .028);
  border-bottom: 1px solid var(--line-soft);
}
.terminal .t-bar .c {
  width: 11px; height: 11px;
  border-radius: 50%;
}
.terminal .t-bar .c.r { background: #ff5f57; }
.terminal .t-bar .c.y { background: #febc2e; }
.terminal .t-bar .c.g { background: #28c840; }
.terminal .t-bar .t-title {
  margin-left: 10px;
  font-size: 11.5px;
  color: var(--ink-faint);
}
.terminal .t-body {
  padding: 18px 20px;
  font-size: 12.8px;
  line-height: 1.85;
  overflow-x: auto;
  white-space: pre;
}
.terminal .t-body .p { color: var(--green); }
.terminal .t-body .cmd { color: var(--ink); }
.terminal .t-body .out { color: var(--ink-faint); }
.terminal .t-body .ok { color: var(--green); }
.terminal .t-body .hi { color: var(--accent-hi); }
.terminal .cursor {
  display: inline-block;
  width: 8px; height: 15px;
  background: var(--accent-hi);
  vertical-align: -2px;
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---- ports table ---- */
.ports-wrap h3 {
  font-size: 13px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 14px;
}
.ports {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--bg-raise);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
  overflow-x: auto;
}
.ports table, .ports { border-spacing: 0; }
.ports tr { border-bottom: 1px solid var(--line-soft); }
.ports tr:last-child { border-bottom: none; }
.ports th {
  text-align: left;
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 11px 18px;
  background: rgba(255, 255, 255, .02);
  white-space: nowrap;
}
.ports td {
  padding: 11px 18px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.ports td.p { color: var(--accent-hi); font-weight: 600; }
.ports td.proto { color: var(--cyan); }
.ports tr:hover td { background: rgba(111, 141, 255, .045); color: var(--ink); }

/* ==========================================================================
   CTA band + footer
   ========================================================================== */
.cta-band {
  max-width: 1080px;
  margin: 90px auto 70px;
  padding: 66px 32px;
  text-align: center;
  border: 1px solid rgba(111, 141, 255, .22);
  border-radius: 18px;
  background:
    radial-gradient(ellipse 70% 120% at 50% -20%, rgba(59, 91, 214, .22), transparent 70%),
    linear-gradient(170deg, var(--bg-panel), var(--bg-raise));
}
.cta-band h2 {
  font-size: clamp(24px, 3.4vw, 34px);
  margin: 0 0 12px;
  letter-spacing: -.5px;
}
.cta-band p { color: var(--ink-dim); margin: 0 0 30px; }

.footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 26px;
  padding: 26px 32px 34px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--ink-faint);
  max-width: 1080px;
  margin: 0 auto;
}
.footer .spacer { flex: 1; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
  .nav { padding: 12px 18px; gap: 12px; flex-wrap: wrap; }
  .nav-links { order: 3; width: 100%; margin-left: 0; justify-content: center; }
  .hero { padding: 70px 20px 60px; }
  .section { padding: 60px 20px 20px; }
  .deploy-grid { grid-template-columns: 1fr; }
  .terminal { position: static; }
  .cta-band { margin: 60px 16px 50px; }
  .arch { flex-direction: column; }
  .arch-flow { flex-direction: row; padding: 0; justify-content: center; }
  .arch-flow .flow-lane { flex-direction: row; gap: 8px; }
  .footer { justify-content: center; text-align: center; }
  .footer .spacer { display: none; }
}
