/* =============================================================================
   License to Deduct -- Blog Styles (blog.css)
   Extends the main site's design system. Import this on blog pages only.
   The main site's inline CSS custom properties are replicated here as a
   standalone stylesheet so blog pages do not depend on index.html's <style>.
   ============================================================================= */

/* ===== Custom Properties (mirrors index.html) ===== */
:root {
  --surface-primary: #FAF8F3;
  --surface-secondary: #F0EDE5;
  --surface-white: #FFFFFF;
  --surface-dark: #292520;
  --surface-dark-card: #352F28;

  --text-primary: #2C2A25;
  --text-secondary: #8A8578;
  --text-muted: #A39E92;
  --text-on-dark: #F2EFE8;
  --text-on-dark-muted: #A39E92;

  --sage-olive: #6B7C5E;
  --sage-olive-light: #9DB88A;
  --sage-olive-hover: #5A6B4F;
  --sage-olive-bg: rgba(107,124,94,0.08);
  --sage-olive-bg-hover: rgba(107,124,94,0.14);

  --business-green: #5C7A4B;
  --business-green-light: #8FBA75;
  --deduction-gold: #A68B3C;
  --deduction-gold-light: #D4B85A;
  --terracotta: #C47532;
  --terracotta-light: #E09A55;
  --destructive: #B5453A;

  --shadow-xs: 0 1px 2px rgba(44,42,37,0.06);
  --shadow-sm: 0 2px 4px rgba(44,42,37,0.08);
  --shadow-md: 0 4px 12px rgba(44,42,37,0.10);
  --shadow-lg: 0 8px 24px rgba(44,42,37,0.12);
  --shadow-xl: 0 16px 48px rgba(44,42,37,0.16);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-primary);
  background: var(--surface-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ===== Typography ===== */
h1, h2, h3, h4 {
  color: var(--text-primary);
  line-height: 1.2;
  font-weight: 700;
}
h1, h2 { font-family: Georgia, 'Times New Roman', serif; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.4rem); letter-spacing: -0.01em; }
h3 { font-size: 1.2rem; font-weight: 700; }

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sage-olive);
  margin-bottom: 12px;
}
.section-label i { font-size: 0.7rem; }

.section-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 580px;
  line-height: 1.8;
}

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
section { padding: 80px 0; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn i { font-size: 0.9em; }

.btn-sm { padding: 10px 20px; font-size: 0.875rem; }

.btn-primary {
  background: linear-gradient(135deg, var(--sage-olive), var(--sage-olive-hover));
  color: white;
  box-shadow: 0 4px 14px rgba(107,124,94,0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(107,124,94,0.45);
}

.btn-secondary {
  background: var(--surface-white);
  color: var(--sage-olive);
  border: 2px solid var(--surface-secondary);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  border-color: var(--sage-olive-light);
  background: var(--sage-olive-bg);
  transform: translateY(-2px);
}

.btn-dark {
  background: var(--surface-dark);
  color: var(--text-on-dark);
  box-shadow: 0 4px 14px rgba(41,37,32,0.3);
}
.btn-dark:hover {
  background: var(--surface-dark-card);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(41,37,32,0.4);
}

.btn-outline {
  background: transparent;
  color: var(--sage-olive);
  border: 2px solid var(--sage-olive);
}
.btn-outline:hover {
  background: var(--sage-olive-bg);
  transform: translateY(-2px);
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(250,248,243,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(44,42,37,0.06);
  transition: box-shadow 0.3s ease;
}
.header.scrolled { box-shadow: var(--shadow-md); }
.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-primary);
}
.logo img { width: 36px; height: 36px; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s;
}
.nav-links a:hover,
.nav-links a.nav-active { color: var(--sage-olive); }
.nav-cta { margin-left: 8px; }

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
}

/* ===== Mobile Navigation Overlay ===== */
.mobile-nav {
  display: none;
  position: fixed;
  top: 72px; left: 0; right: 0; bottom: 0;
  background: rgba(250,248,243,0.98);
  backdrop-filter: blur(20px);
  z-index: 999;
  flex-direction: column;
  padding: 32px 24px;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  padding: 16px 0;
  border-bottom: 1px solid rgba(44,42,37,0.06);
}
.mobile-nav .btn { margin-top: 24px; width: 100%; justify-content: center; }

/* ===== Blog Hero ===== */
.blog-hero {
  padding: 140px 0 64px;
  background: linear-gradient(180deg, var(--surface-white) 0%, var(--surface-primary) 100%);
  text-align: center;
}
.blog-hero-content { max-width: 680px; margin: 0 auto; }
.blog-hero h1 { margin-bottom: 16px; }
.blog-hero .section-subtitle { margin: 0 auto; }

