/* Nexus — shared design system. Dusk at cruising altitude: slate-blue sky, amber horizon, violet haze,
   with navy, red, orange and gold as the accent set. */

:root {
  /* Sky, top to bottom */
  --sky-0: #3e5578;
  --sky-1: #536c91;
  --sky-2: #7489a8;
  --sky-3: #a3b0c0;
  --haze: #c9c4bd;
  --glow: #f6d189;
  --amber: #f3b468;
  --ember: #e98f5c;
  --dusk: #9a7f80;
  --mauve: #6f6170;
  --night: #4b4557;

  /* Accents */
  --w-navy: #262a66;
  --w-red: #d9372b;
  --w-orange: #f0782c;
  --w-gold: #f8b934;

  /* Surfaces & text (light UI) */
  --bg: #f3f1ef;
  --card: #ffffff;
  --card-glass: rgba(255, 255, 255, 0.78);
  --ink: #1d2639;
  --ink-2: #4a5468;
  --ink-3: #848da0;
  --line: #e4e6ec;
  --line-2: #d3d7e0;
  --tint: #f1f3f8;
  --accent: #e2712f;
  --accent-ink: #b9531a;
  --accent-pale: #fdf0e6;

  --focus: 0 0 0 3px rgba(226, 113, 47, 0.25);
  --shadow-sm: 0 1px 2px rgba(29, 38, 57, 0.06), 0 2px 8px rgba(29, 38, 57, 0.04);
  --shadow-md: 0 2px 6px rgba(29, 38, 57, 0.06), 0 16px 40px rgba(29, 38, 57, 0.10);
  --shadow-lg: 0 30px 80px rgba(29, 38, 57, 0.28);
  --radius: 14px;

  --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --font-ui: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --sun-btn: linear-gradient(135deg, var(--w-gold) 0%, var(--w-orange) 55%, var(--w-red) 100%);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }
svg { flex: none; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Brand mark: a cabin window, shade half up, sun on the horizon ---------- */
.mark { display: inline-block; width: 30px; height: 30px; flex: none; }
.mark svg { display: block; width: 100%; height: 100%; }
.mark--sm { width: 24px; height: 24px; }
.mark--lg { width: 44px; height: 44px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--card); color: var(--ink);
  font-weight: 600; font-size: 14px; letter-spacing: 0.005em;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s, filter .15s;
}
.btn:hover { border-color: var(--sky-2); color: var(--sky-0); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn--primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--primary:hover { background: var(--sky-0); border-color: var(--sky-0); color: #fff; }
.btn--sun { background: var(--sun-btn) border-box; border-color: transparent; color: #fff; text-shadow: 0 1px 1px rgba(120, 40, 10, .25); }
.btn--sun:hover { filter: brightness(1.06) saturate(1.05); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(233, 120, 44, .28); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--tint); border-color: transparent; }
.btn--glass { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .28); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.btn--glass:hover { background: rgba(255, 255, 255, .24); border-color: rgba(255, 255, 255, .45); color: #fff; }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn--icon { width: 40px; padding: 0; }
.btn--sm.btn--icon { width: 32px; }

/* ---------- Toast ---------- */
.toast-stack { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(460px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 12px;
  background: var(--ink); color: #fff; font-size: 14px;
  box-shadow: var(--shadow-md);
  animation: nx-toast-in .25s ease-out;
}
.toast--error { background: #9b2420; }
@keyframes nx-toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Sky scene (gate window, landing hero, sign-in, app headers) ----------
   --horizon: where the sun meets the cloud sea; --sun-x: where along it the sun sets. */
.sky {
  --horizon: 62%; --sun-x: 68%; --sun: clamp(64px, 8vw, 132px);
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(180deg,
    var(--sky-0) 0%, var(--sky-1) calc(var(--horizon) * .29), var(--sky-2) calc(var(--horizon) * .55), var(--sky-3) calc(var(--horizon) * .76),
    var(--glow) calc(var(--horizon) - 4%), var(--amber) var(--horizon), var(--ember) calc(var(--horizon) + 5%),
    var(--dusk) calc(var(--horizon) + (100% - var(--horizon)) * .37), var(--mauve) calc(var(--horizon) + (100% - var(--horizon)) * .68), var(--night) 100%);
  color: #fff;
}
.sky__scene { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.sky__scene > * { position: absolute; }
.sky__glow {
  left: -10%; right: -10%; top: calc(var(--horizon) - 16%); height: 34%;
  background:
    radial-gradient(55% 55% at var(--sun-x) 50%, rgba(255, 214, 140, .55), transparent 70%),
    radial-gradient(40% 40% at calc(var(--sun-x) - 30%) 55%, rgba(255, 170, 110, .22), transparent 70%);
  filter: blur(6px);
}
.sky__stars { inset: 0 0 calc(100% - var(--horizon) + 14%) 0; }
.sky__stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; opacity: .0; animation: nx-twinkle var(--t, 5s) ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes nx-twinkle { 0%, 100% { opacity: 0; } 50% { opacity: var(--o, .55); } }

.sky__trails { inset: 0; }
.sky__trail { display: block; }
.sky__trail-draw path { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: nx-trail 3.2s cubic-bezier(.25, .6, .2, 1) .5s forwards; }
.sky__trail-head { opacity: 0; animation: nx-fade-in 1s ease-out 3.1s forwards; }
.sky__trails.is-static .sky__trail-draw path { animation: none; stroke-dashoffset: 0; }
.sky__trails.is-static .sky__trail-head { animation: none; opacity: 1; }
@keyframes nx-trail { to { stroke-dashoffset: 0; } }
@keyframes nx-fade-in { to { opacity: 1; } }

.sky__drift { inset: 0; will-change: transform; }
.sky__drift > * { position: absolute; }
.sky__sun {
  left: var(--sun-x); top: var(--horizon); width: var(--sun); height: var(--sun); margin: calc(var(--sun) / -2) 0 0 calc(var(--sun) / -2);
  border-radius: 50%;
  background: radial-gradient(circle, #fffaf0 0%, #fff1cf 46%, #ffd99a 64%, rgba(255, 206, 140, 0) 71%);
  box-shadow: 0 0 calc(var(--sun) * .5) calc(var(--sun) * .12) rgba(255, 214, 150, .45);
}
.sky__sea { left: 0; right: 0; top: calc(var(--horizon) - 1%); bottom: 0; }
.sky__deck { position: absolute; left: 0; top: 0; overflow: visible;   /* puffs rise above the deck's box */ animation: nx-drift var(--secs, 200s) linear infinite; will-change: transform; }
@keyframes nx-drift { to { transform: translate3d(-50%, 0, 0); } }
.sky__bloom {
  left: 0; right: 0; top: calc(var(--horizon) - 18%); height: 34%;
  background: radial-gradient(30% 50% at var(--sun-x) 52%, rgba(255, 226, 170, .42), rgba(255, 190, 120, .12) 55%, transparent 80%);
  mix-blend-mode: screen;
}
.sky__haze { left: 0; right: 0; bottom: 0; height: 30%; background: linear-gradient(180deg, transparent, rgba(75, 69, 87, .45)); }
.sky__grain {
  inset: 0; opacity: .09; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='.33 .33 .33 0 0 .33 .33 .33 0 0 .33 .33 .33 0 0 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
