/* ============================================================
   BASE.CSS — Reset, Variables, Typography, Layout Primitives
   ChartNexus Redesign · Cinematic Premium
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;1,9..144,300;1,9..144,400;1,9..144,500&family=Manrope:wght@300;400;500;600;700&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --black:    #0a0a0a;
  --surface:  #111111;
  --surface2: #181818;
  --line:     #1f1f1f;
  --line2:    #2a2a2a;
  --ink:      #f0ede8;   /* warm off-white */
  --ink-dim:  #8a8581;
  --ink-mute: #7a7774;
  --red:      #E63946;
  --red-dark: #c02a35;
  --orange:   #FF6B35;
  --green:    #16a34a;
  --grad:     linear-gradient(135deg, var(--red), var(--orange));

  --ff-display: 'Fraunces', Georgia, serif;
  --ff-body:    'Manrope', system-ui, sans-serif;

  --fs-display: clamp(3.2rem, 8vw, 7.5rem);
  --fs-h1:      clamp(2.2rem, 5vw, 4rem);
  --fs-h2:      clamp(1.6rem, 3vw, 2.5rem);
  --fs-h3:      clamp(1.2rem, 2vw, 1.6rem);
  --fs-body:    1.0625rem;
  --fs-small:   0.875rem;
  --fs-label:   0.6875rem;

  --lh-display: 1.0;
  --lh-h:       1.15;
  --lh-body:    1.7;

  --space-xs:   0.5rem;
  --space-sm:   1rem;
  --space-md:   2rem;
  --space-lg:   4rem;
  --space-xl:   7rem;
  --space-xxl:  11rem;

  --max-w:      1280px;
  --col-gap:    2rem;

  --nav-h:      72px;
  --radius:     4px;
  --radius-lg:  12px;

  --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-slow: 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Light Mode Override ───────────────────────────────────── */
html[data-theme="light"] {
  --black:    #ffffff;
  --surface:  #f4f4f4;
  --surface2: #ebebeb;
  --line:     #e0e0e0;
  --line2:    #d0d0d0;
  --ink:      #1a1816;
  --ink-dim:  #5a5754;
  --ink-mute: #888480;
}

/* ── Light Mode: hardcoded-color overrides ─────────────────── */
html[data-theme="light"] .nav { background: var(--black); border-color: var(--line); }
html[data-theme="light"] .nav.scrolled { background: rgba(255,255,255,0.94); border-color: var(--line); }
/* Logo swap handled in JS (chartnexus_logo_b.png → chartnexus_logo_w.png) */
html[data-theme="light"] .nav__mobile { background: var(--black); border-color: var(--line); }
html[data-theme="light"] .nav__toggle span { background: var(--ink); }

html[data-theme="light"] .ticker-bar { background: var(--surface2); border-color: var(--line); }
html[data-theme="light"] .ticker-bar::before { background: linear-gradient(to right, var(--surface2), transparent); }
html[data-theme="light"] .ticker-bar::after  { background: linear-gradient(to left,  var(--surface2), transparent); }

html[data-theme="light"] .trust-strip { background: var(--surface2); }
html[data-theme="light"] .trust-strip__item { color: var(--ink-dim); }

html[data-theme="light"] .section-marker__num { color: var(--red); }
html[data-theme="light"] .section-marker__line { background: var(--line); }

html[data-theme="light"] .pain-item { background: var(--surface); border-color: var(--line); }
html[data-theme="light"] .sapu-card { background: var(--surface); border-color: var(--line); }
html[data-theme="light"] .include-card { background: var(--surface); border-color: var(--line); }
html[data-theme="light"] .testi-card { background: var(--surface); border-color: var(--line); }
html[data-theme="light"] .next-step__num { color: var(--red); }

html[data-theme="light"] .stock-showcase { background: var(--surface); }
html[data-theme="light"] .stock-tab { color: var(--ink-mute); }
html[data-theme="light"] .stock-tab:hover { color: var(--ink); }
html[data-theme="light"] .stock-card { background: var(--surface2); border-color: var(--line); }
html[data-theme="light"] .stock-card:hover { background: var(--surface); }

html[data-theme="light"] .product-featured-card { background: var(--surface); border-color: var(--line); }
html[data-theme="light"] .product-tile { background: var(--surface); border-color: var(--line); }
html[data-theme="light"] .product-tile:hover { background: var(--surface2); }

html[data-theme="light"] .zoom-countdown-block { background: var(--surface); border-color: var(--line); border-left-color: var(--red); }

html[data-theme="light"] .comparison-table { border-color: var(--line); }
html[data-theme="light"] .comparison-table__head { background: var(--surface2); }
html[data-theme="light"] .comparison-table__row { border-color: var(--line); }
html[data-theme="light"] .comparison-table__row:nth-child(even) { background: var(--surface); }
html[data-theme="light"] .comparison-table__cell { border-color: var(--line); color: var(--ink-mute); }
html[data-theme="light"] .comparison-table__cell--label { color: var(--ink); }
html[data-theme="light"] .comparison-table__cell--featured { background: rgba(230,57,70,0.05); border-left-color: var(--red); color: var(--ink); }

