/* Same palette and type as huangjiz.com, so the two sites read as one family. */
:root {
  --bg: #070e1a;
  --text: #e8eef5;
  --text-secondary: #b0bfcf;
  --muted: #7d93a8;
  --line: rgba(87, 216, 191, 0.12);
  --accent: #57d8bf;
  --accent-dim: rgba(87, 216, 191, 0.15);
  --card: rgba(10, 18, 32, 0.82);
  --card-border: rgba(87, 216, 191, 0.14);
  --offline: #e0a458;
  --mono: 'DM Mono', ui-monospace, Menlo, monospace;
  --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: clamp(16px, 5vw, 64px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ── BACKGROUND: fixed behind everything; the gradient shows if WebGL or the CDN is unavailable ── */
#fx-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: radial-gradient(ellipse 90% 70% at 85% 30%, #16224a 0%, transparent 65%), var(--bg);
}
#fx-bg canvas { width: 100% !important; height: 100% !important; display: block; }
.overlay-grid {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: radial-gradient(rgba(87, 216, 191, 0.08) 0.7px, transparent 0.7px);
  background-size: 32px 32px;
  opacity: 0.25;
}

/* ── NAV ── */
.nav, main, .footer { position: relative; z-index: 2; }
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem var(--gutter);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 14, 26, 0.55);
  backdrop-filter: blur(8px);
}
.brand { font-family: var(--mono); font-weight: 500; font-size: 0.9rem; text-decoration: none; }
.nav-links { display: flex; gap: clamp(0.9rem, 3vw, 1.8rem); }
.nav-links a { color: var(--text-secondary); text-decoration: none; font-size: 0.85rem; transition: color 0.2s; }
.nav-links a:hover { color: var(--accent); }

/* ── HERO ── */
main { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }
.hero {
  min-height: calc(86vh - 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3.5rem 0;
}
.hero-note {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero-note::before { content: ''; width: 2.2rem; height: 1px; background: var(--accent); }
.hero-title {
  margin: 1.5rem 0;
  font-weight: 700;
  font-size: clamp(3rem, 8vw, 5.5rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
}
.accent { color: var(--accent); }
.hero-desc {
  max-width: 46ch;
  border-left: 2px solid var(--accent);
  padding-left: 1.1rem;
  color: var(--text-secondary);
}
.hero-desc p { margin: 0 0 0.5rem; }
.hero-desc p:last-child { margin-bottom: 0; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2.4rem; }
.btn {
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.75rem 1.6rem;
  background: rgba(7, 14, 26, 0.5);
  color: var(--text);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: all 0.25s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 20px var(--accent-dim); }
.btn.main { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.btn.main:hover { background: #6be8cf; color: var(--bg); box-shadow: 0 4px 24px rgba(87, 216, 191, 0.3); }

/* ── SECTIONS ── */
section[id] { padding: 3.5rem 0; border-top: 1px solid var(--line); scroll-margin-top: 1rem; }
.section-header { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.8rem; }
.section-index { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); }
.section-title { margin: 0; font-size: clamp(1.5rem, 3.4vw, 2rem); font-weight: 600; letter-spacing: -0.01em; }
.section-note { margin: 1rem 0 0; font-size: 0.85rem; color: var(--muted); }

.service, .machine {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.4rem 1.5rem;
}
.service { display: block; text-decoration: none; transition: border-color 0.25s, box-shadow 0.25s; }
.service:hover { border-color: var(--accent); box-shadow: 0 0 24px var(--accent-dim); }
.service-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; }
.service-host { font-family: var(--mono); font-weight: 500; color: var(--accent); overflow-wrap: anywhere; }
.service p { margin: 0.7rem 0 0; max-width: 68ch; color: var(--text-secondary); font-size: 0.95rem; }
.tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
}

.machines { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.machine-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.machine h3 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.machine-spec { margin-top: 0.3rem; font-family: var(--mono); font-size: 0.76rem; color: var(--muted); }
.machine p { margin: 0.9rem 0 0; color: var(--text-secondary); font-size: 0.92rem; }
.status { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--mono); font-size: 0.7rem; color: var(--accent); }
.status[hidden] { display: none; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.status.off { color: var(--offline); }
.status.off i { box-shadow: none; }

.notes { margin: 0; display: grid; gap: 0; }
.notes > div {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 0.3rem 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.notes > div:first-child { padding-top: 0; }
.notes > div:last-child { border-bottom: 0; padding-bottom: 0; }
.notes dt { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); padding-top: 0.15rem; }
.notes dd { margin: 0; color: var(--text-secondary); max-width: 68ch; }

/* ── FOOTER ── */
.footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.6rem var(--gutter) 2.4rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.footer-links { display: flex; gap: 1.2rem; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* ── 404 ── */
.lost { min-height: 72vh; display: flex; flex-direction: column; justify-content: center; }
.lost h1 { margin: 1rem 0; font-size: clamp(2.4rem, 7vw, 4rem); line-height: 1; letter-spacing: -0.02em; }
.lost p { color: var(--text-secondary); margin: 0 0 1.8rem; }
.lost .btn { align-self: flex-start; }

@media (max-width: 820px) {
  .machines { grid-template-columns: minmax(0, 1fr); }
  .notes > div { grid-template-columns: minmax(0, 1fr); }
  .hero { min-height: auto; padding: 4rem 0 3.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .service { transition: none; }
}
