/* comparehero2-style navbar
 * Mirrors comparehero2/src/components/page-layout/components/page-header/index.marko
 * Plain CSS only; no Tailwind. Class prefix: .ch2-nav
 */

:root {
    --ch2-color-text: #121212;           /* Figma Neutrals/Black */
    --ch2-color-link-hover: #1d4ed8;
    --ch2-color-border-gray: #d9d9d9;    /* Figma Neutrals/Gray */
    --ch2-color-white: #fff;
    --ch2-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --ch2-shadow-dropdown: 0 2px 6px rgba(0, 0, 0, 0.08);
    --ch2-nav-height: 60px;
    --ch2-container-max: 1280px;
}

/* Reset for the nav region only */
.ch2-nav,
.ch2-nav * {
    box-sizing: border-box;
}

.ch2-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    width: 100%;
    background-color: var(--ch2-color-white);
    border-bottom: 1px solid var(--ch2-color-border-gray);
    font-family: "Public Sans", "Ubuntu", "Inter", "Plus Jakarta Sans", sans-serif;
    font-weight: 420;
}

@media (min-width: 1024px) {
    .ch2-nav {
        border-bottom: none;
        box-shadow: var(--ch2-shadow-sm);
    }
}

.ch2-nav__container {
    position: relative;
    max-width: var(--ch2-container-max);
    margin: 0 auto;
    padding: 17px 16px 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 1024px) {
    .ch2-nav__container {
        justify-content: space-between;
        gap: 0;
    }
}

/* Mobile hamburger button */
.ch2-nav__hamburger {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    color: var(--ch2-color-text);
}

@media (min-width: 1024px) {
    .ch2-nav__hamburger { display: none; }
}

.ch2-nav__hamburger-icon {
    width: 24px;
    height: 24px;
    display: block;
}

.ch2-nav__hamburger-icon::before {
    content: "";
    display: block;
    width: 24px;
    height: 2px;
    background: currentColor;
    box-shadow: 0 7px 0 currentColor, 0 14px 0 currentColor;
    margin-top: 4px;
}

/* Logo */
.ch2-nav__logo {
    display: flex;
    align-items: center;
}

.ch2-nav__logo img {
    height: 32px;
    width: auto;
    display: block;
}

/* Desktop menu */
.ch2-nav__menu {
    display: none;
    align-items: center;
    gap: 24px;
}

@media (min-width: 1024px) {
    .ch2-nav__menu {
        display: flex;
    }
}

.ch2-nav__dropdown {
    position: relative;
}

.ch2-nav__dropdown-trigger {
    display: flex;
    align-items: center;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font-size: 16px;
    color: var(--ch2-color-text);
    line-height: 1.5;
    font-family: inherit;
}

.ch2-nav__dropdown-trigger:hover {
    color: var(--ch2-color-link-hover);
}

.ch2-nav__caret {
    display: inline-flex;
    align-items: center;
    margin-left: 12px;
    width: 16px;
    height: 16px;
    color: currentColor;
    transition: transform 200ms ease;
}

.ch2-nav__caret svg {
    width: 100%;
    height: 100%;
    display: block;
}

.ch2-nav__dropdown[data-open="true"] .ch2-nav__caret {
    transform: rotate(180deg);
}

.ch2-nav__dropdown-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: max-content;
    padding: 24px;
    background: var(--ch2-color-white);
    border: 1px solid var(--ch2-color-border-gray);
    box-shadow: var(--ch2-shadow-dropdown);
    border-radius: 10px;
    display: none;
    flex-direction: column;
    gap: 12px;
    z-index: 60;
}

.ch2-nav__dropdown[data-open="true"] .ch2-nav__dropdown-panel {
    display: flex;
}

.ch2-nav__dropdown-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    color: var(--ch2-color-text);
    text-decoration: none;
    white-space: nowrap;
}

.ch2-nav__dropdown-item:hover {
    color: var(--ch2-color-link-hover);
}

.ch2-nav__dropdown-divider {
    border-top: 1px solid var(--ch2-color-border-gray);
}

.ch2-nav__blog-link {
    padding-right: 32px;
    font-size: 16px;
    color: var(--ch2-color-text);
    text-decoration: none;
}

.ch2-nav__blog-link:hover {
    color: var(--ch2-color-link-hover);
}

/* Spacer so fixed nav doesn't cover page content */
.ch2-nav-spacer {
    height: calc(var(--ch2-nav-height) + 1px);
}

/* Mobile drawer */
.ch2-mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: var(--ch2-color-white);
    transform: translateX(100%);
    transition: transform 300ms ease-in-out;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.ch2-mobile-drawer[data-open="true"] {
    transform: translateX(0);
}

@media (min-width: 1024px) {
    .ch2-mobile-drawer { display: none; }
}

.ch2-mobile-drawer__header {
    position: relative;
    height: 60px;
    border-bottom: 1px solid var(--ch2-color-border-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ch2-mobile-drawer__close {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 70;
    height: 60px;
    width: 15%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    cursor: pointer;
    color: var(--ch2-color-text);
    line-height: 1;
}

.ch2-mobile-drawer__close-icon {
    width: 24px;
    height: 24px;
    display: block;
}

.ch2-mobile-drawer__logo img {
    height: 30px;
    width: auto;
    display: block;
}

.ch2-mobile-drawer__nav {
    padding: 4px 0 16px;
}

.ch2-mobile-section {
    border-bottom: 1px solid var(--ch2-color-border-gray);
}

.ch2-mobile-section__trigger {
    width: 100%;
    background: none;
    border: 0;
    text-align: left;
    padding: 18px 20px;
    font-size: 18px;
    font-weight: 420;
    color: var(--ch2-color-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-family: inherit;
}

.ch2-mobile-section__caret {
    display: inline-flex;
    align-items: center;
    width: 20px;
    height: 20px;
    color: currentColor;
    transition: transform 200ms ease;
}

.ch2-mobile-section__caret svg {
    width: 100%;
    height: 100%;
    display: block;
}

.ch2-mobile-section[data-open="true"] .ch2-mobile-section__caret {
    transform: rotate(180deg);
}

.ch2-mobile-section__list {
    list-style: none;
    margin: 0;
    padding: 0 20px 16px;
    display: none;
}

.ch2-mobile-section[data-open="true"] .ch2-mobile-section__list {
    display: block;
}

.ch2-mobile-section__item {
    padding: 0;
}

.ch2-mobile-section__item:not(:last-child) {
    border-bottom: 1px solid var(--ch2-color-border-gray);
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.ch2-mobile-section__link {
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    color: var(--ch2-color-text);
    text-decoration: none;
}

.ch2-mobile-section__link.is-active {
    font-weight: 420;
}

.ch2-mobile-blog-link {
    display: block;
    width: 100%;
    padding: 18px 20px;
    font-size: 18px;
    font-weight: 420;
    color: var(--ch2-color-text);
    text-decoration: none;
}

/* Lock body scroll when drawer open */
body.ch2-no-scroll {
    overflow: hidden;
}
