/*
Theme Name: Nexly Theme
Theme URI: https://nexlyflow.com
Author: Nexly
Author URI: https://nexlyflow.com
Description: A clean, modern WordPress theme for Nexly-style B2B SaaS websites. Built for Elementor — page content is fully editable with Elementor. Header and Footer styled in Nexly branding, configurable via WordPress Customizer.
Version: 1.0.0
Requires at least: 5.9
Tested up to: 6.5
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: nexly-theme
Tags: one-column, full-width-template, custom-logo, custom-menu, custom-background, footer-widgets, blog, e-commerce
*/

/* ===== NEXLY DESIGN TOKENS ===== */
:root {
  --nx-purple:      #5b10ff;
  --nx-purple2:     #8b5cf6;
  --nx-purple3:     #7c3aed;
  --nx-purple-lt:   #ede9fe;
  --nx-purple-dark: #3b0d8f;
  --nx-teal:        #0ea5e9;
  --nx-green:       #10b981;
  --nx-text:        #0f0f23;
  --nx-text2:       #4b5280;
  --nx-text3:       #9097b8;
  --nx-bg:          #f6f7fb;
  --nx-bg2:         #ffffff;
  --nx-card:        #ffffff;
  --nx-border:      #e4e6f0;
  --nx-border2:     #d0d3e8;
  --nx-radius:      12px;
  --nx-shadow-sm:   0 2px 8px rgba(91,16,255,0.07);
  --nx-shadow-md:   0 8px 32px rgba(91,16,255,0.12);
  --nx-shadow-lg:   0 20px 60px rgba(91,16,255,0.16);
  --nx-font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --nx-header-h:    72px;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--nx-font);
  color: var(--nx-text);
  background: var(--nx-bg2);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--nx-purple); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--nx-purple3); }

img { max-width: 100%; height: auto; display: block; }

ul { list-style: none; }

/* ===== LAYOUT ===== */
.nexly-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.nexly-site-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.nexly-main {
  flex: 1;
  padding-top: var(--nx-header-h); /* offset for sticky header */
}

.nexly-main.no-header-offset {
  padding-top: 0;
}

/* ===== BUTTONS ===== */
.nx-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

.nx-btn-primary {
  background: var(--nx-purple);
  color: #fff;
  box-shadow: 0 4px 16px rgba(91,16,255,0.25);
}
.nx-btn-primary:hover {
  background: var(--nx-purple3);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(91,16,255,0.32);
}

.nx-btn-outline {
  background: transparent;
  color: var(--nx-text);
  border: 1.5px solid var(--nx-border2);
}
.nx-btn-outline:hover {
  border-color: var(--nx-purple);
  color: var(--nx-purple);
  background: var(--nx-purple-lt);
}

.nx-btn-ghost {
  background: transparent;
  color: var(--nx-text2);
}
.nx-btn-ghost:hover { color: var(--nx-purple); }

/* ===== HEADER ===== */
.nexly-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nx-header-h);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  z-index: 9999;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.nexly-header.scrolled {
  border-bottom-color: var(--nx-border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.nexly-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}

/* Logo */
.nexly-logo-wrap { flex-shrink: 0; }
.nexly-logo-wrap a { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nexly-logo-wrap img { height: 36px; width: auto; display: block; }
.nexly-logo-text {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--nx-purple), var(--nx-purple2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

/* Primary Nav */
.nexly-nav { flex: 1; display: flex; justify-content: center; }

.nexly-nav .menu {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0; padding: 0;
}

.nexly-nav .menu > li > a {
  display: block;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--nx-text2);
  border-radius: 8px;
  transition: all 0.18s;
  text-decoration: none;
}

.nexly-nav .menu > li > a:hover,
.nexly-nav .menu > li.current-menu-item > a,
.nexly-nav .menu > li.current_page_item > a {
  color: var(--nx-purple);
  background: var(--nx-purple-lt);
}

/* Dropdown */
.nexly-nav .menu li { position: relative; }
.nexly-nav .menu .sub-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius);
  box-shadow: var(--nx-shadow-md);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s;
  pointer-events: none;
  list-style: none;
  z-index: 10000;
}
.nexly-nav .menu li:hover > .sub-menu {
  opacity: 1; visibility: visible; transform: translateY(0); pointer-events: all;
}
.nexly-nav .menu .sub-menu li a {
  display: block;
  padding: 9px 14px;
  font-size: 13.5px;
  color: var(--nx-text2);
  border-radius: 8px;
  transition: all 0.15s;
  text-decoration: none;
}
.nexly-nav .menu .sub-menu li a:hover { color: var(--nx-purple); background: var(--nx-purple-lt); }

/* Header CTA */
.nexly-header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Mobile toggle */
.nexly-mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
}
.nexly-mobile-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--nx-text);
  border-radius: 2px;
  transition: all 0.25s;
}
.nexly-mobile-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nexly-mobile-toggle.open span:nth-child(2) { opacity: 0; }
.nexly-mobile-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Mobile Nav Drawer */
.nexly-mobile-nav {
  display: none;
  position: fixed;
  top: var(--nx-header-h);
  left: 0; right: 0;
  background: #fff;
  border-bottom: 1px solid var(--nx-border);
  box-shadow: var(--nx-shadow-md);
  z-index: 9998;
  padding: 16px 24px 24px;
  max-height: calc(100vh - var(--nx-header-h));
  overflow-y: auto;
}
.nexly-mobile-nav.open { display: block; }
.nexly-mobile-nav .menu { flex-direction: column; align-items: stretch; gap: 2px; }
.nexly-mobile-nav .menu li a {
  display: block; padding: 11px 14px;
  font-size: 15px; font-weight: 500;
  color: var(--nx-text);
  border-radius: 8px;
  text-decoration: none;
}
.nexly-mobile-nav .menu li a:hover { background: var(--nx-purple-lt); color: var(--nx-purple); }
.nexly-mobile-nav .sub-menu { padding-left: 16px; list-style: none; }
.nexly-mobile-nav .nexly-mobile-cta {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--nx-border);
}
.nexly-mobile-nav .nexly-mobile-cta .nx-btn { justify-content: center; }

