/* Blog CSS - Matches Main Site Styling Exactly */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* CSS Variables matching main site exactly */
:root {
  --background: 0 0% 100%;
  --foreground: 210 11% 8%;
  --primary: 241 100% 21%;
  --primary-foreground: 210 20% 98%;
  --muted-foreground: 220 9% 46%;
  --border: 220 13% 88%;
  --card: 0 0% 100%;
  --card-foreground: 210 11% 8%;
  --card-border: 220 13% 91%;
  --radius: 0.5rem;
}

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

/* Base styles */
html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Header - matches main site exactly */
.site-header {
  border-bottom: 1px solid hsl(var(--border));
  background: linear-gradient(90deg, #f2f7ff, #ffffff);
}

.header-container {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
}

.logo-text {
  font-weight: 700;
  font-size: 1.25rem;
  color: hsl(var(--primary));
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  color: hsl(var(--primary));
  transition: background-color 0.2s, transform 0.1s;
}

.nav-link:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.nav-link:active {
  background-color: rgba(0, 0, 0, 0.08);
}

.nav-link svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Main Content - matches homepage section exactly */
.main-content {
  flex: 1;
  background: hsl(var(--background));
}

/* Blog Section - matches homepage calculator section */
.blog-section {
  padding-top: 0;
  padding-bottom: 1.5rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  background: hsl(var(--background));
}

@media (min-width: 640px) {
  .blog-section {
    padding-top: 0;
    padding-bottom: 2.5rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

.content-container {
  max-width: 72rem;
  margin: 0 auto;
}

/* Blog Header Section - matches homepage hero */
.blog-header-section {
  padding: 0.75rem 1rem 0.75rem;
  background: hsl(var(--background));
  text-align: center;
}

@media (min-width: 640px) {
  .blog-header-section {
    padding: 1rem 1.5rem 1rem;
  }
}

.blog-header-container {
  max-width: 80rem;
  margin: 0 auto;
}

/* H1 - matches homepage H1 style */
.blog-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: hsl(var(--primary));
  margin-bottom: 0.75rem;
}

@media (min-width: 640px) {
  .blog-title {
    font-size: 2.25rem;
    margin-bottom: 1rem;
  }
}

/* Subtitle - matches homepage subtitle */
.blog-subtitle {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  max-width: 48rem;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .blog-subtitle {
    font-size: 1rem;
  }
}

/* Section title - matches homepage section heading */
.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
  color: hsl(var(--primary));
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .section-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
  }
}

/* Blog Cards Grid - matches homepage calculator grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

/* Blog Card - matches homepage Card component exactly */
.blog-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--card-border));
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: box-shadow 0.2s, transform 0.1s;
}

@media (min-width: 640px) {
  .blog-card {
    padding: 1.5rem;
  }
}

.blog-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Card inner layout - matches homepage flex layout */
.card-inner {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  height: 100%;
}

/* Icon container - matches homepage icon style exactly */
.card-icon {
  width: 3rem;
  height: 3rem;
  background: hsl(var(--primary) / 0.1);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .card-icon {
    width: 3.5rem;
    height: 3.5rem;
  }
}

.card-icon svg {
  width: 1.5rem;
  height: 1.5rem;
  color: hsl(var(--primary));
}

@media (min-width: 640px) {
  .card-icon svg {
    width: 1.75rem;
    height: 1.75rem;
  }
}

/* Card content area */
.card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Card title - matches homepage h3 style exactly */
.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: hsl(var(--primary));
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

@media (min-width: 640px) {
  .card-title {
    font-size: 1.25rem;
  }
}

/* Card description - matches homepage description exactly */
.card-description {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.75rem;
  flex: 1;
  line-height: 1.6;
}

@media (min-width: 640px) {
  .card-description {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }
}

/* Button - matches homepage Button size="sm" exactly */
.card-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-weight: 500;
  font-size: 0.75rem;
  padding: 0 0.75rem;
  min-height: 2rem;
  border-radius: 0.375rem;
  width: fit-content;
  min-width: 120px;
  transition: opacity 0.2s, transform 0.1s;
  margin-top: auto;
  border: 1px solid hsl(var(--primary));
}

