/* ════════════════════════════════════════════
   A3 Digital Tools — Layout
   Header, footer, mega menu, page structures
════════════════════════════════════════════ */

/* ── SITE HEADER ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--gray-200);
}
.header-inner { position: relative; }
.header-container {
  display: flex;
  align-items: center;
  height: var(--header-height);
  gap: var(--sp-4);
}

/* ── LOGO ── */
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: var(--sp-4);
}
.logo-icon {
  width: 38px; height: 38px;
  background: var(--blue);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.site-logo:hover .logo-icon { transform: rotate(-8deg); }
.logo-text { display: flex; flex-direction: column; }
.logo-main {
  font-family: var(--font);
  font-size: 18px;
  font-weight: var(--fw-xbold);
  color: var(--gray-900);
  letter-spacing: -0.4px;
  line-height: 1;
}
.logo-main strong { color: var(--blue); }
.logo-sub {
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-top: 3px;
}

/* ── PRIMARY NAV ── */
.primary-nav { flex: 1; }
.nav-list {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  align-items: center;
  height: var(--header-height);
  gap: 2px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--gray-600);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.nav-link:hover { color: var(--blue); background: var(--blue-light); }
.nav-link--active { color: var(--blue); font-weight: var(--fw-bold); }
.nav-chevron { transition: transform 0.2s; color: var(--gray-400); }

/* ── HEADER ACTIONS ── */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}
.header-cta { padding: 9px 20px; font-size: var(--text-sm); }
.search-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--gray-100);
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--gray-600);
  transition: var(--transition);
}
.search-toggle:hover { background: var(--blue-light); color: var(--blue); }
.mobile-menu-toggle {
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  background: none; border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: var(--transition);
}
.mobile-menu-toggle:hover { border-color: var(--blue); background: var(--blue-light); }
.hamburger { display: flex; flex-direction: column; gap: 5px; }
.hamburger span { width: 18px; height: 2px; background: var(--gray-600); border-radius: 2px; transition: var(--transition); display: block; }
.mobile-menu-toggle[aria-expanded="true"] .hamburger span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.mobile-menu-toggle[aria-expanded="true"] .hamburger span:nth-child(2) { opacity: 0; }
.mobile-menu-toggle[aria-expanded="true"] .hamburger span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ── MEGA MENU ── */
.mega-menu-parent { position: static; }
.mega-menu-parent:hover > .nav-link { color: var(--blue); background: var(--blue-light); }
.mega-menu-parent:hover .nav-chevron { transform: rotate(180deg); color: var(--blue); }

.mega-menu {
  position: absolute;
  top: var(--header-height);
  left: 0; right: 0;
  background: var(--white);
  border-top: 2px solid var(--blue);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: 0 20px 60px rgba(10,14,26,0.12);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  pointer-events: none;
}
.mega-menu-parent:hover .mega-menu,
.mega-menu-parent:focus-within .mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: all;
}
.mega-menu__inner {
  display: flex;
  gap: 0;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}
.mega-col {
  flex: 1;
  padding: var(--sp-6) var(--sp-4) var(--sp-6) var(--sp-4);
  border-right: 1px solid var(--gray-100);
}
.mega-col:last-child { border-right: none; }
.mega-col__header { margin-bottom: var(--sp-3); }
.mega-col__cat-link {
  display: flex; align-items: center; gap: var(--sp-2);
  text-decoration: none;
  padding: var(--sp-2);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.mega-col__cat-link:hover { background: var(--gray-50); }
.mega-col__icon {
  width: 32px; height: 32px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.mega-col__title {
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  color: var(--gray-900);
  letter-spacing: -0.01em;
}
.mega-col__tools { list-style: none; padding: 0; margin: 0; }
.mega-tool-link {
  display: block;
  padding: 6px var(--sp-2);
  font-size: var(--text-sm);
  color: var(--gray-600);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  line-height: 1.4;
}
.mega-tool-link:hover { background: var(--blue-light); color: var(--blue); padding-left: var(--sp-3); }
.mega-see-all {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--sp-3);
  padding: var(--sp-2);
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--blue);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: gap 0.15s;
}
.mega-see-all:hover { gap: 8px; }

