/* NEMS Mesh — shared styles */
:root {
  color-scheme: dark light;
  --bg: #0a120e;
  --bg-2: #0f1a14;
  --card: rgba(17, 29, 23, .82);
  --card-solid: #111d17;
  --line: #22352b;
  --ink: #e6f0ea;
  --muted: #9db1a5;
  --accent: #5fe39b;      /* signal green: buttons, links, highlights */
  --accent-2: #93f0bd;
  --on-accent: #04170c;
  --cyan: #5cc8ff;        /* secondary: "you" marker, logo hub, gradients */
  --glow: rgba(95, 227, 155, .20);
  --nav-bg: rgba(10, 18, 14, .82);
  --callout-bg: linear-gradient(135deg, rgba(95, 227, 155, .08), rgba(92, 200, 255, .06));
  --callout-line: rgba(95, 227, 155, .28);
  /* map marker colors */
  --m-router: #5cc8ff;
  --m-solar: #5fe39b;
  --m-home: #c4a7ff;
  --m-planned: #9db1a5;
  --radius: 14px;
  --max: 1120px;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Light theme: follows the visitor's phone/computer setting. */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f7f4;
    --bg-2: #e8efea;
    --card: rgba(255, 255, 255, .9);
    --card-solid: #ffffff;
    --line: #d2ddd6;
    --ink: #0f1f17;
    --muted: #4a5d52;
    --accent: #13804a;
    --accent-2: #0e6b3d;
    --on-accent: #ffffff;
    --cyan: #0e7490;
    --glow: rgba(19, 128, 74, .14);
    --nav-bg: rgba(243, 247, 244, .85);
    --callout-bg: linear-gradient(135deg, #e3f3e9, #e1f0f5);
    --callout-line: #bcdcc8;
    --m-router: #0e7490;
    --m-solar: #13804a;
    --m-home: #7c4dcc;
    --m-planned: #7a857e;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; background: var(--bg); }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--accent); }
a:hover { color: var(--accent-2); }

h1, h2, h3 { font-family: var(--mono); font-weight: 700; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.1rem, 4.8vw, 3.5rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.25rem); letter-spacing: -0.03em; }
h3 { font-size: 1.08rem; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 22px; }
section { padding: 88px 0; border-top: 1px solid var(--line); }
.eyebrow {
  font-family: var(--mono); font-weight: 500; text-transform: lowercase; letter-spacing: .04em;
  font-size: .85rem; color: var(--accent); margin-bottom: .9em; display: block;
}
.eyebrow::before { content: "// "; opacity: .55; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 640px; }
.hl {
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cursor {
  display: inline-block; width: .5em; height: .85em; margin-left: .12em; vertical-align: -.06em;
  background: var(--accent); animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Animated background (injected by site.js) */
.bg-fx { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.bg-fx::before {
  content: ""; position: absolute; inset: -10%;
  background:
    radial-gradient(38% 32% at 82% 8%, var(--glow), transparent 70%),
    radial-gradient(32% 28% at 6% 55%, color-mix(in srgb, var(--cyan) 10%, transparent), transparent 70%);
}
.bg-fx .beam {
  position: absolute; top: -10%; height: 120%; width: 180px;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent) 6%, transparent) 45%, transparent);
  animation: beam 16s ease-in-out infinite alternate;
}
.bg-fx .dot {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
  opacity: 0; animation: twinkle 7s ease-in-out infinite;
}
@keyframes beam { from { transform: skewX(-14deg) translateX(-50px); opacity: .5; } to { transform: skewX(-14deg) translateX(50px); opacity: 1; } }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.5); } 50% { opacity: .75; transform: scale(1); } }
@media (prefers-color-scheme: light) { .bg-fx { opacity: .6; } .bg-fx .dot { box-shadow: none; } }

/* Scroll reveal (classes added by site.js only to elements below the fold) */
html .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
html .reveal.in { opacity: 1; transform: none; }

/* Logo (inline SVG in the nav) */
.logo-link { stroke: var(--accent); stroke-width: 2; }
.logo-hub { fill: var(--cyan); }
.logo-node { fill: var(--accent); }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 1000;
  background: var(--nav-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-weight: 700; font-size: 1.08rem; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand svg { width: 28px; height: 28px; }
.nav ul { list-style: none; display: flex; gap: 24px; margin: 0; padding: 0; }
.nav ul a { color: var(--muted); text-decoration: none; font-size: .94rem; padding: 4px 0; transition: color .15s; }
.nav ul a:hover { color: var(--ink); }
.nav ul a[aria-current="page"] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }

.nav-toggle {
  display: none; background: none; border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; width: 44px; height: 40px; padding: 0; cursor: pointer;
}
.nav-toggle svg { width: 22px; height: 22px; margin: auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.nav-toggle .x { display: none; }
.nav.open .nav-toggle .bars { display: none; }
.nav.open .nav-toggle .x { display: block; }

@media (max-width: 880px) {
  .nav-toggle { display: block; }
  .nav ul {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 6px 22px 14px;
    background: var(--bg); border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(0, 0, 0, .18);
  }
  .nav.open ul { display: flex; }
  .nav ul a { display: block; padding: 13px 0; font-size: 1.05rem; color: var(--ink); border-bottom: 1px solid var(--line); }
  .nav ul li:last-child a { border-bottom: 0; }
  .nav ul a[aria-current="page"] { box-shadow: none; color: var(--accent); }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 9px; padding: 12px 20px; border-radius: 10px;
  font-family: var(--mono); font-weight: 600; font-size: .9rem; letter-spacing: -0.01em; text-decoration: none;
  transition: transform .15s, background .15s, border-color .15s, box-shadow .2s;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-2); color: var(--on-accent); box-shadow: 0 8px 28px -8px var(--accent); }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); background: var(--card); }
.btn-ghost:hover { border-color: var(--accent); color: var(--ink); }
.btn-text { color: var(--ink); padding-left: 6px; padding-right: 6px; }
.btn-text:hover { color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

/* Hero */
.hero { padding: 84px 0 72px; border-top: 0; }
.hero-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 48px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } .hero { padding: 52px 0 56px; } }

