/* ==========================================================================
   NX AI — Design System v1
   淺色未來科技風 (Light Futuristic)
   ========================================================================== */

:root {
  /* Brand */
  --nx-primary: #2563EB;        /* Royal Blue */
  --nx-primary-hover: #1D4ED8;
  --nx-primary-active: #1E40AF;
  --nx-accent: #06B6D4;         /* Cyan */
  --nx-accent-soft: #22D3EE;

  /* Surfaces */
  --nx-bg: #F5F7FB;
  --nx-bg-2: #EEF2F8;
  --nx-bg-3: #E7ECF4;
  --nx-surface: #FFFFFF;
  --nx-surface-soft: rgba(255, 255, 255, 0.72);
  --nx-glass: rgba(255, 255, 255, 0.55);

  /* Ink (text) */
  --nx-ink-900: #0B1220;
  --nx-ink-800: #111827;
  --nx-ink-700: #1F2937;
  --nx-ink-600: #374151;
  --nx-ink-500: #4B5563;
  --nx-ink-400: #6B7280;
  --nx-ink-300: #9CA3AF;
  --nx-ink-200: #CBD5E1;
  --nx-ink-100: #E2E8F0;

  /* Lines */
  --nx-line: rgba(15, 23, 42, 0.08);
  --nx-line-strong: rgba(15, 23, 42, 0.14);

  /* Status */
  --nx-success: #10B981;
  --nx-warning: #F59E0B;
  --nx-danger: #EF4444;
  --nx-info: #3B82F6;

  /* Elevation */
  --nx-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --nx-shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --nx-shadow-lg: 0 20px 40px -12px rgba(37, 99, 235, 0.14), 0 8px 20px rgba(15, 23, 42, 0.06);
  --nx-shadow-xl: 0 30px 60px -20px rgba(37, 99, 235, 0.22), 0 12px 30px rgba(15, 23, 42, 0.08);

  /* Radii */
  --nx-r-sm: 8px;
  --nx-r-md: 12px;
  --nx-r-lg: 16px;
  --nx-r-xl: 20px;
  --nx-r-2xl: 28px;

  /* Fonts */
  --nx-font-sans: "Inter", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Hiragino Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --nx-font-mono: "JetBrains Mono", "SF Mono", "Roboto Mono", "IBM Plex Mono", ui-monospace, "Menlo", "Consolas", monospace;

  /* Type scale */
  --nx-ls-tight: -0.028em;   /* large headings */
  --nx-ls-snug:  -0.016em;   /* medium headings */
  --nx-ls-body:  -0.005em;   /* body */
  --nx-ls-mono:  0.02em;     /* mono default */
  --nx-ls-cap:   0.14em;     /* mono ALL CAPS eyebrows */
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--nx-font-sans);
  color: var(--nx-ink-800);
  background: var(--nx-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01", "kern" 1, "liga" 1, "calt" 1;
  font-optical-sizing: auto;
  font-kerning: normal;
  min-height: 100vh;
  line-height: 1.6;
  letter-spacing: var(--nx-ls-body);
  word-spacing: 0.01em;
  /* Auto-inject small tracking around CJK/Latin borders */
  text-spacing-trim: trim-start;
}
/* Better Chinese punctuation spacing on Webkit */
:lang(zh), :lang(zh-Hant), :lang(zh-Hans) {
  font-feature-settings: "palt", "kern" 1;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ==========================================================================
   Background — layered gradient · grid · geometry · glow
   ========================================================================== */
.nx-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(6, 182, 212, 0.14), transparent 60%),
    radial-gradient(1000px 500px at -10% 10%, rgba(37, 99, 235, 0.12), transparent 60%),
    radial-gradient(800px 400px at 50% 100%, rgba(37, 99, 235, 0.06), transparent 60%),
    linear-gradient(180deg, #F5F7FB 0%, #EEF2F8 55%, #E7ECF4 100%);
}
/* Fine grid */
.nx-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 30%, black 35%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, black 35%, transparent 80%);
}
/* Rotating aurora glow */
.nx-bg::after {
  content: "";
  position: absolute;
  width: 700px;
  height: 700px;
  right: -200px;
  top: -200px;
  background: conic-gradient(from 180deg at 50% 50%, rgba(37, 99, 235, 0.12), rgba(6, 182, 212, 0.12), rgba(37, 99, 235, 0.12));
  filter: blur(80px);
  border-radius: 50%;
  animation: nx-aurora 22s ease-in-out infinite;
}
@keyframes nx-aurora {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.85; }
  50% { transform: translate(-40px, 30px) scale(1.08); opacity: 1; }
}

