/* ============================================================
   ZeroFee Tools - shared design system (header + footer)
   Mobile-first. Include once per page:
     <link rel="stylesheet" href="{{A}}/site.css">
   All classes are namespaced `fh-` to avoid clashing with
   existing per-tool styles.
   ============================================================ */

:root {
  --fh-blue: #4f46e5;
  --fh-purple: #7c3aed;
  --fh-grad: linear-gradient(135deg, #4f46e5 0%, #6d28d9 55%, #7c3aed 100%);
  --fh-ink: #111827;
  --fh-muted: #6b7280;
  --fh-footer-bg: #0f172a;
  --fh-footer-ink: #cbd5e1;
  --fh-radius: 10px;
  --fh-shadow: 0 12px 32px rgba(17, 24, 39, 0.18);
}

/* ---------- header ---------- */

.fh-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--fh-grad);
  color: #fff;
  box-shadow: 0 2px 12px rgba(76, 29, 149, 0.35);
}

.fh-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.fh-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}

.fh-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.fh-brand:hover { color: #fff; opacity: 0.92; }

.fh-logo {
  width: 38px;
  height: 38px;
  display: block;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.14);
}

.fh-wordmark { white-space: nowrap; }

/* ---------- hamburger (mobile only) ---------- */

.fh-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.fh-burger:hover { background: rgba(255, 255, 255, 0.15); }

.fh-burger:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.fh-burger span {
  display: block;
  height: 2.5px;
  border-radius: 2px;
  background: #fff;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.fh-burger.active span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.fh-burger.active span:nth-child(2) { opacity: 0; }
.fh-burger.active span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* ---------- nav / dropdowns ---------- */

.fh-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.fh-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.fh-link:hover { background: rgba(255, 255, 255, 0.16); }

.fh-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.fh-dropbtn::after {
  content: "▾";
  font-size: 0.7em;
  line-height: 1;
  transition: transform 0.2s ease;
}

.fh-has-sub { position: relative; }

.fh-sub {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  max-height: 70vh;
  overflow-y: auto;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: #fff;
  border-radius: var(--fh-radius);
  box-shadow: var(--fh-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.fh-has-sub:hover > .fh-sub,
.fh-has-sub:focus-within > .fh-sub,
.fh-has-sub.open > .fh-sub {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.fh-has-sub.open > .fh-dropbtn::after { transform: rotate(180deg); }

.fh-sub a {
  display: block;
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--fh-ink);
  text-decoration: none;
  font-size: 0.93rem;
  line-height: 1.35;
}

.fh-sub a:hover { background: #eef2ff; color: var(--fh-blue); }

.fh-sub a:focus-visible { outline: 2px solid var(--fh-blue); outline-offset: -2px; }

.fh-sub .fh-sub-all {
  font-weight: 700;
  color: var(--fh-blue);
  border-bottom: 1px solid #e5e7eb;
  border-radius: 7px 7px 0 0;
  margin-bottom: 4px;
  padding-bottom: 11px;
}

/* ---------- footer ---------- */

.fh-footer {
  background: var(--fh-footer-bg);
  color: var(--fh-footer-ink);
  margin-top: 64px;
  font-size: 0.95rem;
}

.fh-footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
  gap: 32px;
  padding: 48px 0 36px;
}

.fh-foot-brand .fh-brand { margin-bottom: 12px; }

.fh-tagline {
  margin: 0 0 18px;
  color: #94a3b8;
  line-height: 1.6;
  font-size: 0.9rem;
  max-width: 32ch;
}

.fh-social { display: flex; gap: 10px; flex-wrap: wrap; }

.fh-social a {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  transition: background 0.2s ease, transform 0.2s ease;
}

.fh-social a:hover { background: var(--fh-blue); transform: translateY(-2px); }

.fh-social a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.fh-foot-col h3 {
  margin: 0 0 14px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
}

.fh-foot-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 9px;
}

.fh-foot-col a {
  color: var(--fh-footer-ink);
  text-decoration: none;
  font-size: 0.9rem;
}

.fh-foot-col a:hover { color: #fff; text-decoration: underline; }

.fh-foot-col .fh-sub-all { color: #fff; font-weight: 600; }

.fh-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
  color: #94a3b8;
}

.fh-forever { color: #a5b4fc; font-weight: 600; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .fh-footer-grid { grid-template-columns: 1fr 1fr 1fr; }
  .fh-foot-brand { grid-column: 1 / -1; }
  .fh-tagline { max-width: none; }
}

@media (max-width: 900px) {
  .fh-burger { display: flex; }

  .fh-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: var(--fh-shadow);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease;
  }

  .fh-nav.open { max-height: calc(100vh - 64px); overflow-y: auto; }

  .fh-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 12px 16px;
  }

  .fh-item { border-bottom: 1px solid #f1f5f9; }
  .fh-item:last-child { border-bottom: 0; }

  .fh-link {
    width: 100%;
    justify-content: space-between;
    color: var(--fh-ink);
    font-size: 1rem;
    padding: 13px 8px;
  }

  .fh-link:hover { background: #f1f5f9; }

  .fh-dropbtn::after { color: var(--fh-muted); }

  .fh-sub {
    position: static;
    box-shadow: none;
    border-radius: 0;
    padding: 0 0 0 12px;
    min-width: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: max-height 0.25s ease;
    border-left: 2px solid #e0e7ff;
    margin: 0 8px 0 16px;
  }

  /* hide dropdown unless its parent is open (mobile accordion) */
  .fh-has-sub:not(.open) > .fh-sub { max-height: 0 !important; }
  .fh-has-sub.open > .fh-sub { max-height: 480px; overflow-y: auto; }

  .fh-sub .fh-sub-all { border-bottom: 0; margin-bottom: 0; padding-bottom: 9px; }
}

@media (max-width: 640px) {
  .fh-footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; padding: 36px 0 28px; }
  .fh-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 420px) {
  .fh-footer-grid { grid-template-columns: 1fr; }
}

/* contextual related-tools (auto-injected) */
.related-tools{max-width:1000px;margin:40px auto;padding:0 20px}
.related-tools h2{font-size:1.25rem;margin:0 0 14px}
.related-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px}
.related-card{display:block;padding:16px;border:1px solid #e5e7eb;border-radius:12px;text-decoration:none;color:inherit;background:#fff;transition:box-shadow .2s,transform .2s}
.related-card:hover{box-shadow:0 6px 18px rgba(79,70,229,.15);transform:translateY(-2px)}
.related-card strong{display:block;color:#4f46e5;margin-bottom:6px;font-size:1rem}
.related-card span{font-size:.88rem;color:#4b5563;line-height:1.45;display:block}
.related-guides{max-width:800px;margin:36px auto;padding:20px;border:1px solid #e5e7eb;border-radius:12px;background:#f8fafc}
.related-guides h2{font-size:1.15rem;margin:0 0 10px}
.related-guides ul{margin:0;padding-left:20px}
.related-guides li{margin:8px 0;font-size:.95rem}
.related-guides a{color:#4f46e5;font-weight:600}