/* Phone mockup (always dark: it's a device) */
.phone-wrap { position: relative; isolation: isolate; }
.phone-wrap::before {
  content: ""; position: absolute; inset: 8% -12%; z-index: -1;
  background: radial-gradient(closest-side, var(--glow), transparent); filter: blur(24px);
}
.phone {
  width: 100%; max-width: 330px; margin: 0 auto; padding: 11px; border-radius: 40px;
  background: linear-gradient(160deg, #22332a, #0b140f); border: 1px solid #2a3d33;
  box-shadow: 0 30px 70px -25px rgba(0, 0, 0, .65);
}
.phone-screen {
  height: 515px; border-radius: 30px; background: #07100b; overflow: hidden;
  display: flex; flex-direction: column; font-family: var(--mono); color: #e6f0ea;
}
.phone-status { display: flex; justify-content: space-between; padding: 13px 22px 4px; font-size: .7rem; color: #8ea597; }
.phone-status .nosvc { color: #f2a3a3; }
.phone-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px 12px; border-bottom: 1px solid #18271f; }
.phone-head b { display: block; color: #5fe39b; font-size: .82rem; letter-spacing: .03em; }
.phone-head small { color: #758c80; font-size: .66rem; }
.live { width: 9px; height: 9px; border-radius: 50%; background: #5fe39b; animation: live 2s ease-out infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(95, 227, 155, .6); } 100% { box-shadow: 0 0 0 10px rgba(95, 227, 155, 0); } }
.chat { flex: 1; min-height: 0; padding: 12px; display: flex; flex-direction: column; justify-content: flex-end; gap: 9px; overflow: hidden; 
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 56px); mask-image: linear-gradient(to bottom, transparent, #000 56px); }
.msg { max-width: 90%; padding: 9px 12px; border-radius: 14px; background: #101c16; border: 1px solid #1a2b22; font-size: .74rem; line-height: 1.45; }
.msg .who { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.msg .av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #173526; color: #5fe39b; font-size: .52rem; font-weight: 700; }
.msg .who b { font-size: .72rem; color: #e6f0ea; }
.msg .who time { margin-left: auto; padding-left: 10px; font-size: .62rem; color: #627a6d; }
.msg p { margin: 0; color: #d3e2d9; }
.msg .sig { margin-top: 4px; font-size: .6rem; color: #5fe39b; opacity: .85; }
.msg.me { align-self: flex-end; background: #17432d; border-color: #24603f; }
.msg.me .sig { text-align: right; color: #a9f1c9; }
.msg.pop { animation: pop .35s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.typing { align-self: flex-start; display: flex; gap: 4px; padding: 11px 14px; border-radius: 14px; background: #101c16; border: 1px solid #1a2b22; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #758c80; animation: dots 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes dots { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.phone-input {
  margin: 0 12px 14px; padding: 8px 8px 8px 16px; border-radius: 999px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: #101c16; border: 1px solid #1a2b22; font-size: .72rem; color: #627a6d;
}
.phone-input .typed { color: #e6f0ea; white-space: nowrap; overflow: hidden; }
.phone-input .send { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #5fe39b; display: grid; place-items: center; }
.phone-input .send svg { width: 14px; height: 14px; fill: none; stroke: #04170c; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chat.fade { transition: opacity .6s; opacity: 0; }

/* Hero stats */
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 60px; }
@media (max-width: 900px) { .hero-stats { grid-template-columns: 1fr 1fr; margin-top: 44px; } }
.hero-stats .stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.hero-stats .icon { margin: 0; width: 42px; height: 42px; flex: none; }
.hero-stats b { display: block; font-family: var(--mono); font-size: 1.5rem; line-height: 1.1; color: var(--ink); }
.hero-stats b em { font-style: normal; color: var(--accent); }
.hero-stats .stat > div > span { display: block; color: var(--muted); font-size: .84rem; line-height: 1.35; }
@media (max-width: 420px) { .hero-stats .stat { flex-direction: column; align-items: flex-start; gap: 10px; } }

/* Mesh diagram */
.mesh-art .link { stroke: var(--line); stroke-width: 2; }
.mesh-art .pulse { stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 10 300; animation: travel 3.2s linear infinite; filter: drop-shadow(0 0 4px var(--accent)); }
.mesh-art .pulse.d2 { animation-delay: 1.1s; }
.mesh-art .pulse.d3 { animation-delay: 2.1s; }
.mesh-art .node { fill: var(--card-solid); stroke: var(--accent); stroke-width: 2.5; }
.mesh-art .node.you { stroke: var(--cyan); }
.mesh-art .ring { fill: none; stroke: var(--accent); opacity: .5; transform-origin: center; transform-box: fill-box; animation: ring 3s ease-out infinite; }
.mesh-art text { fill: var(--muted); font: 12px var(--mono); }
@keyframes travel { from { stroke-dashoffset: 310; } to { stroke-dashoffset: 0; } }
@keyframes ring { from { transform: scale(1); opacity: .6; } to { transform: scale(2.6); opacity: 0; } }

.split { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; gap: 20px; } }

/* Grids & cards */
.grid { display: grid; gap: 18px; margin-top: 36px; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .g3, .g2, .g4 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  transition: border-color .25s, box-shadow .25s, transform .25s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 14px 40px -18px var(--glow), 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent); }
.card p:last-child { margin-bottom: 0; }
.card.feature { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }

/* "Pick your path" cards */
.card.path { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.card.path:hover { transform: translateY(-3px); color: inherit; }
.card.path p { color: var(--muted); }
.path .go { margin-top: auto; padding-top: 16px; display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .88rem; font-weight: 600; color: var(--accent); }
.path .go svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; transition: transform .2s; }
.card.path:hover .go svg { transform: translateX(4px); }

/* Line icons */
.icon {
  width: 46px; height: 46px; border-radius: 12px; margin-bottom: 16px;
  display: grid; place-items: center; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
}
.icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Numbered steps */
.steps { counter-reset: step; }
.step::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 16px; border-radius: 12px;
  font-family: var(--mono); font-weight: 700; font-size: 1rem; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Callout */
.callout {
  background: var(--callout-bg);
  border: 1px solid var(--callout-line); border-radius: var(--radius);
  padding: 30px; margin-top: 36px;
}

/* Node hosts strip */
.hosts {
  margin-top: 36px; padding: 26px 28px; border: 1px dashed var(--line); border-radius: var(--radius);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px;
}
.hosts h3 { margin-bottom: .3em; }
.hosts p { margin: 0; color: var(--muted); max-width: 560px; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 24px 0; }
table { width: 100%; border-collapse: collapse; font-size: .96rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--mono); color: var(--muted); font-weight: 500; font-size: .78rem; text-transform: lowercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }

/* FAQ */
details { border-bottom: 1px solid var(--line); padding: 18px 0; }
details summary { cursor: pointer; font-family: var(--mono); font-size: 1rem; font-weight: 600; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; float: right; color: var(--accent); }
details[open] summary::after { content: "–"; }
details p { margin: 12px 0 0; color: var(--muted); }

/* Guide page */
.guide-hero { padding: 72px 0 40px; border-top: 0; }
.toc { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.toc a { border: 1px solid var(--line); background: var(--card); padding: 6px 14px; border-radius: 8px; font-family: var(--mono); font-size: .8rem; color: var(--muted); text-decoration: none; transition: color .15s, border-color .15s; }
.toc a:hover { color: var(--ink); border-color: var(--accent); }
.build { margin-top: 40px; }
.build .meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 16px; }
.tag { background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 10px; font-family: var(--mono); font-size: .76rem; color: var(--muted); }
.tag.hot { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
ul.clean, ol.clean { padding-left: 1.1em; margin: 0 0 1em; }
ul.clean li, ol.clean li { margin-bottom: .45em; }
code { font-family: var(--mono); background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: .85em; }
pre { font-family: var(--mono); background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 16px; overflow-x: auto; font-size: .85rem; }
.warn { border-left: 3px solid var(--accent); padding: 4px 0 4px 16px; color: var(--muted); margin: 18px 0; }
.small { font-size: .88rem; color: var(--muted); }

/* 404 */
.notfound { padding: 110px 0 120px; border-top: 0; }

/* Footer */
footer { border-top: 1px solid var(--line); padding: 40px 0; color: var(--muted); font-size: .88rem; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
footer a { color: var(--muted); }
footer a:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html .reveal { opacity: 1; transform: none; }
  .bg-fx .dot { opacity: .35; }
  html { scroll-behavior: auto; }
}