/* Geometric decoration layer (dashed circles + diagonal lines) */
.nx-bg-deco {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.nx-bg-deco svg {
  position: absolute;
  opacity: 0.7;
}
.nx-bg-deco .deco-1 {
  right: -160px;
  top: 40px;
  width: 480px; height: 480px;
}
.nx-bg-deco .deco-2 {
  left: -140px;
  bottom: 120px;
  width: 400px; height: 400px;
}
.nx-bg-deco .deco-3 {
  right: 8%;
  bottom: -80px;
  width: 260px; height: 260px;
  opacity: 0.5;
}
@media (max-width: 768px) {
  .nx-bg-deco .deco-1 { width: 320px; height: 320px; right: -120px; }
  .nx-bg-deco .deco-2 { width: 260px; height: 260px; left: -100px; }
  .nx-bg-deco .deco-3 { display: none; }
}

/* ==========================================================================
   Layout helpers
   ========================================================================== */
.nx-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}
@media (min-width: 768px) {
  .nx-container { padding: 0 32px; }
}

.nx-stack { display: flex; flex-direction: column; }
.nx-row   { display: flex; align-items: center; }
.nx-gap-2 { gap: 8px; }
.nx-gap-3 { gap: 12px; }
.nx-gap-4 { gap: 16px; }
.nx-gap-6 { gap: 24px; }

/* ==========================================================================
   Typography
   ========================================================================== */
.nx-eyebrow {
  font-family: var(--nx-font-mono);
  font-size: 11px;
  letter-spacing: var(--nx-ls-cap);
  text-transform: uppercase;
  color: var(--nx-primary);
  font-weight: 500;
  line-height: 1;
}
.nx-h1 {
  font-size: clamp(38px, 6.2vw, 62px);
  line-height: 1.08;
  letter-spacing: var(--nx-ls-tight);
  font-weight: 700;
  color: var(--nx-ink-900);
  margin: 0;
  text-wrap: balance;
}
.nx-h1 .nx-grad {
  background: linear-gradient(135deg, #2563EB 0%, #06B6D4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* Prevent gradient text clipping at descenders */
  padding-bottom: 0.02em;
}
.nx-h2 {
  font-size: clamp(24px, 3.4vw, 34px);
  line-height: 1.2;
  letter-spacing: var(--nx-ls-snug);
  font-weight: 700;
  color: var(--nx-ink-900);
  margin: 0;
  text-wrap: balance;
}
.nx-h3 {
  font-size: 20px;
  line-height: 1.35;
  letter-spacing: var(--nx-ls-snug);
  font-weight: 600;
  color: var(--nx-ink-900);
  margin: 0;
}
.nx-lead {
  font-size: 17px;
  line-height: 1.7;
  letter-spacing: var(--nx-ls-body);
  color: var(--nx-ink-500);
  max-width: 620px;
  text-wrap: pretty;
}
.nx-mono {
  font-family: var(--nx-font-mono);
  letter-spacing: var(--nx-ls-mono);
  font-feature-settings: "tnum" 1, "zero" 1, "cv11", "ss01";
}
/* Tabular numerals on all mono spans — makes numbers align nicely */
[class*="mono"], .nx-font-mono, code, kbd, samp, pre {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.nx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--nx-r-md);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  transition: all 0.15s ease;
  white-space: nowrap;
  border: 1px solid transparent;
  font-feature-settings: "cv11", "ss01";
}
.nx-btn-primary {
  background: linear-gradient(180deg, #2563EB 0%, #1D4ED8 100%);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 4px 12px rgba(37, 99, 235, 0.28);
}
.nx-btn-primary:hover {
  background: linear-gradient(180deg, #1D4ED8 0%, #1E40AF 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 6px 16px rgba(37, 99, 235, 0.36);
  transform: translateY(-1px);
}
.nx-btn-ghost {
  background: rgba(255,255,255,0.6);
  color: var(--nx-ink-800);
  border: 1px solid var(--nx-line);
  backdrop-filter: blur(8px);
}
.nx-btn-ghost:hover {
  background: rgba(255,255,255,0.9);
  border-color: var(--nx-line-strong);
}
.nx-btn-lg { padding: 14px 24px; font-size: 15px; border-radius: var(--nx-r-lg); }
.nx-btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: var(--nx-r-sm); }

/* ==========================================================================
   Card
   ========================================================================== */
.nx-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #FBFCFE 100%);
  border: 1px solid var(--nx-line);
  border-radius: var(--nx-r-lg);
  box-shadow: var(--nx-shadow-md);
  position: relative;
  overflow: hidden;
}
.nx-card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.nx-card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--nx-shadow-lg);
  border-color: rgba(37, 99, 235, 0.24);
}