.card-button:hover {
  opacity: 0.9;
}

.card-button:active {
  transform: scale(0.98);
}

.card-button svg {
  width: 1rem;
  height: 1rem;
}

/* Footer - matches main site footer exactly */
.site-footer {
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  margin-top: 4rem;
}

.footer-container {
  max-width: 80rem;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.footer-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .footer-main {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  transition: background-color 0.2s;
}

.footer-brand:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.footer-brand-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: hsl(var(--primary));
}

.footer-brand-text strong {
  display: block;
  font-size: 1.125rem;
  font-weight: 700;
  color: hsl(var(--primary));
}

.footer-brand-text span {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
}

@media (min-width: 768px) {
  .footer-nav {
    justify-content: flex-end;
  }
}

.footer-link {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  padding: 0.25rem 0.5rem;
  transition: color 0.2s;
}

.footer-link:hover {
  color: hsl(var(--primary));
}

.footer-separator {
  color: rgba(0, 0, 0, 0.2);
  margin: 0 0.25rem;
}

.footer-divider {
  height: 1px;
  background: hsl(var(--border));
  margin: 1.5rem 0;
}

.footer-bottom {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .footer-bottom {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.footer-copyright {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.footer-disclaimer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  text-align: center;
}

.footer-disclaimer p {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

/* Blog Post Styling (for individual posts) */
.blog-post-container {
  max-width: 48rem;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
  overflow-x: hidden;
}

@media (max-width: 640px) {
  .blog-post-container {
    padding: 1rem 0.75rem 3rem;
  }
}

.blog-post-header {
  margin-bottom: 2rem;
}

.blog-post-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: hsl(var(--primary));
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

@media (min-width: 640px) {
  .blog-post-title {
    font-size: 2rem;
  }
}

@media (min-width: 768px) {
  .blog-post-title {
    font-size: 2.5rem;
  }
}

.blog-post-meta,
.blog-meta {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  padding-bottom: 0.5rem;
  margin-bottom: 0;
  border-bottom: none;
}

.author-attribution {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  font-style: italic;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
}

/* Blog Featured Image */
.blog-image {
  margin: 1.5rem 0 2rem;
  border-radius: 0.5rem;
  overflow: hidden;
}

.blog-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0.5rem;
}

.blog-post-content,
.blog-content {
  font-size: 1rem;
  line-height: 1.8;
}

.blog-post-content h2,
.blog-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: hsl(var(--primary));
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.blog-post-content h3,
.blog-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.blog-post-content p,
.blog-content p {
  margin-bottom: 1rem;
}

.blog-post-content ul,
.blog-post-content ol,
.blog-content ul,
.blog-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.blog-post-content li,
.blog-content li {
  margin-bottom: 0.5rem;
}

.blog-post-content strong,
.blog-content strong {
  font-weight: 600;
}

.blog-post-content a,
.blog-content a {
  color: hsl(var(--primary));
  text-decoration: underline;
}

.blog-post-content a:hover,
.blog-content a:hover {
  opacity: 0.8;
}

/* Formula/Code blocks */
.formula-box {
  background: hsl(var(--primary) / 0.05);
  border-left: 4px solid hsl(var(--primary));
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.9375rem;
  font-weight: 600;
  overflow-x: auto;
  word-wrap: break-word;
}

@media (max-width: 640px) {
  .formula-box {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }
}

.example-box {
  background: rgba(34, 197, 94, 0.08);
  border-left: 4px solid #22c55e;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  overflow-x: auto;
  word-wrap: break-word;
}

@media (max-width: 640px) {
  .example-box {
    padding: 0.75rem 1rem;
  }
}

.example-box strong {
  color: #16a34a;
}

/* Breadcrumb */
.breadcrumb {
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.breadcrumb a {
  color: hsl(var(--muted-foreground));
  text-decoration: none;
}

.breadcrumb a:hover {
  color: hsl(var(--primary));
}

.breadcrumb span {
  color: hsl(var(--muted-foreground));
  margin: 0 0.5rem;
}

/* Calculator Links Container */
.calculator-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}

@media (max-width: 640px) {
  .calculator-links {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Calculator Links */
.calculator-link,
.blog-content .calculator-link,
.blog-post-content .calculator-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--primary));
  color: #ffffff !important;
  padding: 0.625rem 1.25rem;
  border-radius: 0.375rem;
  text-decoration: none !important;
  font-weight: 500;
  font-size: 0.875rem;
  transition: opacity 0.2s, transform 0.1s;
  border: 1px solid hsl(var(--primary));
  white-space: nowrap;
  text-align: center;
}

.calculator-link:hover,
.blog-content .calculator-link:hover,
.blog-post-content .calculator-link:hover {
  opacity: 0.9;
  color: #ffffff !important;
  text-decoration: none !important;
  transform: translateY(-1px);
}

.calculator-link:active {
  transform: scale(0.98);
}

/* FAQ Section */
.faq-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid hsl(var(--border));
}

