/**
 * Page Sub Navigation Bar Block - Frontend Styles
 * Based on Figma design: Sub Nav Bar component
 */

.page-sub-nav-bar-block {
    width: 100%;
    position: sticky;
    top: 5rem; /* Header height - stick below the header */
    z-index: 998; /* Below header z-index: 999 */
    background-color: var(--color-surface-muted);
}

@media (min-width: 871px) {
    body:has(.top-bar-nav) .page-sub-nav-bar-block {
        top: 7.5rem; /* Top bar (40px) + header (80px) */
    }
}

body:has(.hero-get-started-content) .page-sub-nav-bar-block {
  background-color: var(--color-surface-muted);
}

body:has(.page-sub-nav-bar-block) .hero-get-started-wrapper {
    padding-bottom: 2.5rem;
}

.page-sub-nav-bar-container {
    max-width: 108rem;
    margin: 0 auto;
    padding: 0 9.375rem;
    box-sizing: border-box;
    box-shadow: 0 0.25rem 0.5rem 0 rgba(48, 48, 48, 0.08);
}

.page-sub-nav-bar-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 5rem;
    width: 100%;
    position: relative;
    background-color: var(--color-surface-muted);
    
}

/* Chevron Icon - Hidden on desktop */
.page-sub-nav-bar-chevron {
    display: none;
}

/* Show chevrons when the list overflows (desktop/tablet only) */
@media (min-width: 768px) {
    .page-sub-nav-bar-block.page-sub-nav-bar-has-overflow .page-sub-nav-bar-chevron {
        display: flex;
    }
}

.page-sub-nav-bar-list {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-width: 0;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0.5rem 0.5rem;
    overflow: hidden;
}

/* Enable horizontal scrolling when the list overflows (desktop/tablet only) */
@media (min-width: 768px) {
    .page-sub-nav-bar-block.page-sub-nav-bar-has-overflow .page-sub-nav-bar-list {
        justify-content: flex-start;
        flex: 1;
        min-width: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
}

@media (min-width: 768px) {
    .page-sub-nav-bar-block.page-sub-nav-bar-has-overflow .page-sub-nav-bar-list::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
        background: transparent;
    }
}

/* Desktop/Tablet chevrons use the same visual style as mobile */
@media (min-width: 768px) {
    .page-sub-nav-bar-chevron {
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        flex-shrink: 0;
        margin-left: 0.5rem;
        background-color: transparent;
        border: none;
        cursor: pointer;
        padding: 0.5rem;
        border-radius: 50%;
        transition: background-color 0.2s ease, transform 0.2s ease;
        color: var(--color-primary-dark);
        outline: none;
    }

    .page-sub-nav-bar-chevron--left {
        margin-left: 0;
        margin-right: 0.5rem;
    }

    .page-sub-nav-bar-chevron--left svg {
        transform: rotate(180deg);
    }

    .page-sub-nav-bar-chevron svg {
        width: 1.5rem;
        height: 1.5rem;
        display: block;
    }

    .page-sub-nav-bar-chevron:hover {
        background-color: rgba(40, 50, 60, 0.1);
        transform: scale(1.1);
    }

    .page-sub-nav-bar-chevron:active {
        transform: scale(0.95);
        background-color: rgba(40, 50, 60, 0.15);
    }
}

.page-sub-nav-bar-item {
    margin: 0;
    padding: 0;
}

.page-sub-nav-bar-link {
    display: inline-block;
    padding: 1rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    line-height: 1.5rem;
    font-style: normal;
    color: var(--color-primary-dark);
    text-decoration: none;
    text-align: center;
    position: relative;
    transition: all 0.2s ease;
    white-space: nowrap;
    border-radius: 0.375rem;
    background-color: transparent;
    cursor: pointer;
}

/* Active state styling */
.page-sub-nav-bar-link.is-active {
    color: var(--color-primary-dark);
    background-color: white;
    padding: 1rem;
    border-radius: 0.5rem;
}