/* ===== Blog List ===== */
.blog-list { padding: 48px 0 96px; background: var(--surface-primary); }
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 32px;
}

.post-card {
  background: var(--surface-white);
  border-radius: var(--radius-lg);
  padding: 36px;
  border: 1px solid rgba(44,42,37,0.07);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(107,124,94,0.15);
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}
.post-card-meta time { color: var(--text-muted); }
.post-card-divider { color: var(--text-muted); }

.post-card-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.3rem;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.post-card-title a { text-decoration: none; color: inherit; }
.post-card-title a:hover { color: var(--sage-olive); }

.post-card-excerpt {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  flex: 1;
}

.post-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sage-olive);
  text-decoration: none;
  margin-top: 4px;
  transition: gap 0.2s;
}
.post-card-link:hover { gap: 10px; }
.post-card-link i { font-size: 0.75rem; }

/* ===== Blog Post Article Layout ===== */
.post-header {
  padding: 140px 0 56px;
  background: linear-gradient(180deg, var(--surface-white) 0%, var(--surface-primary) 100%);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.breadcrumb a:hover { color: var(--sage-olive); }
.breadcrumb i { font-size: 0.65rem; }

.post-header-content { max-width: 800px; }
.post-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 24px;
}
.post-byline {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.875rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.post-byline span { display: flex; align-items: center; gap: 6px; }
.post-byline i { color: var(--sage-olive); font-size: 0.8rem; }
.post-byline-author { font-weight: 600; color: var(--text-secondary); }

/* Article body */
.post-body-section { padding: 0 0 96px; }
.post-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 64px;
  align-items: flex-start;
  max-width: 1100px;
}

.post-content {
  min-width: 0; /* Prevent grid overflow */
}

/* Article typography */
.post-content h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-top: 56px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--surface-secondary);
  color: var(--text-primary);
}
.post-content h3 {
  font-size: 1.2rem;
  margin-top: 36px;
  margin-bottom: 14px;
  color: var(--text-primary);
}
.post-content p {
  font-size: 1.05rem;
  color: var(--text-primary);
  line-height: 1.85;
  margin-bottom: 20px;
  max-width: none;
}
.post-content ul,
.post-content ol {
  margin-bottom: 20px;
  padding-left: 1.5rem;
}
.post-content ul { list-style: disc; }
.post-content ol { list-style: decimal; }
.post-content li {
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 8px;
  color: var(--text-primary);
}
.post-content a {
  color: var(--sage-olive);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.post-content a:hover { color: var(--sage-olive-hover); }
.post-content strong { font-weight: 700; }
.post-content em { font-style: italic; }
.post-content blockquote {
  border-left: 4px solid var(--sage-olive-light);
  padding: 16px 24px;
  margin: 28px 0;
  background: var(--sage-olive-bg);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.post-content blockquote p {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-secondary);
  margin: 0;
}
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.post-content table th {
  background: var(--surface-dark);
  color: var(--text-on-dark);
  font-weight: 600;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.post-content table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--surface-secondary);
  color: var(--text-primary);
}
.post-content table tr:last-child td { border-bottom: none; }
.post-content table tr:nth-child(even) td { background: var(--surface-primary); }
.post-content hr {
  border: none;
  border-top: 2px solid var(--surface-secondary);
  margin: 40px 0;
}
.post-content code {
  background: var(--surface-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Callout / info box for important notes inside articles */
.post-content .callout {
  background: var(--sage-olive-bg);
  border: 1px solid rgba(107,124,94,0.2);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin: 28px 0;
}

/* ===== Table of Contents (sidebar) ===== */
.toc {
  background: var(--surface-white);
  border: 1px solid rgba(44,42,37,0.08);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
  position: sticky;
  top: 96px;
}
.toc-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sage-olive);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toc ol {
  list-style: none;
  padding: 0;
  counter-reset: toc-counter;
}
.toc li {
  counter-increment: toc-counter;
  margin-bottom: 8px;
  font-size: 0.875rem;
}
.toc li a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
  line-height: 1.5;
  display: block;
}
.toc li a:hover { color: var(--sage-olive); }

/* ===== Post Sidebar App Card ===== */
.post-sidebar-app {
  background: linear-gradient(135deg, var(--sage-olive-hover), var(--sage-olive));
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  color: white;
  position: sticky;
  top: 340px; /* below TOC */
}
.post-sidebar-app .app-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  margin: 0 auto 16px;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}
.post-sidebar-app h3 {
  color: white;
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.post-sidebar-app p {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
  margin-bottom: 20px;
}
.post-sidebar-app .btn {
  width: 100%;
  justify-content: center;
  background: white;
  color: var(--sage-olive);
  font-weight: 700;
  margin-bottom: 10px;
}
.post-sidebar-app .btn-outline-white {
  width: 100%;
  justify-content: center;
  background: transparent;
  color: white;
  border: 2px solid rgba(255,255,255,0.5);
  font-weight: 600;
  margin-bottom: 0;
}
.post-sidebar-app .btn-outline-white:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.8);
}

