/* ==========================================================================
   Nexora Design System — Base + Components
   Requires tokens.css. All classes are prefixed with `nx-`.
   ========================================================================== */

/* ---- Base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body.nx {
  margin: 0;
  background: var(--nx-bg);
  color: var(--nx-text);
  font-family: var(--nx-font-sans);
  font-size: var(--nx-text-md);
  line-height: var(--nx-leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.nx a { color: inherit; text-decoration: none; }
.nx :focus-visible { outline: none; box-shadow: var(--nx-focus-ring); }

.nx-container {
  width: 100%;
  max-width: var(--nx-container);
  margin-inline: auto;
  padding-inline: var(--nx-gutter);
}

/* Ambient red glow — place behind hero content */
.nx-ambient {
  position: relative;
  isolation: isolate;
}
.nx-ambient::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--nx-gradient-ambient);
  pointer-events: none;
}

/* Full-bleed hero artwork — place as first child of a positioned, isolated
   parent (e.g. .nx-frame). Sits behind all content and fades into the base
   color. On desktop it fills the lower part of the hero so the headline stays
   on clean black. */
.nx-hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.nx-hero-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../assets/hero-bg-mobile.webp") 39% 100% / cover no-repeat;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22%);
  mask-image: linear-gradient(180deg, transparent 0, #000 22%);
}
.nx-hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(100% 80% at 50% 60%, transparent 55%, var(--nx-bg) 100%);
}
@media (min-width: 761px) {
  .nx-hero-bg::before {
    top: auto;
    height: min(62%, 43vw);
    background-image: url("../assets/hero-bg.webp");
    background-position: 39% 60%;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 40%);
    mask-image: linear-gradient(180deg, transparent 0, #000 40%);
  }
}
/* Light theme: daytime artwork, same framing/positioning/masks as dark. */
[data-theme="light"] .nx-hero-bg::before {
  background-image: url("../assets/hero-bg-light-mobile.webp");
}
/* On mobile the copy overlaps the (bright, busy) daytime globe: veil the
   copy area with the base color so muted text keeps AA contrast. */
@media (max-width: 760px) {
  [data-theme="light"] .nx-hero-bg::after {
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--nx-bg) 88%, transparent) 0 40%, transparent 58%),
      radial-gradient(100% 80% at 50% 60%, transparent 55%, var(--nx-bg) 100%);
  }
}
@media (min-width: 761px) {
  [data-theme="light"] .nx-hero-bg::before {
    background-image: url("../assets/hero-bg-light.webp");
  }
}

/* Rounded page frame (the bordered "window" around the landing page) */
.nx-frame {
  border: 1px solid var(--nx-border-strong);
  border-radius: var(--nx-radius-xl);
  background: var(--nx-bg);
  overflow: hidden;
}

/* ---- Typography --------------------------------------------------------- */
.nx-display {
  margin: 0;
  font-size: var(--nx-text-4xl);
  font-weight: var(--nx-weight-semibold);
  line-height: var(--nx-leading-tight);
  letter-spacing: var(--nx-tracking-tight);
  text-wrap: balance;
}
.nx-h2 {
  margin: 0;
  font-size: var(--nx-text-3xl);
  font-weight: var(--nx-weight-semibold);
  line-height: var(--nx-leading-tight);
  letter-spacing: var(--nx-tracking-tight);
}
.nx-h3 {
  margin: 0;
  font-size: var(--nx-text-xl);
  font-weight: var(--nx-weight-semibold);
  line-height: var(--nx-leading-snug);
}
.nx-lead {
  margin: 0;
  font-size: var(--nx-text-md);
  color: var(--nx-text-muted);
  max-width: 34rem;
}
.nx-caption {
  font-size: var(--nx-text-xs);
  color: var(--nx-text-muted);
}
.nx-text-accent { color: var(--nx-accent-text); }
.nx-text-muted { color: var(--nx-text-muted); }

/* ---- Logo --------------------------------------------------------------- */
.nx-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--nx-space-2);
  font-weight: var(--nx-weight-bold);
  font-size: var(--nx-text-md);
  letter-spacing: var(--nx-tracking-wide);
  text-transform: uppercase;
}
.nx-logo__mark { width: 18px; height: 18px; color: var(--nx-accent); }
/* Preserve brand-name casing (e.g. "em7"). */
.nx-logo--as-written { text-transform: none; letter-spacing: var(--nx-tracking-normal); }

