/* =====================================================================
   GITD NEXUS home page (/), v2 "cinematic". Own stylesheet (shared ui.css / style.css not loaded here).
   Idea: a night survey flight - near-black ground, a live point-cloud valley in the hero, a survey-marker
   orange for the drone, the scan and the main action; a scroll story of the five steps of the work.
   ===================================================================== */
:root {
  --ink: #05090D;
  --ink-2: #0B131A;
  --ink-3: #111D27;
  --line: #1F2F3C;
  --paper: #EEEAE0;
  --muted: #8E9BA5;
  --signal: #F06A22;
  --signal-2: #FF8443;
  --water: #5FB6C9;
  --err: #FF9A8A;
  --f-body: "IBM Plex Sans Thai", "Leelawadee UI", Tahoma, system-ui, sans-serif;
  --f-mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--ink); }
body.nx { margin: 0; background: var(--ink) !important; color: var(--paper); font-family: var(--f-body); font-size: 16px;
  line-height: 1.65; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
.nx [hidden] { display: none !important; }
.nx a { color: inherit; }
.nx-mono { font-family: var(--f-mono); font-size: 12px; letter-spacing: .04em; }
::selection { background: rgba(240, 106, 34, .35); }

/* ---------- buttons ---------- */
.nx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font: inherit; font-size: 15.5px;
  font-weight: 600; text-decoration: none; cursor: pointer; border: 1px solid var(--signal); border-radius: 0;
  background: var(--signal); color: #160A02 !important; padding: 13px 26px; transition: background .2s, border-color .2s, color .2s; }
.nx-btn:hover { background: var(--signal-2); border-color: var(--signal-2); }
.nx-btn:focus-visible, .nx-nav a:focus-visible, .nx-apps a:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }
.nx-btn.line { background: transparent; color: var(--paper) !important; border-color: rgba(238, 234, 224, .45); }
.nx-btn.line:hover { border-color: var(--paper); background: rgba(238, 234, 224, .06); }
.nx-btn.ghost { background: transparent; color: var(--paper) !important; border-color: var(--line); font-weight: 500; }
.nx-btn.ghost:hover { border-color: var(--muted); }
.nx-btn.sm { font-size: 13.5px; padding: 6px 14px; }
.nx-btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- header ---------- */
.nx-bar { position: fixed; inset: 0 0 auto; z-index: 20; display: flex; align-items: center; gap: 28px; padding: 22px 40px;
  transition: background .35s, padding .35s, border-color .35s; border-bottom: 1px solid transparent; }
.nx-bar.solid { background: rgba(5, 9, 13, .86); backdrop-filter: blur(10px); padding-block: 12px; border-bottom-color: var(--line); }
.nx-logo { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; margin-right: auto; }
.nx-logo img { display: block; border-radius: 7px; box-shadow: 0 0 0 1px rgba(238, 234, 224, .18); }
.nx-word { display: inline-flex; align-items: baseline; gap: 7px; font-size: 16px; line-height: 1; }
.nx-word b { font-weight: 700; letter-spacing: .08em; }
.nx-word span { font-weight: 400; letter-spacing: .36em; color: var(--muted); }
.nx-nav { display: flex; gap: 28px; }
.nx-nav a { font-size: 14px; text-decoration: none; color: var(--muted); position: relative; padding: 4px 0; transition: color .2s; }
.nx-nav a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px; background: var(--signal); transition: right .3s var(--ease); }
.nx-nav a:hover { color: var(--paper); }
.nx-nav a:hover::after { right: 0; }
.nx-user { font-size: 13.5px; white-space: nowrap; }
.nx-user small { color: var(--muted); margin-left: 6px; font-size: 12.5px; }

/* ---------- hero ---------- */
.nx-hero { position: relative; min-height: max(680px, min(100svh, 1100px)); display: flex; flex-direction: column; justify-content: center;
  overflow: hidden; isolation: isolate; }
.nx-terrain { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.nx-hero-shade { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, rgba(5, 9, 13, .92) 0%, rgba(5, 9, 13, .55) 38%, rgba(5, 9, 13, 0) 65%),
              linear-gradient(0deg, var(--ink) 0%, rgba(5, 9, 13, 0) 22%),
              linear-gradient(180deg, rgba(5, 9, 13, .7) 0%, rgba(5, 9, 13, 0) 18%); }
