/*
Theme Name: FirmMatters Blog
Theme URI: https://firmmatters.net
Description: Custom blog theme matching the FirmMatters website design system.
Version: 2.0
Author: FirmMatters Inc.
Author URI: https://firmmatters.net
Text Domain: firmmatters-blog
*/

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

:root {
  --fm-red: #c23a2e;
  --fm-red-hover: #a83228;
  --fm-black: #1a1a1a;
  --fm-dark: #2a2a2a;
  --fm-body: #3d3d3d;
  --fm-muted: #666;
  --fm-light: #888;
  --fm-lighter: #999;
  --fm-border: rgba(0,0,0,0.07);
  --fm-border-light: rgba(0,0,0,0.05);
  --fm-bg: #faf9f7;
  --fm-bg-warm: #f0eeea;
  --fm-bg-card: #ffffff;
  --fm-font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --fm-font-display: 'Playfair Display', Georgia, serif;
  --fm-font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --fm-max-width: 1200px;
  --fm-content-width: 720px;
  --fm-transition: 0.25s ease;
  --fm-radius: 14px;
  --fm-shadow-hover: 0 12px 40px rgba(0,0,0,0.06);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--fm-font-body);
  background-color: var(--fm-bg);
  color: var(--fm-body);
  line-height: 1.7;
}

a {
  color: var(--fm-red);
  text-decoration: none;
  transition: color var(--fm-transition);
}

a:hover {
  color: var(--fm-red-hover);
}

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

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4 {
  font-family: var(--fm-font-display);
  color: var(--fm-black);
  line-height: 1.2;
  font-weight: 700;
}

h1 { font-size: 3.2rem; margin-bottom: 1rem; }
h2 { font-size: 2rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.4rem; margin-bottom: 0.5rem; }
h4 { font-size: 1.15rem; margin-bottom: 0.5rem; }

p {
  margin-bottom: 1.25rem;
}

/* ===== HEADER / NAVIGATION ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(250, 249, 247, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--fm-border);
}

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

.site-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.site-logo img {
  height: 40px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--fm-muted);
  text-decoration: none;
  transition: color var(--fm-transition);
  letter-spacing: 0.005em;
}

.nav-links a:hover,
.nav-links a.current {
  color: var(--fm-black);
}

.nav-cta {
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  color: #fff !important;
  background: var(--fm-red);
  padding: 8px 18px;
  border-radius: 6px;
  transition: background var(--fm-transition) !important;
}

.nav-cta:hover {
  background: var(--fm-red-hover) !important;
  color: #fff !important;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--fm-black);
  margin: 5px 0;
  transition: var(--fm-transition);
}

/* ===== BLOG HERO ===== */
.blog-hero {
  padding: 140px 2rem 52px;
  max-width: var(--fm-max-width);
  margin: 0 auto;
  border-bottom: 1px solid var(--fm-border);
}

.blog-hero .hero-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--fm-red);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.blog-hero h1 {
  max-width: 720px;
  margin-bottom: 16px;
  line-height: 1.15;
}

.blog-hero h1 em {
  color: var(--fm-red);
  font-style: italic;
}

.blog-hero .subtitle {
  font-size: 1rem;
  color: var(--fm-light);
  max-width: 560px;
  line-height: 1.75;
}

/* ===== CATEGORY FILTER ===== */
.category-filter {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 28px 2rem 0;
  max-width: var(--fm-max-width);
  margin: 0 auto;
}

.category-filter a {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--fm-light);
  padding: 6px 14px;
  border: 1px solid #d0cfc9;
  border-radius: 100px;
  transition: all var(--fm-transition);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.category-filter a:hover,
.category-filter a.active {
  color: var(--fm-red);
  border-color: var(--fm-red);
  background: rgba(194, 58, 46, 0.04);
}

/* ===== POST GRID ===== */
.posts-grid {
  max-width: var(--fm-max-width);
  margin: 0 auto;
  padding: 2rem 2rem 3.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.75rem;
}

/* ===== POST CARD ===== */
.post-card {
  background: var(--fm-bg-card);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-radius);
  overflow: hidden;
  transition: transform var(--fm-transition), box-shadow var(--fm-transition);
}

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

.post-card-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-bottom: 1px solid var(--fm-border-light);
}

.post-card-image.placeholder {
  background: linear-gradient(135deg, var(--fm-bg-warm), #e8e4dd);
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-card-body {
  padding: 1.5rem;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
  font-size: 0.7rem;
  color: var(--fm-lighter);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.post-card-category {
  color: var(--fm-red);
  font-weight: 700;
}

.post-card-title {
  font-family: var(--fm-font-display);
  font-size: 1.25rem;
  color: var(--fm-black);
  margin-bottom: 0.6rem;
  line-height: 1.35;
}

.post-card-title a {
  color: var(--fm-black);
  text-decoration: none;
}

.post-card-title a:hover {
  color: var(--fm-red);
}

.post-card-excerpt {
  font-size: 0.88rem;
  color: var(--fm-light);
  line-height: 1.65;
  margin-bottom: 1rem;
}

.post-card-read-more {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--fm-red);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-card-read-more:hover {
  color: var(--fm-black);
}

/* ===== FEATURED POST ===== */
.featured-post {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  background: var(--fm-bg-card);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-radius);
  overflow: hidden;
  transition: transform var(--fm-transition), box-shadow var(--fm-transition);
}

.featured-post:hover {
  transform: translateY(-3px);
  box-shadow: var(--fm-shadow-hover);
}

.featured-post .post-card-image {
  height: 100%;
  min-height: 320px;
}

.featured-post .post-card-body {
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-post .post-card-title {
  font-size: 1.7rem;
}

.featured-label {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
  background: var(--fm-red);
  padding: 3px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 1rem;
  width: fit-content;
}

/* ===== SINGLE POST ===== */
.single-post-header {
  padding: 140px 2rem 36px;
  max-width: 780px;
  margin: 0 auto;
  border-bottom: 1px solid var(--fm-border);
}

.single-post-header .post-category {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--fm-red);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  display: block;
}

.single-post-header h1 {
  font-size: 2.6rem;
  max-width: 780px;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.single-post-header h1 em {
  color: var(--fm-red);
  font-style: italic;
}

.post-meta-bar {
  display: flex;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--fm-lighter);
  margin-top: 0.5rem;
}

.post-meta-bar .divider {
  color: #d0cfc9;
}

.single-post-featured-image {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 2rem 0;
}

.single-post-featured-image img {
  width: 100%;
  border-radius: var(--fm-radius);
  border: 1px solid var(--fm-border);
}

/* ===== ARTICLE CONTENT ===== */
.article-content {
  max-width: var(--fm-content-width);
  margin: 0 auto;
  padding: 2.5rem 2rem 3rem;
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--fm-body);
}

.article-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.7rem;
}

