/**
 * Topmost Bar Block
 *
 * @package KeyfactorTheme\Blocks
 */

/* ==========================================================================
   Layout
   ========================================================================== */

.topmost-bar {
    width: 100%;

    min-height: 40px;

    margin-bottom: 20px;
}

.topmost-bar + .kf-nav + #main-content {
    margin-top: -20px;
}

.topmost-bar__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 8px 0;
    margin: 0 auto;
}

.topmost-bar__inner::before {  
    content: "";  
    flex: 1; /* Acts as a spacer on the left */
}

/* ---------- Content (text + link) ---------- */

.topmost-bar__content {
    display: flex;
    align-items: center;
    gap: 3px 8px;
    flex-shrink: 0;
}

.topmost-bar__text {
    font-weight: 400;
    font-size: clamp(14px, 13.27px + 0.23vw, 16px);
    line-height: 1.28;
}

.topmost-bar__link {
    font-family: "degular-variable", sans-serif;
    /* font-weight: 500; */
    font-size: clamp(14px, 13.27px + 0.23vw, 16px);
    line-height: 100%;
    /* letter-spacing: 0%; */
    

    color: inherit;
    transition: opacity 0.2s ease;
}

.topmost-bar__link svg {
    display: inline-block;
    top: -.08em;
    right: -.2em;
    position: relative;

    transition: transform 0.2s ease;
}

.topmost-bar__link:hover,
.topmost-bar__link:focus {
    opacity: 0.8;
}

.topmost-bar__link:hover svg,
.topmost-bar__link:focus svg {
    transform: translateX(4px);
}

/* ---------- SVG separator ---------- */

.topmost-bar__separator {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 0;

    margin: 0 8px;
}

.topmost-bar__separator svg {
    display: block;
}

/* ---------- Language selector wrapper ---------- */

.topmost-bar__language {
    flex-shrink: 0;
    position: relative;
    margin-left: auto;

    flex: 1;
    text-align: right;
}

/* ==========================================================================
   Weglot language dropdown – custom styling
   ========================================================================== */

/* Container reset */
.topmost-bar__language .country-selector.weglot-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    outline: none;
}

/* Visually-hidden checkbox (preserves click toggle) */
.topmost-bar__language .weglot-dropdown .weglot_choice {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Current-language label */
.topmost-bar__language .weglot-dropdown .wgcurrent {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: inherit;
    font-size: 14px;
    line-height: 1;
    padding: 4px 0;
    white-space: nowrap;
    user-select: none;
}

/* ▼ Triangle arrow */
.topmost-bar__language .weglot-dropdown .wgcurrent::after {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

/* ---------- Dropdown list (tooltip balloon) ---------- */

.topmost-bar__language .weglot-dropdown ul {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    margin: 0;
    padding: 8px 0;
    background-color: #ffffff;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    list-style: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity 0.25s ease,
        transform 0.25s ease,
        visibility 0.25s ease;
    min-width: 140px;
    z-index: 99999;

    text-align: center;
}

/* Balloon caret (▲ pointing up) */
.topmost-bar__language .weglot-dropdown ul::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid #ffffff;
    pointer-events: none;
}

/* Invisible hover bridge – covers the gap between label and dropdown */
.topmost-bar__language .weglot-dropdown ul::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    height: 16px; /* slightly larger than the 10px gap to be safe */
}

/* ---------- Open states ---------- */

/* Hover – desktop only */
@media (hover: hover) {
    .topmost-bar__language .weglot-dropdown:hover ul {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(-50%) translateY(0);
    }

    .topmost-bar__language .weglot-dropdown:hover .wgcurrent::after {
        transform: rotate(180deg);
    }
}

/* Focus / focus-within – keyboard & assistive tech */
.topmost-bar__language .weglot-dropdown:focus ul,
.topmost-bar__language .weglot-dropdown:focus-within ul {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.topmost-bar__language .weglot-dropdown:focus .wgcurrent::after,
.topmost-bar__language .weglot-dropdown:focus-within .wgcurrent::after {
    transform: rotate(180deg);
}

/* Checkbox toggle – click / tap */
.topmost-bar__language .weglot-dropdown .weglot_choice:checked ~ ul {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.topmost-bar__language .weglot-dropdown .weglot_choice:checked ~ .wgcurrent::after {
    transform: rotate(180deg);
}

/* ---------- List items ---------- */

.topmost-bar__language .weglot-dropdown ul li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.topmost-bar__language .weglot-dropdown ul li a {
    display: block;
    padding: 6px 16px;
    color: #333333;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
    transition: background-color 0.15s ease;
}

.topmost-bar__language .weglot-dropdown ul li a:hover,
.topmost-bar__language .weglot-dropdown ul li a:focus {
    background-color: #f5f5f5;
    color: #1a1a1a;
}

@media (max-width: 1400px) {
    .topmost-bar__language .weglot-dropdown ul {
        min-width: 100px;
    }
    
    .topmost-bar__language .weglot-dropdown ul {
        transform: translateX(-77%) translateY(0);
    }

    .topmost-bar__language .weglot-dropdown ul::before {
        left: 77%;
    }
}

@media (max-width: 1023px) {
    .topmost-bar__inner::before {
        display: none;
    }

    .topmost-bar__language {
        flex: auto;
    }

    .topmost-bar__inner {
        flex-wrap: wrap;
    }
}

@media (max-width: 767px) {

    .topmost-bar__language {
        display: none;
    }

    .topmost-bar__content {
        flex-wrap: wrap;
        flex-shrink: 1;
    }

    .topmost-bar__separator {
        display: none;
    }
}