html[data-theme="light"] .faq-list { border-color: var(--line); }
html[data-theme="light"] .faq-item { border-color: var(--line); }
html[data-theme="light"] .faq-item__q { color: var(--ink); }
html[data-theme="light"] .faq-item__q:hover { background: var(--surface2); }

html[data-theme="light"] .sticky-wa-bar { background: rgba(238,236,234,0.97); border-color: var(--line); }



html[data-theme="light"] .footer { background: var(--surface); border-color: var(--line); }
html[data-theme="light"] .footer__links a { color: var(--ink-mute); }
html[data-theme="light"] .footer__links a:hover { color: var(--ink); }

html[data-theme="light"] .btn--outline { border-color: var(--ink); color: var(--ink); }
html[data-theme="light"] .btn--outline:hover { background: var(--ink); color: var(--black); }

html[data-theme="light"] .label--accent { background: rgba(230,57,70,0.1); color: var(--red); }

/* Hero sections always keep dark-mode colours — they sit on top of dark photo overlays.
   Scoping CSS vars here means every var(--ink) / var(--ink-mute) inside resolves
   to the dark-mode value even when html[data-theme="light"] is active. */
.home-hero,
.page-hero,
.k2-hero {
  --ink:      #f0ede8;
  --ink-dim:  #8a8581;
  --ink-mute: #6a6561;
  --line:     rgba(255,255,255,0.08);
  color: #f0ede8;
}
html[data-theme="light"] .page-hero .orb-field,
html[data-theme="light"] .home-hero .orb-field { display: none; }

html[data-theme="light"] .orb--red   { opacity: 0.5; }
html[data-theme="light"] .orb--orange { opacity: 0.35; }
html[data-theme="light"] .grid-overlay { opacity: 0.3; }

/* final-cta-block has a hardcoded dark background — keep text light in both modes */
.final-cta-block { --ink: #f0ede8; --ink-mute: #8a8581; }

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--ff-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  background: var(--black);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
html { overflow-x: hidden; }

img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { border: none; background: none; cursor: pointer; font: inherit; }
input, textarea, select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

/* ── Film Grain Overlay ────────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--ff-display);
  font-weight: 400;
  line-height: var(--lh-h);
  letter-spacing: -0.02em;
}

.display {
  font-family: var(--ff-display);
  font-size: var(--fs-display);
  font-weight: 300;
  line-height: var(--lh-display);
  font-style: italic;
  letter-spacing: -0.03em;
  font-optical-sizing: auto;
}

.label {
  font-family: var(--ff-body);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.label--accent {
  color: var(--orange);
}

p { color: var(--ink-dim); max-width: 62ch; }
p.wide { max-width: 80ch; }
p.lead { font-size: 1.2rem; line-height: 1.6; color: var(--ink); }

strong { color: var(--ink); font-weight: 600; }
em { font-style: italic; color: var(--ink); }

/* ── Layout Primitives ─────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 3rem);
}

.container--narrow {
  max-width: 900px;
}

.section {
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--line);
}

.section:first-of-type { border-top: none; }

.section--flush { padding: 0; }
.section--lg { padding: var(--space-xxl) 0; }

/* Grid systems */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--col-gap);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--col-gap);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--col-gap);
}

/* Flex helpers */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Spacing utilities */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* ── Section Marker ────────────────────────────────────────── */
.section-marker {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: var(--space-md);
}

.section-marker__num {
  font-family: var(--ff-body);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--red);
  min-width: 2rem;
}

.section-marker__line {
  flex: 1;
  max-width: 2.5rem;
  height: 1px;
  background: var(--line2);
}

.section-marker__title {
  font-family: var(--ff-body);
  font-size: 0.95em;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ── Scroll Reveal ─────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s cubic-bezier(0.22,1,0.36,1), transform 0.7s cubic-bezier(0.22,1,0.36,1);
}
.reveal-left {
  opacity: 0;
  transform: translateX(-48px);
  transition: opacity 0.7s cubic-bezier(0.22,1,0.36,1), transform 0.7s cubic-bezier(0.22,1,0.36,1);
}
.reveal-right {
  opacity: 0;
  transform: translateX(48px);
  transition: opacity 0.7s cubic-bezier(0.22,1,0.36,1), transform 0.7s cubic-bezier(0.22,1,0.36,1);
}
.reveal-scale {
  opacity: 0;
  transform: scale(0.93);
  transition: opacity 0.65s cubic-bezier(0.22,1,0.36,1), transform 0.65s cubic-bezier(0.22,1,0.36,1);
}
.reveal-fast {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.reveal.is-visible,
.reveal-left.is-visible,
.reveal-right.is-visible,
.reveal-scale.is-visible,
.reveal-fast.is-visible {
  opacity: 1;
  transform: translate(0) scale(1);
}

.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.16s; }
.reveal-delay-3 { transition-delay: 0.24s; }
.reveal-delay-4 { transition-delay: 0.34s; }
.reveal-delay-5 { transition-delay: 0.44s; }
.reveal-delay-6 { transition-delay: 0.54s; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root {
    --space-lg:  3rem;
    --space-xl:  5rem;
    --space-xxl: 7rem;
  }

  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }

  /* Reduce horizontal reveal offset to prevent overflow on narrow screens */
  .reveal-right { transform: translateX(20px); }
  .reveal-left  { transform: translateX(-20px); }
}