/* ── HEADER SEARCH BAR ── */
.header-search {
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
  padding: var(--sp-4) 0;
  display: none;
  position: relative;
}
.header-search.is-open { display: block; }
.search-bar-wrap {
  display: flex; align-items: center;
  gap: var(--sp-3);
  background: var(--white);
  border: 2px solid var(--blue-mid);
  border-radius: var(--radius-full);
  padding: 9px 12px 9px 20px;
  box-shadow: var(--shadow-blue);
}
.search-bar-input { flex: 1; border: none; outline: none; font-family: var(--font); font-size: var(--text-base); color: var(--gray-800); background: transparent; }
.search-bar-close {
  background: none; border: none;
  font-size: var(--text-lg);
  color: var(--gray-400); cursor: pointer;
  padding: 0 var(--sp-2); transition: color 0.15s;
}
.search-bar-close:hover { color: var(--gray-700); }

/* ── FOOTER ── */
.site-footer {
  background: var(--gray-900);
  margin-top: var(--sp-16);
}
.footer-newsletter {
  background: var(--blue);
  padding: var(--sp-12) 0;
}
.newsletter-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-10);
  flex-wrap: wrap;
}
.newsletter-title {
  font-size: var(--text-xl);
  font-weight: var(--fw-xbold);
  color: var(--white);
  margin-bottom: var(--sp-2);
}
.newsletter-desc { font-size: var(--text-base); color: rgba(255,255,255,0.65); margin: 0; }
.newsletter-form { flex: 1; min-width: 280px; }
.newsletter-input-row { display: flex; gap: var(--sp-2); }
.newsletter-input {
  flex: 1;
  padding: 13px 20px;
  border-radius: var(--radius-full);
  border: none;
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--gray-800);
  outline: none;
}
.newsletter-btn { flex-shrink: 0; }
.newsletter-gdpr { font-size: var(--text-xs); color: rgba(255,255,255,0.45); margin-top: var(--sp-2); }
.newsletter-gdpr a { color: rgba(255,255,255,0.6); text-decoration: underline; }

.footer-main { padding: var(--sp-16) 0 var(--sp-12); }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-10);
}
.footer-logo {
  display: flex; align-items: center; gap: var(--sp-3);
  text-decoration: none; margin-bottom: var(--sp-4);
}
.footer-logo-icon {
  width: 36px; height: 36px; background: var(--blue);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.footer-logo span { font-size: 17px; font-weight: var(--fw-xbold); color: var(--white); }
.footer-tagline { font-size: var(--text-sm); color: rgba(255,255,255,0.45); line-height: var(--lh-normal); max-width: 260px; margin-bottom: var(--sp-4); }
.footer-tagline a { color: rgba(255,255,255,0.65); text-decoration: underline; }
.footer-badges { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.footer-badge {
  font-size: var(--text-xs); font-weight: var(--fw-semi);
  padding: 4px 10px; border-radius: var(--radius-full);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.55);
}
.footer-col__title {
  font-size: var(--text-xs); font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
  margin-bottom: var(--sp-4);
}
.footer-col__links { list-style: none; padding: 0; }
.footer-col__links li { margin-bottom: var(--sp-2); }
.footer-col__links a {
  font-size: var(--text-sm); color: rgba(255,255,255,0.5);
  text-decoration: none; transition: color 0.15s;
}
.footer-col__links a:hover { color: var(--white); }
.footer-see-all { color: var(--blue-mid) !important; font-weight: var(--fw-semi); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.07); padding: var(--sp-5) 0; }
.footer-bottom__inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--sp-3); }
.footer-copy { font-size: var(--text-sm); color: rgba(255,255,255,0.25); }
.footer-copy a { color: rgba(255,255,255,0.4); }
.footer-made { font-size: var(--text-sm); color: rgba(255,255,255,0.25); }

/* ── MOBILE OVERLAY NAV ── */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: var(--z-overlay);
  backdrop-filter: blur(4px);
}
.mobile-nav-overlay.is-open { display: block; }
.mobile-nav {
  position: absolute;
  top: 0; left: 0;
  width: min(360px, 90vw);
  height: 100vh;
  background: var(--white);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-xl);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}
