.rcsh-masthead {
    background: linear-gradient(125deg, #113d53 0 43%, #062838 43% 100%);
    padding: 8px max(4vw, calc((100vw - 1440px) / 2));
    gap: 12px 28px;
}
.rcsh-masthead .official-brand {
    display: flex;
    align-items: center;
    gap: clamp(10px, 2vw, 24px);
}
.rcsh-masthead .official-logo {
    width: clamp(55px, 6.5vw, 96px);
    height: auto;
    object-fit: contain;
}
.rcsh-masthead .official-brand strong {
    font-size: clamp(16px, 1.6vw, 24px);
    line-height: 1.2;
}
.rcsh-brand-name small {
    display: block;
    max-width: 43ch;
    margin-top: 3px;
    font-size: clamp(12px, 1.15vw, 16px);
    line-height: 1.18;
}
.rcsh-masthead .central-contact a {
    color: #fff;
    display: inline-block;
    font-size: calc(clamp(22px, 2.5vw, 38px) - 2pt);
    font-weight: 750;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}
.rcsh-masthead .central-contact a:hover { text-decoration: underline; }
#site-menu { background: #10384d; min-height: 56px; padding-block: 6px; }
#site-menu a[aria-current="page"],
#site-menu > .mod-menu > li.active > button.rcsh-menu-group {
    background: #ff7900;
    border-radius: 6px;
    color: #102638;
    font-weight: 750;
    text-decoration: none;
}
#site-menu a[aria-current="page"] {
    display: inline-block;
    padding: 3px 18px;
}
main.rcsh-home { max-width: none !important; padding: 0 0 48px !important; background: #f1f6fb; }
.rcsh-home .portal-grid {
    max-width: 1520px;
    margin: auto;
    padding: clamp(20px, 3vw, 44px) 3.4vw 0;
}
.rcsh-home .portal-side:empty, .rcsh-home .quick:empty { display: none; }
.rcsh-home .portal-grid:not(:has(.portal-side:not(:empty))) { grid-template-columns: minmax(0, 1fr); }
.rcsh-home .hero {
    background-color: #072637;
    border-bottom: 0;
    isolation: isolate;
    min-height: clamp(310px, 29.2vw, 600px);
    overflow: hidden;
    padding: clamp(30px, 3vw, 64px) max(6vw, calc((100vw - 1440px) / 2));
    position: relative;
}
.rcsh-hero-photo {
    background-image: url('../images/brand/home-reference.png');
    background-position: right 22.5%;
    background-repeat: no-repeat;
    background-size: 174.2% 266.7%;
    inset: 0 0 0 40%;
    position: absolute;
    z-index: -2;
}
.rcsh-home .hero:has(.rcsh-hero-photo)::before {
    background: linear-gradient(90deg, #072637 32%, #072637eb 42%, transparent 65%);
    content: '';
    inset: 0;
    position: absolute;
    z-index: -1;
}
.rcsh-home .hero h1 {
    color: #fff;
    font-size: clamp(30px, 2.8vw, 62px);
    line-height: 1.04;
    margin: 0 0 12px;
    max-width: min(100%, 550px);
}
.rcsh-home .hero p {
    font-size: clamp(16px, 1.35vw, 23px);
    line-height: 1.25;
    margin: 0;
    max-width: 49ch;
}
@media (min-width: 768px) {
    .rcsh-home .hero { justify-content: flex-start; }
    .rcsh-home .hero:has(.rcsh-hero-photo) h1 { border-left: 6px solid #ff7900; padding-left: 16px; }
    .rcsh-home .hero:has(.rcsh-hero-photo) p { margin-left: 22px; }
}
@media (max-width: 767px) {
    .rcsh-masthead { padding-block: 12px; }
    .rcsh-hero-photo { inset: 0; opacity: .42; }
    .rcsh-home .hero:has(.rcsh-hero-photo)::before {
        background: linear-gradient(90deg, #072637ed, #07263766);
    }
}

.rcsh-home .hero:has(.rcsh-hero-photo) { background-image: none; }


/* Homepage navigation */
.quick:has(.rcsh-directory) { display: block; margin: 0 0 2rem; }
.rcsh-directory nav, .rcsh-directory-cards {
    display: grid;
    gap: .65rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr));
    margin-bottom: 1rem;
}
.rcsh-directory nav {
    background: #f5f9fd;
    border-radius: 12px;
    box-shadow: 0 6px 18px #102c491a;
    padding: .65rem;
}
.rcsh-directory nav a { background: #f5f9fd; color: #102c49; }
.rcsh-directory-cards a { background: #0b3448; color: #fff; min-height: 6rem; align-content: center; }
.rcsh-directory-news { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.rcsh-directory-news h2 { margin: 0; }
.rcsh-directory-news a { background: transparent; border: 0; color: #8e4200; padding: .4rem; }


/* Joomla main menu */
#site-menu { column-gap: 1rem; row-gap: .25rem; }
#site-menu > .mod-menu { align-items: center; column-gap: clamp(.45rem, 1vw, 1rem); row-gap: 0; }
#site-menu .mod-menu__toggle-sub {
    align-items: center;
    background: transparent;
    border: 0;
    color: inherit;
    display: inline-flex;
    justify-content: center;
    min-height: 44px;
    padding: 0;
    vertical-align: middle;
    width: 32px;
    cursor: pointer;
}
#site-menu .mod-menu__toggle-sub .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
#site-menu .mod-menu__toggle-sub::after {
    content: '';
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    width: .45rem;
    height: .45rem;
    transform: translateY(-2px) rotate(45deg);
}
#site-menu .mod-menu__toggle-sub[aria-expanded="true"]::after {
    transform: translateY(2px) rotate(225deg);
}
#site-menu .mod-menu__sub[aria-hidden="true"] { display: none; }
#site-menu .mod-menu__sub {
    background: #10384d;
    border-radius: 0 0 .45rem .45rem;
    margin: 0;
    padding: .25rem .5rem;
}
#site-menu .mod-menu__sub a { display: block; padding: .5rem; }
#site-menu .mod-menu__sub a:hover, #site-menu .mod-menu__sub a:focus-visible { background: #205169; }
#site-menu form { min-width: 0; }
#site-menu input { max-width: 100%; }
@media (min-width: 768px) {
    #site-menu > .mod-menu > li { align-self: stretch; }
    #site-menu .mod-menu__sub {
        position: absolute;
        inset-block-start: 100%;
        inset-inline-start: 0;
        width: 15rem;
        max-width: calc(100vw - 2rem);
        box-shadow: 0 8px 20px #071c2b40;
        z-index: 10;
    }
    #site-menu > .mod-menu > li:nth-last-child(-n+3) > .mod-menu__sub {
        inset-inline-start: auto;
        inset-inline-end: 0;
    }
}
@media (max-width: 767px) {
    #site-menu:not([hidden]) { display: block; padding-block: .5rem; }
    #site-menu > .mod-menu { display: block; }
    #site-menu > .mod-menu > li { min-height: 44px; }
    #site-menu .mod-menu__toggle-sub { width: 44px; }
    #site-menu .mod-menu__sub { margin-inline-start: .75rem; border-inline-start: 2px solid #ff7900; }
}


