/* ============================================================
   NEXUS TERMINAL — Shared Stylesheet
   ============================================================ */

/* Font loaded via <link> in HTML <head> for better performance.
   Avoids render-blocking @import inside CSS.
   See: <link rel="preconnect"> + <link rel="stylesheet"> in each .html file. */

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  background: #000;
  color: #c8c8c8;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ── Scanline overlay ───────────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  --green:   #00ff41;
  --orange:  #ff6600;
  --red:     #ff2244;
  --bg:      #000;
  --bg2:     #0a0a0a;
  --bg3:     #0f0f0f;
  --border:  #1a1a1a;
  --muted1:  #444;
  --muted2:  #666;
  --muted3:  #999;
  --text:    #c8c8c8;
  --nav-h:   64px;
}

/* ── Focus visible (accessibility) ─────────────────────────── */
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* ── Skip to content (accessibility) ───────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--green);
  color: #000;
  padding: 8px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  z-index: 10000;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 8px;
}

/* ── Utility ────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-green  { color: var(--green); }
.text-orange { color: var(--orange); }
.text-red    { color: var(--red); }
.text-muted  { color: var(--muted2); }
.mono { font-family: 'JetBrains Mono', monospace; }

/* ── Navigation ─────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(0, 0, 0, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
}
.nav-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--green);
  text-shadow: 0 0 12px rgba(0,255,65,0.4);
  white-space: nowrap;
}
.nav-logo span { color: var(--muted2); font-weight: 400; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-links a {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--muted3);
  text-transform: uppercase;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--green); }
.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--muted3);
  transition: all 0.3s;
}
.nav-mobile {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  background: rgba(0,0,0,0.97);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px 24px;
  z-index: 999;
  flex-direction: column;
  gap: 8px;
}
.nav-mobile.open { display: flex; }
.nav-mobile a {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted3);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s;
}
.nav-mobile a:hover { color: var(--green); }
.nav-mobile .btn-primary { margin-top: 12px; text-align: center; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: var(--green);
  color: #000;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  white-space: nowrap;
}
.btn-primary:hover {
  background: #00dd38;
  box-shadow: 0 0 20px rgba(0,255,65,0.35);
  transform: translateY(-1px);
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: transparent;
  color: var(--green);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--green);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  white-space: nowrap;
}
.btn-ghost:hover {
  background: rgba(0,255,65,0.08);
  box-shadow: 0 0 16px rgba(0,255,65,0.2);
  transform: translateY(-1px);
}
.btn-outline-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: transparent;
  color: var(--green);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--green);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
.btn-outline-sm:hover {
  background: rgba(0,255,65,0.08);
  box-shadow: 0 0 12px rgba(0,255,65,0.15);
}

/* ── Section shared ──────────────────────────────────────────── */
section { padding: 96px 0; }
.section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--green);
}
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: #fff;
  margin-bottom: 16px;
}
.section-sub {
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--muted2);
  max-width: 560px;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 28px 24px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--green);
  opacity: 0;
  transition: opacity 0.2s;
}
.card:hover {
  border-color: rgba(0,255,65,0.25);
  box-shadow: 0 4px 32px rgba(0,255,65,0.06);
  transform: translateY(-2px);
}
.card:hover::before { opacity: 1; }
.card-icon {
  font-size: 1.4rem;
  margin-bottom: 14px;
  display: block;
}
.card-tag {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--green);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  margin-bottom: 10px;
}
.card-body {
  font-size: 0.78rem;
  line-height: 1.65;
  color: var(--muted2);
}

