/* ==========================================================================
   SHARED COMPONENTS — Header, Footer, Breadcrumbs, Promo Banner
   ========================================================================== */

/* Header (Glassmorphism) */
.site-header {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.04), 0 1px 6px -1px rgba(0, 0, 0, 0.03);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  height: 56px;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.header-logo { display: flex; align-items: center; }
.header-logo img { height: 22px; }

/* Header Nav */
.header-nav {
  display: flex; align-items: center; gap: 2px;
}

.nav-dropdown { position: relative; }

.nav-trigger {
  display: flex; align-items: center; gap: 5px;
  background: none; border: none; cursor: pointer;
  font-family: var(--font-sans); font-size: 0.82rem; font-weight: 500;
  color: #475569; padding: 6px 11px; border-radius: 8px;
  transition: all 0.12s ease;
  letter-spacing: -0.005em;
}
.nav-trigger:hover { color: #0F172A; background: rgba(0, 0, 0, 0.03); }
.nav-trigger i, .nav-trigger svg { width: 10px; height: 10px; transition: transform 0.15s cubic-bezier(0.16,1,0.3,1); opacity: 0.4; }
.nav-dropdown.open .nav-trigger i,
.nav-dropdown.open .nav-trigger svg { transform: rotate(180deg); opacity: 0.7; }
.nav-dropdown.open .nav-trigger { color: #0F172A; background: rgba(0, 0, 0, 0.04); }

/* Mega Menu — precision panel */
.mega-menu {
  position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  width: 660px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  box-shadow:
    0 0 0 0.5px rgba(0,0,0,0.03),
    0 1px 2px rgba(0,0,0,0.04),
    0 4px 12px -2px rgba(0,0,0,0.06),
    0 16px 40px -8px rgba(0,0,0,0.1);
  padding: 0;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.12s ease, visibility 0.12s, transform 0.12s cubic-bezier(0.2,0.9,0.3,1);
  transform: translateX(-50%) translateY(6px);
  transform-origin: top center;
  z-index: 100;
  overflow: hidden;
}

.nav-dropdown.open .mega-menu {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.mega-menu-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0;
  padding: 20px 20px 20px 24px;
}

.mega-col {
  padding-right: 16px;
}

.mega-col + .mega-col {
  padding-left: 16px;
  border-left: 1px solid rgba(0,0,0,0.04);
}

.mega-col h5 {
  font-family: var(--font-display); font-size: 0.6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: #94A3B8; margin-bottom: 10px;
  padding-bottom: 0;
  border-bottom: none;
}

.mega-col a {
  display: block; font-size: 0.8rem; font-weight: 450; color: #475569;
  padding: 5px 8px; margin: 0 -8px; border-radius: 6px;
  transition: all 0.1s ease;
  line-height: 1.4;
}
.mega-col a:hover {
  color: #0F172A;
  background: #F1F5F9;
}

.mega-link-all {
  display: inline-flex !important; align-items: center; gap: 4px;
  font-size: 0.75rem !important; font-weight: 600 !important;
  color: var(--accent-primary) !important;
  margin-top: 8px; padding: 4px 8px !important;
  border-top: none;
}
.mega-link-all:hover { background: rgba(224,93,54,0.05) !important; gap: 6px !important; }
.mega-link-all i, .mega-link-all svg { width: 11px; height: 11px; transition: transform 0.12s; }
.mega-link-all:hover i, .mega-link-all:hover svg { transform: translateX(2px); }

.mega-col-cta {
  background: #FAFBFD; border-radius: 0;
  padding: 20px 24px; margin: 0;
  border-left: 1px solid rgba(0,0,0,0.04);
  border-top: none;
}
.mega-col-cta h5 { border-bottom: none; padding-bottom: 0; }
.mega-col-cta p { font-size: 0.78rem; color: #64748B; margin-bottom: 14px; line-height: 1.5; }
.mega-cta {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.78rem; font-weight: 600; color: var(--accent-primary);
  padding: 6px 12px; border-radius: 6px;
  background: rgba(224, 93, 54, 0.06);
  transition: all 0.12s;
}
.mega-cta:hover { background: rgba(224, 93, 54, 0.1); gap: 7px; }
.mega-cta i, .mega-cta svg { width: 13px; height: 13px; transition: transform 0.12s; }
.mega-cta:hover i, .mega-cta:hover svg { transform: translateX(2px); }

/* Compact mega menu (Articles, Templates) */
.mega-menu-compact { width: 520px; }

/* Glossary dropdown */
.mega-menu-glossary {
  width: 380px;
  padding: 0;
  overflow: hidden;
}

.glossary-dropdown-inner {
  display: flex;
  flex-direction: column;
}

.glossary-search-wrap {
  padding: 14px 14px 0;
}

.glossary-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #F8FAFC;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.glossary-search-box:focus-within {
  border-color: rgba(224, 93, 54, 0.3);
  box-shadow: 0 0 0 3px rgba(224, 93, 54, 0.06);
  background: #fff;
}

.glossary-search-icon {
  flex-shrink: 0;
  color: #94A3B8;
  width: 15px;
  height: 15px;
}

.glossary-search-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  color: var(--text-main);
  outline: none;
}
.glossary-search-box input::placeholder { color: #94A3B8; font-size: 0.82rem; }

.glossary-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 600;
  color: #94A3B8;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 4px;
  padding: 0 4px;
}

/* Glossary search results */
.glossary-results {
  max-height: 260px;
  overflow-y: auto;
  margin-top: 6px;
  padding: 0 6px;
}

.glossary-results-empty,
.glossary-no-results {
  padding: 20px 4px;
  font-size: 0.8rem;
  color: #94A3B8;
  text-align: center;
}

.glossary-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 7px;
  text-decoration: none;
  transition: background 0.08s;
}
.glossary-result-item:hover { background: #F1F5F9; }

.glossary-result-name {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-main);
}