/* Search beside the main navigation */
#site-menu .mod-finder { width: min(15rem, 100%); min-width: 0; margin: 0 0 0 auto; }
#site-menu .mod-finder .visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
#site-menu .mod-finder__search { position: relative; }
#site-menu .mod-finder .awesomplete { display: block; width: 100%; }
#site-menu .mod-finder input[name="q"] {
    width: 100%; min-height: 44px; padding: .5rem 3rem .5rem .8rem;
    border: 1px solid #c4d6e7; border-radius: .5rem;
    background: #fff; color: #102c49; font: inherit;
}
#site-menu .mod-finder button[type="submit"] {
    position: absolute; inset-block: 2px; inset-inline-end: 2px;
    width: 42px; min-height: 0; padding: 0; border: 0; border-radius: .375rem;
    background: #fff; color: #102c49; font-size: 0; cursor: pointer;
}
#site-menu .mod-finder button[type="submit"]:hover { background: #e7eef5; }
#site-menu .mod-finder .icon-search { display: none; }
#site-menu .mod-finder button[type="submit"]::before {
    content: ''; position: absolute; top: calc(50% - 8px); left: 12px;
    width: 14px; height: 14px; border: 2px solid currentColor; border-radius: 50%;
}
#site-menu .mod-finder button[type="submit"]::after {
    content: ''; position: absolute; top: calc(50% + 4px); left: 23px;
    width: 8px; height: 2px; border-radius: 1px; background: currentColor;
    transform: rotate(45deg); transform-origin: left center;
}
@media (max-width: 480px) {
    #site-menu .mod-finder { width: 100%; }
}


