/* ============================================================
   CITRA Associates — Blog Shared Stylesheet
   Font: Host Grotesk (matches main site)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Host+Grotesk:wght@300;400;500;600;700&display=swap');

/* ── Custom Properties ──────────────────────────────────────── */
:root {
  --color-primary:   #0EA5E9;
  --color-primary-dark: #0284C7;
  --color-dark:      #111827;
  --color-heading:   #1F2937;
  --color-body:      #374151;
  --color-muted:     #6B7280;
  --color-border:    #E5E7EB;
  --color-bg-light:  #F9FAFB;
  --color-bg-white:  #FFFFFF;
  --color-badge-bg:  rgba(14, 165, 233, 0.12);

  --font-sans: 'Host Grotesk', system-ui, -apple-system, sans-serif;

  --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:  3rem;

  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  --nav-height: 64px;
  --article-width: 720px;
  --container-width: 1200px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--color-body);
  background: var(--color-bg-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: inherit; text-decoration: none; }
ul, ol { padding-left: var(--space-6); }

/* ── Navigation ─────────────────────────────────────────────── */
/* ── Navbar — matches main site exactly ─────────────────────── */
.blog-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  padding: 0 2rem;
  transition: background 0.3s, box-shadow 0.3s;
  background: transparent;
}

.blog-nav.scrolled {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo-img {
  height: 44px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Center pill container — dark hero (default: article pages) */
.nav-pill {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: background 0.3s, border-color 0.3s;
}

/* Over light background (listing page) */
.blog-nav.light-bg .nav-pill {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

/* Scrolled — both variants collapse pill styling */
.blog-nav.scrolled .nav-pill {
  background: transparent;
  border-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Link colors — dark hero default: white text */
.nav-pill a {
  padding: 8px 20px;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}
.nav-pill a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

/* Link colors — light background: dark text */
.blog-nav.light-bg .nav-pill a {
  color: rgba(17, 24, 39, 0.75);
}
.blog-nav.light-bg .nav-pill a:hover {
  color: #111827;
  background: rgba(0, 0, 0, 0.05);
}

/* Link colors — scrolled state (always dark) */
.blog-nav.scrolled .nav-pill a {
  color: rgba(17, 24, 39, 0.7);
}
.blog-nav.scrolled .nav-pill a:hover {
  color: #111827;
  background: rgba(0, 0, 0, 0.05);
}

/* Hamburger stroke — dark on light bg, white on dark bg */
.blog-nav.light-bg .nav-toggle span,
.blog-nav.scrolled .nav-toggle span {
  background: var(--color-dark);
}

/* CTA button — right side */
.nav-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: var(--color-primary);
  color: #fff !important;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: filter 0.2s;
  flex-shrink: 0;
}
.nav-cta-btn:hover { filter: brightness(1.1); }

/* Hamburger — hidden on desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: 0.3s;
}
.blog-nav.scrolled .nav-toggle span { background: var(--color-dark); }

/* Mobile drawer */
.mobile-menu {
  display: none;
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  z-index: 99;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--color-border);
  flex-direction: column;
  padding: 1rem 1.5rem 1.5rem;
  gap: 0.25rem;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  display: block;
  padding: 0.75rem 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  color: rgba(17, 24, 39, 0.7);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
}
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a:hover { color: #111827; }
.mobile-menu .mobile-cta {
  margin-top: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: var(--color-primary);
  color: #fff !important;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: none;
}

/* ── Blog Hero (Article pages) ──────────────────────────────── */
.blog-hero {
  position: relative;
  width: 100%;
  height: 520px;
  margin-top: 0; /* fixed nav overlaps — hero starts from top */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.blog-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(17, 24, 39, 0.25) 0%,
    rgba(17, 24, 39, 0.72) 65%,
    rgba(17, 24, 39, 0.90) 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-12) var(--space-8);
  max-width: var(--container-width);
  margin: 0 auto;
}

/* Make overlay span the full width but content inside max-width */
.blog-hero {
  display: flex;
}
.blog-hero-overlay {
  flex: 1;
}
@media (min-width: 1200px) {
  .blog-hero-overlay {
    padding: var(--space-16) calc((100% - var(--container-width)) / 2 + var(--space-8));
  }
}

.category-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background: var(--color-primary);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-4);
  width: fit-content;
}