/* Hover state styling - only on devices that support hover, and when page is not scrolling */
@media (hover: hover) {
    .page-sub-nav-bar-block:not(.is-scrolling) .page-sub-nav-bar-link:hover {
        color: var(--color-primary-dark);
        background-color: white;
        padding: 1rem;
        border-radius: 0.5rem;
    }
}

.page-sub-nav-bar-link:focus-visible {
    position: relative;
    z-index: 2;
}

/* Active/Hover State Indicator - White background with shadow */
.page-sub-nav-bar-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-white);
    border-radius: 0.375rem;
    opacity: 0;
    transition: opacity 0.2s ease, box-shadow 0.2s ease;
    z-index: -1;
    pointer-events: none;
    box-shadow: 0 0.25rem 0.5rem 0 rgba(48, 48, 48, 0.08);
}

/* Active state indicator styling */
.page-sub-nav-bar-link.is-active::before {
    opacity: 1;
}

/* Hover state indicator styling - only on devices that support hover, and when page is not scrolling */
@media (hover: hover) {
    .page-sub-nav-bar-block:not(.is-scrolling) .page-sub-nav-bar-link:hover::before {
        opacity: 1;
    }
}

/* Bottom Rule */
.page-sub-nav-bar-rule {
    width: 100%;
    height: 0.0625rem;
    background-color: var(--color-gray-ui);
}

/* Block Alignment Support */
.page-sub-nav-bar-block.alignwide {
    max-width: 75rem;
    margin-left: auto;
    margin-right: auto;
}

.page-sub-nav-bar-block.alignwide .page-sub-nav-bar-container {
    max-width: 100%;
    padding: 0 9.375rem;
}