/* The quick-link button replaces the standalone cooperation card. */
.rcsh-home .portal-grid > div:has(> .quick .rcsh-cooperation-link) > .rcsh-partner {
    display: none;
}

.rcsh-masthead { justify-content: space-between; }
.rcsh-masthead .central-contact { margin-inline-start: auto; }
@media (min-width: 768px) {
    .rcsh-masthead, #site-menu { padding-inline-end: clamp(1rem, 2vw, 2rem); }
    #site-menu > search { flex: 0 1 clamp(10rem, 14vw, 15rem); min-width: 0; margin-inline-start: auto; }
    #site-menu > search .mod-finder { width: 100%; }
}
@media (max-width: 767px) {
    #site-menu .mod-finder { margin-top: .5rem; }
}
@media (min-width: 1024px) {
    .rcsh-home .hero .rcsh-hero-title > span { display: block; }
}


/* Language dropdown above the telephone */
.rcsh-masthead .rcsh-header-contact {
    display: flex; flex-direction: column; align-items: flex-end;
    gap: .35rem; margin-inline-start: auto; max-width: 100%;
}
.rcsh-masthead .rcsh-header-contact .central-contact { margin: 0; }
.rcsh-masthead .mod-languages { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .3rem .55rem; font-size: .85rem; }
.rcsh-masthead .mod-languages p { margin: 0; }
.rcsh-masthead .mod-languages > .visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.rcsh-masthead .mod-languages__select { position: relative; }
.rcsh-masthead .mod-languages__select > button {
    background: #10384d; color: #fff; border: 1px solid #a6c1d1;
    border-radius: .4rem; padding: .25rem .65rem; min-height: 36px; cursor: pointer;
}
.rcsh-masthead .mod-languages__pretext { display: none; }
.rcsh-masthead .mod-languages::before {
    content: '';
    flex: 0 0 1.5rem;
    height: 1.5rem;
    background: url('../images/brand/language-picker.png') center / contain no-repeat;
    filter: grayscale(1) invert(1) brightness(2);
}
.rcsh-masthead .mod-languages__select > button::after {
    content: ' ▾'; margin-inline-start: .2rem;
}
.rcsh-masthead .mod-languages__select .dropdown-menu {
    position: absolute; inset-inline-end: 0; inset-block-start: 100%; z-index: 20;
    display: none; width: max-content; max-width: calc(100vw - 2rem);
    list-style: none; padding: .25rem; margin: 0; border-radius: .35rem;
    background: #10384d; box-shadow: 0 6px 15px #071c2b50;
}
.rcsh-masthead .mod-languages__select .dropdown-menu.show { display: block; }
.rcsh-masthead .mod-languages__select .dropdown-menu a { display: block; color: #fff; padding: .5rem; text-decoration: none; }
.rcsh-masthead .mod-languages__select .dropdown-menu a:hover,
.rcsh-masthead .mod-languages__select .dropdown-menu a:focus-visible,
.rcsh-masthead .mod-languages__select .dropdown-menu .lang-active a { background: #205169; }
body ._access-icon._access { background-color: #10384d !important; border-radius: 0 .5rem .5rem 0; }

/* The common Home link already routes to the current language. */
#site-menu > .mod-menu:has(> .item-101) > :is(.item-121,.item-122,.item-123) { display: none; }
body:has(main.rcsh-home) #site-menu > .mod-menu > .item-101 > a {
    background: #ff7900; border-radius: 6px; color: #102638;
    display: inline-block; font-weight: 750; padding: 3px 18px; text-decoration: none;
}


/* Hide Joomla’s article metadata on public article and blog views. */
main dl.article-info { display: none; }


/* Automatic homepage news cards */
.rcsh-home .mod-articles-items {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    gap: 1rem; padding: 0; margin: 0; list-style: none;
}
.rcsh-home .mod-articles-items > li { min-width: 0; display: flex; }
.rcsh-home .mod-articles-item {
    display: flex; flex-direction: column; width: 100%; padding: 0;
    border: 1px solid #c4d6e7; border-radius: .8rem; overflow: hidden;
    background: #fff; box-shadow: 0 5px 18px #102c4910;
}
.rcsh-home .mod-articles-item:hover, .rcsh-home .mod-articles-item:focus-within { border-color: #ea790e; }
.rcsh-home .mod-articles-item:not(:has(img))::before {
    content: ''; display: block; flex: none; aspect-ratio: 16 / 9;
    background: #123b50 var(--news-cover, linear-gradient(135deg, #0a2738, #24617d)) center / cover no-repeat;
    border-bottom: 3px solid #ff7900;
}
.rcsh-home .mod-articles-item img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.rcsh-home .mod-articles-item-content { display: flex; flex: 1; flex-direction: column; padding: 1rem 1.1rem; }
.rcsh-home .mod-articles-title { margin: 0 0 .55rem; font-size: clamp(1.03rem, 1.45vw, 1.25rem); line-height: 1.22; }
.rcsh-home .mod-articles-title a { color: #102c49; text-decoration: none; }
.rcsh-home .mod-articles-title a:hover { text-decoration: underline; }
.rcsh-home .mod-articles-item-content > p { margin: 0 0 .55rem; font-size: .92rem; line-height: 1.45; }
.rcsh-home .mod-articles-item-content > p:has(> time:only-child) { display: none; }
.rcsh-home .mod-articles-item-content > .readmore { margin: auto 0 0; padding-top: .4rem; }
.rcsh-home .mod-articles-item .readmore a { font-size: 0; color: #8e4200; font-weight: 750; text-decoration: none; }
.rcsh-home .mod-articles-item .readmore a::after { content: 'Подробнее →'; font-size: .9rem; }
html[lang^='kk'] .rcsh-home .mod-articles-item .readmore a::after { content: 'Толығырақ →'; }
html[lang^='en'] .rcsh-home .mod-articles-item .readmore a::after { content: 'Read more →'; }
.rcsh-home .mod-articles-item .readmore a:hover::after { text-decoration: underline; }
.rcsh-home .mod-articles-item:has(.mod-articles-link[href*='/state-awards-2025-']) { --news-cover: url('https://centrspas.kz/upload/iblock/b4e/zeajeiu1dh2u6atzf6cy8peprq2fg9m2.jpeg'); }
.rcsh-home .mod-articles-item:has(.mod-articles-link[href*='/zhetybay-exercise-2023-']) { --news-cover: url('https://centrspas.kz/upload/iblock/b31/b318929d45f3a152dd9786bcd69a5cb5.jpg'); }
.rcsh-home .mod-articles-item:has(.mod-articles-link[href*='/wild-well-visit-2022-']) { --news-cover: url('https://centrspas.kz/upload/iblock/472/472929082f46af24dec0264cc5a25c54.jpg'); }
.rcsh-home .mod-articles-item:has(.mod-articles-link[href*='/fire-drill-2022-']) { --news-cover: url('https://centrspas.kz/upload/iblock/fea/fea373d127a364c9a1513f8802f4bce5.jpeg'); }

#site-menu .mod-menu__toggle-sub.rcsh-menu-group {
    width: auto;
    gap: .65rem;
    padding-inline: .2rem .42rem;
    font: inherit;
}
#site-menu .nav-item:not(.active) > .rcsh-menu-group:hover { color: #ffad43; }

.rcsh-back-to-top {
    position: fixed;
    inset-inline-end: max(1rem, env(safe-area-inset-right));
    inset-block-end: max(1rem, env(safe-area-inset-bottom));
    z-index: 25;
    width: 48px;
    height: 48px;
    border: 1px solid #ff7900;
    border-radius: .6rem;
    background: #10384d;
    color: #fff;
    font: 700 1.65rem/1 system-ui, sans-serif;
    cursor: pointer;
}
.rcsh-back-to-top:hover, .rcsh-back-to-top:focus-visible {
    background: #ff7900;
    color: #102638;
}
