/* ---------- navigation bar ---------- */
.gh-head-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    flex-wrap: wrap; /* allow wrapping on small screens */
}

.gh-head-brand {
    display: flex;
    align-items: center;
}

.gh-head-nav {
    display: flex;
    align-items: center;
    margin-left: 30px; /* space between logo and nav */
}

.gh-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gh-head-logo img {
    max-height: 50px;
    display: block;
}

/* ---------- Main Navigation ---------- */
.gh-head-menu {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 999;
}

.gh-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 15px;
}

.gh-menu li {
    position: relative;
}

.gh-menu li a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 8px 12px;
    transition: color 0.3s, background-color 0.3s;
}

.gh-menu li a:hover,
.gh-menu li.nav-current a {
    color: #007BFF;
}

/* ---------- Tags Dropdown ---------- */
.nav-tags > a {
    cursor: pointer;
}

.tags-sub-nav {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    padding: 10px;
    list-style: none;
    min-width: 350px;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(-10px);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 5px 10px;
}

.nav-tags.open .tags-sub-nav,
.nav-tags:hover .tags-sub-nav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.tags-sub-nav li a {
    text-decoration: none;
    color: #333;
    padding: 6px 10px;
    display: block;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
}

.tags-sub-nav li a:hover {
    background-color: #007BFF;
    color: #fff;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .gh-head-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .gh-head-nav {
        width: 100%;
        margin-left: 0;
    }

    .gh-head-menu {
        flex-direction: column;
        gap: 10px;
    }

    .gh-menu {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }

    .gh-menu li a {
        padding: 10px 15px;
    }

    .tags-sub-nav {
        position: static;
        box-shadow: none;
        padding-left: 20px;
        margin-top: 5px;
        display: none;
        grid-template-columns: 1fr;
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .nav-tags.open .tags-sub-nav {
        display: block;
    }

    .tags-sub-nav li a {
        padding: 8px 12px;
    }
}

.dropdown-icon {
    width: 14px;
    height: 14px;
    margin-left: 5px;
    transition: transform 0.2s ease;
}

.nav-tags:hover .dropdown-icon {
    transform: rotate(180deg);
}


/* TOC Sidebar */
/* Layout wrapper */
.post-layout {
  display: flex;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* TOC sidebar */
.toc-sidebar {
  flex: 0 0 250px; /* fixed width */
  position: sticky;
  top: 100px; /* stays visible while scrolling */
  align-self: flex-start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  border-right: 1px solid #e0e0e0;
  padding-right: 1rem;
}

/* TOC list style */
.toc-sidebar h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.toc-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-sidebar li {
  margin: 0.5rem 0;
}

.toc-sidebar a {
  text-decoration: none;
  color: #555;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.toc-sidebar a:hover {
  color: #000;
}

/* Highlight active section */
.toc-sidebar a.active {
  color: #0073e6;
  font-weight: 600;
}

/* Main content */
.post-content {
  flex: 1;
  min-width: 0;
}

/* Mobile: move TOC above content */
@media (max-width: 768px) {
  .post-layout {
    flex-direction: column;
  }

  .toc-sidebar {
    position: relative;
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
  }
}