.mobile-nav-overlay.is-open .mobile-nav { transform: translateX(0); }
.mobile-nav__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-5) var(--sp-5);
  border-bottom: 1px solid var(--gray-100);
}
.mobile-nav__title { font-size: var(--text-base); font-weight: var(--fw-xbold); color: var(--gray-900); }
.mobile-nav__close {
  background: var(--gray-100); border: none; border-radius: var(--radius-sm);
  width: 32px; height: 32px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--gray-600);
}
.mobile-nav__body { padding: var(--sp-5); }
.mobile-search-input {
  width: 100%; padding: 10px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-full);
  font-family: var(--font); font-size: var(--text-sm);
  outline: none; margin-bottom: var(--sp-5);
}
.mobile-search-input:focus { border-color: var(--blue); }
.mobile-cats { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.mobile-cat-link {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  text-decoration: none; font-size: var(--text-sm);
  font-weight: var(--fw-semi); color: var(--gray-700);
  transition: var(--transition);
}
.mobile-cat-link:hover { background: var(--blue-light); border-color: var(--blue-mid); color: var(--blue); }
.mobile-cat-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.mobile-cat-count { margin-left: auto; font-size: var(--text-xs); color: var(--gray-400); font-weight: var(--fw-semi); }
.mobile-links { display: flex; flex-direction: column; border-top: 1px solid var(--gray-100); padding-top: var(--sp-4); gap: 2px; }
.mobile-links a {
  padding: 10px var(--sp-3); border-radius: var(--radius-sm);
  font-size: var(--text-base); color: var(--gray-700);
  text-decoration: none; transition: background 0.15s;
}
.mobile-links a:hover { background: var(--blue-light); color: var(--blue); }

/* ── BLOG LAYOUT ── */
.blog-layout { display: grid; grid-template-columns: 1fr; gap: var(--sp-8); padding: var(--sp-10) 0; }
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.blog-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
}
.blog-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.blog-card__img-wrap { display: block; aspect-ratio: 16/9; overflow: hidden; }
.blog-card__img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.blog-card:hover .blog-card__img { transform: scale(1.03); }
.blog-card__img-wrap--placeholder { background: var(--gray-100); display: flex; align-items: center; justify-content: center; }
.blog-card__placeholder { font-size: 40px; }
.blog-card__body { padding: var(--sp-5); }
.blog-card__meta { display: flex; gap: var(--sp-3); align-items: center; margin-bottom: var(--sp-3); }
.blog-card__date { font-size: var(--text-xs); color: var(--gray-400); font-weight: var(--fw-semi); }
.blog-card__read { font-size: var(--text-xs); color: var(--blue); font-weight: var(--fw-semi); }
.blog-card__cat a { font-size: var(--text-xs); color: var(--blue); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: 0.06em; text-decoration: none; }
.blog-card__title { font-size: var(--text-md); font-weight: var(--fw-xbold); color: var(--gray-900); margin-bottom: var(--sp-3); line-height: var(--lh-snug); }
.blog-card__title a { color: inherit; text-decoration: none; }
.blog-card__title a:hover { color: var(--blue); }
.blog-card__excerpt { font-size: var(--text-sm); color: var(--gray-500); line-height: var(--lh-normal); margin-bottom: var(--sp-4); }
.blog-card__read-more { font-size: var(--text-sm); font-weight: var(--fw-bold); color: var(--blue); text-decoration: none; }
.blog-card__read-more:hover { color: var(--blue-dark); }

/* ── SINGLE POST ── */
.single-post__header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: var(--sp-10) 0 var(--sp-8);
}
.single-post__header-inner { max-width: 820px; }
.post-cats { margin-bottom: var(--sp-3); }
.post-cats a { font-size: var(--text-xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: 0.08em; color: var(--blue); background: var(--blue-light); padding: 4px 12px; border-radius: var(--radius-full); text-decoration: none; }
.single-post__title { font-size: clamp(26px,4vw,42px); font-weight: var(--fw-black); color: var(--gray-900); margin-bottom: var(--sp-4); line-height: var(--lh-tight); }
.post-meta { display: flex; gap: var(--sp-5); align-items: center; flex-wrap: wrap; }
.post-meta span { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-sm); color: var(--gray-400); font-weight: var(--fw-semi); }
.single-post__featured-img { background: var(--gray-100); padding: var(--sp-5) 0; }
.single-post__img { border-radius: var(--radius-xl); width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.single-post__layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--sp-10);
  padding: var(--sp-10) 0;
  align-items: start;
}
.single-post__sidebar { position: sticky; top: calc(var(--header-height) + var(--sp-5)); }

