/* The service bar on the kids site (Views/Shared/_ServiceBar.cshtml, IA-PLAN section 7): a 34px strip of soft sky
   glass above the header, Islamic Portal Kids as a grape pill, the website's services as quiet links. It takes the
   place of the old back-to-islamicportal.com strip (.sg-mainsite), hidden here while the bar is on the page. On the
   Discovery World map it floats above the sky in the 34px the floating header already leaves for it. */

.k-svc {
    --svc-glass: rgba(255, 255, 255, .5);
    --svc-edge: rgba(255, 255, 255, .75);
    --svc-ink: var(--ink-soft, #554B86);
    --svc-hover: rgba(255, 255, 255, .7);
    --svc-pill: linear-gradient(135deg, #8D72F0 0%, #6E54E0 100%);
    --svc-pill-ink: #FFFFFF;
    --svc-rule: rgba(120, 96, 200, .22);
    position: relative;
    z-index: 62;
    background: var(--svc-glass);
    box-shadow: 0 1px 0 var(--svc-edge) inset, 0 -1px 0 rgba(120, 96, 200, .12) inset;
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    backdrop-filter: blur(14px) saturate(1.3);
    color: var(--svc-ink);
    font-family: var(--font-body, system-ui, sans-serif);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
}
:root[data-theme="dark"] .k-svc {
    --svc-glass: rgba(30, 26, 78, .55);
    --svc-edge: rgba(255, 255, 255, .1);
    --svc-ink: var(--ink-soft, #E3D8FF);
    --svc-hover: rgba(255, 255, 255, .1);
    --svc-pill: linear-gradient(135deg, #9C84FF 0%, #6E54E0 100%);
    --svc-rule: rgba(255, 255, 255, .16);
}

/* The bar replaces the old strip. */
.k-svc ~ .sg-mainsite {
    display: none;
}
/* Discovery World: the header floats over the sky and leaves the top 34px to this bar. */
body.page-world .k-svc {
    position: absolute;
    inset-inline: 0;
    top: 0;
}
/* The Learning Hub (LH1): the bar above Learn's own in the Learn shell, a little more solid on the plain page, scrolling
   away so Learn's sticky bar still sticks at the top. --ln-above tells Learn how much sits above its bar at the top of
   the page (its offline note and its phone menu allow for it). */
.ln-shell:has(> .k-svc) {
    --ln-above: 34px;
}
.ln-shell .k-svc {
    --svc-glass: rgba(255, 255, 255, .72);
    box-shadow: 0 1px 0 var(--svc-edge) inset, 0 -1px 0 rgba(120, 96, 200, .16) inset;
}
:root[data-theme="dark"] .ln-shell .k-svc {
    --svc-glass: rgba(30, 26, 78, .7);
}
.ln-shell .k-svc *,
.ln-shell .k-svc *::before,
.ln-shell .k-svc *::after {
    box-sizing: border-box;
}

.k-svc-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding-inline: var(--gutter, 16px);
}
/* Centred on every site. On phones the strip fills the row and scrolls, so the items centre with auto margins: they
   collapse to 0 when the strip overflows, and the first item stays reachable (justify-content would cut it off). */
.k-svc-item:first-child {
    margin-inline-start: auto;
}
.k-svc-item:last-child {
    margin-inline-end: auto;
}
.k-svc-list {
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}
.k-svc-item {
    display: flex;
    flex: none;
}
.k-svc-item--masjid {
    margin-inline-start: 6px;
    padding-inline-start: 8px;
    border-inline-start: 1.5px solid var(--svc-rule);
}

.k-svc-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding-inline: 10px;
    border-radius: 999px;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}
.k-svc-link:hover {
    background: var(--svc-hover);
    color: var(--ink, #2B2350);
}
.k-svc-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2.5px var(--grape-deep, #5B3FD0) inset;
}
:root[data-theme="dark"] .k-svc-link:focus-visible {
    box-shadow: 0 0 0 2.5px #FFC84A inset;
}
.k-svc-icon {
    flex: none;
    width: 15px;
    height: 15px;
}
.k-svc-short {
    display: none;
}
.k-svc-chev {
    width: 11px;
    height: 11px;
    transition: transform .2s ease;
}
.k-svc-link[aria-expanded="true"] .k-svc-chev {
    transform: rotate(180deg);
}

.k-svc-item.is-current .k-svc-link {
    background: var(--svc-pill);
    color: var(--svc-pill-ink);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14), 0 4px 10px -4px rgba(91, 63, 208, .6);
    font-weight: 700;
}
.k-svc-item.is-current .k-svc-link:focus-visible {
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14), 0 0 0 2.5px #FFC84A inset;
}

/* "Coming soon" on the bar itself, for the items in ServiceBar:ComingSoon (production only): a sunny tag with a
   softly pulsing dot. */
.k-svc-badge {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 4px;
    height: 17px;
    margin-inline-start: 2px;
    padding-inline: 6px 8px;
    border-radius: 999px;
    background: var(--sun-soft, #FFF3CF);
    box-shadow: 0 0 0 1px rgba(214, 152, 20, .35) inset;
    color: #8A5A00;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .02em;
    line-height: 1;
}
.k-svc-badge::before {
    content: "";
    flex: none;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #E0A31A;
    animation: k-svc-soon 2.4s ease-out infinite;
}
@keyframes k-svc-soon {
    0% {
        box-shadow: 0 0 0 0 rgba(224, 163, 26, .55);
    }
    70%,
    100% {
        box-shadow: 0 0 0 5px rgba(224, 163, 26, 0);
    }
}
.k-svc-badge-short {
    display: none;
}
:root[data-theme="dark"] .k-svc-badge {
    background: rgba(255, 201, 77, .16);
    box-shadow: 0 0 0 1px rgba(255, 216, 115, .35) inset;
    color: #FFD873;
}

/* ---------- The menus (Masjid Services, Household Devices) ---------- */

.k-svc-menu {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-start: var(--svc-menu-x, 12px);
    width: min(370px, calc(100vw - 24px));
    padding: 6px;
    border-radius: 20px;
    background: var(--paper, #FFFFFF);
    box-shadow: var(--shadow-l, 0 34px 64px -28px rgba(76, 52, 150, .6));
    color: var(--ink, #2B2350);
    font-size: 14px;
    line-height: 1.3;
    animation: k-svc-drop .25s var(--ease-soft, ease) both;
}
.k-svc-menu[hidden] {
    display: none;
}
@keyframes k-svc-drop {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(.97);
    }
}
.k-svc-menu-list {
    display: grid;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.k-svc-menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 14px;
    color: inherit;
    text-decoration: none;
}
.k-svc-menu-link:hover,
.k-svc-menu-link:focus-visible {
    background: var(--grape-soft, #EFE8FF);
}
.k-svc-menu-link:focus-visible,
.k-svc-menu-all:focus-visible {
    outline: 3px solid var(--grape, #8D72F0);
    outline-offset: -3px;
}
.k-svc-menu-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: var(--mint-soft, #DDF8EE);
    color: var(--mint-deep, #147559);
}
:root[data-theme="dark"] .k-svc-menu-icon {
    color: #7EE3C3;
}
.k-svc-menu-svg {
    width: 22px;
    height: 22px;
}
.k-svc-menu-text {
    display: grid;
    flex: 1 1 auto;
    gap: 2px;
    min-width: 0;
}
.k-svc-menu-text b {
    font-family: var(--font-display, inherit);
    font-weight: 700;
}
.k-svc-menu-text small {
    color: var(--ink-faint, #6B6396);
    font-size: 12.5px;
}
.k-svc-soon {
    flex: none;
    align-self: flex-start;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--sun-soft, #FFF3CF);
    color: #8A5A00;
    font-size: 11px;
    font-weight: 800;
}
:root[data-theme="dark"] .k-svc-soon {
    color: #FFD873;
}
.k-svc-menu-all {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
    padding: 10px 12px;
    border-top: 1.5px solid var(--line, rgba(120, 96, 200, .16));
    color: var(--grape-deep, #5B3FD0);
    font-weight: 700;
    text-decoration: none;
}
:root[data-theme="dark"] .k-svc-menu-all {
    color: #CBBBFF;
}
.k-svc-menu-all svg {
    flex: none;
    width: 16px;
    height: 16px;
}
:root[dir="rtl"] .k-svc-menu-all svg {
    transform: scaleX(-1);
}

/* ---------- Narrower screens ---------- */

/* The bar's "Coming soon" tags say "Soon" below 1400 px, so the row still fits. */
@media (max-width: 1399.98px) {
    .k-svc-badge-full {
        display: none;
    }
    .k-svc-badge-short {
        display: inline;
    }
}

@media (max-width: 991.98px) {
    .k-svc-full {
        display: none;
    }
    .k-svc-short {
        display: inline;
    }
}

/* Wherever the row is wider than the screen, the strip scrolls sideways and its edges fade where there is more. */
.k-svc-list {
    min-width: 0;
    margin-block: -4px; /* room for the pill's shadow inside the scroller */
    padding-block: 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}
.k-svc-list::-webkit-scrollbar {
    display: none;
}
.k-svc-list.has-after {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
}
.k-svc-list.has-before {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px);
    mask-image: linear-gradient(90deg, transparent, #000 36px);
}
.k-svc-list.has-before.has-after {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent);
}
:root[dir="rtl"] .k-svc-list.has-after:not(.has-before) {
    -webkit-mask-image: linear-gradient(-90deg, #000 calc(100% - 36px), transparent);
    mask-image: linear-gradient(-90deg, #000 calc(100% - 36px), transparent);
}
:root[dir="rtl"] .k-svc-list.has-before:not(.has-after) {
    -webkit-mask-image: linear-gradient(-90deg, transparent, #000 36px);
    mask-image: linear-gradient(-90deg, transparent, #000 36px);
}


@media (max-width: 767.98px) {
    .k-svc-inner {
        padding-inline: 0;
    }
    .k-svc-list {
        flex: 1 1 auto;
        padding-inline: 8px;
    }
    .k-svc-menu {
        inset-inline: 8px;
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .k-svc-link,
    .k-svc-chev {
        transition: none;
    }
    .k-svc-menu,
    .k-svc-badge::before {
        animation: none;
    }
}

@media print {
    .k-svc {
        display: none !important;
    }
}
