/* ═══════════════════════════════════════════════════════════════
   nav.css — AllFinanceTool Navigation Styles
   Aesthetic: Refined dark finance — obsidian, gold accent, sharp type
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&display=swap');

/* ── CSS VARIABLES ──────────────────────────────────────────── */
:root {
  --aft-nav-h: 62px;
  --aft-bg:    rgba(7, 9, 12, 0.96);
  --aft-bd:    rgba(255, 255, 255, 0.07);
  --aft-text:  #d4d8e8;
  --aft-muted: #5e6580;
  --aft-gold:  #ffb340;
  --aft-gold2: #ffd07a;
  --aft-s1:    #0d0f14;
  --aft-s2:    #12151c;
  --aft-s3:    #1a1e27;
  --aft-s4:    #21263300;
  --aft-font:  'DM Sans', sans-serif;
  --aft-logo-font: 'Fangsong', serif;
  --aft-radius: 10px;
  --aft-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 4px 16px rgba(0,0,0,0.4);
}

/* LIGHT THEME OVERRIDES */
body.aft-light {
  --aft-bg:    rgba(250, 249, 244, 0.97);
  --aft-bd:    rgba(0, 0, 0, 0.08);
  --aft-text:  #1a1c24;
  --aft-muted: #8a8fa8;
  --aft-s1:    #f5f4ef;
  --aft-s2:    #edecea;
  --aft-s3:    #e4e3de;
  --aft-shadow: 0 20px 60px rgba(0,0,0,0.12), 0 4px 16px rgba(0,0,0,0.08);
}

/* ── NAV SHELL ──────────────────────────────────────────────── */
.aft-nav {
  position: sticky;
  top: 0;
  /* margin-top: -25px; */
  z-index: 1000;
  background: var(--aft-bg);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid var(--aft-bd);
  transition: background 0.3s, border-color 0.3s;
  font-family: var(--aft-font);
  border-radius: 25px;
}

.aft-nav::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,179,64,0.15), transparent);
  pointer-events: none;
}

.aft-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: var(--aft-nav-h);
  gap: 0;
}

/* ── LOGO ───────────────────────────────────────────────────── */
.aft-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 32px;
}

.aft-logo-mark {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--aft-gold);
  box-shadow: 0 0 10px rgba(255,179,64,0.7), 0 0 20px rgba(255,179,64,0.3);
  flex-shrink: 0;
  transition: box-shadow 0.3s;
}
.aft-logo:hover .aft-logo-mark {
  box-shadow: 0 0 16px rgba(255,179,64,0.9), 0 0 32px rgba(255,179,64,0.4);
}

.aft-logo-text {
  font-family: var(--aft-logo-font);
  font-size: 1.08rem;
  font-weight: 400;
  color: var(--aft-text);
  letter-spacing: 0.2px;
  transition: color 0.2s;
}
.aft-logo:hover .aft-logo-text { color: var(--aft-gold); }

/* ── NAV LINKS CONTAINER ─────────────────────────────────────── */
.aft-nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

/* ── NAV ITEM + TRIGGER ──────────────────────────────────────── */
.aft-nav-item {
  position: static; /* mega uses fixed-width relative to nav */
}

.aft-has-mega { position: relative; }

.aft-nav-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  font-family: var(--aft-font);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--aft-muted);
  padding: 8px 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
  letter-spacing: 0.1px;
  white-space: nowrap;
}
.aft-nav-trigger:hover,
.aft-nav-item:hover .aft-nav-trigger {
  color: var(--aft-gold);
  background: rgba(255,179,64,0.08);
}

.aft-caret {
  font-size: 0.6rem;
  transition: transform 0.22s ease;
  opacity: 0.6;
}
.aft-nav-item:hover .aft-caret,
.aft-nav-trigger[aria-expanded="true"] .aft-caret {
  transform: rotate(180deg);
}

/* ── RIGHT CONTROLS ─────────────────────────────────────────── */
.aft-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.aft-theme-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  flex-shrink: 0;
}
.aft-theme-btn:hover {
  background: rgba(255,179,64,0.12);
  border-color: rgba(255,179,64,0.3);
  transform: scale(1.08);
}
body.aft-light .aft-theme-btn {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.1);
}

/* ── MEGA MENU ───────────────────────────────────────────────── */
.aft-mega {
  position: absolute;
  top: calc(var(--aft-nav-h) + 2px);
  left: 50%;
  transform: translateX(-50%);
  width: 760px;
  background: var(--aft-s1);
  border: 1px solid var(--aft-bd);
  border-radius: 14px;
  box-shadow: var(--aft-shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-8px);
  transition: opacity 0.2s ease, transform 0.22s ease;
  overflow: hidden;
}
.aft-mega.aft-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Arrow tip */
.aft-mega::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 7px;
  background: var(--aft-s1);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.aft-mega-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 6px;
}

