:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e2e8f0;
  --brand: #0f7a55;
  --brand-ink: #ffffff;
  --shuttle: #343c4a;
  --critical: #dc2626;
  --critical-soft: #fef2f2;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 12px 32px -8px rgba(15,23,42,.18);
  --font: "Inter Tight", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  display: flex; align-items: center; gap: 40px;
  height: 72px; padding: 0 clamp(16px, 4vw, 56px);
  background: linear-gradient(to bottom, rgba(248,250,252,.92), rgba(248,250,252,0));
  transition: background .2s, box-shadow .2s;
}
/* Once the page scrolls past the hero top, give the bar a solid backing so content never shows through */
.nav.scrolled { background: rgba(248,250,252,.94); backdrop-filter: blur(10px); box-shadow: 0 1px 0 var(--line); }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.logo img { width: 30px; height: auto; }
.logo-text { display: flex; flex-direction: column; gap: 4px; font-family: "Archivo", var(--font); line-height: 1; }
.logo-text b { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.logo-text small { font-size: 8px; font-weight: 500; letter-spacing: .42em; color: var(--ink-2); }
.footer-brand .logo img { width: 40px; }
.footer-brand .logo-text b { font-size: 26px; }
.footer-brand .logo-text small { font-size: 9.5px; }
.nav-links { display: flex; gap: 28px; font-size: 15px; color: var(--ink-2); }
.nav-links a:hover { color: var(--ink); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 14px; color: var(--ink-2); }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 999px; font: 600 15px var(--font); cursor: pointer; border: 1px solid transparent; transition: background .2s, border-color .2s; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #1e293b; }
.btn-ghost { background: rgba(255,255,255,.7); border-color: var(--line); color: var(--ink); backdrop-filter: blur(8px); }
.btn-ghost:hover { border-color: var(--ink-3); }
.btn-sm { height: 36px; padding: 0 16px; font-size: 14px; }

/* ---------- Hero ---------- */
.hero { position: relative; height: 100vh; height: 100svh; min-height: 560px; overflow: hidden; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.hero::after { /* readability wash behind copy */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(248,250,252,.96) 0%, rgba(248,250,252,.85) 34%, rgba(248,250,252,0) 58%);
}
.hero-copy {
  position: absolute; z-index: 5; left: clamp(16px, 4vw, 56px); bottom: clamp(48px, 10vh, 112px);
  max-width: 680px;
}
.eyebrow { font-size: 18px; font-weight: 500; color: var(--ink); }
h1 { margin-top: 18px; font-size: clamp(38px, 5.4vw, 72px); line-height: 1.02; letter-spacing: -.035em; font-weight: 600; }
h1 span { color: var(--ink-3); }
.lead { margin-top: 20px; font-size: clamp(16px, 1.3vw, 19px); line-height: 1.55; color: var(--ink-2); max-width: 540px; }
.cta { margin-top: 32px; display: flex; gap: 12px; flex-wrap: wrap; }
.stats { margin-top: 40px; display: flex; gap: 28px; font: 500 12px var(--mono); color: var(--ink-2); letter-spacing: .04em; }
.stats b { display: block; font: 600 22px var(--font); color: var(--ink); letter-spacing: -.02em; margin-bottom: 2px; }
.scroll-cue { position: absolute; z-index: 5; left: 50%; bottom: 24px; transform: translateX(-50%); font: 500 11px var(--mono); letter-spacing: .14em; color: var(--ink-3); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.scroll-cue i { width: 1px; height: 28px; background: linear-gradient(var(--ink-3), transparent); animation: cue 2s infinite; }
@keyframes cue { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* ---------- Metric AI eye ---------- */
.ai { position: absolute; z-index: 5; top: 104px; left: clamp(16px, 4vw, 56px); display: flex; align-items: center; gap: 14px; }
.ai-eye { width: 56px; height: 44px; flex: none; color: var(--ink); }
.ai-eye .lids { transform-box: fill-box; transform-origin: center; animation: eyeBlink 7s infinite; }
@keyframes eyeBlink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.15); } }
.ai-eye .lens { transition: fill .3s; }
.ai.alert .ai-eye .lens { fill: #ff4d4d; }
.ai-name { font-size: 15px; font-weight: 600; }
.ai-status { margin-top: 2px; font-size: 14px; color: var(--ink-2); transition: color .3s; }
.ai.alert .ai-status { color: var(--critical); }
@media (max-width: 860px) { .ai { top: 84px; } }

/* ---------- 3D labels ---------- */
.tag { position: absolute; left: 0; top: 0; will-change: transform; }
.tag-inner {
  transform: translate(-50%, calc(-100% - 8px));
  font: 700 13px var(--mono); color: #fff; background: var(--shuttle);
  padding: 4px 8px; border-radius: 7px; position: relative; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(15,23,42,.18);
}
.tag-inner::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 8px; background: var(--shuttle); }
.tag.active .tag-inner { background: var(--brand); }
.tag.active .tag-inner::after { background: var(--brand); }
.tag.alarm .tag-inner { background: var(--critical); animation: tagPulse 1.2s infinite; }
.tag.alarm .tag-inner::after { background: var(--critical); }
@keyframes tagPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.55); } 60% { box-shadow: 0 0 0 10px rgba(220,38,38,0); } }
.tag.crane .tag-inner { background: none; color: var(--ink-2); font-size: 11px; box-shadow: none; padding: 0; }
.tag.crane .tag-inner::after { display: none; }
.tag.ground .tag-inner { background: none; color: var(--ink-3); font-size: 11px; box-shadow: none; padding: 0; transform: translate(-50%, -50%); }
.tag.ground .tag-inner::after { display: none; }