.nx-hud { position: absolute; inset: 96px 40px 120px; pointer-events: none; z-index: -1; }
.nx-hud .c { position: absolute; width: 22px; height: 22px; border: 1px solid rgba(238, 234, 224, .35); }
.nx-hud .tl { top: 0; left: 0; border-width: 1px 0 0 1px; } .nx-hud .tr { top: 0; right: 0; border-width: 1px 1px 0 0; }
.nx-hud .bl { bottom: 0; left: 0; border-width: 0 0 1px 1px; } .nx-hud .br { bottom: 0; right: 0; border-width: 0 1px 1px 0; }
.nx-hero-in { position: relative; padding: 120px 40px 150px max(40px, 7vw); max-width: 1100px; }
.nx-kicker { margin: 0 0 18px; font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.nx-kicker i { width: 18px; height: 1px; background: var(--signal); }
.nx-mega { margin: 0; font-weight: 700; font-size: clamp(76px, 13.5vw, 228px); line-height: .84; letter-spacing: -.035em; }
.nx-mega .ln { display: block; overflow: hidden; padding-bottom: .04em; }
.nx-mega .ln > span { display: inline-block; }
.nx-mega .outline { color: transparent; -webkit-text-stroke: 1.5px var(--paper); }
.nx-hero-th { margin: 26px 0 0; font-size: clamp(20px, 2.1vw, 28px); line-height: 1.45; font-weight: 500; max-width: 22em; }
.nx-cta { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 14px; }

.nx-telemetry { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; display: grid;
  grid-template-columns: 1.4fr repeat(5, 1fr); border-top: 1px solid var(--line); background: rgba(5, 9, 13, .72); backdrop-filter: blur(6px); }
.nx-telemetry div { padding: 14px 22px; border-right: 1px solid var(--line); min-width: 0; }
.nx-telemetry div:first-child { padding-left: 40px; }
.nx-telemetry div:last-child { border-right: 0; }
.nx-telemetry dt { font-size: 11.5px; color: var(--muted); }
.nx-telemetry dd { margin: 2px 0 0; font: 15px var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nx-telemetry .sim dd { font-family: var(--f-body); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.nx-telemetry .sim dd::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.nx-scroll { position: absolute; right: 40px; bottom: 100px; width: 26px; height: 42px; border: 1px solid rgba(238, 234, 224, .4); border-radius: 13px; }
.nx-scroll span { position: absolute; left: 50%; top: 8px; width: 2px; height: 8px; margin-left: -1px; background: var(--paper); animation: wheel 1.8s var(--ease) infinite; }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 80%, 100% { transform: translateY(16px); opacity: 0; } }

/* load-in */
.js .load { opacity: 0; transform: translateY(28px); animation: up 1.1s var(--ease) forwards; animation-delay: var(--d, 0s); }
.js .nx-mega .load { transform: translateY(105%); }
@keyframes up { to { opacity: 1; transform: none; } }

/* ---------- ticker ---------- */
.nx-ticker { border-block: 1px solid var(--line); overflow: hidden; background: var(--ink-2); }
.nx-ticker-track { display: flex; width: max-content; animation: tick 60s linear infinite; }
.nx-ticker span { padding: 18px 30px; font-size: 15px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 30px; }
.nx-ticker span::after { content: ""; width: 6px; height: 6px; background: var(--signal); transform: rotate(45deg); }
@keyframes tick { to { transform: translateX(-50%); } }

/* ---------- workflow chapters ---------- */
.nx-flow { width: min(1240px, 100% - 80px); margin: 0 auto; padding: 140px 0 60px; }
.nx-eyebrow { margin: 0 0 14px; font: 12.5px var(--f-mono); letter-spacing: .08em; color: var(--signal); }
.nx-flow-head h2, .nx-access h2 { margin: 0; font-size: clamp(36px, 5vw, 68px); line-height: 1.15; font-weight: 700; letter-spacing: -.015em; text-wrap: balance; }
.nx-flow-head { margin-bottom: 80px; }
.nx-ch { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 72px; align-items: center;
  padding: 72px 0; border-top: 1px solid var(--line); }
.nx-ch.flip .nx-ch-txt { order: 2; }
.nx-ch-no { display: block; font: 600 15px var(--f-mono); color: var(--signal); margin-bottom: 14px; }
.nx-ch h3 { margin: 0 0 16px; font-size: clamp(28px, 3.2vw, 44px); line-height: 1.2; font-weight: 700; }
.nx-ch p { margin: 0; color: #BFC7CC; font-size: 17px; max-width: 30em; }
.nx-ch-sys { display: inline-block; margin-top: 22px; font: 12.5px var(--f-mono); color: var(--muted); border: 1px solid var(--line); padding: 4px 10px; }
.nx-ch-fig { margin: 0; aspect-ratio: 4 / 3; background: var(--ink-2); border: 1px solid var(--line); position: relative; overflow: hidden; }
.nx-ch-fig::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 40px 40px; opacity: .35; }
.nx-ch-fig svg { position: relative; width: 100%; height: 100%; display: block; }
.nx-ch-fig text { font: 11px var(--f-body); fill: var(--muted); }

/* reveal on scroll */
.js .rv { opacity: 0; transform: translateY(46px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.js .rv.in { opacity: 1; transform: none; }
.draw { fill: none; stroke-dasharray: 1; stroke-dashoffset: 1; }
.in .draw { animation: draw 2.6s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* 01 plan */
.fig-plan .area { fill: rgba(95, 182, 201, .07); stroke: var(--water); stroke-width: 1.5; stroke-dasharray: 5 5; }
.fig-plan .mow { stroke: var(--paper); stroke-width: 1.3; opacity: .8; }
.in .fig-plan .mow { animation-duration: 5s; }
.fig-plan .dr { fill: var(--signal); }
.fig-plan .pins circle { fill: var(--ink); stroke: var(--water); stroke-width: 1.5; }
/* 02 capture (frames built by nexus.js) */
.fig-capture rect { fill: rgba(238, 234, 224, .035); stroke: rgba(238, 234, 224, .55); stroke-width: 1; opacity: 0; }
.in .fig-capture rect { animation: pop .5s var(--ease) forwards; animation-delay: calc(var(--i) * 110ms); }
.fig-capture .shot { fill: rgba(240, 106, 34, .16); stroke: var(--signal); }
@keyframes pop { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
.fig-capture rect { transform-box: fill-box; transform-origin: center; }
/* 03 mesh (built by nexus.js) */
.fig-mesh .pt { fill: var(--paper); }
.fig-mesh .tri { fill: none; stroke: var(--water); stroke-width: .8; opacity: 0; }
.in .fig-mesh .tri { animation: fade .8s ease forwards; animation-delay: calc(1.1s + var(--i) * 6ms); }
.fig-mesh .pt { transition: transform 1.6s var(--ease); transform: translate(var(--dx), var(--dy)); }
.in .fig-mesh .pt { transform: none; }
@keyframes fade { to { opacity: .55; } }
/* 04 section */
.fig-section .ground { stroke: var(--paper); stroke-width: 2; }
.fig-section .design { stroke: var(--signal); stroke-width: 2; animation-delay: .8s !important; }
.fig-section .cut { fill: rgba(240, 106, 34, .18); opacity: 0; }
.fig-section .fill { fill: rgba(95, 182, 201, .22); opacity: 0; }
.in .fig-section .cut, .in .fig-section .fill { animation: show 1s ease 2.4s forwards; }
@keyframes show { to { opacity: 1; } }
.fig-section .ticks path { stroke: var(--muted); stroke-width: 1; fill: none; }
.fig-section .lbl text { font-family: var(--f-mono); }
/* 05 layers */
.fig-layers .ly path { stroke-width: 1.4; transition: transform 1.4s var(--ease); }
.fig-layers .l1 path { fill: rgba(238, 234, 224, .1); stroke: var(--paper); }
.fig-layers .l2 path { fill: rgba(95, 182, 201, .12); stroke: var(--water); }
.fig-layers .l3 path { fill: rgba(240, 106, 34, .12); stroke: var(--signal); }
.fig-layers .ly { transition: transform 1.4s var(--ease); transform: translateY(40px); }
.fig-layers text { opacity: 0; transition: opacity .6s ease 1.2s; }
.in .fig-layers .l1 { transform: translateY(90px); }
.in .fig-layers .l2 { transform: translateY(40px); }
.in .fig-layers .l3 { transform: translateY(-10px); }
.in .fig-layers text { opacity: 1; }

/* ---------- access ---------- */
.nx-access { position: relative; padding: 140px 0 120px; background:
  radial-gradient(900px 500px at 85% 20%, rgba(240, 106, 34, .09), transparent 70%), var(--ink-2); border-top: 1px solid var(--line); }
.nx-access-in { width: min(1240px, 100% - 80px); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 6fr) minmax(320px, 4fr); gap: 72px; align-items: end; }
.nx-access-lead { margin: 22px 0 0; color: #BFC7CC; font-size: 17px; max-width: 30em; }
.nx-login { display: grid; padding: 32px; background: var(--ink); border: 1px solid var(--line); }
.nx-login label { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.nx-login input { font: inherit; font-size: 16px; color: var(--paper); background: transparent; border: 0; border-bottom: 1px solid #34495A;
  border-radius: 0; padding: 10px 0; margin: 0 0 22px; outline: none; transition: border-color .2s; }
.nx-login input:hover { border-bottom-color: var(--muted); }
.nx-login input:focus-visible { border-bottom-color: var(--signal); }
.nx-error { margin: 14px 0 0; font-size: 14px; color: var(--err); }
.nx-error:empty { display: none; }
body[data-state="loading"] .nx-login { visibility: hidden; }
body[data-state="in"] .nx-access-in { grid-template-columns: minmax(0, 1fr); }

.nx-apps { width: min(1240px, 100% - 80px); margin: 64px auto 0; padding: 0; list-style: none;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.nx-apps li { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.nx-apps a { position: relative; display: grid; grid-template-rows: auto 1fr auto; gap: 14px; height: 100%; min-height: 230px; padding: 26px;
  text-decoration: none; overflow: hidden; isolation: isolate; transition: background .3s; }
.nx-apps a::before { content: ""; position: absolute; inset: auto 0 0 0; height: 0; background: var(--signal); z-index: -1; transition: height .45s var(--ease); }
.nx-apps a:hover::before, .nx-apps a:focus-visible::before { height: 100%; }
.nx-apps a:hover, .nx-apps a:focus-visible { color: #160A02; }
.nx-app-top { display: flex; justify-content: space-between; align-items: center; }
.nx-app-no { font: 12.5px var(--f-mono); color: var(--muted); transition: color .3s; }
.nx-app-ic svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nx-apps b { display: block; font-size: 21px; line-height: 1.3; font-weight: 600; }
.nx-apps small { display: block; margin-top: 6px; font-size: 14px; color: var(--muted); line-height: 1.5; transition: color .3s; }
.nx-app-go { display: flex; justify-content: space-between; font: 12.5px var(--f-mono); color: var(--muted); transition: color .3s; }
.nx-app-go::after { content: "→"; font-size: 18px; line-height: 1; transition: transform .3s var(--ease); }
.nx-apps a:hover .nx-app-no, .nx-apps a:hover small, .nx-apps a:hover .nx-app-go { color: rgba(22, 10, 2, .75); }
.nx-apps a:hover .nx-app-go::after { transform: translateX(6px); }

/* ---------- footer ---------- */
.nx-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 32px; padding: 36px 40px 44px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted); }
.nx-foot-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--paper); font-weight: 700; letter-spacing: .12em; margin-right: auto; }
.nx-foot-brand img { border-radius: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .nx-telemetry { grid-template-columns: repeat(3, 1fr); }
  .nx-telemetry div:nth-child(n+4) { display: none; }
  .nx-apps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .nx-bar { padding: 16px 20px; gap: 16px; }
  .nx-nav { display: none; }
  .nx-hud { inset: 80px 20px 110px; }
  .nx-hero-in { padding: 110px 24px 150px; }
  .nx-scroll { display: none; }
  .nx-hero-shade { background: linear-gradient(180deg, rgba(5, 9, 13, .55) 0%, rgba(5, 9, 13, .78) 35%, rgba(5, 9, 13, .7) 70%, var(--ink) 100%); }
  .nx-flow, .nx-access-in, .nx-apps { width: calc(100% - 40px); }
  .nx-flow { padding-top: 96px; }
  .nx-flow-head { margin-bottom: 40px; }
  .nx-ch { grid-template-columns: minmax(0, 1fr); gap: 32px; padding: 48px 0; }
  .nx-ch.flip .nx-ch-txt { order: 0; }
  .nx-access { padding: 96px 0 80px; }
  .nx-access-in { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .nx-foot { padding: 28px 20px 36px; }
}
@media (max-width: 560px) {
  .nx-user { display: none; }
  .nx-telemetry div { padding: 10px 14px; }
  .nx-telemetry div:first-child { padding-left: 20px; }
  .nx-telemetry div:nth-child(n+3) { display: none; }
  .nx-telemetry { grid-template-columns: 1.3fr 1fr; }
  .nx-apps { grid-template-columns: minmax(0, 1fr); }
  .nx-apps a { min-height: 0; }
  .nx-login { padding: 24px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .load, .js .rv { opacity: 1 !important; transform: none !important; animation: none !important; transition: none !important; }
  .nx-ticker-track, .nx-scroll span, .nx-telemetry .sim dd::before { animation: none; }
  .draw { stroke-dashoffset: 0; }
  .fig-capture rect, .fig-mesh .tri, .fig-section .cut, .fig-section .fill { opacity: 1 !important; animation: none !important; }
  .fig-mesh .pt { transform: none; }
}
