/* ═══════════════════════════════════════════════════
   base.css  —  Finsight Core shared styles
   Loaded on every page via base.html
   ═══════════════════════════════════════════════════ */

/* ── RESET ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── DESIGN TOKENS ── */
:root {
  --ink:     #0a0c10;
  --ink2:    #111520;
  --ink3:    #161c2c;
  --ink4:    #1d2538;
  --ink5:    #232e47;
  --signal:  #4fffb0;
  --signal2: #00d97e;
  --signal3: #a8ffd6;
  --amber:   #ffb84d;
  --rose:    #ff6b6b;
  --ice:     #c8d6ff;
  --white:   #ffffff;
  --paper:   #e8eef8;
  --line:    rgba(200, 214, 255, 0.10);
  --line2:   rgba(79,  255, 176, 0.20);
  --ghost:   rgba(200, 214, 255, 0.08);
  --ghost2:  rgba(200, 214, 255, 0.04);

  /* Layout rhythm */
  --nav-h:  64px;
  --tick-h: 36px;
  --offset: calc(var(--tick-h) + var(--nav-h)); /* 100px */
}

/* ── BASE ── */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--ink);
  color: var(--paper);
  overflow-x: hidden;
}

/* ── CUSTOM CURSOR ── */
/* Only on devices with a fine pointer (mouse) */
@media (pointer: fine) {
  body { cursor: none; }

  .cur {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: exclusion;
  }

  .cur-dot {
    display: block;
    width: 8px;
    height: 8px;
    background: var(--signal);
    border-radius: 50%;
    transform: translate(-50%, -50%);
  }

  .cur-ring {
    position: fixed;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(79, 255, 176, 0.40);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    transition: width 0.15s, height 0.15s, border-color 0.15s;
  }
}

@media (pointer: coarse) {
  .cur,
  .cur-ring { display: none; }
}

/* ── TICKER TAPE ── */
.ticker {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 400;
  height: var(--tick-h);
  overflow: hidden;
  background: rgba(10, 12, 16, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.ticker-track {
  display: flex;
  height: 100%;
  align-items: center;
  white-space: nowrap;
  animation: tickSlide 40s linear infinite;
}

.tick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 22px;
  height: 100%;
  border-right: 1px solid var(--line);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: rgba(200, 214, 255, 0.45);
}

.tick .ts { color: var(--paper); font-weight: 500; }
.tick .tv { color: var(--paper); }
.tick .tp { color: var(--signal); }
.tick .tn { color: var(--rose); }

@keyframes tickSlide {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── NAVBAR ── */
nav#main-nav {
  position: fixed;
  top: var(--tick-h);
  left: 0;
  right: 0;
  z-index: 300;
  height: var(--nav-h);
  padding: 0 5%;
  display: flex;
  align-items: center;
  background: rgba(10, 12, 16, 0.72);
  backdrop-filter: blur(24px) saturate(1.8);
  border-bottom: 1px solid var(--line);
  transition: background 0.3s;
}

nav#main-nav.solid {
  background: rgba(10, 12, 16, 0.97);
}

/* Logo */
.nlogo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.nlogo-mark {
  width: 36px;
  height: 36px;
  background: var(--ink3);
  border: 1px solid var(--line2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.nlogo-mark::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 45%;
  background: linear-gradient(to top, rgba(79, 255, 176, 0.22), transparent);
}

.nlogo-mark svg {
  width: 18px;
  height: 18px;
  position: relative;
  z-index: 1;
}

.nlogo-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.3px;
}

.nlogo-name span {
  color: var(--signal);
  font-weight: 300;
}

/* Desktop nav links */
.nlinks {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0 auto 0 44px;
}

.nlinks a {
  font-size: 13px;
  color: rgba(200, 214, 255, 0.6);
  text-decoration: none;
  font-weight: 400;
  transition: color 0.2s;
  letter-spacing: 0.2px;
}

.nlinks a:hover { color: var(--white); }

/* Desktop CTA group */
.ncta {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* Hamburger button — hidden on desktop, shown via media query */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: var(--ink3);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
  transition: border-color 0.2s;
}

.nav-hamburger:hover { border-color: var(--line2); }

.nav-hamburger span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--paper);
  border-radius: 2px;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

/* Animated X when open */
.nav-hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── MOBILE SIDEBAR ── */
.sidebar-overlay {
  /* Always in the DOM — visibility controlled by opacity + pointer-events,
     NOT display:none, so the JS .visible class actually works. */
  display: block;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(10, 12, 16, 0.70);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;           /* invisible & non-interactive by default */
  transition: opacity 0.3s;
}

.sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto;           /* clickable when open */
}

.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 600;
  width: min(300px, 85vw);
  background: var(--ink2);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding-top: var(--offset);
  overflow-y: auto;
}

.sidebar.open { transform: translateX(0); }

.sidebar-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: var(--ink3);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--paper);
  line-height: 1;
  transition: border-color 0.2s, color 0.2s;
}

.sidebar-close:hover { border-color: var(--line2); color: var(--signal); }

.sidebar-nav {
  list-style: none;
  padding: 24px 0 16px;
  border-bottom: 1px solid var(--line);
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 500;
  color: rgba(200, 214, 255, 0.75);
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}

.sidebar-nav li a:hover {
  color: var(--white);
  background: var(--ghost);
}

.sidebar-actions {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── SHARED BUTTONS ── */
.btn-line {
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  transition: border-color 0.2s, color 0.2s;
  letter-spacing: 0.3px;
}

.btn-line:hover { border-color: var(--line2); color: var(--signal); }

.btn-solid {
  padding: 9px 20px;
  border-radius: 8px;
  border: none;
  background: var(--signal);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  transition: background 0.2s, transform 0.2s;
  letter-spacing: 0.3px;
  text-align: center;
  display: inline-block;
  text-decoration: none;
}

.btn-solid:hover { background: var(--signal3); transform: translateY(-1px); }

.btn-full { display: block; width: 100%; }

/* ── FOOTER ── */
footer {
  background: var(--ink2);
  border-top: 1px solid var(--line);
  padding: 56px 5% 32px;
}

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 44px;
}

.fl-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.fl-logo-mark {
  width: 30px;
  height: 30px;
  background: var(--ink3);
  border: 1px solid var(--line2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fl-logo-name { font-size: 16px; font-weight: 700; color: var(--white); }
.fl-logo-name span { color: var(--signal); font-weight: 300; }

.fl-tagline {
  font-size: 13px;
  color: rgba(200, 214, 255, 0.45);
  line-height: 1.7;
  max-width: 220px;
  margin-bottom: 18px;
}

.fl-social { display: flex; gap: 8px; }

.fl-soc-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--ink3);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  color: rgba(200, 214, 255, 0.5);
  transition: border-color 0.2s, color 0.2s;
}

.fl-soc-btn:hover { border-color: var(--line2); color: var(--signal); }

.footer-col h5 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--paper);
  margin-bottom: 16px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  font-size: 13px;
  color: rgba(200, 214, 255, 0.45);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--paper); }

.footer-bottom {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-copy { font-size: 12px; color: rgba(200, 214, 255, 0.35); }
.footer-copy span { color: var(--signal); }

.footer-legal { display: flex; gap: 18px; flex-wrap: wrap; }

.footer-legal a {
  font-size: 12px;
  color: rgba(200, 214, 255, 0.35);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-legal a:hover { color: var(--paper); }

/* ── SCROLL REVEAL ── */
.rv {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.rv.in  { opacity: 1; transform: none; }
.rv1    { transition-delay: 0.10s; }
.rv2    { transition-delay: 0.20s; }
.rv3    { transition-delay: 0.30s; }
.rv4    { transition-delay: 0.40s; }

/* ── SECTION UTILITIES ── */
.s-pad { padding: 100px 5%; }

.s-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--signal);
  margin-bottom: 18px;
}

.s-tag::before {
  content: '';
  width: 20px;
  height: 1px;
  background: var(--signal);
}

.s-h2 {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(34px, 4vw, 54px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -1.5px;
  color: var(--white);
  margin-bottom: 18px;
}

.s-h2 em { font-style: italic; color: var(--signal); }

.s-body {
  font-size: 16px;
  color: rgba(200, 214, 255, 0.6);
  line-height: 1.8;
  max-width: 480px;
  font-weight: 400;
}

/* ══════════════════════════════════════════
   BASE RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════════ */

/* Tablet */
@media (max-width: 1024px) {
  .footer-top { grid-template-columns: 1fr 1fr; gap: 36px; }
}

/* Mobile */
@media (max-width: 768px) {
  :root {
    --nav-h:  58px;
    --tick-h: 30px;
  }

  /* Show hamburger, hide desktop nav */
  .nlinks        { display: none; }
  .ncta          { display: none; }
  .nav-hamburger { display: flex; }

  nav#main-nav { padding: 0 4%; }

  .s-pad { padding: 72px 4%; }
  .s-h2  { letter-spacing: -1px; }

  .footer-top    { grid-template-columns: 1fr; gap: 28px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  :root { --nav-h: 54px; }
}