/* ── Terminal box ────────────────────────────────────────────── */
.terminal-box {
  background: #050505;
  border: 1px solid #1e1e1e;
  font-size: 0.72rem;
  line-height: 1.6;
  padding: 16px 20px;
  overflow: hidden;
  position: relative;
}
.terminal-box .tb-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #1a1a1a;
}
.tb-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.tb-dot.r { background: #ff2244; }
.tb-dot.y { background: #ffc300; }
.tb-dot.g { background: #00ff41; }
.tb-title {
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--muted2);
  text-transform: uppercase;
  margin-left: 4px;
}
.terminal-box .tb-line { color: var(--muted3); }
.terminal-box .tb-line .g  { color: var(--green); }
.terminal-box .tb-line .o  { color: var(--orange); }
.terminal-box .tb-line .r  { color: var(--red); }
.terminal-box .tb-line .w  { color: #fff; }
.terminal-box .tb-line .d  { color: var(--muted1); }
.terminal-box .tb-prompt::before {
  content: '> ';
  color: var(--green);
}

/* ── Ticker tape ─────────────────────────────────────────────── */
.ticker-wrap {
  overflow: hidden;
  background: #0a0a0a;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  position: relative;
}
.ticker-wrap::before,
.ticker-wrap::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 80px;
  z-index: 2;
}
.ticker-wrap::before { left: 0; background: linear-gradient(to right, #0a0a0a, transparent); }
.ticker-wrap::after  { right: 0; background: linear-gradient(to left, #0a0a0a, transparent); }
.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker-scroll 40s linear infinite;
  gap: 0;
  will-change: transform;
}
.ticker-track:hover { animation-play-state: paused; }
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 28px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-right: 1px solid var(--border);
}
.ticker-item .sym { color: #fff; }
.ticker-item .val { color: var(--muted3); }
.ticker-item .chg-up   { color: var(--green); }
.ticker-item .chg-down { color: var(--red); }
@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 40px 0 32px;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-logo {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--green);
}
.footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-links a {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted2);
  text-transform: uppercase;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--green); }
.footer-copy {
  font-size: 0.68rem;
  color: var(--muted1);
  letter-spacing: 0.04em;
}

/* ── Divider ─────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ── Fade-in animation ───────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}
.fade-in-delay-1 { transition-delay: 0.1s; }
.fade-in-delay-2 { transition-delay: 0.2s; }
.fade-in-delay-3 { transition-delay: 0.3s; }
.fade-in-delay-4 { transition-delay: 0.4s; }
.fade-in-delay-5 { transition-delay: 0.5s; }

/* ── Typewriter ──────────────────────────────────────────────── */
.typewriter-cursor::after {
  content: '_';
  color: var(--green);
  animation: blink 0.8s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Grid helpers ────────────────────────────────────────────── */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }

/* ── Badge ───────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid;
}
.badge-green  { color: var(--green); border-color: var(--green); background: rgba(0,255,65,0.06); }
.badge-orange { color: var(--orange); border-color: var(--orange); background: rgba(255,102,0,0.08); }
.badge-muted  { color: var(--muted2); border-color: var(--muted1); background: transparent; }

/* ── Table ───────────────────────────────────────────────────── */
.nt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.nt-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted2);
  border-bottom: 1px solid var(--border);
}
.nt-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #111;
  vertical-align: top;
  line-height: 1.5;
}
.nt-table tr:hover td { background: rgba(0,255,65,0.02); }
.nt-table .cmd-cell {
  color: var(--green);
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* ── Accordion ───────────────────────────────────────────────── */
.accordion-item {
  border: 1px solid var(--border);
  margin-bottom: 8px;
  overflow: hidden;
}
.accordion-header {
  width: 100%;
  background: var(--bg2);
  border: none;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
}
.accordion-header:hover { background: #0f0f0f; }
.accordion-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.accordion-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  text-transform: uppercase;
}
.accordion-arrow {
  font-size: 0.75rem;
  color: var(--green);
  transition: transform 0.2s;
}
.accordion-item.open .accordion-arrow { transform: rotate(180deg); }
.accordion-body {
  display: none;
  padding: 0 20px 20px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
}
.accordion-item.open .accordion-body { display: block; }

/* ── Pricing ─────────────────────────────────────────────────── */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--border);
}
.pricing-card {
  padding: 40px 32px;
  border-right: 1px solid var(--border);
  position: relative;
  background: var(--bg);
  transition: background 0.2s;
}
.pricing-card:last-child { border-right: none; }
.pricing-card.featured {
  background: #050505;
  border-top: 2px solid var(--green);
}
.pricing-card .popular-badge {
  position: absolute;
  top: -1px; right: 24px;
  background: var(--green);
  color: #000;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
}
.pricing-tier {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 12px;
}
.pricing-price {
  font-size: 2.6rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  margin-bottom: 4px;
}
.pricing-price sup {
  font-size: 1rem;
  vertical-align: super;
  font-weight: 600;
  color: var(--muted2);
}
.pricing-period {
  font-size: 0.7rem;
  color: var(--muted2);
  margin-bottom: 24px;
  letter-spacing: 0.04em;
}
.pricing-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin-bottom: 24px;
}
.pricing-features { margin-bottom: 32px; }
.pricing-feature {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--muted3);
}
.pricing-feature .check { color: var(--green); flex-shrink: 0; margin-top: 1px; }
.pricing-feature .cross { color: var(--muted1); flex-shrink: 0; margin-top: 1px; }
.pricing-feature.enabled { color: var(--text); }