.aft-mega-col {
  padding: 14px 10px;
  border-right: 1px solid var(--aft-bd);
}
.aft-mega-col:last-child { border-right: none; }

.aft-mega-col-head {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--aft-gold);
  font-weight: 700;
  padding: 0 8px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--aft-bd);
  margin-bottom: 6px;
}
.aft-mega-col-icon { font-size: 0.85rem; }

/* Dropdown item */
.aft-dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s, transform 0.12s;
  cursor: pointer;
}
.aft-dd-item:hover {
  background: rgba(255,179,64,0.08);
  transform: translateX(2px);
}
.aft-dd-active {
  background: rgba(255,179,64,0.1);
}
.aft-dd-active .aft-dd-label { color: var(--aft-gold) !important; }

.aft-dd-icon {
  font-size: 1.05rem;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--aft-s2);
  border-radius: 7px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.aft-dd-item:hover .aft-dd-icon { background: var(--aft-s3); }

.aft-dd-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.aft-dd-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--aft-text);
  transition: color 0.15s;
}
.aft-dd-item:hover .aft-dd-label { color: var(--aft-gold); }
.aft-dd-desc {
  font-size: 0.68rem;
  color: var(--aft-muted);
  line-height: 1.3;
}

/* ── SIMPLE DROPDOWN ─────────────────────────────────────────── */
.aft-drop {
  position: absolute;
  top: calc(var(--aft-nav-h) + 2px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  min-width: 200px;
  background: var(--aft-s1);
  border: 1px solid var(--aft-bd);
  border-radius: 12px;
  box-shadow: var(--aft-shadow);
  padding: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.22s ease;
  z-index: 100;
}
.aft-drop.aft-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.aft-drop::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 7px;
  background: var(--aft-s1);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.aft-drop-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--aft-text);
  transition: background 0.15s, color 0.15s, transform 0.12s;
  white-space: nowrap;
}
.aft-drop-item:hover {
  background: rgba(255,179,64,0.09);
  color: var(--aft-gold);
  transform: translateX(2px);
}

/* ── HAMBURGER ───────────────────────────────────────────────── */
.aft-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
}
.aft-hamburger span {
  display: block;
  height: 1.5px;
  border-radius: 2px;
  background: var(--aft-muted);
  transition: all 0.22s ease;
}
.aft-hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); background: var(--aft-gold); }
.aft-hamburger.open span:nth-child(2) { opacity: 0; }
.aft-hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); background: var(--aft-gold); }

/* ── MOBILE PANEL ────────────────────────────────────────────── */
.aft-mobile-panel {
  display: none;
  flex-direction: column;
  background: var(--aft-s1);
  border-top: 1px solid var(--aft-bd);
  /* padding: 12px 0 24px; */
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.aft-mobile-panel.aft-panel-open {
  max-height: 90vh;
  overflow-y: auto;
}

.aft-mobile-section { border-bottom: 1px solid var(--aft-bd); }

.aft-mobile-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--aft-text);
  cursor: pointer;
  transition: color 0.15s;
}
.aft-mobile-section-head:hover { color: var(--aft-gold); }
.aft-mobile-caret { font-size: 0.65rem; color: var(--aft-muted); transition: transform 0.22s; }

.aft-mobile-section-body {
  display: none;
  flex-direction: column;
  padding: 0 12px 10px;
}
.aft-mobile-section-body.aft-mobile-body-open { display: flex; }

.aft-mobile-link {
  display: block;
  padding: 9px 10px;
  font-size: 0.81rem;
  color: var(--aft-muted);
  text-decoration: none;
  border-radius: 7px;
  transition: background 0.15s, color 0.15s;
}
.aft-mobile-link:hover { background: rgba(255,179,64,0.08); color: var(--aft-gold); }
.aft-mobile-flat { padding: 12px 20px; border-radius: 0; font-weight: 500; color: var(--aft-text); }

.aft-mobile-divider { height: 1px; background: var(--aft-bd); margin: 6px 0; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .aft-nav-links { display: none; }
  .aft-hamburger { display: flex; }
  .aft-mobile-panel { display: flex; }
  .aft-logo { margin-right: auto; }
}

@media (max-width: 900px) and (min-width: 769px) {
  .aft-mega { width: 600px; }
  .aft-nav-trigger { padding: 8px 9px; font-size: 0.8rem; }
}

/* ── PRINT ───────────────────────────────────────────────────── */
@media print {
  .aft-nav { display: none !important; }
}


/* ── 1. LOGO & BRAND STYLING ────────────────────────────────── */
.aft-logo-text span {
  color: #26ad04; /* Keep your "tool" green */
}

/* Specific blue for the word "Type" */
.brand-type-blue {
    color: #3b82f6; 
    font-weight: 800;
}

.parent-brand-link {
    display: inline-flex; /* Changed from flex to inline-flex to tighten boundaries */
    align-items: center;
    text-decoration: none;
    color: #ffffff;
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 19px;
    
    /* This pulls the letters together to look like a single word logo */
    letter-spacing: -0.8px; 
    
    /* This kills any hidden browser spacing between spans */
    word-spacing: -4px; 
}