/* ---------- Notifications ---------- */
.toast {
  position: fixed; top: 0; right: clamp(16px, 2.5vw, 32px); z-index: 40;
  width: min(380px, calc(100vw - 32px));
  display: grid; grid-template-columns: 20px 1fr; column-gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 8px 24px -12px rgba(15,23,42,.25); padding: 16px 18px;
  opacity: 0; transition: transform 1s cubic-bezier(.22,.8,.2,1), opacity .5s;
}
.toast.show { opacity: 1; }
.toast.out { opacity: 0; transition: opacity .3s; }
.toast.critical { --accent: var(--critical); }
.toast.warn { --accent: var(--warn); }
.t-icon { width: 20px; height: 20px; margin-top: 1px; color: var(--accent); }
.t-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.t-level { color: var(--accent); font-weight: 600; }
.t-time { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.t-close { margin-left: auto; border: 0; background: none; color: var(--ink-3); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.t-close:hover { color: var(--ink); }
.t-title { margin-top: 4px; font-size: 16px; font-weight: 600; }
.t-body { margin-top: 4px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.t-meta { margin-top: 6px; font-size: 13px; color: var(--ink-3); }
.t-actions { margin-top: 12px; display: flex; gap: 20px; }
.t-link { border: 0; background: none; padding: 0; font: 600 14px var(--font); color: var(--ink); cursor: pointer; }
.t-link + .t-link { color: var(--ink-2); font-weight: 500; }
.t-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Footer (same on every page) ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); }
.footer-inner, .footer-bottom { max-width: 1240px; margin: 0 auto; padding-left: clamp(16px, 4vw, 56px); padding-right: clamp(16px, 4vw, 56px); }
.footer-inner { display: grid; grid-template-columns: 1.3fr 1fr 1.3fr .8fr; gap: 40px; padding-block: 56px 40px; }
.footer-brand p { margin-top: 14px; max-width: 260px; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.site-footer h4 { margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--ink); }
.site-footer address, .site-footer ul { font-style: normal; list-style: none; font-size: 15px; line-height: 1.7; color: var(--ink-2); }
.site-footer address b { color: var(--ink); font-weight: 600; }
.site-footer li span { display: inline-block; min-width: 56px; color: var(--ink-3); }
.site-footer a { overflow-wrap: anywhere; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.footer-bottom { padding-block: 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-3); }
@media (max-width: 860px) { .footer-inner { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-inner { grid-template-columns: 1fr; gap: 28px; } }

@media (max-width: 860px) {
  .nav-links, .nav-right .lang { display: none; }
  .hero::after { background: linear-gradient(0deg, rgba(248,250,252,.97) 0%, rgba(248,250,252,.85) 40%, rgba(248,250,252,0) 70%); }
  .hero-copy { right: 16px; bottom: 56px; }
  .stats { gap: 20px; }
  .scroll-cue { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity .3s; }
}
