/* SmartNest Canada - Smart Home Automation Blog */

/* Design System Colors */
:root {
  --deep-navy: #0B1220;
  --signal-blue: #3AA7FF;
  --teal: #20C6B7;
  --graphite: #1A2230;
  --soft-gray: #A7B0BD;
  
  /* Typography Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3.1rem;
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  
  /* Shadows */
  --shadow-card: 0 12px 28px rgba(0, 0, 0, 0.28);
  --shadow-hover: 0 16px 32px rgba(0, 0, 0, 0.32);
  
  /* Transitions */
  --transition-fast: 160ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 220ms ease;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--deep-navy);
  color: #ffffff;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Node-Mesh Background Animation */
.node-mesh-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.node-mesh-background svg {
  width: 100%;
  height: 100%;
}

.node {
  filter: drop-shadow(0 0 8px var(--signal-blue));
  animation: pulse 3s ease-in-out infinite;
}

.node:nth-child(2n) {
  animation-delay: 0.5s;
}

.node:nth-child(3n) {
  animation-delay: 1s;
}

.node:nth-child(4n) {
  animation-delay: 1.5s;
}

.connection {
  stroke: var(--teal);
  stroke-width: 1;
  opacity: 0.3;
  animation: flow 4s linear infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes flow {
  0% {
    stroke-dasharray: 0, 1000;
  }
  50% {
    stroke-dasharray: 500, 500;
  }
  100% {
    stroke-dasharray: 0, 1000;
  }
}

/* Typography */
h1 {
  font-size: var(--text-5xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

h2 {
  font-size: var(--text-4xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

h3 {
  font-size: var(--text-3xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

h4 {
  font-size: var(--text-2xl);
  font-weight: 500;
  line-height: 1.4;
}

h5 {
  font-size: var(--text-xl);
  font-weight: 500;
  line-height: 1.4;
}

h6 {
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1.5;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.section {
  padding: var(--space-20) 0;
}

.grid {
  display: grid;
  gap: var(--space-8);
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(11, 18, 32, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(58, 167, 255, 0.1);
  transition: all var(--transition-normal);
}

.header.scrolled {
  background: rgba(11, 18, 32, 0.98);
  box-shadow: var(--shadow-card);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) 0;
}

.logo {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--signal-blue);
  text-decoration: none;
}

.logo:hover {
  color: var(--teal);
  transition: color var(--transition-fast);
}

.nav {
  display: flex;
  gap: var(--space-8);
}

.nav-link {
  color: var(--soft-gray);
  text-decoration: none;
  font-weight: 500;
  padding: var(--space-2) var(--space-4);
  border-radius: 8px;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--signal-blue);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--signal-blue);
  transition: all var(--transition-fast);
  transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 80%;
}

/* Mobile Menu */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
}

.mobile-menu-btn span {
  width: 24px;
  height: 2px;
  background: var(--soft-gray);
  margin: 3px 0;
  transition: var(--transition-fast);
}

.mobile-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(11, 18, 32, 0.98);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(58, 167, 255, 0.1);
  padding: var(--space-6);
}

.mobile-menu.active {
  display: block;
}

.mobile-menu .nav-link {
  display: block;
  padding: var(--space-4);
  border-bottom: 1px solid rgba(167, 176, 189, 0.1);
}

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  padding: var(--space-24) 0 var(--space-20);
  background: linear-gradient(135deg, var(--deep-navy) 0%, var(--graphite) 100%);
}

.hero-content {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  margin-bottom: var(--space-6);
  background: linear-gradient(135deg, var(--signal-blue) 0%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: var(--text-xl);
  color: var(--soft-gray);
  margin-bottom: var(--space-8);
  line-height: 1.7;
}

.cta-buttons {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: var(--space-4) var(--space-8);
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-lg);
  transition: all var(--transition-normal);
  border: 2px solid transparent;
  cursor: pointer;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--signal-blue) 0%, var(--teal) 100%);
  color: white;
  box-shadow: var(--shadow-card);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  color: white;
}

.btn-secondary {
  background: transparent;
  color: var(--signal-blue);
  border-color: var(--signal-blue);
}

.btn-secondary:hover {
  background: var(--signal-blue);
  color: white;
}

/* Stats Section */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-6);
  margin: var(--space-16) 0;
}

.stat-card {
  text-align: center;
  padding: var(--space-6);
  background: rgba(58, 167, 255, 0.1);
  border: 1px solid rgba(58, 167, 255, 0.2);
  border-radius: 16px;
  transition: all var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}

.stat-number {
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--signal-blue);
  margin-bottom: var(--space-2);
}

.stat-label {
  font-size: var(--text-lg);
  color: var(--soft-gray);
}

/* Cards */
.card {
  background: var(--graphite);
  border-radius: 16px;
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  transition: all var(--transition-normal);
  border: 1px solid rgba(167, 176, 189, 0.1);
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-3);
  color: white;
}

.card-excerpt {
  color: var(--soft-gray);
  margin-bottom: var(--space-4);
  line-height: 1.6;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
  color: var(--soft-gray);
  margin-bottom: var(--space-4);
}

.badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: 20px;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-beginner {
  background: rgba(32, 198, 183, 0.2);
  color: var(--teal);
  border: 1px solid var(--teal);
}

.badge-advanced {
  background: rgba(58, 167, 255, 0.2);
  color: var(--signal-blue);
  border: 1px solid var(--signal-blue);
}

.badge-local-first {
  background: rgba(32, 198, 183, 0.2);
  color: var(--teal);
  border: 1px solid var(--teal);
}

.badge-privacy {
  background: rgba(167, 176, 189, 0.2);
  color: var(--soft-gray);
  border: 1px solid var(--soft-gray);
}