.glossary-result-cat {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94A3B8;
  background: #F1F5F9;
  padding: 2px 7px;
  border-radius: 4px;
}
.glossary-result-item:hover .glossary-result-cat { background: #fff; }

/* Popular terms */
.glossary-popular {
  padding: 12px 14px;
  border-top: 1px solid rgba(0,0,0,0.05);
}

.glossary-popular h5 {
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94A3B8;
  margin-bottom: 8px;
}

.glossary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.glossary-tags a {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #475569;
  padding: 3px 10px;
  background: #F8FAFC;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 6px;
  transition: all 0.1s;
  text-decoration: none;
}
.glossary-tags a:hover {
  color: var(--accent-primary);
  border-color: rgba(224, 93, 54, 0.2);
  background: rgba(224, 93, 54, 0.04);
}

/* Browse all link */
.glossary-browse-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 11px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-primary);
  border-top: 1px solid rgba(0,0,0,0.05);
  text-decoration: none;
  transition: background 0.1s, gap 0.1s;
}
.glossary-browse-all:hover { background: rgba(224, 93, 54, 0.03); gap: 7px; }
.glossary-browse-all svg { transition: transform 0.12s; }
.glossary-browse-all:hover svg { transform: translateX(2px); }

/* Header CTA button */
.header-actions { display: flex; align-items: center; }

.header-cta-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-primary); color: #fff;
  font-family: var(--font-display); font-size: 0.8rem; font-weight: 600;
  padding: 7px 16px; border-radius: 8px;
  transition: all 0.15s ease;
  letter-spacing: -0.01em;
  box-shadow: 0 1px 2px rgba(224,93,54,0.15), 0 0 0 1px rgba(224,93,54,0.1);
}
.header-cta-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(224,93,54,0.25), 0 0 0 1px rgba(224,93,54,0.15);
  transform: translateY(-0.5px);
}
.header-cta-btn i, .header-cta-btn svg { width: 13px; height: 13px; transition: transform 0.12s; }
.header-cta-btn:hover i, .header-cta-btn:hover svg { transform: translateX(1px); }

.mobile-nav-cta { display: none; }

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: none; background: none; border: none; cursor: pointer;
  color: var(--text-main); padding: 8px;
}
.mobile-menu-toggle i, .mobile-menu-toggle svg { width: 22px; height: 22px; }

