/* ==========================================================================
   Shared Blog Styles (Header, Footer, TOC)
   Centralized here to easily identify and apply fixes across all blog pages.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Table of Contents (TOC)
   -------------------------------------------------------------------------- */
.toc-box a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.toc-box a:hover {
    color: var(--accent, #e84c1e);
}

.toc-box a.active {
    font-weight: bold;
    color: var(--accent, #e84c1e);
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Site Header
   -------------------------------------------------------------------------- */
:root {
  --header-bg: linear-gradient(120deg, #0ea5e9 0%, #60a5fa 45%, #f472b6 100%);
  --header-text: #ffffff;
  --header-accent: #ffe29a;
  --header-surface: rgba(255, 255, 255, 0.12);
  --header-border: rgba(255, 255, 255, 0.25);
  --header-shadow: 0 12px 30px rgba(14, 116, 144, 0.18);
  --header-focus: #fff;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--header-bg);
  color: var(--header-text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px) saturate(1.2);
  will-change: transform;
  /* Override any global `header` rules from main.css that add large padding */
  padding: 0 !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.header-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--header-text);
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 1.25rem;
  white-space: nowrap;
}
.logo img {
  height: 38px;
  width: auto;
  aspect-ratio: 1024 / 575;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.cta-button {
  background: #111827;
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.25);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.cta-button:hover,
.cta-button:focus {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(17, 24, 39, 0.3);
  outline: none;
}
.menu-toggle {
  display: none;
  background: var(--header-surface);
  border: 1px solid var(--header-border);
  color: var(--header-text);
  border-radius: 12px;
  padding: 0.45rem 0.6rem;
  font-size: 1.2rem;
  cursor: pointer;
}
.menu-toggle:focus {
  outline: 2px solid var(--header-focus);
  outline-offset: 2px;
}
.nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.nav-list {
  display: flex;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-item {
  position: relative;
}
.nav-trigger {
  background: var(--header-surface);
  border: 1px solid var(--header-border);
  color: var(--header-text);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
}
.nav-trigger:hover,
.nav-trigger:focus-within {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}
.nav-trigger .chip {
  width: 8px;
  height: 8px;
  background: var(--header-accent);
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(255, 226, 154, 0.2);
}
.dropdown {
  position: absolute;
  left: 0;
  top: 110%;
  min-width: 240px;
  background: #ffffff;
  color: #111827;
  border-radius: 14px;
  padding: 0.5rem;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}
.nav-item:focus-within .dropdown,
.nav-item:hover .dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.dropdown a {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  text-decoration: none;
  color: #111827;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s ease, color 0.2s ease;
}
.dropdown .nav-icon {
  font-size: 1.25rem;
  line-height: 1.1;
}
.dropdown .nav-text {
  display: block;
}
.dropdown a:hover,
.dropdown a:focus {
  background: #eef2ff;
  color: #1d4ed8;
  outline: none;
}
.dropdown .desc {
  display: block;
  font-weight: 400;
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 0.1rem;
}
@media (max-width: 980px) {
  .menu-toggle {
    display: inline-flex;
  }
  .nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: #0f172a;
    padding: 0.75rem 1rem 1rem;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .nav.open {
    display: flex;
  }
  .nav-list {
    flex-direction: column;
    gap: 0.6rem;
  }
  .dropdown {
    position: static;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
  }
  .dropdown a {
    color: #fff;
  }
  .dropdown a:hover,
  .dropdown a:focus {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
  }
  .dropdown .desc {
    color: #e2e8f0;
  }
}
/* Compact header adjustments for tool pages to reduce overlap and LCP impact */
body.tools-page .header-wrap { padding: 0.45rem 0.75rem; }
body.tools-page .logo img { height: 30px; }
/* Visible focus styles for keyboard users */
.menu-toggle:focus-visible,
.nav a:focus-visible,
.nav-trigger:focus-visible,
.cta-button:focus-visible {
  outline: 3px solid rgba(99,102,241,0.95);
  outline-offset: 2px;
  border-radius: 8px;
}

/* --------------------------------------------------------------------------
   Site Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background: linear-gradient(90deg, #4f8cff 0%, #ffb347 100%);
  color: #fff;
  padding: 2rem 0 1rem 0;
  font-size: 1rem;
  box-shadow: 0 -2px 16px rgba(0,0,0,0.08);
  margin-top: 2rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-links a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  border-radius: 4px;
  padding: 0.2em 0.6em;
}
.footer-links a:hover,
.footer-links a:focus {
  background: rgba(255,255,255,0.12);
  color: #222;
  outline: none;
}
.footer-copyright {
  font-size: 0.98em;
  opacity: 0.85;
  text-align: center;
}
#backToTop {
  background: #fff;
  color: #4f8cff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.3em;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(79,140,255,0.10);
  transition: background 0.2s, color 0.2s;
  margin-top: 0.5rem;
}
#backToTop:hover,
#backToTop:focus {
  background: #4f8cff;
  color: #fff;
  outline: none;
}
@media (max-width: 600px) {
  .footer-container {
    padding: 0 1rem;
  }
  .footer-links {
    gap: 0.7rem;
  }
}

/* --------------------------------------------------------------------------
   Author Box
   -------------------------------------------------------------------------- */
.author-box {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 2rem;
    border-radius: 12px;
    margin: 3rem 0;
    box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.05);
}
.author-box .author-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}
.author-box .author-info {
    flex: 1;
}
.author-box h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.3rem;
    color: #0f172a;
}
.author-box .author-bio {
    margin: 0 0 1rem 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #475569;
}
.author-box .author-bio strong {
    color: #1e293b;
}
.author-box .author-footer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
}
.author-box .author-socials a {
    color: var(--accent, #e84c1e);
    text-decoration: none;
    font-weight: 600;
    margin: 0 0.2rem;
}
.author-box .author-socials a:hover {
    text-decoration: underline;
}
@media (max-width: 600px) {
    .author-box {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }
    .author-box .author-footer {
        align-items: center;
    }
}

/* --------------------------------------------------------------------------
   Call-to-Action (CTA) Widgets
   -------------------------------------------------------------------------- */
.cta-box {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 1px solid #cbd5e1;
    border-left: 5px solid #3b82f6;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2.5rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.cta-box p {
    margin-top: 0;
    margin-bottom: 0.75rem;
}
.cta-box p:last-child {
    margin-bottom: 0;
}
.cta-box strong {
    color: #0f172a;
}
/* Danger / Warning Variant */
.cta-box.danger-cta {
    background: linear-gradient(135deg, #fef2f2, #fff1f2);
    border-color: #fca5a5;
    border-left-color: #ef4444;
}
/* Success Variant */
.cta-box.success-cta {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border-color: #86efac;
    border-left-color: #22c55e;
}
/* Inline CTA Button */
.cta-box .inline-btn {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.6rem 1.25rem;
    background: #2563eb;
    color: #ffffff !important;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}
.cta-box .inline-btn:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}
.cta-box.danger-cta .inline-btn { background: #ef4444; box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2); }
.cta-box.danger-cta .inline-btn:hover { background: #dc2626; box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3); }
.cta-box.success-cta .inline-btn { background: #16a34a; box-shadow: 0 2px 4px rgba(22, 163, 74, 0.2); }
.cta-box.success-cta .inline-btn:hover { background: #15803d; box-shadow: 0 4px 8px rgba(22, 163, 74, 0.3); }

/* --------------------------------------------------------------------------
   Blog Metadata (Author, Date, Read Time)
   -------------------------------------------------------------------------- */
.meta-data {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}
.meta-avatar {
    flex-shrink: 0;
}
.meta-avatar img {
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border: 2px solid #ffffff;
}
.meta-info {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.5;
}
.meta-info a {
    color: #0f172a;
    font-weight: 600;
    text-decoration: none;
}
.meta-info a:hover {
    color: var(--accent, #e84c1e);
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Responsive Images & Media Utility Classes
   -------------------------------------------------------------------------- */
.blog-container article img {
    max-width: 100%;
    height: auto;
    display: block;
}
.hero-img {
    width: 100%;
    border-radius: 12px;
    margin: 0.5rem 0 2rem 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    object-fit: cover;
    aspect-ratio: 1200 / 630;
}
.img-fluid-rounded {
    border-radius: 10px;
}
.img-fluid-bordered {
    border: 1px solid #e2e8f0;
}
.img-spacing {
    margin: 2rem 0;
}

/* ==========================================================================
   TEXTBOOK ACADEMIC THEME (Global)
   ========================================================================== */

/* Textbook Article Container */
.textbook-theme {
    background-color: #fffcf7;
    padding: 4rem 6%;
    border: 1px solid #e4dfd3;
    border-radius: 4px;
    box-shadow: -1px 0 3px rgba(0,0,0,0.02), 4px 4px 15px rgba(0,0,0,0.06);
    font-family: "Georgia", "Times New Roman", serif;
    color: #2c2b29;
    line-height: 1.8;
    font-size: 1.15rem;
}

/* Textbook Typography */
.textbook-theme h1,
.textbook-theme h2,
.textbook-theme h3 {
    font-family: "Georgia", "Times New Roman", serif;
    color: #111;
    font-weight: normal;
}

.textbook-theme h1 {
    font-size: 2.4rem;
    font-weight: bold;
    border-bottom: 2px solid #111;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.textbook-theme h2 {
    font-size: 1.8rem;
    margin-top: 3rem;
    border-bottom: 1px solid #d4d0c5;
    padding-bottom: 0.3rem;
}

.textbook-theme p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

/* Textbook TOC */
.textbook-theme .toc-box {
    background: #f5f2eb;
    border: 1px solid #111;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.08);
}
.textbook-theme .toc-box h3 {
    margin-top: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 1rem;
    font-weight: bold;
    border-bottom: 1px solid #ccc;
    padding-bottom: 0.75rem;
}
.textbook-theme .toc-box ul { list-style: none; padding: 0; margin: 1rem 0 0 0; }
.textbook-theme .toc-box li { margin-bottom: 0.75rem; }
.textbook-theme .toc-box a { color: #333; text-decoration: none; }
.textbook-theme .toc-box a:hover,
.textbook-theme .toc-box a.active { color: #b91c1c; text-decoration: underline; font-weight: bold; background-color: transparent; }

/* Textbook Author Box Override */
.textbook-theme .author-box {
    background: #ffffff;
    border: 1px solid #111;
    border-radius: 0;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.05);
    font-family: "Georgia", "Times New Roman", serif;
}
.textbook-theme .author-box .author-img { border-radius: 0; border: 1px solid #111; box-shadow: 3px 3px 0px rgba(0,0,0,0.05); }
.textbook-theme .author-box h4 { font-family: "Georgia", "Times New Roman", serif; color: #111; }
.textbook-theme .author-box .author-bio,
.textbook-theme .author-box .author-footer { color: #333; border-color: #d4d0c5; }
.textbook-theme .author-box .author-socials a { color: #b91c1c; }

/* Textbook Theme CTA Override */
.textbook-theme .cta-box {
    background: #fffcf7;
    border: 1px solid #111;
    border-left: 4px solid #111;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.05);
    border-radius: 0;
}
.textbook-theme .cta-box .inline-btn {
    background: #ffffff;
    color: #111 !important;
    border: 2px solid #111;
    border-radius: 0;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.1);
    font-family: "Georgia", serif;
}
.textbook-theme .cta-box .inline-btn:hover { background: #f4f1ea; transform: translate(-2px, -2px); box-shadow: 5px 5px 0px rgba(0,0,0,0.1); }

/* Textbook Meta Data & Image Overrides */
.textbook-theme .meta-data { border-bottom: 1px solid #111; }
.textbook-theme .meta-info { color: #444; font-family: "Georgia", serif; }
.textbook-theme .meta-info a { color: #111; }
.textbook-theme .meta-avatar img { border-radius: 0; border: 1px solid #111; box-shadow: 3px 3px 0px rgba(0,0,0,0.05); }
.textbook-theme img { border-radius: 0 !important; box-shadow: none !important; }

/* Textbook Financial Components Override */
.textbook-theme .highlight-box,
.textbook-theme .tldr-box {
    background: #ffffff;
    border: 1px solid #111;
    border-left: 4px solid #111;
    border-radius: 0;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.05);
    padding: 1.5rem;
    margin: 2rem 0;
    font-family: "Georgia", serif;
}
.textbook-theme .highlight-box-green {
    border-left-color: #15803d;
}
.textbook-theme .content-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-family: "Georgia", serif;
    background: #ffffff;
    border: 1px solid #111;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.05);
}
.textbook-theme .content-table th,
.textbook-theme .content-table td {
    border: 1px solid #111;
    padding: 1rem;
    text-align: left;
}
.textbook-theme .content-table th {
    background: #f5f2eb;
    font-weight: bold;
}
.textbook-theme .faq-container {
    background: #ffffff;
    border: 1px solid #111;
    border-radius: 0;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.05);
    padding: 2rem;
    margin: 2rem 0;
}
.textbook-theme .faq-container h3 { border-bottom: 1px dashed #ccc; padding-bottom: 0.5rem; margin-top: 1.5rem; }
.textbook-theme .faq-container h3:first-child { margin-top: 0; }