/* Category Header */
.category-header {
  background: linear-gradient(135deg, var(--signal-blue) 0%, var(--teal) 100%);
  padding: var(--space-20) 0 var(--space-16);
  text-align: center;
  margin-top: 80px;
}

.category-header h1 {
  color: white;
  margin-bottom: var(--space-4);
}

.category-description {
  font-size: var(--text-xl);
  color: rgba(255, 255, 255, 0.9);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Filter Chips */
.filter-chips {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
  margin: var(--space-8) 0;
}

.chip {
  padding: var(--space-2) var(--space-4);
  background: rgba(167, 176, 189, 0.1);
  color: var(--soft-gray);
  border: 1px solid rgba(167, 176, 189, 0.2);
  border-radius: 20px;
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.chip:hover,
.chip.active {
  background: var(--signal-blue);
  color: white;
  border-color: var(--signal-blue);
}

/* Advantages Section */
.advantages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
  margin: var(--space-16) 0;
}

.advantage-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-6);
  background: var(--graphite);
  border-radius: 16px;
  border: 1px solid rgba(167, 176, 189, 0.1);
  transition: all var(--transition-normal);
}

.advantage-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}

.advantage-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--signal-blue) 0%, var(--teal) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.advantage-icon svg {
  width: 24px;
  height: 24px;
  color: white;
}

.advantage-content h4 {
  margin-bottom: var(--space-2);
  color: white;
}

.advantage-content p {
  color: var(--soft-gray);
  line-height: 1.6;
}

/* Reviews Section */
.reviews {
  background: var(--graphite);
  border-radius: 24px;
  padding: var(--space-12);
  margin: var(--space-16) 0;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
}

.review-card {
  background: var(--deep-navy);
  padding: var(--space-6);
  border-radius: 16px;
  border: 1px solid rgba(167, 176, 189, 0.1);
}

.review-text {
  font-style: italic;
  margin-bottom: var(--space-4);
  color: var(--soft-gray);
  line-height: 1.7;
}

.review-author {
  font-weight: 600;
  color: white;
  margin-bottom: var(--space-1);
}

.review-location {
  font-size: var(--text-sm);
  color: var(--teal);
}

/* Newsletter Section */
.newsletter {
  background: linear-gradient(135deg, var(--signal-blue) 0%, var(--teal) 100%);
  border-radius: 24px;
  padding: var(--space-12);
  text-align: center;
  margin: var(--space-16) 0;
}

.newsletter h3 {
  color: white;
  margin-bottom: var(--space-4);
}

.newsletter p {
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--space-8);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.newsletter-form {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
}

.newsletter-input {
  padding: var(--space-4) var(--space-6);
  border: none;
  border-radius: 12px;
  font-size: var(--text-lg);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-width: 300px;
}

.newsletter-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.newsletter-btn {
  padding: var(--space-4) var(--space-8);
  background: white;
  color: var(--signal-blue);
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: var(--text-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.newsletter-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Footer */
.footer {
  background: var(--graphite);
  padding: var(--space-12) 0 var(--space-6);
  margin-top: var(--space-20);
  border-top: 1px solid rgba(167, 176, 189, 0.1);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}

.footer-section h4 {
  color: white;
  margin-bottom: var(--space-4);
}

.footer-section p,
.footer-section a {
  color: var(--soft-gray);
  text-decoration: none;
  margin-bottom: var(--space-2);
  display: block;
}

.footer-section a:hover {
  color: var(--signal-blue);
}

.footer-bottom {
  text-align: center;
  padding-top: var(--space-6);
  border-top: 1px solid rgba(167, 176, 189, 0.1);
  color: var(--soft-gray);
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--signal-blue) 0%, var(--teal) 100%);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  z-index: 1000;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

/* Loading State */
.loading {
  opacity: 0.5;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  border: 2px solid var(--signal-blue);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  transform: translate(-50%, -50%);
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Success State */
.success-message {
  background: var(--teal);
  color: white;
  padding: var(--space-4);
  border-radius: 12px;
  text-align: center;
  margin-top: var(--space-4);
  display: none;
}

.success-message.visible {
  display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav {
    display: none;
  }
  
  .mobile-menu-btn {
    display: flex;
  }
  
  h1 {
    font-size: var(--text-4xl);
  }
  
  h2 {
    font-size: var(--text-3xl);
  }
  
  .hero p {
    font-size: var(--text-lg);
  }
  
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .newsletter-form {
    flex-direction: column;
    align-items: center;
  }
  
  .newsletter-input {
    min-width: auto;
    width: 100%;
    max-width: 400px;
  }
  
  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 100%;
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-4);
  }
  
  .stats {
    grid-template-columns: 1fr;
  }
  
  .advantages {
    grid-template-columns: 1fr;
  }
  
  .advantage-item {
    flex-direction: column;
    text-align: center;
  }
}

/* Scroll Reveal Animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all var(--transition-slow);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Preloader */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--deep-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity var(--transition-slow);
}

.preloader.hidden {
  opacity: 0;
  pointer-events: none;
}

.preloader-node {
  width: 100px;
  height: 100px;
  border: 3px solid transparent;
  border-top: 3px solid var(--signal-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  position: relative;
}

.preloader-node::before,
.preloader-node::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--teal);
  border-radius: 50%;
  top: -4px;
  animation: pulse 2s ease-in-out infinite;
}

.preloader-node::before {
  left: 20px;
}

.preloader-node::after {
  right: 20px;
}

/* Link Pulse Effect */
a {
  position: relative;
  overflow: hidden;
}

a:hover {
  color: var(--signal-blue);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--graphite);
}

::-webkit-scrollbar-thumb {
  background: var(--signal-blue);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--teal);
}