.bolt-icon {
    margin-right: 2px; /* Controls the ONLY space allowed: between the bolt and 'Quick' */
}

.brand-type-blue {
    color: #3b82f6;
    font-weight: 800;
    /* Ensure no margin or padding is adding hidden gaps */
    margin: 0;
    padding: 0;
}

.parent-brand-link:hover {
    opacity: 0.8;
}



/* ── 2. LAYOUT & ALIGNMENT ──────────────────────────────────── */
/* FIXED: We only need ONE .aft-nav-inner declaration */
.aft-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between; /* This keeps Logo left, Links center, Back right */
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: var(--aft-nav-h);
}

/* The container holding QuickTypeTest | FinanceTool */
.aft-logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* The divider line | */
.brand-divider {
    color: var(--aft-bd);
    font-weight: 200;
    font-size: 1.2rem;
    pointer-events: none;
}

/* ── 3. NAV LINKS & BACK BUTTON ─────────────────────────────── */
.aft-nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
    flex: 1;
    justify-content: center; /* This centers Tools/Blog/About */
}

.back-to-typing-link {
    color: #888;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.back-to-typing-link:hover {
    color: #3b82f6;
    text-decoration: underline;
}

/* ── 4. RESPONSIVE FIXES ─────────────────────────────────────── */
@media (max-width: 768px) {
    .back-to-typing-link {
        display: none; /* Hide on mobile to save space */
    }
    .aft-nav-links {
        display: none; /* Mobile uses the hamburger panel instead */
    }
}


/* ── THEME FRIENDLY NAV SHELL ──────────────────────────────── */
.aft-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  /* Uses the variable - will be dark by default */
  background: var(--aft-bg); 
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid var(--aft-bd);
  transition: background 0.3s, border-color 0.3s;
}

/* Fixes for Light Theme */
body.aft-light .aft-nav {
  /* This variable in your :root should be the light color */
  background: rgba(255, 255, 255, 0.95); 
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Text color needs to flip too! */
body.aft-light .parent-brand-link,
body.aft-light .aft-logo-text,
body.aft-light .aft-nav-trigger,
body.aft-light .back-to-typing-link {
  color: #1a1c24 !important; /* Dark text for light background */
}

/* Ensure the blue "Type" and green "tool" stay colorful in both themes */
.brand-type-blue { color: #3b82f6 !important; }
.aft-logo-text span { color: #26ad04 !important; }

/* The Divider line needs to dim in light mode */
body.aft-light .brand-divider {
  color: #000;
  opacity: 0.15;
}


/* Ensure the mobile panel is hidden by default and transitions smoothly */
.aft-mobile-panel {
    display: none;
    flex-direction: column;
    background: var(--aft-bg) !important; /* Force the background color */
    border-top: 1px solid var(--aft-bd);
    position: absolute;
    top: 100%; /* Sits exactly at the bottom of the nav bar */
    left: 0;
    width: 100%;
    z-index: 99999 !important; /* Extremely high to cover everything */
    max-height: 0;
    overflow-y: auto;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s;
}

/* When the JavaScript adds this class, it slides down */
.aft-mobile-panel.aft-panel-open {
    display: flex;
    max-height: 90vh;
    opacity: 1;
    backdrop-filter: none; /* Remove blur here so it stays solid */
}

/* Styling for the drop-down sections inside mobile */
.aft-mobile-section-body {
  display: none;
  flex-direction: column;
  background: rgba(0,0,0,0.2);
  padding-left: 15px;
}

.aft-mobile-section-body.aft-mobile-body-open {
  display: flex;
}

/* Hamburger Animation */
.aft-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.aft-hamburger.open span:nth-child(2) { opacity: 0; }
.aft-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.aft-nav {
  /* This ensures the 'contains' check in JS is accurate */
  display: block; 
  width: 100%;
}

/* When the mobile panel has the 'aft-panel-open' class, hide the theme button */
.aft-nav:has(.aft-panel-open) .aft-theme-btn {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Alternatively, if your browser doesn't support :has, use this JS-friendly class */
.aft-panel-open ~ .aft-nav-right .aft-theme-btn,
.open .aft-theme-btn {
    display: none !important;
}


.aft-nav {
    z-index: 1000; /* Base level */
}

.aft-theme-btn {
    z-index: 1001; /* Sits on the navbar */
}

.aft-mobile-panel {
    z-index: 9999 !important; /* Sits ON TOP of the button */
    position: absolute;
    top: var(--aft-nav-h);
    left: 0;
    width: 100%;
    background: var(--aft-bg); /* Ensure this is NOT transparent */
}

.aft-hamburger.open ~ .aft-theme-btn,
.aft-panel-open ~ .aft-nav-right .aft-theme-btn,
.aft-nav:has(.aft-panel-open) .aft-theme-btn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}