/* BudgetNorth - Canadian Family Budget Planning Website */
/* Design System: Clean ledgers; subtle dotted rulers */

:root {
  /* Color Palette */
  --deep-blue: #0D1B2A;
  --teal: #1B998B;
  --gold: #FFC857;
  --gray: #A7B0BD;
  --white: #FFFFFF;
  
  /* Typography - Modular Scale */
  --scale-xs: 1.2rem;
  --scale-sm: 1.5rem;
  --scale-md: 2.25rem;
  --scale-lg: 3.1rem;
  
  /* Grid System */
  --max-width: 1200px;
  --gutter: 24px;
  
  /* Card System */
  --card-radius: 18px;
  --shadow-light: 0 2px 8px rgba(13, 27, 42, 0.1);
  --shadow-medium: 0 4px 16px rgba(13, 27, 42, 0.15);
  --shadow-heavy: 0 8px 32px rgba(13, 27, 42, 0.2);
  
  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 3rem;
  --space-xl: 4rem;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  line-height: 1.6;
  color: var(--deep-blue);
  background-color: var(--white);
  overflow-x: hidden;
}

/* Typography */
h1 {
  font-size: var(--scale-lg);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

h2 {
  font-size: var(--scale-md);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--space-sm);
}

h3 {
  font-size: var(--scale-sm);
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: var(--space-sm);
}

h4 {
  font-size: var(--scale-xs);
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: var(--space-xs);
}

p {
  margin-bottom: var(--space-sm);
  line-height: 1.7;
}

/* Dotted Ruler Background Pattern */
.dotted-bg {
  background-image: radial-gradient(circle, var(--gray) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.1;
}

/* Header */
.header {
  background: var(--white);
  box-shadow: var(--shadow-light);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transition: all 0.3s ease;
}

.header.scrolled {
  box-shadow: var(--shadow-medium);
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--deep-blue);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo::before {
  content: "📊";
  font-size: 1.8rem;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: var(--space-md);
  align-items: center;
}

.nav-menu a {
  color: var(--deep-blue);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
}

.nav-menu a:hover,
.nav-menu a.active {
  color: var(--teal);
  background: rgba(27, 153, 139, 0.1);
}

.nav-menu a.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--teal);
  border-radius: 1px;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  cursor: pointer;
  padding: 0.5rem;
  background: none;
  border: none;
}

.menu-toggle span {
  width: 24px;
  height: 3px;
  background: var(--deep-blue);
  margin: 3px 0;
  transition: 0.3s;
  border-radius: 2px;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Main Content */
.main {
  margin-top: 80px;
  min-height: calc(100vh - 80px);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--gutter);
}

.grid-12 {
  grid-template-columns: repeat(12, 1fr);
}

.grid-6 {
  grid-template-columns: repeat(6, 1fr);
}

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

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

/* Card System */
.card {
  background: var(--white);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-light);
  transition: all 0.3s ease;
  overflow: hidden;
  border: 1px solid rgba(167, 176, 189, 0.1);
}

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

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--card-radius) var(--card-radius) 0 0;
}

.card-content {
  padding: var(--space-md);
}

.card-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--deep-blue);
  margin-bottom: var(--space-sm);
}

.card-text {
  color: var(--gray);
  line-height: 1.6;
  margin-bottom: var(--space-sm);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--teal);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.card-link:hover {
  color: var(--deep-blue);
  transform: translateX(4px);
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--deep-blue) 0%, var(--teal) 100%);
  color: var(--white);
  padding: var(--space-xl) 0;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 30px 30px;
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-text h1 {
  font-size: var(--scale-lg);
  margin-bottom: var(--space-md);
  color: var(--white);
}

.hero-text p {
  font-size: 1.1rem;
  margin-bottom: var(--space-lg);
  color: rgba(255, 255, 255, 0.9);
}

/* Budget Progress Ring */
.progress-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.progress-ring svg {
  width: 200px;
  height: 200px;
}

.progress-ring circle {
  fill: none;
  stroke-width: 8;
}

.progress-ring .progress-bg {
  stroke: rgba(255, 255, 255, 0.2);
}