/* ===== Social Sharing ===== */
.post-share {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 2px solid var(--surface-secondary);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.post-share-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}
.share-btn-twitter {
  background: #000000;
  color: white;
}
.share-btn-twitter:hover { background: #1a1a1a; transform: translateY(-2px); }
.share-btn-linkedin {
  background: #0A66C2;
  color: white;
}
.share-btn-linkedin:hover { background: #0853A0; transform: translateY(-2px); }

/* ===== CTA Banner (bottom of each post) ===== */
.post-cta-section {
  background: linear-gradient(135deg, var(--sage-olive-hover) 0%, var(--sage-olive) 100%);
  position: relative;
  overflow: hidden;
  padding: 80px 0;
}
.post-cta-section::before {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.post-cta-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  flex-wrap: wrap;
}
.post-cta-text h2 {
  color: white;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  margin-bottom: 12px;
}
.post-cta-text p {
  color: rgba(255,255,255,0.8);
  font-size: 1rem;
  max-width: 520px;
  line-height: 1.7;
}
.post-cta-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.post-cta-buttons .btn-primary {
  background: white;
  color: var(--sage-olive-hover);
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}
.post-cta-buttons .btn-primary:hover {
  background: rgba(255,255,255,0.92);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.post-cta-buttons .btn-dark {
  background: rgba(255,255,255,0.12);
  color: white;
  border: 2px solid rgba(255,255,255,0.25);
  box-shadow: none;
}
.post-cta-buttons .btn-dark:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.4);
}

/* ===== Blog Index CTA ===== */
.blog-cta-section {
  padding: 80px 0;
  background: var(--surface-white);
}
.blog-cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  padding: 48px;
  background: linear-gradient(135deg, var(--sage-olive-hover), var(--sage-olive));
  border-radius: var(--radius-xl);
  flex-wrap: wrap;
}
.blog-cta-text h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: white;
  margin-bottom: 10px;
}
.blog-cta-text p {
  font-size: 1rem;
  color: rgba(255,255,255,0.82);
  max-width: 480px;
  line-height: 1.7;
}
.blog-cta-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.blog-cta-buttons .btn-primary {
  background: white;
  color: var(--sage-olive-hover);
}
.blog-cta-buttons .btn-dark {
  background: rgba(255,255,255,0.12);
  color: white;
  border: 2px solid rgba(255,255,255,0.25);
  box-shadow: none;
}
.blog-cta-buttons .btn-dark:hover {
  background: rgba(255,255,255,0.2);
}

/* ===== Footer ===== */
.footer {
  background: var(--surface-dark);
  color: var(--text-on-dark-muted);
  padding: 64px 0 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}
.footer-brand .logo { color: var(--text-on-dark); margin-bottom: 16px; }
.footer-brand .logo img { filter: brightness(10); }
.footer-brand p { font-size: 0.9rem; line-height: 1.7; max-width: 300px; }
.footer-col h4 {
  color: var(--text-on-dark);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 20px;
  font-weight: 700;
}
.footer-col a { display: block; font-size: 0.9rem; padding: 4px 0; transition: color 0.2s; }
.footer-col a:hover { color: rgba(255,255,255,0.9); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 32px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.8rem;
}
.footer-social { display: flex; gap: 16px; }
.footer-social a { font-size: 1.1rem; transition: color 0.2s; }
.footer-social a:hover { color: white; }

/* ===== Animations ===== */
.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-up.visible { opacity: 1; transform: translateY(0); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .post-layout {
    grid-template-columns: 1fr;
    max-width: 720px;
  }
  .post-sidebar { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  section { padding: 56px 0; }
  .nav-links { display: none; }
  .nav-cta { display: none; }
  .mobile-toggle { display: block; }
  .blog-hero { padding: 120px 0 48px; }
  .posts-grid { grid-template-columns: 1fr; }
  .post-header { padding: 120px 0 40px; }
  .post-cta-inner { flex-direction: column; text-align: center; }
  .post-cta-buttons { justify-content: center; }
  .blog-cta-inner { flex-direction: column; text-align: center; padding: 36px 24px; }
  .blog-cta-buttons { justify-content: center; }
  .post-share { justify-content: center; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 16px; text-align: center; }
}

/* ===== Mobile TOC (shown only when sidebar is hidden) ===== */
.toc-mobile { display: none; }

@media (max-width: 1024px) {
  .toc-mobile { display: block; margin-bottom: 32px; }
  .toc-mobile .toc { position: static; top: auto; }
}