.article-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.3rem;
}

.article-content p {
  margin-bottom: 1.5rem;
}

.article-content a {
  color: var(--fm-red);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-content a:hover {
  color: var(--fm-black);
}

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

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

.article-content blockquote {
  border-left: 3px solid var(--fm-red);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  background: rgba(0,0,0,0.02);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--fm-muted);
}

.article-content pre {
  background: var(--fm-bg-warm);
  border: 1px solid var(--fm-border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.article-content code {
  font-family: var(--fm-font-mono);
  font-size: 0.88em;
  background: rgba(0,0,0,0.04);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.article-content pre code {
  background: none;
  padding: 0;
}

.article-content img {
  border-radius: 10px;
  margin: 2rem 0;
  border: 1px solid var(--fm-border);
}

.article-content hr {
  border: none;
  border-top: 1px solid var(--fm-border);
  margin: 2.5rem 0;
}

/* ===== AUTHOR BOX ===== */
.author-box {
  max-width: var(--fm-content-width);
  margin: 0 auto 2.5rem;
  padding: 1.5rem;
  background: var(--fm-bg-card);
  border: 1px solid var(--fm-border);
  border-radius: var(--fm-radius);
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.author-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--fm-bg-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--fm-font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--fm-red);
  flex-shrink: 0;
}

.author-info h4 {
  font-family: var(--fm-font-body);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--fm-black);
  margin-bottom: 0.15rem;
}

.author-info p {
  font-size: 0.82rem;
  color: var(--fm-light);
  margin-bottom: 0;
  line-height: 1.5;
}

/* ===== POST NAVIGATION ===== */
.post-nav {
  max-width: var(--fm-content-width);
  margin: 0 auto;
  padding: 0 2rem 3rem;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
}

.post-nav a {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--fm-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.post-nav a:hover {
  color: var(--fm-red);
}

/* ===== CTA BANNER ===== */
.blog-cta {
  background: var(--fm-bg-warm);
  border-top: 1px solid var(--fm-border);
  padding: 4rem 2rem;
  text-align: center;
}

.blog-cta h2 {
  font-size: 2rem;
  margin-bottom: 0.6rem;
}

.blog-cta h2 em {
  color: var(--fm-red);
  font-style: italic;
}

.blog-cta p {
  color: var(--fm-light);
  font-size: 0.95rem;
  max-width: 500px;
  margin: 0 auto 1.25rem;
}

.btn-primary {
  display: inline-block;
  font-family: var(--fm-font-body);
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  background: var(--fm-red);
  padding: 0.75rem 2rem;
  border-radius: 8px;
  text-decoration: none;
  transition: background var(--fm-transition);
}

.btn-primary:hover {
  background: var(--fm-red-hover);
  color: #fff;
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--fm-bg);
  border-top: 1px solid var(--fm-border);
  padding: 1.75rem 2rem;
}

.footer-inner {
  max-width: var(--fm-max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-logo {
  font-family: var(--fm-font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--fm-black);
  text-decoration: none;
}

.footer-email a {
  font-size: 0.85rem;
  color: var(--fm-lighter);
}

.footer-email a:hover {
  color: var(--fm-black);
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 2rem 3rem;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #d0cfc9;
  color: var(--fm-light);
  transition: all var(--fm-transition);
}

.pagination a:hover {
  border-color: var(--fm-red);
  color: var(--fm-red);
}

.pagination .current {
  background: var(--fm-red);
  border-color: var(--fm-red);
  color: #fff;
}

/* ===== 404 ===== */
.error-404 {
  padding: 160px 2rem 80px;
  text-align: center;
}

.error-404 h1 {
  font-size: 6rem;
  color: var(--fm-red);
  margin-bottom: 0.5rem;
}

.error-404 p {
  color: var(--fm-light);
  font-size: 1.1rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: fixed;
    top: 68px;
    left: 0;
    width: 100%;
    background: var(--fm-bg);
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
    border-bottom: 1px solid var(--fm-border);
  }

  .nav-links.active {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.5rem; }

  .blog-hero h1 { font-size: 2.2rem; }
  .single-post-header h1 { font-size: 2rem; }

  .posts-grid { grid-template-columns: 1fr; }
  .featured-post { grid-template-columns: 1fr; }
  .featured-post .post-card-image { min-height: 200px; }

  .author-box { flex-direction: column; text-align: center; }
  .footer-inner { flex-direction: column; gap: 0.75rem; }
  .post-nav { flex-direction: column; }
}