@media (max-width: 768px) {
  .site-header { height: 52px; }
  .header-logo img { height: 19px; }
  .mobile-menu-toggle { padding: 6px; }

  .header-nav {
    display: none; position: fixed; top: 52px; left: 0; right: 0;
    height: calc(100vh - 52px); height: calc(100dvh - 52px);
    background: var(--bg-base);
    flex-direction: column; align-items: stretch; gap: 0; padding: 0;
    overflow-y: auto; overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    z-index: 999;
  }
  .header-nav.mobile-open { display: flex; }
  .mobile-menu-toggle { display: block; }

  .nav-dropdown { border-bottom: 1px solid var(--border-light); width: 100%; }
  .nav-dropdown:last-child { border-bottom: none; }

  .nav-trigger {
    width: 100%; justify-content: space-between;
    padding: 12px 16px; font-size: 0.92rem; font-weight: 600;
    color: var(--text-main); border-radius: 0;
  }
  .nav-trigger:hover { background: var(--bg-subtle); }

  .mega-menu {
    position: static; transform: none !important; width: 100%;
    box-shadow: none; border: none; border-radius: 0;
    padding: 0; margin-top: 0;
    opacity: 0; visibility: hidden; pointer-events: none;
    max-height: 0; overflow: hidden;
    transition: max-height 0.2s cubic-bezier(0.16,1,0.3,1), opacity 0.15s ease, padding 0.2s ease, visibility 0.15s;
    background: #FAFBFC;
  }
  .nav-dropdown.open .mega-menu {
    opacity: 1; visibility: visible; pointer-events: auto;
    max-height: 800px; padding: 8px 0 0;
  }

  .mega-menu-inner {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    padding: 0;
  }
  .mega-col { min-width: 0; padding: 0 16px; border-left: none; padding-left: 16px; }
  .mega-col + .mega-col { border-left: none; padding-left: 16px; }
  .mega-col h5 {
    margin-bottom: 6px; margin-top: 12px; color: #94A3B8; font-size: 0.6rem;
    padding: 0;
  }
  .mega-col:first-child h5 { margin-top: 4px; }
  .mega-col a {
    display: block; padding: 9px 0; font-size: 0.88rem;
    border-radius: 0; margin: 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
  }
  .mega-col a:last-child { border-bottom: none; }
  .mega-col a:hover { background: transparent; color: var(--accent-primary); }

  /* CTA column always spans full width on mobile */
  .mega-col-cta {
    margin: 8px 0 0; padding: 16px;
    border-radius: 0; border-left: none;
    background: #F1F5F9; border-color: #E2E8F0;
  }
  .mega-col-cta h5 { margin-top: 0; }
  .mega-col-cta a { border-bottom: none; }

  .header-actions { display: none; }

  /* Mobile CTA link in nav */
  .mobile-nav-cta {
    display: none;
  }
  .header-nav.mobile-open .mobile-nav-cta {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--accent-primary); color: #fff;
    font-family: var(--font-display); font-weight: 600; font-size: 0.9rem;
    padding: 14px 16px; margin: 0; width: 100%;
    text-decoration: none; text-align: center;
    flex-shrink: 0;
  }
  .header-nav.mobile-open .mobile-nav-cta:hover { background: var(--accent-hover); }
  .mobile-nav-cta i, .mobile-nav-cta svg { width: 14px; height: 14px; }
}

/* Breadcrumbs */
.breadcrumb-container {
  background-color: var(--bg-base);
  padding: 16px 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.breadcrumb {
  list-style: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.breadcrumb-item { display: flex; align-items: center; }
.breadcrumb-item:not(:last-child)::after {
  content: '/';
  margin-left: 12px;
  color: var(--text-light);
}

.breadcrumb-link { color: var(--text-muted); transition: color 0.2s ease; }
.breadcrumb-link:hover { color: var(--accent-primary); }
.breadcrumb-current { color: var(--text-main); font-weight: 500; }

@media (max-width: 640px) {
  .breadcrumb-container { padding: 12px 0; }
  .breadcrumb { font-size: 0.78rem; gap: 4px 8px; }
  .breadcrumb-item:not(:last-child)::after { margin-left: 8px; }
  .breadcrumb-current {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Footer */
.site-footer {
  background: var(--bg-base);
  border-top: 1px solid var(--border-light);
  padding-top: 80px;
}

.footer-main { padding-bottom: 64px; }

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 48px;
}

.footer-brand img { height: 28px; margin-bottom: 24px; }
.footer-brand p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 320px;
}

.footer-column h4 {
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.footer-column ul { list-style: none; padding: 0; margin: 0; }
.footer-column ul li { margin-bottom: 14px; }
.footer-column ul li a {
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}
.footer-column ul li a:hover { color: var(--accent-primary); }

.footer-bottom {
  border-top: 1px solid var(--border-light);
  padding: 32px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-light);
}

.footer-legal { display: flex; gap: 32px; }
.footer-legal a:hover { color: var(--text-main); }

/* Promo Banner */
.promo-banner {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  padding: 16px 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.promo-banner a {
  color: var(--text-main);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--border-light);
  text-underline-offset: 4px;
}
.promo-banner a:hover {
  color: var(--accent-primary);
  text-decoration-color: var(--accent-primary);
}

/* Responsive Footer */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .footer-brand { grid-column: 1 / -1; }
  .site-footer { padding-top: 56px; }
  .footer-main { padding-bottom: 40px; }
  .footer-column h4 { margin-bottom: 16px; font-size: 0.9rem; }
  .footer-column ul li { margin-bottom: 10px; }
  .footer-column ul li a { font-size: 0.88rem; }
  .footer-legal { gap: 20px; }
}

@media (max-width: 640px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-bottom { flex-direction: column; gap: 16px; text-align: center; }
  .footer-legal { gap: 16px; flex-wrap: wrap; justify-content: center; }
}

/* ==========================================================================
   HUB / INDEX PAGES
   ========================================================================== */

/* --- Dark Hero --- */
.hub-hero {
  background: var(--bg-dark);
  padding: 80px 24px 60px;
  text-align: center;
}
.hub-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #FFFFFF;
  margin-bottom: 16px;
  line-height: 1.1;
}
.hub-hero p {
  font-size: 1.1rem;
  color: var(--text-light);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}
