/* ==========================================================================
   iNNotifications - Design tokens & component styles
   Tailwind utilities live in css/tailwind.css (built from tools/, no runtime CDN).
   Colors are exposed to Tailwind as `bg-page`, `bg-card`, `text-ink`, `text-ink2`,
   `text-ink3`, `text-accent`, `border-line` ... so both themes stay readable.
   ========================================================================== */

:root {
  color-scheme: dark;
  /* RGB channels so Tailwind opacity modifiers work (bg-card/60) */
  --c-bg: 7 9 14;
  --c-bg2: 13 17 26;
  --c-card: 17 24 39;
  --c-ink: 248 250 252;
  --c-ink2: 203 213 225;
  --c-ink3: 148 163 184;
  --c-line: 51 65 85;
  --c-accent: 129 140 248;
  --c-code: 7 10 15;

  /* legacy tokens (docs pages) */
  --bg-primary: #07090E;
  --bg-secondary: #0D111A;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.35);
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
}

html.light {
  color-scheme: light;
  --c-bg: 248 250 252;
  --c-bg2: 241 245 249;
  --c-card: 255 255 255;
  --c-ink: 15 23 42;
  --c-ink2: 51 65 85;
  --c-ink3: 71 85 105;
  --c-line: 203 213 225;
  --c-accent: 67 56 202;
  --c-code: 15 23 42;

  --bg-primary: #F8FAFC;
  --bg-secondary: #FFFFFF;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(241, 245, 249, 0.95);
  --border-color: rgba(15, 23, 42, 0.1);
  --border-glow: rgba(99, 102, 241, 0.3);
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --shadow-card: 0 8px 30px 0 rgba(15, 23, 42, 0.08);
}

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

body {
  background-color: rgb(var(--c-bg));
  color: rgb(var(--c-ink));
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  text-rendering: optimizeLegibility;
}

/* Accessibility helpers ---------------------------------------------------- */
.skip-link {
  position: absolute; left: 12px; top: -64px; z-index: 100;
  padding: 10px 16px; border-radius: 10px; background: #4F46E5; color: #fff; font-weight: 600; font-size: 14px;
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid rgb(var(--c-accent)); outline-offset: 2px; border-radius: 6px; }
.sr-only-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Background grid & ambient glow ------------------------------------------- */
.bg-grid-pattern {
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
}
html.light .bg-grid-pattern {
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.045) 1px, transparent 1px);
}
.ambient-glow-purple, .ambient-glow-cyan { position: absolute; pointer-events: none; z-index: 0; filter: blur(80px); max-width: 100vw; }
.ambient-glow-purple { width: 600px; height: 600px; background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.06) 50%, transparent 70%); }
.ambient-glow-cyan { width: 500px; height: 500px; background: radial-gradient(circle, rgba(6, 182, 212, 0.14) 0%, transparent 70%); }
html.light .ambient-glow-purple { opacity: .55; }
html.light .ambient-glow-cyan { opacity: .5; }
.glow-wrap { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

/* Panels -------------------------------------------------------------------- */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.glass-panel:hover { border-color: var(--border-glow); }

.text-gradient {
  background: linear-gradient(100deg, #818CF8 0%, #22D3EE 55%, #34D399 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
html.light .text-gradient { background-image: linear-gradient(100deg, #4338CA 0%, #0891B2 55%, #059669 100%); }

/* Navbar -------------------------------------------------------------------- */
.navbar-scrolled {
  background: rgb(var(--c-bg) / 0.85) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}
.nav-link { position: relative; }
.nav-link.is-active { color: rgb(var(--c-ink)); }
.nav-link.is-active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; border-radius: 2px; background: #6366F1; }

/* Code --------------------------------------------------------------------- */
pre, code { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.code-window { background: rgb(var(--c-code)); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 14px; overflow: hidden; color: #e2e8f0; }
html.light .code-window { border-color: rgba(15, 23, 42, .15); box-shadow: var(--shadow-card); }
.code-window pre { tab-size: 2; -webkit-overflow-scrolling: touch; }

/* Tabs --------------------------------------------------------------------- */
.active-sdk-tab { background: rgba(99, 102, 241, 0.18) !important; color: #A5B4FC !important; border-color: rgba(99, 102, 241, 0.45) !important; }
.active-step-tab { background: #6366F1 !important; color: #FFFFFF !important; }
.active-api-tab { border-bottom: 2px solid #6366F1 !important; color: #A5B4FC !important; }
.active-lang { background: rgba(99, 102, 241, 0.22) !important; color: rgb(var(--c-accent)) !important; font-weight: 600; }

.tour-tab { border: 1px solid transparent; }
.tour-tab[aria-selected="true"] { background: rgba(99, 102, 241, 0.14); border-color: rgba(99, 102, 241, 0.45); color: rgb(var(--c-accent)); }
.tour-tab[aria-selected="true"] .tour-tab-dot { background: #6366F1; box-shadow: 0 0 0 4px rgba(99,102,241,.2); }
.tour-panel[hidden] { display: none; }
.tour-panel { animation: fadeUp .45s cubic-bezier(.16,1,.3,1) both; }
.tour-scroll { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tour-scroll::-webkit-scrollbar { display: none; }

/* Device frames ------------------------------------------------------------- */
.frame-browser {
  border-radius: 14px; overflow: hidden; background: rgb(var(--c-card));
  border: 1px solid var(--border-color);
  box-shadow: 0 30px 80px -20px rgba(2, 6, 23, 0.55), 0 0 0 1px rgba(99, 102, 241, 0.08);
}
html.light .frame-browser { box-shadow: 0 30px 70px -25px rgba(15, 23, 42, .35), 0 0 0 1px rgba(15,23,42,.05); }
.frame-browser-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: rgb(var(--c-bg2)); border-bottom: 1px solid var(--border-color); }
.frame-dots { display: flex; gap: 6px; flex: none; }
.frame-dots i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.frame-dots i:nth-child(1) { background: #FB7185; } .frame-dots i:nth-child(2) { background: #FBBF24; } .frame-dots i:nth-child(3) { background: #34D399; }
.frame-url { flex: 1; min-width: 0; text-align: center; font: 500 11px/1 'JetBrains Mono', monospace; color: rgb(var(--c-ink3)); background: rgb(var(--c-bg)); border: 1px solid var(--border-color); border-radius: 8px; padding: 6px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frame-screen { position: relative; background: rgb(var(--c-bg2)); aspect-ratio: 1440 / 900; }
.frame-screen img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }

.frame-phone {
  position: relative; border-radius: 34px; padding: 8px; background: #0B0F17;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 30px 70px -20px rgba(2, 6, 23, 0.7), inset 0 0 0 2px rgba(255, 255, 255, 0.04);
}
html.light .frame-phone { box-shadow: 0 30px 60px -20px rgba(15, 23, 42, .5), inset 0 0 0 2px rgba(255, 255, 255, 0.04); }
.frame-phone-screen { position: relative; border-radius: 27px; overflow: hidden; aspect-ratio: 390 / 844; background: rgb(var(--c-bg2)); }
.frame-phone-screen img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.frame-phone::before { content: ''; position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: 26%; height: 14px; border-radius: 10px; background: #0B0F17; z-index: 2; }

/* theme-aware images: only the active theme's <img> is displayed (so lazy loads once) */
html.dark .shot-l, html:not(.light):not(.dark) .shot-l { display: none; }
html.light .shot-d { display: none; }

.tour-stage { position: relative; }
.tour-stage .stage-phone { position: absolute; right: -2%; bottom: -10%; width: 21%; min-width: 120px; }
.tour-stage[data-view="mobile"] .stage-desktop { display: none; }
@media (min-width: 768px) {
  .tour-stage[data-view="mobile"] .stage-desktop { display: block; }
}
@media (max-width: 767px) {
  .tour-stage { padding-bottom: 0; }
  .tour-stage .stage-phone { position: static; width: min(300px, 78vw); margin: 0 auto; }
  .tour-stage[data-view="desktop"] .stage-phone { display: none; }
  .tour-stage[data-view="mobile"] .stage-phone { display: block; }
  .view-toggle { display: inline-flex; }
}
@media (min-width: 768px) { .view-toggle { display: none; } }
.view-toggle button[aria-pressed="true"] { background: #6366F1; color: #fff; }

/* Hero visual --------------------------------------------------------------- */
.hero-stage { position: relative; }
.hero-stage .hero-phone { position: absolute; right: -14px; bottom: -34px; width: 24%; min-width: 96px; }
.hero-stage .hero-notif { position: absolute; left: -18px; bottom: 36px; width: min(300px, 72%); }
.hero-tilt { transform: perspective(1800px) rotateY(-6deg) rotateX(2deg); transform-origin: left center; transition: transform .6s cubic-bezier(.16,1,.3,1); }
.hero-tilt:hover { transform: perspective(1800px) rotateY(-2deg) rotateX(1deg); }
@media (max-width: 1023px) { .hero-tilt { transform: none; } .hero-tilt:hover { transform: none; } }
@media (max-width: 639px) {
  .hero-stage .hero-phone { right: -6px; bottom: -22px; width: 26%; min-width: 84px; }
  .hero-stage .hero-notif { left: -4px; bottom: 14px; width: 66%; }
}
.float-slow { animation: floaty 7s ease-in-out infinite; }
.float-slow-2 { animation: floaty 8.5s ease-in-out -2s infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Marquee (SDK logos) --------------------------------------------------------- */
.marquee { display: flex; overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee-track { display: flex; gap: 12px; flex: none; padding-right: 12px; animation: marquee 38s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-100%); } }

/* Bento cards ------------------------------------------------------------------ */
.bento-card { position: relative; overflow: hidden; }
.bento-card::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s ease; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(99, 102, 241, 0.13), transparent 60%); }
.bento-card:hover::after { opacity: 1; }

/* Scroll reveal -------------------------------------------------------------- */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-on-scroll.is-revealed { opacity: 1; transform: translateY(0); }
.no-js .reveal-on-scroll { opacity: 1; transform: none; }

/* FAQ accordion --------------------------------------------------------------- */
.faq-content { max-height: 0; overflow: hidden; transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease; opacity: 0; }
.faq-item.faq-open .faq-content { max-height: 600px; opacity: 1; }
.faq-item.faq-open .faq-icon { transform: rotate(180deg); }

/* Pricing --------------------------------------------------------------------- */
.plan-featured { border-color: rgba(99, 102, 241, 0.55) !important; box-shadow: 0 20px 60px -20px rgba(99, 102, 241, 0.45); }

/* Simulator banner pop -------------------------------------------------------- */
@keyframes notifPop { 0% { transform: scale(0.95); opacity: 0.5; } 50% { transform: scale(1.03); } 100% { transform: scale(1); opacity: 1; } }
.animate-pop { animation: notifPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }

/* Light-theme fixes for legacy dark-only utility classes (docs pages / simulator) ---- */
html.light .bg-dark-900 { background-color: rgb(var(--c-bg)); }
html.light .bg-dark-800, html.light .bg-dark-800\/30, html.light .bg-dark-800\/40 { background-color: rgb(var(--c-bg2)); }
html.light .bg-dark-700 { background-color: #e2e8f0; }
html.light .text-white:not([class*="bg-brand"]):not([class*="bg-indigo"]):not(.keep-white) { color: rgb(var(--c-ink)); }
html.light .text-slate-100, html.light .text-slate-200, html.light .text-slate-300 { color: rgb(var(--c-ink2)); }
html.light .text-slate-400, html.light .text-slate-500 { color: rgb(var(--c-ink3)); }
html.light .border-slate-800, html.light .border-slate-700, html.light .border-slate-700\/60, html.light .border-slate-800\/60, html.light .border-slate-800\/80 { border-color: rgb(var(--c-line) / .7); }
html.light .code-window .text-white, html.light .code-window .text-slate-200, html.light .code-window .text-slate-300 { color: #e2e8f0; }
html.light .code-window .text-slate-400 { color: #94a3b8; }

/* Respect reduced motion -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal-on-scroll { opacity: 1 !important; transform: none !important; }
  .marquee-track { animation: none !important; }
  .hero-tilt { transform: none !important; }
}