.page-sub-nav-bar-block.alignfull {
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.page-sub-nav-bar-block.alignfull .page-sub-nav-bar-container {
    max-width: 100%;
    padding: 0 9.375rem;
}

/* Fix for editor - prevent overflow */
.block-editor-block-list__layout .page-sub-nav-bar-block.alignfull,
.editor-styles-wrapper .page-sub-nav-bar-block.alignfull,
.wp-block-acf-page-sub-navigation-bar .page-sub-nav-bar-block.alignfull {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* Responsive Design */

/* Desktop - 1025px to 1280px */
@media (min-width: 1025px) and (max-width: 1280px) {
    
    
    .page-sub-nav-bar-container {
        padding: 0 5rem;
    }
    
    .page-sub-nav-bar-block.alignfull .page-sub-nav-bar-container {
        padding: 0 5rem;
    }

    .page-sub-nav-bar-block.alignwide .page-sub-nav-bar-container {
        padding: 0 5rem;
    }
}

/* Desktop - 1200px and below */
@media (max-width: 1200px) {
    
    .wp-block-heading.has-large-font-size {
        font-family: Outfit;
        font-weight: 400;
        font-size: 1.5rem !important;
        font-style: Regular;
        line-height: 2rem;
        letter-spacing: 0%;
        margin-top: 0.8em;
    }
    
    .page-sub-nav-bar-container {
        padding: 0 5rem;
    }
    
    .page-sub-nav-bar-block.alignfull .page-sub-nav-bar-container {
        padding: 0 5rem;
    }
    
    .page-sub-nav-bar-block.alignwide .page-sub-nav-bar-container {
        padding: 0 5rem;
    }
}

/* Tablet - 768px to 870px */
@media (min-width: 768px) and (max-width: 870px) {
    .page-sub-nav-bar-block {
        top: 3rem;
    }
    
    .page-sub-nav-bar-container {
        padding: 0 2rem;
    }
    
    .page-sub-nav-bar-block.alignfull .page-sub-nav-bar-container {
        padding: 0 2rem;
    }

    .page-sub-nav-bar-block.alignwide .page-sub-nav-bar-container {
        padding: 0 2rem;
    }
    
    .page-sub-nav-bar-list {
        gap: 2rem;
    }
    
    .page-sub-nav-bar-link {
        font-size: 1rem;
    }
}

/* Tablet - 871px to 1024px */
@media (min-width: 871px) and (max-width: 1024px) {
    .page-sub-nav-bar-block {
        top: 5rem;
    }

    body:has(.top-bar-nav) .page-sub-nav-bar-block {
        top: 7.5rem;
    }

    .page-sub-nav-bar-container {
        padding: 0 3.125rem;
    }

    .page-sub-nav-bar-block.alignfull .page-sub-nav-bar-container {
        padding: 0 3.125rem;
    }

    .page-sub-nav-bar-block.alignwide .page-sub-nav-bar-container {
        padding: 0 3.125rem;
    }

    .page-sub-nav-bar-list {
        gap: 2rem;
    }

    .page-sub-nav-bar-link {
        font-size: 1rem;
    }
}

/* Mobile - 767.98px and below */
@media (max-width: 767.98px) {
    .page-sub-nav-bar-block {
        top: 3rem; /* Mobile header height - stick below the header */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox - hide scrollbar */
        -ms-overflow-style: none; /* IE and Edge - hide scrollbar */
        scrollbar-color: transparent transparent; /* Firefox - make scrollbar transparent */
    }
    
    /* Hide scrollbar for Chrome, Safari, Opera */
    .page-sub-nav-bar-block::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
        background: transparent;
    }
    
    .page-sub-nav-bar-block::-webkit-scrollbar-track {
        display: none;
        background: transparent;
    }
    
    .page-sub-nav-bar-block::-webkit-scrollbar-thumb {
        display: none;
        background: transparent;
    }
    
    .page-sub-nav-bar-container {
        padding: 0 1rem;
    }
    
    .page-sub-nav-bar-block.alignfull .page-sub-nav-bar-container {
        padding: 0 1rem;
    }
    
    .page-sub-nav-bar-block.alignwide .page-sub-nav-bar-container {
        padding: 0 1rem;
    }
    
    .page-sub-nav-bar-wrapper {
        height: 5rem;
        position: relative;
        display: flex;
        align-items: center;
        padding-left: 0.625rem;
    }
    
    .page-sub-nav-bar-list {
        gap: 2rem;
        justify-content: flex-start;
        padding: 0.5rem 0.5rem;
        flex: 1;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox - hide scrollbar */
        -ms-overflow-style: none; /* IE and Edge - hide scrollbar */
    }
    
    /* Hide scrollbar on the list as well */
    .page-sub-nav-bar-list::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
        background: transparent;
    }
    
    .page-sub-nav-bar-list::-webkit-scrollbar-track {
        display: none;
        background: transparent;
    }
    
    .page-sub-nav-bar-list::-webkit-scrollbar-thumb {
        display: none;
        background: transparent;
    }
    
    .page-sub-nav-bar-link {
        font-size: 1rem;
        padding: 1rem;
    }
    
    .page-sub-nav-bar-link::before {
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        height: auto;
        width: auto;
        transform: none;
        border-radius: 0.375rem;
    }
    
    /* Mobile Chevron Icon - Clickable Button */
    .page-sub-nav-bar-chevron {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        flex-shrink: 0;
        margin-left: 0.5rem;
        background-color: transparent;
        border: none;
        cursor: pointer;
        padding: 0.5rem;
        border-radius: 50%;
        transition: background-color 0.2s ease, transform 0.2s ease;
        color: var(--color-primary-dark);
        outline: none;
    }

    .page-sub-nav-bar-chevron--left {
        margin-left: 0;
        margin-right: 0.5rem;
    }

    .page-sub-nav-bar-chevron--left svg {
        transform: rotate(180deg);
    }
    
    .page-sub-nav-bar-chevron:hover {
        background-color: rgba(40, 50, 60, 0.1);
        transform: scale(1.1);
    }
    
    .page-sub-nav-bar-chevron:active {
        transform: scale(0.95);
        background-color: rgba(40, 50, 60, 0.15);
    }
    
    .page-sub-nav-bar-chevron svg {
        width: 1.5rem;
        height: 1.5rem;
        display: block;
    }
}