/* ── PAGE CONTENT ── */
.page-content-wrap { max-width: 820px; margin: 0 auto; padding: var(--sp-10) 0; }
.all-tools-section { padding: 0 0 var(--sp-16); }

/* ════════════════════════════════════════════
   FIXES v1.1
════════════════════════════════════════════ */

/* ── MEGA MENU HOVER FIX ──
   Problem: menu vanished instantly on slight mouse movement.
   Fix: add pointer-events bridge + use :hover on parent li
   rather than relying solely on JS. The invisible bridge fills
   the gap between nav item and dropdown.
── */
.mega-menu-parent { position: static; }

/* CSS-only hover (works without JS) */
.mega-menu-parent:hover > .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: all;
    /* Delay hiding by 150ms so mouse can reach dropdown */
    transition: opacity 0.15s ease 0s,
                transform 0.15s ease 0s,
                visibility 0s linear 0s;
}

/* When NOT hovered — delay the hide so mouse can travel */
.mega-menu {
    transition: opacity 0.15s ease 0.15s,
                transform 0.15s ease 0.15s,
                visibility 0s linear 0.15s;
}

/* Invisible bridge between nav item and dropdown */
.mega-menu-parent::after {
    content: '';
    position: absolute;
    top: calc(100% - 4px);
    left: 0;
    width: 100%;
    height: 8px;
    background: transparent;
    z-index: calc(var(--z-dropdown) - 1);
}

/* ── NEWSLETTER STRIP (dark, not blue) ── */
.footer-newsletter-strip {
    background: #111318;
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 14px 0;
}
.newsletter-strip-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.newsletter-strip-text {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.newsletter-strip-text strong {
    font-size: 14px;
    font-weight: 700;
    color: white;
}
.newsletter-strip-text span {
    font-size: 13px;
    color: rgba(255,255,255,0.45);
}
.newsletter-strip-form { flex-shrink: 0; }
.newsletter-strip-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.newsletter-strip-input {
    padding: 9px 18px;
    border: 1.5px solid rgba(255,255,255,0.15);
    border-radius: 100px;
    background: rgba(255,255,255,0.06);
    color: white;
    font-family: var(--font);
    font-size: 13px;
    outline: none;
    width: 240px;
    transition: border-color 0.2s;
}
.newsletter-strip-input::placeholder { color: rgba(255,255,255,0.3); }
.newsletter-strip-input:focus { border-color: var(--blue); }
.newsletter-strip-btn {
    background: white;
    color: var(--gray-900);
    border: none;
    border-radius: 100px;
    padding: 9px 20px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.newsletter-strip-btn:hover { background: var(--blue-light); color: var(--blue); }

/* Remove old .footer-newsletter (blue) — replaced by strip */
.footer-newsletter { display: none !important; }

/* ── RATING WIDGET ── */
.rating-stars-display {
    display: flex;
    gap: 2px;
    font-size: 20px;
    margin-bottom: 4px;
}
.rating-star { transition: transform 0.1s; }
.star-full  { color: #F59E0B; }
.star-half  { color: #F59E0B; }
.star-empty { color: #D1D5DB; }
.rating-numbers {
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 500;
    margin-bottom: 10px;
}
.rating-numbers strong { color: var(--gray-900); font-weight: 800; font-size: 16px; }

.rate-tool-widget { margin-top: 8px; }
.rate-tool-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: block;
    margin-bottom: 5px;
}
.rate-tool-stars {
    display: flex;
    gap: 3px;
}
.rate-star {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--gray-300);
    cursor: pointer;
    padding: 2px;
    transition: color 0.12s, transform 0.12s;
    line-height: 1;
}
.rate-star:hover,
.rate-star.hovered,
.rate-star.selected { color: #F59E0B; transform: scale(1.15); }
.rate-tool-feedback {
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
    min-height: 18px;
    color: var(--gray-400);
}

/* ── RESPONSIVE: newsletter strip ── */
@media (max-width: 768px) {
    .newsletter-strip-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
    .newsletter-strip-input { width: 100%; }
    .newsletter-strip-row { width: 100%; }
    .newsletter-strip-btn { flex-shrink: 0; }
}