/* ---- Navigation --------------------------------------------------------- */
.nx-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--nx-space-6);
  padding-block: var(--nx-space-5);
}
.nx-nav__links {
  display: flex;
  gap: var(--nx-space-10);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nx-nav__link {
  font-size: var(--nx-text-sm);
  font-weight: var(--nx-weight-medium);
  color: var(--nx-text-muted);
  transition: color var(--nx-duration-base) var(--nx-ease-standard);
}
.nx-nav__link:hover { color: var(--nx-text); }
.nx-nav__link[aria-current="page"] { color: var(--nx-accent-text); }
.nx-nav__actions { display: flex; align-items: center; gap: var(--nx-space-3); }

@media (max-width: 860px) {
  .nx-nav__links { display: none; }
}

/* ---- Buttons ------------------------------------------------------------ */
.nx-btn {
  --_h: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--nx-space-2);
  height: var(--_h);
  padding-inline: var(--nx-space-5);
  border: 1px solid transparent;
  border-radius: var(--nx-radius-full);
  font: inherit;
  font-size: var(--nx-text-sm);
  font-weight: var(--nx-weight-medium);
  white-space: nowrap;
  cursor: pointer;
  transition:
    background var(--nx-duration-base) var(--nx-ease-standard),
    border-color var(--nx-duration-base) var(--nx-ease-standard),
    box-shadow var(--nx-duration-base) var(--nx-ease-standard),
    transform var(--nx-duration-fast) var(--nx-ease-standard);
}
.nx-btn:active { transform: translateY(1px); }
.nx-btn svg { width: 14px; height: 14px; transition: transform var(--nx-duration-base) var(--nx-ease-emphasized); }
.nx-btn:hover svg:last-child { transform: translateX(2px); }
.nx-btn[disabled] { opacity: 0.45; pointer-events: none; }

.nx-btn--sm { --_h: 32px; padding-inline: var(--nx-space-4); font-size: var(--nx-text-xs); }
.nx-btn--lg { --_h: 48px; padding-inline: var(--nx-space-6); font-size: var(--nx-text-md); }

.nx-btn--primary {
  background: var(--nx-gradient-accent);
  color: var(--nx-on-accent);
  box-shadow: var(--nx-shadow-glow-sm);
}
.nx-btn--primary:hover {
  box-shadow: 0 0 0 1px rgba(245, 48, 61, 0.6), 0 10px 30px -6px rgba(225, 29, 42, 0.75);
}

.nx-btn--secondary {
  background: var(--nx-surface);
  border-color: var(--nx-border-strong);
  color: var(--nx-text);
  backdrop-filter: blur(var(--nx-blur-glass));
}
.nx-btn--secondary:hover { border-color: var(--nx-text-subtle); background: var(--nx-surface-strong); }

.nx-btn--ghost { background: transparent; color: var(--nx-text-muted); }
.nx-btn--ghost:hover { color: var(--nx-text); background: var(--nx-surface); }

/* Round icon button (theme toggle, card arrow) */
.nx-icon-btn {
  --_s: 36px;
  display: inline-grid;
  place-items: center;
  width: var(--_s);
  height: var(--_s);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius-full);
  background: var(--nx-surface);
  color: var(--nx-text);
  cursor: pointer;
  transition: background var(--nx-duration-base), border-color var(--nx-duration-base);
}
.nx-icon-btn:hover { background: var(--nx-surface-strong); border-color: var(--nx-border-strong); }
.nx-icon-btn svg { width: 16px; height: 16px; }
.nx-icon-btn--sm { --_s: 28px; }
.nx-icon-btn--sm svg { width: 12px; height: 12px; }
.nx-icon-btn--plain { border-color: transparent; background: transparent; }

/* ---- Badge / Eyebrow pill ---------------------------------------------- */
.nx-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--nx-space-2);
  padding: var(--nx-space-1) var(--nx-space-3);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius-full);
  background: var(--nx-surface);
  font-size: var(--nx-text-xs);
  font-weight: var(--nx-weight-medium);
  color: var(--nx-text);
  backdrop-filter: blur(var(--nx-blur-glass));
}
.nx-badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nx-accent);
  box-shadow: 0 0 8px 1px var(--nx-accent);
}
.nx-badge--accent {
  background: var(--nx-accent-soft);
  border-color: rgba(225, 29, 42, 0.35);
  color: var(--nx-accent-text);
}