/* ===== FOOTER ===== */
.nexly-footer {
  background: #06040f;
  color: rgba(255,255,255,0.75);
  padding: 72px 0 0;
}

.nexly-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 56px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.nexly-footer-brand .footer-logo-text {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #c4a3ff, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
  margin-bottom: 14px;
}
.nexly-footer-brand p {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(255,255,255,0.55);
  margin-bottom: 24px;
  max-width: 280px;
}

.footer-social { display: flex; gap: 10px; }
.footer-social a {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  transition: all 0.2s;
  text-decoration: none;
}
.footer-social a:hover {
  background: var(--nx-purple);
  border-color: var(--nx-purple);
  color: #fff;
}

.nexly-footer-col h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 18px;
}
.nexly-footer-col ul { list-style: none; padding: 0; margin: 0; }
.nexly-footer-col ul li { margin-bottom: 11px; }
.nexly-footer-col ul li a {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  transition: color 0.2s;
}
.nexly-footer-col ul li a:hover { color: #fff; }

.nexly-footer-bottom {
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.nexly-footer-bottom p {
  font-size: 13px;
  color: rgba(255,255,255,0.35);
}
.nexly-footer-bottom .footer-legal { display: flex; gap: 20px; }
.nexly-footer-bottom .footer-legal a {
  font-size: 13px;
  color: rgba(255,255,255,0.35);
  text-decoration: none;
  transition: color 0.2s;
}
.nexly-footer-bottom .footer-legal a:hover { color: rgba(255,255,255,0.7); }

/* ===== PAGE CONTENT ===== */
.nexly-page-content {
  padding: 64px 0;
}

/* ===== BLOG ===== */
.nexly-post-loop { padding: 64px 0; }
.nexly-posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.nexly-post-card {
  background: var(--nx-card);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius);
  overflow: hidden;
  transition: box-shadow 0.25s, transform 0.25s;
}
.nexly-post-card:hover {
  box-shadow: var(--nx-shadow-md);
  transform: translateY(-3px);
}
.nexly-post-card .post-thumb img { width: 100%; height: 200px; object-fit: cover; }
.nexly-post-card .post-body { padding: 24px; }
.nexly-post-card .post-meta { font-size: 12px; color: var(--nx-text3); margin-bottom: 10px; }
.nexly-post-card .post-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; line-height: 1.45; }
.nexly-post-card .post-title a { color: var(--nx-text); text-decoration: none; }
.nexly-post-card .post-title a:hover { color: var(--nx-purple); }
.nexly-post-card .post-excerpt { font-size: 13.5px; color: var(--nx-text2); line-height: 1.6; margin-bottom: 18px; }
.nexly-post-card .post-read-more { font-size: 13.5px; font-weight: 600; color: var(--nx-purple); }

/* ===== 404 ===== */
.nexly-404 { text-align: center; padding: 120px 24px; }
.nexly-404 h1 { font-size: 96px; font-weight: 900; color: var(--nx-purple-lt); line-height: 1; }
.nexly-404 h2 { font-size: 28px; font-weight: 700; margin-bottom: 14px; }
.nexly-404 p  { color: var(--nx-text2); margin-bottom: 32px; }

/* ===== WIDGETS ===== */
.widget { margin-bottom: 32px; }
.widget-title { font-size: 14px; font-weight: 700; margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--nx-text3); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .nexly-footer-grid { grid-template-columns: 1fr 1fr; gap: 36px; }
  .nexly-posts-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .nexly-nav { display: none; }
  .nexly-header-actions { display: none; }
  .nexly-mobile-toggle { display: flex; }
  .nexly-footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .nexly-posts-grid { grid-template-columns: 1fr; }
  .nexly-footer-bottom { flex-direction: column; text-align: center; }
  :root { --nx-header-h: 64px; }
}

@media (max-width: 480px) {
  .nexly-container { padding: 0 16px; }
}

/* ===== ELEMENTOR OVERRIDES ===== */
/* Remove default body padding that conflicts with Elementor */
.elementor-page .nexly-main,
.page-template-default .nexly-main {
  padding-top: var(--nx-header-h);
}

/* Let Elementor sections stretch full-width */
.elementor-section.elementor-section-full_width .elementor-container {
  max-width: 100%;
}

/* Ensure Elementor popups appear above header */
.elementor-popup-modal { z-index: 99999 !important; }

/* Fade-in animation helper class (use in Elementor CSS Extra or WP CSS) */
.nx-fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.nx-fade-in.nx-visible {
  opacity: 1;
  transform: none;
}

/* ===== ACCESSIBILITY ===== */
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  white-space: nowrap;
  height: 1px; width: 1px;
  overflow: hidden;
}
.skip-link {
  position: absolute; top: -40px; left: 0;
  background: var(--nx-purple); color: #fff;
  padding: 8px 16px; z-index: 100000;
  border-radius: 0 0 8px 0;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }
