/* ==========================================================================
   PIP Wealth — Shared Styles
   Common CSS used across all pages (except index.html)
   ========================================================================== */

/* Design Tokens */
:root {
  --navy: #0B2E4A;
  --navy-light: #11425E;
  --blue: #146FF8;
  --blue-hover: #1060D8;
  --green: #78C48C;
  --green-soft: #E8F5EC;
  --white: #FFFFFF;
  --off-white: #F7F9FC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --max-width: 1200px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-sm: 4px;
  --radius-lg: 12px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body { font-family: var(--font-body); color: var(--gray-800); line-height: 1.7; background: var(--white); }
a { color: inherit; text-decoration: none; }

/* Header */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  height: 72px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
}
.logo img {
  height: 40px;
  width: auto;
  filter: brightness(0) saturate(100%);
}
[data-theme="dark"] .logo img {
  filter: none;
}
.back-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--blue);
  display: flex;
  align-items: center;
  gap: 0.375rem;
  transition: color var(--transition);
}
.back-link:hover { color: var(--blue-hover); }

/* Navigation */
.nav { display: flex; align-items: center; gap: var(--space-xl, 2rem); }
.nav-links { list-style: none; display: flex; gap: var(--space-xs, 0.25rem); }
.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.nav-links a:hover { color: var(--blue); background: rgba(20, 111, 248, 0.04); }
.nav-links a.nav-active { color: var(--blue); position: relative; }
.nav-links a.nav-active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 0.75rem;
  right: 0.75rem;
  height: 2px;
  background: var(--blue);
  border-radius: 1px;
}
.has-dropdown { position: relative; }
.dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(11, 46, 74, 0.12);
  min-width: 180px;
  padding: 0.5rem 0;
  list-style: none;
  z-index: 100;
}
.has-dropdown:hover .dropdown { display: block; }
.dropdown a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  border-radius: 0;
}
.dropdown a:hover { background: var(--off-white); }
.nav-cta {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--white);
  background: var(--blue);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background var(--transition), transform var(--transition);
}
.nav-cta:hover { background: var(--blue-hover); transform: translateY(-1px); }
.mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.mobile-toggle span {
  width: 24px;
  height: 2px;
  background: var(--gray-700);
  transition: var(--transition);
}
/* Mobile tap targets (44px minimum for WCAG) */
@media (max-width: 768px) {
  .nav-links a,
  .btn-primary,
  .back-link,
  .accordion-header,
  .blog-card-tag,
  .footer a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

@media (max-width: 768px) {
  .mobile-toggle { display: flex; }
  .nav {
    display: none;
    position: fixed;
    top: var(--header-height, 80px);
    left: 0;
    right: 0;
    background: var(--white);
    padding: var(--space-xl, 2rem);
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(11, 46, 74, 0.12);
  }
  .nav.active { display: flex; }
  .nav-links { flex-direction: column; width: 100%; }
  .nav-links a { padding: 0.75rem; }
  .has-dropdown .dropdown {
    display: none;
    position: static;
    box-shadow: none;
    border: none;
    padding-left: 1rem;
  }
  .has-dropdown:hover .dropdown,
  .has-dropdown:focus-within .dropdown { display: block; }
  .nav-cta { text-align: center; }
}

/* Button: Primary */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  font-size: 0.9375rem;
  font-weight: 600;
  background: var(--blue);
  color: var(--white);
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary:hover { background: var(--blue-hover); transform: translateY(-1px); }

/* Footer — Rich */
.footer {
  background: var(--navy);
  color: var(--white);
  padding: 3rem 0 0;
}
.footer .container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer-about { max-width: 320px; }
.footer-about .logo { margin-bottom: 1rem; }
.footer-about p { font-size: 0.875rem; color: rgba(255,255,255,0.5); line-height: 1.7; }
.footer h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.4);
  margin-bottom: 1rem;
  font-family: var(--font-body);
}
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 0.375rem; }
.footer-links li { font-size: 0.875rem; color: rgba(255,255,255,0.5); line-height: 1.7; }
.footer-links a { font-size: 0.875rem; color: rgba(255,255,255,0.6); transition: color var(--transition); }
.footer-links a:hover { color: var(--green); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 0;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.footer-copy { font-size: 0.8125rem; color: rgba(255,255,255,0.3); }
.footer-legal { display: flex; gap: 1.5rem; }
.footer-legal a { font-size: 0.8125rem; color: rgba(255,255,255,0.3); transition: color var(--transition); }
.footer-legal a:hover { color: rgba(255,255,255,0.6); }
.footer-reg { font-size: 0.75rem; color: rgba(255,255,255,0.25); display: block; margin-top: 0.25rem; }
.brokercheck-badge { display: inline-flex; align-items: center; gap: 0.25rem; }
.footer-quote {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--blue);
}
.footer-quote blockquote {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  color: rgba(255,255,255,0.4);
  font-style: italic;
  line-height: 1.6;
}
.footer-quote cite {
  display: block;
  font-style: normal;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.25);
  margin-top: 0.25rem;
}
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-about { grid-column: span 2; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-about { grid-column: span 1; }
}

/* Dark Mode — full variable remap for text readability */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #E2E8F0;
    --navy-light: #CBD5E1;
    --white: #0F172A;
    --off-white: #1E293B;
    --gray-100: #1E293B;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #94A3B8;
    --gray-500: #94A3B8;
    --gray-600: #CBD5E1;
    --gray-700: #E2E8F0;
    --gray-800: #F1F5F9;
  }
  :root:not([data-theme="light"]) body { background: #0F172A; color: #E2E8F0; }
  :root:not([data-theme="light"]) .header { background: #0F172A; border-bottom-color: #334155; }
  :root:not([data-theme="light"]) .nav-links a { color: #CBD5E1; }
  :root:not([data-theme="light"]) .dropdown { background: #1E293B; border-color: #334155; }
  :root:not([data-theme="light"]) .dropdown a { color: #CBD5E1; }
  :root:not([data-theme="light"]) .dropdown a:hover { background: #334155; }
  :root:not([data-theme="light"]) .blog-card { background: #1E293B; border-color: #334155; }
  :root:not([data-theme="light"]) .accordion-item { border-color: #334155; }
  :root:not([data-theme="light"]) .accordion-header { background: #0F172A; }
  :root:not([data-theme="light"]) .accordion-header:hover { background: #1E293B; }
  :root:not([data-theme="light"]) .article-cta { background: #1E293B; border-color: #334155; }
  :root:not([data-theme="light"]) .article-body strong { color: #E2E8F0; }
  :root:not([data-theme="light"]) .search-input { background: #1E293B; border-color: #334155; color: #E2E8F0; }
  :root:not([data-theme="light"]) .footer { background: #0B2E4A; color: #E2E8F0; }
  :root:not([data-theme="light"]) .footer h4 { color: rgba(226,232,240,0.4); }
  :root:not([data-theme="light"]) .footer a { color: rgba(226,232,240,0.6); }
  :root:not([data-theme="light"]) .footer-about p { color: rgba(226,232,240,0.5); }
  :root:not([data-theme="light"]) .footer-copy { color: rgba(226,232,240,0.3); }
  :root:not([data-theme="light"]) .footer-legal a { color: rgba(226,232,240,0.3); }
  :root:not([data-theme="light"]) .footer-grid { border-bottom-color: rgba(255,255,255,0.08); }
  :root:not([data-theme="light"]) .insights-hero { background: linear-gradient(165deg, #0F172A 0%, #1E293B 100%); }
  :root:not([data-theme="light"]) .insights-hero h1 { color: #F1F5F9; }
  :root:not([data-theme="light"]) .insights-hero p { color: rgba(226,232,240,0.65); }
  :root:not([data-theme="light"]) .insights-count { color: rgba(226,232,240,0.45); }
  :root:not([data-theme="light"]) .article-hero { background: linear-gradient(165deg, #0F172A 0%, #1E293B 100%); }
  :root:not([data-theme="light"]) .article-hero h1 { color: #F1F5F9; }
  :root:not([data-theme="light"]) .article-meta { color: rgba(226,232,240,0.5); }
  :root:not([data-theme="light"]) .article-author { color: rgba(226,232,240,0.75); }
  :root:not([data-theme="light"]) .article-body p { color: #CBD5E1; }
  :root:not([data-theme="light"]) .article-body h2,
  :root:not([data-theme="light"]) .article-body h3 { color: #E2E8F0; }
  :root:not([data-theme="light"]) .blog-card h3 a { color: #E2E8F0; }
  :root:not([data-theme="light"]) .blog-card p { color: #94A3B8; }
  :root:not([data-theme="light"]) .btn-primary { color: #FFFFFF; }
  :root:not([data-theme="light"]) .page-hero { background: linear-gradient(165deg, #0F172A 0%, #1E293B 100%); }
  :root:not([data-theme="light"]) .page-hero h1 { color: #F1F5F9; }
  :root:not([data-theme="light"]) .page-hero p { color: rgba(226,232,240,0.65); }
}
[data-theme="dark"] {
  --navy: #E2E8F0;
  --navy-light: #CBD5E1;
  --white: #0F172A;
  --off-white: #1E293B;
  --gray-100: #1E293B;
  --gray-200: #334155;
  --gray-300: #475569;
  --gray-400: #94A3B8;
  --gray-500: #94A3B8;
  --gray-600: #CBD5E1;
  --gray-700: #E2E8F0;
  --gray-800: #F1F5F9;
}
[data-theme="dark"] body { background: #0F172A; color: #E2E8F0; }
[data-theme="dark"] .header { background: #0F172A; border-bottom-color: #334155; }
[data-theme="dark"] .nav-links a { color: #CBD5E1; }
[data-theme="dark"] .dropdown { background: #1E293B; border-color: #334155; }
[data-theme="dark"] .dropdown a { color: #CBD5E1; }
[data-theme="dark"] .dropdown a:hover { background: #334155; }
[data-theme="dark"] .blog-card { background: #1E293B; border-color: #334155; }
[data-theme="dark"] .accordion-item { border-color: #334155; }
[data-theme="dark"] .accordion-header { background: #0F172A; }
[data-theme="dark"] .accordion-header:hover { background: #1E293B; }
[data-theme="dark"] .article-cta { background: #1E293B; border-color: #334155; }
[data-theme="dark"] .article-body strong { color: #E2E8F0; }
[data-theme="dark"] .search-input { background: #1E293B; border-color: #334155; color: #E2E8F0; }
/* Keep navy-bg sections dark in dark mode */
[data-theme="dark"] .footer { background: #0B2E4A; color: #E2E8F0; }
[data-theme="dark"] .footer h4 { color: rgba(226,232,240,0.4); }
[data-theme="dark"] .footer a { color: rgba(226,232,240,0.6); }
[data-theme="dark"] .footer-about p { color: rgba(226,232,240,0.5); }
[data-theme="dark"] .footer-copy { color: rgba(226,232,240,0.3); }
[data-theme="dark"] .footer-legal a { color: rgba(226,232,240,0.3); }
[data-theme="dark"] .footer-grid { border-bottom-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .insights-hero { background: linear-gradient(165deg, #0F172A 0%, #1E293B 100%); }
[data-theme="dark"] .insights-hero h1 { color: #F1F5F9; }
[data-theme="dark"] .insights-hero p { color: rgba(226,232,240,0.65); }
[data-theme="dark"] .insights-count { color: rgba(226,232,240,0.45); }
[data-theme="dark"] .article-hero { background: linear-gradient(165deg, #0F172A 0%, #1E293B 100%); }
[data-theme="dark"] .article-hero h1 { color: #F1F5F9; }
[data-theme="dark"] .article-meta { color: rgba(226,232,240,0.5); }
[data-theme="dark"] .article-author { color: rgba(226,232,240,0.75); }
[data-theme="dark"] .article-body p { color: #CBD5E1; }
[data-theme="dark"] .article-body h2,
[data-theme="dark"] .article-body h3 { color: #E2E8F0; }
[data-theme="dark"] .blog-card h3 a { color: #E2E8F0; }
[data-theme="dark"] .blog-card p { color: #94A3B8; }
[data-theme="dark"] .btn-primary { color: #FFFFFF; }
[data-theme="dark"] .page-hero { background: linear-gradient(165deg, #0F172A 0%, #1E293B 100%); }
[data-theme="dark"] .page-hero h1 { color: #F1F5F9; }
[data-theme="dark"] .page-hero p { color: rgba(226,232,240,0.65); }

/* Dark mode toggle button */
.theme-toggle {
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  transition: all var(--transition);
  width: 36px;
  height: 36px;
}
.theme-toggle:hover { border-color: var(--blue); color: var(--blue); }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

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

/* ==========================================================================
   Blog Article Styles (shared by blog-headlines, blog-retirement, blog-tax-planning)
   ========================================================================== */

/* Article Hero */
.article-hero {
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-light) 100%);
  padding: 5rem 2rem 4rem;
}
.article-hero-inner {
  max-width: 720px;
  margin: 0 auto;
}
.article-tags {
  display: flex;
  gap: 0.375rem;
  margin-bottom: 1.5rem;
}
.article-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--green);
  background: rgba(120, 196, 140, 0.12);
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
}
.article-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  color: var(--white);
  line-height: 1.25;
  margin-bottom: 1.5rem;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.5);
}
.article-author { color: rgba(255,255,255,0.75); font-weight: 500; }

/* Article Body */
.article-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}
.article-body p {
  font-size: 1.0625rem;
  color: var(--gray-700);
  line-height: 1.85;
  margin-bottom: 1.5rem;
}
.article-body h2, .article-body h3 {
  font-family: var(--font-display);
  color: var(--navy);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}
.article-body h2 { font-size: 1.75rem; }
.article-body h3 { font-size: 1.375rem; }
.article-body em { color: var(--gray-600); }
.article-body strong { color: var(--navy); }
.article-body ul {
  margin: 0 0 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.article-body li {
  font-size: 1.0625rem;
  color: var(--gray-700);
  line-height: 1.7;
}
.article-body blockquote {
  border-left: 3px solid var(--blue);
  padding: 0.5rem 0 0.5rem 1.5rem;
  margin: 2rem 0;
}
.article-body blockquote p {
  font-style: italic;
  color: var(--gray-600);
}

/* Article Source */
.article-source {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
  font-size: 0.8125rem;
  color: var(--gray-400);
  line-height: 1.6;
}

/* Article CTA Banner */
.article-cta {
  background: var(--off-white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  margin-top: 3rem;
}
.article-cta h3 {
  font-family: var(--font-display);
  color: var(--navy);
  font-size: 1.375rem;
  margin-bottom: 0.75rem;
}
.article-cta p {
  font-size: 0.9375rem !important;
  color: var(--gray-500) !important;
  margin-bottom: 1.25rem !important;
}

/* Reading progress bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: #146FF8;
  z-index: 9999;
  width: 0%;
  transition: width 0.1s linear;
}

/* Reading time badge */
.reading-time {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.6);
}
.reading-time svg { opacity: 0.7; }

/* Featured image normalization */
.article-featured-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 12px;
  margin: 2rem 0;
}