/* ---- Card (glass feature card) ----------------------------------------- */
.nx-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--nx-space-3);
  padding: var(--nx-space-5);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius-lg);
  background: var(--nx-gradient-surface), var(--nx-surface);
  box-shadow: var(--nx-shadow-card);
  backdrop-filter: blur(var(--nx-blur-glass));
  -webkit-backdrop-filter: blur(var(--nx-blur-glass));
  transition: border-color var(--nx-duration-base), transform var(--nx-duration-slow) var(--nx-ease-standard);
}
.nx-card--interactive:hover { border-color: var(--nx-border-strong); transform: translateY(-2px); }
.nx-card__title { margin: var(--nx-space-2) 0 0; font-size: var(--nx-text-sm); font-weight: var(--nx-weight-semibold); }
.nx-card__body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--nx-space-4);
}
.nx-card__text { margin: 0; font-size: var(--nx-text-xs); color: var(--nx-text-muted); line-height: var(--nx-leading-normal); }

/* Icon tile inside cards */
.nx-icon-tile {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--nx-radius-md);
  border: 1px solid var(--nx-border);
  background: var(--nx-surface-strong);
  color: var(--nx-text);
}
.nx-icon-tile svg { width: 16px; height: 16px; }
.nx-icon-tile--accent {
  background: radial-gradient(circle at 50% 30%, rgba(245, 48, 61, 0.35), rgba(225, 29, 42, 0.12));
  border-color: rgba(245, 48, 61, 0.35);
  color: var(--nx-red-400);
}
.nx-icon-tile--round { border-radius: var(--nx-radius-full); }

/* ---- Stats bar --------------------------------------------------------- */
.nx-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--nx-space-6) var(--nx-space-10);
  padding: var(--nx-space-4) var(--nx-space-6);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius-lg);
  background: var(--nx-gradient-surface), var(--nx-surface);
  backdrop-filter: blur(var(--nx-blur-glass));
}
.nx-stats__lead { display: flex; align-items: center; gap: var(--nx-space-3); margin-right: auto; }
@media (max-width: 640px) {
  .nx-stats { display: grid; grid-template-columns: repeat(2, 1fr); }
  .nx-stats__lead { grid-column: 1 / -1; }
}
.nx-stat { display: flex; flex-direction: column; gap: 2px; }
.nx-stat__value {
  font-size: var(--nx-text-xl);
  font-weight: var(--nx-weight-semibold);
  letter-spacing: var(--nx-tracking-tight);
  color: var(--nx-accent-text);
  font-variant-numeric: tabular-nums;
}
.nx-stat__label { font-size: var(--nx-text-xs); color: var(--nx-text-muted); }

/* ---- Avatar stack ------------------------------------------------------ */
.nx-avatars { display: flex; }
.nx-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--nx-bg);
  background: var(--nx-neutral-600) center/cover no-repeat;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: var(--nx-weight-semibold);
  color: var(--nx-neutral-0);
}
.nx-avatar + .nx-avatar { margin-left: -8px; }

/* ---- Form input -------------------------------------------------------- */
.nx-input {
  height: 40px;
  width: 100%;
  padding-inline: var(--nx-space-4);
  border: 1px solid var(--nx-border-strong);
  border-radius: var(--nx-radius-full);
  background: var(--nx-surface);
  color: var(--nx-text);
  font: inherit;
  font-size: var(--nx-text-sm);
  transition: border-color var(--nx-duration-base), box-shadow var(--nx-duration-base);
}
.nx-input::placeholder { color: var(--nx-text-subtle); }
.nx-input:focus { outline: none; border-color: var(--nx-accent); box-shadow: var(--nx-focus-ring); }

/* ---- Orb (CSS stand-in for the glowing globe) -------------------------- */
.nx-orb {
  position: relative;
  aspect-ratio: 1;
  width: min(420px, 80vw);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 95, 106, 0.55) 0%, transparent 45%),
    radial-gradient(circle at 50% 40%, #2a0a0d 0%, #0d0405 70%);
  box-shadow:
    inset 0 20px 60px rgba(245, 48, 61, 0.35),
    inset 0 -40px 80px rgba(0, 0, 0, 0.9),
    var(--nx-shadow-glow-lg);
}
.nx-orb::before,
.nx-orb::after {
  content: "";
  position: absolute;
  inset: -18% -30%;
  border-radius: 50%;
  border: 1px solid rgba(245, 48, 61, 0.55);
  transform: rotate(-12deg) scaleY(0.32);
  filter: drop-shadow(0 0 6px rgba(245, 48, 61, 0.8));
}
.nx-orb::after {
  inset: -8% -18%;
  transform: rotate(14deg) scaleY(0.4);
  border-color: rgba(245, 48, 61, 0.35);
}

/* ---- Divider ----------------------------------------------------------- */
.nx-divider { height: 1px; border: 0; background: var(--nx-border); margin: 0; }