.blog-hero-overlay h1 {
  font-size: clamp(2rem, 4.5vw, 3.25rem); /* matches site h2 scale: 32px→52px */
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 800px;
  margin-bottom: var(--space-4);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  color: rgba(255,255,255,0.75);
  font-size: var(--text-sm);
  font-weight: 400;
}

/* ── Article Container ──────────────────────────────────────── */
.article-container {
  width: 100%;
}

/* ── Article Body ───────────────────────────────────────────── */
.article-body {
  max-width: var(--article-width);
  margin: 0 auto;
  padding: var(--space-16) var(--space-6);
  line-height: 1.75;
}

.article-body h2 {
  font-size: clamp(1.5rem, 2.5vw, 2rem); /* site h3 scale: 24px→32px */
  font-weight: 700;
  color: var(--color-heading);
  margin-top: var(--space-12);
  margin-bottom: var(--space-4);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.article-body h3 {
  font-size: clamp(1.125rem, 2vw, 1.375rem); /* site h4 scale: 18px→22px */
  font-weight: 600;
  color: var(--color-heading);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  line-height: 1.3;
}

.article-body p {
  margin-bottom: var(--space-5);
  color: var(--color-body);
  font-size: 1.0625rem; /* 17px — body-large feel for readability */
  line-height: 1.7;
}

.article-body ul,
.article-body ol {
  margin-bottom: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.article-body li {
  color: var(--color-body);
  line-height: 1.7;
}

.article-body a {
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
}
.article-body a:hover { color: var(--color-primary-dark); }

.article-body strong { font-weight: 600; color: var(--color-heading); }

.article-body blockquote {
  border-left: 3px solid var(--color-primary);
  padding: var(--space-4) var(--space-6);
  margin: var(--space-8) 0;
  background: var(--color-bg-light);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: var(--text-lg);
  font-weight: 300;
  color: var(--color-heading);
  font-style: italic;
}

/* ── FAQ Section ────────────────────────────────────────────── */
.faq-section {
  margin-top: var(--space-16);
  padding-top: var(--space-10);
  border-top: 1px solid var(--color-border);
}

.faq-section > h2 {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-heading);
  margin-bottom: var(--space-8);
}

.faq-item {
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--color-border);
}
.faq-item:last-child { border-bottom: none; }

.faq-item h3 {
  font-size: 1.125rem; /* 18px — h4 equivalent */
  font-weight: 600;
  color: var(--color-heading);
  margin-bottom: var(--space-3);
  line-height: 1.3;
}

.faq-item p {
  color: var(--color-body);
  line-height: 1.7;
  margin: 0;
}

/* ── Related Articles Section ───────────────────────────────── */
.related-section {
  background: var(--color-bg-light);
  padding: var(--space-16) var(--space-8);
}

.related-section > h2 {
  text-align: center;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-heading);
  margin-bottom: var(--space-10);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  max-width: var(--container-width);
  margin: 0 auto;
}

.related-card {
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s, box-shadow 0.25s;
}
.related-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.related-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.related-card-body {
  padding: var(--space-5);
}

.related-card-body h3 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-heading);
  line-height: 1.4;
  margin-bottom: var(--space-3);
}

.related-card-body p {
  font-size: var(--text-sm);
  color: var(--color-muted);
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

.related-card-body .read-link {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s;
}
.related-card-body .read-link:hover { gap: 8px; }

/* ── CTA Block ──────────────────────────────────────────────── */
.cta-block {
  background: var(--color-dark);
  padding: var(--space-20) var(--space-8);
  text-align: center;
}

.cta-block h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.75rem); /* between h2 and h3 on main site */
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #fff;
  margin-bottom: var(--space-5);
}

.cta-block p {
  font-size: var(--text-lg);
  color: rgba(255,255,255,0.72);
  max-width: 600px;
  margin: 0 auto var(--space-8);
  line-height: 1.7;
  font-weight: 300;
}