.hub-hero .hub-count { display: none; }

/* --- Card Grids --- */
.featured-grid,
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 48px 24px 96px;
}

/* --- Cards --- */
.featured-card a,
.article-card-featured a {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px 24px 20px;
  text-decoration: none;
  transition: all 0.2s ease;
}
.featured-card a:hover,
.article-card-featured a:hover {
  box-shadow: var(--shadow-hover);
  border-color: #CBD5E1;
}

/* Category indicator — tiny dot + label */
.card-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  color: var(--text-light);
}
.card-tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.card-tag-calculator::before { background: var(--accent-primary); }
.card-tag-article::before { background: var(--text-light); }
.card-tag-template::before { background: #059669; }
.card-tag-glossary::before { background: #7C3AED; }

.featured-card h3,
.article-card-featured h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.featured-card p,
.article-card-featured p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
  flex-grow: 1;
  margin-bottom: 16px;
}
.featured-card .read-more,
.article-card-featured .read-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-primary);
  transition: gap 0.15s ease;
  margin-top: auto;
}
.featured-card a:hover .read-more,
.article-card-featured a:hover .read-more {
  gap: 8px;
}

/* --- Hub Section Headings (resources page) --- */
.hub-section-heading {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 20px;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding: 0 24px;
}

@media (max-width: 768px) {
  .featured-grid,
  .articles-grid { grid-template-columns: 1fr; padding: 32px 16px 64px; }
  .hub-hero { padding: 56px 16px 48px; }
}

/* ==========================================================================
   GLOSSARY HUB
   ========================================================================== */

/* Sticky letter bar */
.glossary-letter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  max-width: var(--container-max);
  margin: 0 auto 48px;
  padding: 16px 24px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 72px;
  z-index: 10;
}
.glossary-letter-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background: transparent;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s ease;
  border: none;
}
.glossary-letter-link:hover {
  background: var(--bg-dark);
  color: white;
}

/* Letter group as card */
.glossary-letter-group {
  max-width: var(--container-max);
  margin: 0 auto 24px;
  padding: 0 24px;
}
.glossary-letter-group-inner {
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 28px 32px;
}
.glossary-letter-group h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--bg-dark);
  display: inline-block;
}
.glossary-term-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0 40px;
}
.glossary-term-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.glossary-term-list li:last-child { border-bottom: none; }
.glossary-term-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s ease;
}
.glossary-term-list a::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border-light);
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.glossary-term-list a:hover {
  color: var(--accent-primary);
}
.glossary-term-list a:hover::before {
  background: var(--accent-primary);
}

@media (max-width: 640px) {
  .glossary-term-list { grid-template-columns: 1fr; }
  .glossary-letter-nav { gap: 1px; padding: 12px 16px; }
  .glossary-letter-link { width: 30px; height: 30px; font-size: 0.7rem; }
  .glossary-letter-group-inner { padding: 20px; }
}