/* ── Form styles (shared) ────────────────────────────────────── */
.form-input {
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  color: #fff;
  font-family: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.form-input:focus {
  border-color: var(--green);
}
.form-input::placeholder {
  color: #666;
}
.form-select {
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  color: #666;
  font-family: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.form-select:focus {
  border-color: var(--green);
}
.form-select.has-value {
  color: #c8c8c8;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .pricing-grid { grid-template-columns: 1fr; border: none; gap: 2px; }
  .pricing-card { border-right: none; border: 1px solid var(--border); }
  .pricing-card.featured { border-top: 2px solid var(--green); }
}

@media (max-width: 768px) {
  /* Nav */
  .nav-links { display: none; }
  .nav-right .btn-ghost { display: none; }
  .nav-hamburger { display: flex; }

  /* Layout */
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  section { padding: 56px 0; }
  .section-title { font-size: 1.4rem; letter-spacing: 0.02em; }
  .section-sub { font-size: 0.8rem; }

  /* Hero */
  .hero-inner { padding: 48px 16px 40px; }
  .hero-headline { font-size: clamp(1.7rem, 7vw, 2.4rem); }
  .hero-headline-static { font-size: 0.9rem; }
  .hero-sub { font-size: 0.78rem; margin-bottom: 28px; }
  .hero-ctas { flex-direction: column; align-items: flex-start; gap: 10px; }
  .hero-ctas .btn-primary,
  .hero-ctas .btn-ghost { width: 100%; justify-content: center; }
  .hero-stats { gap: 20px; padding-top: 28px; }
  .hero-stat-value { font-size: 1.3rem; }

  /* Tables — horizontal scroll on mobile */
  .nt-table { font-size: 0.72rem; }
  .nt-table th, .nt-table td { padding: 10px 12px; }
  .compare-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Terminal boxes — allow horizontal scroll */
  .terminal-box { overflow-x: auto; font-size: 0.68rem; }

  /* Footer */
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 20px; }
  .footer-links { gap: 16px; }

  /* Cards */
  .card { padding: 22px 18px; }
  .pricing-card { padding: 32px 22px; }

  /* Why grid */
  .why-item { padding: 28px 20px; }

  /* Docs */
  .docs-main { padding: 28px 16px; }

  /* Accordion */
  .accordion-header { padding: 14px 16px; }
  .accordion-body { padding: 0 16px 16px; }
}

@media (max-width: 480px) {
  :root { --nav-h: 56px; }
  .container { padding: 0 14px; }
  section { padding: 44px 0; }

  .nav-logo { font-size: 0.95rem; }

  .btn-primary, .btn-ghost { padding: 11px 16px; font-size: 0.7rem; letter-spacing: 0.08em; }

  .hero-inner { padding: 36px 14px 32px; }
  .hero-eyebrow { font-size: 0.58rem; }
  .hero-headline { font-size: clamp(1.5rem, 8vw, 2rem); }
  .hero-stats { flex-wrap: wrap; gap: 16px 28px; }
  .hero-stat-value { font-size: 1.2rem; }
  .hero-stat-label { font-size: 0.58rem; }

  .section-title { font-size: 1.25rem; }
  .section-label { font-size: 0.6rem; }

  /* Ticker — faster on mobile feels snappier */
  .ticker-track { animation-duration: 25s; }
  .ticker-item { padding: 0 18px; font-size: 0.68rem; }

  /* Pricing */
  .pricing-price { font-size: 2.1rem; }
  .pricing-card { padding: 28px 18px; }

  /* Tables full-width scroll */
  .nt-table, .compare-table { font-size: 0.68rem; }
  .nt-table th, .nt-table td,
  .compare-table th, .compare-table td { padding: 8px 10px; }

  /* Social badges wrap tighter */
  .social-badges { gap: 8px; }
  .social-badge { font-size: 0.62rem; padding: 6px 12px; }

  /* Footer stack tight */
  .footer { padding: 28px 0 24px; }
  .footer-links { gap: 12px; }
  .footer-copy { font-size: 0.62rem; }
}

/* ── Reduced motion preference ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .fade-in {
    opacity: 1;
    transform: none;
  }
  .ticker-track {
    animation: none;
  }
}