.progress-ring .progress-bar {
  stroke: var(--gold);
  stroke-linecap: round;
  transition: stroke-dasharray 1s ease;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.progress-text {
  text-align: center;
  font-weight: 600;
  font-size: 1.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  justify-content: center;
}

.btn-primary {
  background: var(--gold);
  color: var(--deep-blue);
}

.btn-primary:hover {
  background: #e6b444;
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.btn-secondary {
  background: var(--teal);
  color: var(--white);
}

.btn-secondary:hover {
  background: #1a8a79;
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.btn-outline {
  background: transparent;
  color: var(--deep-blue);
  border: 2px solid var(--deep-blue);
}

.btn-outline:hover {
  background: var(--deep-blue);
  color: var(--white);
}

/* Sections */
.section {
  padding: var(--space-xl) 0;
}

.section-title {
  text-align: center;
  margin-bottom: var(--space-xl);
  color: var(--deep-blue);
}

.section-subtitle {
  text-align: center;
  color: var(--gray);
  font-size: 1.1rem;
  margin-bottom: var(--space-xl);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Featured Articles */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--space-lg);
}

.featured-card {
  background: var(--white);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-light);
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid rgba(167, 176, 189, 0.1);
}

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

.featured-card .card-image {
  height: 250px;
  width: 100%;
  object-fit: cover;
}

/* Category Grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.category-card {
  background: var(--white);
  border-radius: var(--card-radius);
  padding: var(--space-lg);
  text-align: center;
  box-shadow: var(--shadow-light);
  transition: all 0.3s ease;
  border: 1px solid rgba(167, 176, 189, 0.1);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.category-card:hover {
  box-shadow: var(--shadow-medium);
  transform: translateY(-6px);
  border-color: var(--teal);
}

.category-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto var(--space-md);
  background: var(--teal);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.category-card h3 {
  color: var(--deep-blue);
  margin-bottom: var(--space-sm);
}

.category-card p {
  color: var(--gray);
  font-size: 0.95rem;
}

/* Review Section */
.review {
  background: rgba(27, 153, 139, 0.05);
  padding: var(--space-lg);
  border-radius: var(--card-radius);
  border-left: 4px solid var(--teal);
  margin-bottom: var(--space-lg);
}

.review-text {
  font-style: italic;
  font-size: 1.1rem;
  color: var(--deep-blue);
  margin-bottom: var(--space-md);
}

.review-author {
  font-weight: 600;
  color: var(--teal);
}

/* Newsletter */
.newsletter {
  background: linear-gradient(135deg, var(--teal) 0%, var(--deep-blue) 100%);
  color: var(--white);
  padding: var(--space-xl) 0;
  text-align: center;
}

.newsletter h2 {
  color: var(--white);
  margin-bottom: var(--space-md);
}

.newsletter p {
  margin-bottom: var(--space-lg);
  color: rgba(255, 255, 255, 0.9);
}

.newsletter-form {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  gap: var(--space-sm);
}

.newsletter-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
}

.newsletter-success {
  background: var(--gold);
  color: var(--deep-blue);
  padding: var(--space-sm);
  border-radius: 8px;
  margin-top: var(--space-md);
  display: none;
}

.newsletter-success.show {
  display: block;
}

/* Footer */
.footer {
  background: var(--deep-blue);
  color: var(--white);
  padding: var(--space-xl) 0 var(--space-md);
}

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

.footer-section h3 {
  color: var(--gold);
  margin-bottom: var(--space-md);
}

.footer-section a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  display: block;
  margin-bottom: 0.5rem;
  transition: color 0.3s ease;
}

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

.footer-bottom {
  text-align: center;
  padding-top: var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--teal);
  color: var(--white);
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-medium);
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  z-index: 1000;
}

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

.back-to-top:hover {
  background: var(--deep-blue);
  transform: translateY(-4px);
}

/* Article Pages */
.article-header {
  background: var(--deep-blue);
  color: var(--white);
  padding: var(--space-xl) 0;
  text-align: center;
}

.article-meta {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: var(--space-md);
}

.article-content {
  padding: var(--space-xl) 0;
}

.article-content h2 {
  color: var(--deep-blue);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-md);
}

.article-content h3 {
  color: var(--teal);
  margin-top: var(--space-md);
  margin-bottom: var(--space-sm);
}

.article-content ul,
.article-content ol {
  margin-left: var(--space-md);
  margin-bottom: var(--space-md);
}

.article-content li {
  margin-bottom: 0.5rem;
}

/* Template Cards */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.template-card {
  background: var(--white);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--shadow-light);
  transition: all 0.3s ease;
}

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

.template-card .card-image {
  height: 200px;
}

/* Legal Pages */
.legal-content {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-xl) 0;
}

.legal-content h2 {
  color: var(--deep-blue);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-md);
}

.legal-content h3 {
  color: var(--teal);
  margin-top: var(--space-md);
  margin-bottom: var(--space-sm);
}

/* Responsive Design */
@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }
  
  .nav-menu {
    position: fixed;
    top: 80px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 80px);
    background: var(--white);
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: var(--space-lg);
    transition: left 0.3s ease;
    box-shadow: var(--shadow-medium);
  }
  
  .nav-menu.active {
    left: 0;
  }
  
  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .grid-12,
  .grid-6,
  .grid-4,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  
  .newsletter-form {
    flex-direction: column;
  }
  
  .container {
    padding: 0 var(--space-sm);
  }
  
  h1 {
    font-size: var(--scale-md);
  }
  
  h2 {
    font-size: var(--scale-sm);
  }
  
  .hero-text h1 {
    font-size: var(--scale-md);
  }
  
  .featured-grid {
    grid-template-columns: 1fr;
  }
  
  .category-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  :root {
    --gutter: 16px;
  }
  
  .nav-container {
    height: 60px;
    padding: 0 var(--space-sm);
  }
  
  .main {
    margin-top: 60px;
  }
  
  .nav-menu {
    top: 60px;
  }
  
  .hero {
    padding: var(--space-lg) 0;
  }
  
  .section {
    padding: var(--space-lg) 0;
  }
  
  .card-content {
    padding: var(--space-sm);
  }
  
  .newsletter-form {
    gap: var(--space-xs);
  }
  
  .progress-ring svg {
    width: 150px;
    height: 150px;
  }
  
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
  }
}

/* Animation Classes */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.fade-in.show {
  opacity: 1;
  transform: translateY(0);
}

.slide-in-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.6s ease;
}

.slide-in-left.show {
  opacity: 1;
  transform: translateX(0);
}

.slide-in-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.6s ease;
}

.slide-in-right.show {
  opacity: 1;
  transform: translateX(0);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }
.mt-5 { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }
.mb-5 { margin-bottom: var(--space-xl); }

.hidden { display: none; }
.visible { display: block; }

/* SVG Icons */
.icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.icon-lg {
  width: 32px;
  height: 32px;
}

.icon-xl {
  width: 48px;
  height: 48px;
}