.cta-button {
  display: inline-block;
  padding: var(--space-4) var(--space-8);
  background: var(--color-primary);
  color: #fff;
  font-size: var(--text-base);
  font-weight: 600;
  border-radius: var(--radius-md);
  letter-spacing: 0.02em;
  transition: background 0.2s, transform 0.15s;
}
.cta-button:hover {
  background: var(--color-primary-dark);
  color: #fff;
  transform: translateY(-2px);
}

/* ── Blog Footer ────────────────────────────────────────────── */
.blog-footer {
  background: var(--color-bg-light);
  border-top: 1px solid var(--color-border);
  padding: var(--space-8) var(--space-8);
}

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

.blog-footer p {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

.footer-nav {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.footer-nav a {
  font-size: var(--text-sm);
  color: var(--color-muted);
  transition: color 0.2s;
}
.footer-nav a:hover { color: var(--color-dark); }

/* ── Blog Listing Page ──────────────────────────────────────── */
.listing-hero {
  background: var(--color-bg-light);
  padding-top: calc(72px + 4rem); /* fixed nav height + breathing room */
  padding-bottom: var(--space-16);
  padding-left: var(--space-8);
  padding-right: var(--space-8);
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}

.listing-hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem); /* matches main site h1 scale: 40px→80px */
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-heading);
  margin-bottom: var(--space-5);
  line-height: 1.08;
}

.listing-hero p {
  font-size: var(--text-lg);
  color: var(--color-muted);
  max-width: 580px;
  margin: 0 auto;
  font-weight: 300;
  line-height: 1.7;
}

.listing-container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: var(--space-16) var(--space-8);
}

/* ── Card Grid ──────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
}

/* ── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s, box-shadow 0.25s;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.card-img-wrap {
  position: relative;
  width: 100%;
  padding-top: 58%;
  overflow: hidden;
}
.card-img-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.card:hover .card-img-wrap img { transform: scale(1.04); }

.card-tag {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  padding: 2px 10px;
  background: var(--color-primary);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
}

.card-body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-body h2 {
  font-size: 1.125rem; /* 18px — h4 equivalent */
  font-weight: 600;
  color: var(--color-heading);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-3);
}

.card-excerpt {
  font-size: var(--text-sm);
  color: var(--color-muted);
  line-height: 1.65;
  flex: 1;
  margin-bottom: var(--space-5);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.card-readtime {
  font-size: var(--text-xs);
  color: var(--color-muted);
  font-weight: 500;
}

.card-link {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s;
}
.card-link:hover { gap: 8px; }

/* ── Responsive ─────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 1024px) {
  .card-grid       { grid-template-columns: repeat(2, 1fr); }
  .related-grid    { grid-template-columns: repeat(2, 1fr); }
  .related-grid .related-card:last-child { display: none; }

  .blog-nav { padding: 0 1.5rem; }
  .blog-hero { height: 420px; }
  .blog-hero-overlay { padding: var(--space-10) var(--space-6); }
}

/* Mobile — hide pill & CTA, show hamburger */
@media (max-width: 768px) {
  .blog-nav { padding: 0 1.25rem; }
  .nav-pill { display: none; }
  .nav-cta-btn { display: none; }
  .nav-toggle { display: flex; }

  .card-grid    { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .related-grid .related-card:last-child { display: block; }

  .blog-hero { height: 340px; }
  .blog-hero-overlay { padding: var(--space-8) var(--space-5); }
  .blog-hero-overlay h1 { font-size: 1.6rem; }

  .article-body { padding: var(--space-10) var(--space-5); }
  .article-body h2 { font-size: var(--text-xl); }

  .related-section { padding: var(--space-12) var(--space-5); }
  .cta-block        { padding: var(--space-12) var(--space-5); }

  .listing-container { padding: var(--space-10) var(--space-5); }
  .listing-hero       { padding: var(--space-12) var(--space-5) var(--space-10); }

  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .article-meta { gap: var(--space-2); font-size: var(--text-xs); }
  .card-body h2 { font-size: var(--text-base); }
}

/* Project reference links in articles */
.project-links-note {
  background: var(--color-bg-light);
  border-left: 3px solid var(--color-primary);
  padding: 0.75rem 1rem;
  border-radius: 0 8px 8px 0;
  font-size: 0.9375rem;
  margin: 2rem 0;
}
.project-links-note a {
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}