@media (min-width: 1541px) {
    .page-sub-nav-bar-container,
    .page-sub-nav-bar-block.alignfull .page-sub-nav-bar-container,
    .page-sub-nav-bar-block.alignwide .page-sub-nav-bar-container {
        padding-left: clamp(6rem, 15.046vw, 16.25rem);
        padding-right: clamp(6rem, 15.046vw, 16.25rem);
    }
}

/* Small Mobile - 480px and below */
@media (max-width: 480px) {
    
    
    .page-sub-nav-bar-list {
        gap: 1rem;
    }
    
    .page-sub-nav-bar-link {
        font-size: 1rem;
    }
}

/* Smooth scroll behavior for anchor links */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 12.5rem; /* Header (80px) + Nav Bar (80px) + 40px padding */
}

/* Add scroll margin to anchor targets to prevent covering by sticky nav */
[id] {
    scroll-margin-top: 12.5rem; /* Header (80px) + Nav Bar (80px) + 40px padding */
}

/* Tablet scroll padding - 768px to 870px */
@media (min-width: 768px) and (max-width: 870px) {
    html {
        scroll-padding-top: 10.5rem; /* Tablet Header (48px) + Nav Bar (80px) + 40px padding */
    }
    
    [id] {
        scroll-margin-top: 10.5rem; /* Tablet Header (48px) + Nav Bar (80px) + 40px padding */
    }
}

/* Tablet scroll padding - 871px to 1024px */
@media (min-width: 871px) and (max-width: 1024px) {
    html {
        scroll-padding-top: 12.5rem; /* Header (80px) + Nav Bar (80px) + 40px padding */
    }

    [id] {
        scroll-margin-top: 12.5rem; /* Header (80px) + Nav Bar (80px) + 40px padding */
    }
}

/* Mobile scroll padding */
@media (max-width: 767.98px) {
    html {
        scroll-padding-top: 6.5rem !important; /* Mobile header + sub-nav + minimal breathing room */
    }
    
    [id] {
        scroll-margin-top: 6.5rem !important; /* Mobile header + sub-nav + minimal breathing room */
    }
    
    /* Ensure headings are fully visible on mobile */
    h1[id],
    h2[id],
    h3[id],
    h4[id],
    h5[id],
    h6[id] {
        scroll-margin-top: 6.5rem !important;
        padding-top: 6.5rem !important; /* Create anchor space above heading */
        margin-top: -6.5rem !important; /* Pull content back up so layout doesn't shift */
        position: relative;
        z-index: 1;
    }
    
    /* For sections/divs with IDs - ensure first heading inside is visible */
    section[id],
    div[id] {
        scroll-margin-top: 6.5rem !important;
        position: relative;
        overflow: hidden;
    }
    
    /* Ensure first heading in sections is visible with proper spacing */
    section[id] > h1:first-child,
    section[id] > h2:first-child,
    section[id] > h3:first-child,
    section[id] > h4:first-child,
    section[id] > h5:first-child,
    section[id] > h6:first-child {
        padding-top: 6.5rem !important; /* Create anchor space above heading */
        margin-top: -6.5rem !important; /* Pull content back up */
        position: relative;
        z-index: 1;
    }
}

/* Print styles */
@media print {
    .page-sub-nav-bar-block {
        display: none;
    }
}
/* Disable sticky for extreme reflow / 400% zoom */
@media screen and (max-width: 480px) and (max-height: 300px) {
    .page-sub-nav-bar-block {
        position: relative !important;
        top: auto !important;
    }
}