.faq-section h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: hsl(var(--primary));
  margin-bottom: 1.5rem;
}

.faq-item {
  margin-bottom: 1.5rem;
}

.faq-item h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.faq-item p {
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
}

/* Related posts section */
.related-posts {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid hsl(var(--border));
}

.related-posts h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: hsl(var(--primary));
  margin-bottom: 1rem;
}

.related-posts ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-posts li {
  margin-bottom: 0.75rem;
}

.related-posts a {
  color: hsl(var(--primary));
  text-decoration: none;
}

.related-posts a:hover {
  text-decoration: underline;
}

/* Reference table styling */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
}

.reference-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 400px;
}

.reference-table th,
.reference-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid hsl(var(--border));
}

.reference-table th {
  background: hsl(var(--primary) / 0.05);
  font-weight: 600;
  color: hsl(var(--primary));
  white-space: nowrap;
}

.reference-table tr:hover {
  background: hsl(var(--primary) / 0.02);
}

/* Trust section styling */
.trust-section {
  margin-top: 2.5rem;
  padding: 1.5rem;
  background: hsl(var(--primary) / 0.03);
  border-radius: 0.5rem;
  border-left: 4px solid hsl(var(--primary));
}

.trust-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: hsl(var(--primary));
  margin-bottom: 1rem;
  margin-top: 0;
}

.trust-section p {
  color: hsl(var(--muted-foreground));
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.trust-section p:last-child {
  margin-bottom: 0;
}

/* Responsive */
@media (max-width: 640px) {
  .header-container {
    padding: 0.5rem 0.75rem;
  }
  
  .logo-text {
    font-size: 1rem;
  }
  
  .logo-icon {
    width: 2rem;
    height: 2rem;
  }
  
  .logo-icon svg {
    width: 1.25rem;
    height: 1.25rem;
  }
  
  .nav-link {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
  }
  
  .reference-table {
    font-size: 0.85rem;
  }
  
  .reference-table th,
  .reference-table td {
    padding: 0.5rem 0.75rem;
  }
  
  /* Mobile blog post content */
  .blog-post-content h2,
  .blog-content h2 {
    font-size: 1.25rem;
  }
  
  .blog-post-content h3,
  .blog-content h3 {
    font-size: 1.1rem;
  }
  
  .trust-section {
    padding: 1rem;
    margin-top: 2rem;
  }
  
  .trust-section h2 {
    font-size: 1.1rem;
  }
  
  .faq-section h2 {
    font-size: 1.25rem;
  }
  
  .faq-item h3 {
    font-size: 1rem;
  }
  
  /* Calculator links on mobile */
  .calculator-links {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .calculator-link {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
  }
}

/* Prevent horizontal overflow */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Images responsive */
img {
  max-width: 100%;
  height: auto;
}

/* Prevent any element from overflowing */
article, section, div, p {
  max-width: 100%;
}

/* Long words/URLs break properly */
.blog-post-content,
.blog-content {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}