/* Glass card */
.nx-glass-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0.60) 100%);
  border: 1px solid rgba(255,255,255,0.8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--nx-shadow-md);
  border-radius: var(--nx-r-lg);
}

/* ==========================================================================
   Status dot
   ========================================================================== */
.nx-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--nx-success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
  position: relative;
  flex-shrink: 0;
}
.nx-dot::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: nx-pulse 2s ease-in-out infinite;
}
@keyframes nx-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.7); opacity: 0; }
}
.nx-dot-warn { background: var(--nx-warning); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16); }
.nx-dot-danger { background: var(--nx-danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16); }

/* ==========================================================================
   Badge / Pill
   ========================================================================== */
.nx-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(37, 99, 235, 0.08);
  color: var(--nx-primary);
  border: 1px solid rgba(37, 99, 235, 0.16);
}
.nx-badge-mono { font-family: var(--nx-font-mono); font-size: 11px; }
.nx-badge-success { background: rgba(16, 185, 129, 0.08); color: var(--nx-success); border-color: rgba(16, 185, 129, 0.20); }
.nx-badge-muted { background: rgba(15, 23, 42, 0.04); color: var(--nx-ink-500); border-color: var(--nx-line); }

/* ==========================================================================
   Nav
   ========================================================================== */
.nx-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 247, 251, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--nx-line);
}
.nx-nav-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nx-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--nx-ink-900);
  font-size: 17px;
  line-height: 1;
}
.nx-logo-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563EB 0%, #06B6D4 100%);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  position: relative;
  overflow: hidden;
}
.nx-logo-mark::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 7px;
  background: linear-gradient(135deg, transparent 30%, rgba(255,255,255,0.25) 50%, transparent 70%);
}
.nx-nav-links {
  display: none;
  gap: 4px;
  align-items: center;
}
@media (min-width: 768px) {
  .nx-nav-links { display: flex; }
}
.nx-nav-link {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  letter-spacing: 0.01em;
  color: var(--nx-ink-500);
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}
.nx-nav-link:hover { color: var(--nx-ink-900); background: rgba(15, 23, 42, 0.04); }

/* ==========================================================================
   Sections
   ========================================================================== */
section { padding: 72px 0; }
@media (max-width: 768px) { section { padding: 48px 0; } }

.nx-section-head { margin-bottom: 32px; }
.nx-section-head .nx-eyebrow { margin-bottom: 12px; display: inline-block; }

/* ==========================================================================
   Utility
   ========================================================================== */
.nx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ==========================================================================
   Brand Footer(共用頁尾) — 登入前 / 登入後皆使用
   ========================================================================== */
.nx-brand-foot {
  padding: 32px 8px 20px;
  border-top: 1px solid var(--nx-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  background: transparent;
}
.nx-brand-foot .bf-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.nx-brand-foot .bf-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563EB 0%, #06B6D4 100%);
  color: #fff;
  font-family: var(--nx-font-mono);
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
  letter-spacing: 0.02em;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.24);
}
.nx-brand-foot .bf-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--nx-ink-900);
  letter-spacing: 0.02em;
}
.nx-brand-foot .bf-tag {
  font-family: var(--nx-font-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--nx-ink-500);
}
.nx-brand-foot .bf-copy {
  font-family: var(--nx-font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--nx-ink-400);
  margin-top: 2px;
}

/* 登入前 landing / auth 頁 — 頁面底部延伸樣式 */
.nx-brand-foot.is-page {
  margin-top: 40px;
  padding: 44px 24px 32px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* 登入後 dashboard 頁 — 收縮版,融入內容區 */
.nx-brand-foot.is-inner {
  margin-top: 12px;
  padding: 28px 8px 16px;
}
