/* ==========================================================================
   Шапка сайта (views/layouts/_header.php): липкая, мега-меню, мобильное меню.
   ========================================================================== */

.sh {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 1px 0 var(--ama-line, #e3e8f1);
    transition: box-shadow .2s ease;
}
.sh.is-scrolled { box-shadow: 0 6px 24px rgba(28, 37, 65, .08); }
.sh * { box-sizing: border-box; }

.sh-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    height: 76px;
    display: flex;
    align-items: center;
    gap: 28px;
}
.sh-logo { display: inline-flex; align-items: center; flex: 0 0 auto; }
.sh-logo img { display: block; height: 30px; width: auto; }

/* ---------- Навигация (десктоп) ---------- */
.sh-nav { flex: 1 1 auto; }
.sh-menu { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; }
.sh-item { position: relative; margin: 0; padding: 0; }
.sh-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 44px;
    padding: 0 14px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    font-family: var(--ama-font-head, 'Nunito', sans-serif);
    font-weight: 700;
    font-size: 16px;
    line-height: 1;
    white-space: nowrap;
    color: var(--ama-ink, #1c2541);
    text-decoration: none !important;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.sh-link:hover, .sh-item.is-open > .sh-link { background: var(--ama-bg, #f5f7fb); color: var(--ama-pink, #e6157f); }
.sh-item.is-active > .sh-link { color: var(--ama-pink, #e6157f); }
.sh-caret { width: 12px; height: 12px; transition: transform .2s ease; }
.sh-item.is-open .sh-caret { transform: rotate(180deg); }

/* Выпадающие панели */
.sh-mega, .sh-drop {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(28, 37, 65, .16), 0 0 0 1px rgba(28, 37, 65, .05);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
    z-index: 1100;
}
/* Невидимый «мостик», чтобы меню не закрывалось при переводе курсора */
.sh-mega::before, .sh-drop::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
.sh-item.is-open > .sh-mega, .sh-item.is-open > .sh-drop { opacity: 1; visibility: visible; transform: translateY(0); }

.sh-mega {
    display: grid;
    grid-template-columns: 1fr 1fr 1.1fr;
    gap: 8px 32px;
    width: min(880px, calc(100vw - 48px));
    padding: 28px 32px;
    left: -12px;
}
.sh-mega-title {
    font-family: var(--ama-font-head, 'Nunito', sans-serif);
    font-weight: 800;
    font-size: 13px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ama-muted, #5c6680);
    margin-bottom: 10px;
}
.sh-mega-list { list-style: none; margin: 0; padding: 0; }
.sh-mega-list a, .sh-drop a {
    display: block;
    padding: 8px 10px;
    margin: 0 -10px;
    border-radius: 10px;
    font-family: var(--ama-font-text, 'Inter', sans-serif);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--ama-ink, #1c2541);
    text-decoration: none !important;
    transition: background-color .15s ease, color .15s ease;
}
.sh-mega-list a:hover, .sh-drop a:hover { background: var(--ama-bg, #f5f7fb); color: var(--ama-pink, #e6157f); }

.sh-mega-side { display: flex; flex-direction: column; gap: 12px; }
.sh-card {
    display: block;
    padding: 16px 18px;
    border-radius: 14px;
    background: linear-gradient(135deg, #eef7fd, #fdf0f7);
    text-decoration: none !important;
    transition: transform .15s ease, box-shadow .15s ease;
}
.sh-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(28, 37, 65, .1); }
.sh-card-title {
    display: block;
    font-family: var(--ama-font-head, 'Nunito', sans-serif);
    font-weight: 800;
    font-size: 16px;
    color: var(--ama-ink, #1c2541);
    margin-bottom: 4px;
}
.sh-card-text { display: block; font-size: 13.5px; line-height: 1.4; color: var(--ama-muted, #5c6680); }
.sh-all {
    margin-top: auto;
    font-family: var(--ama-font-head, 'Nunito', sans-serif);
    font-weight: 800;
    font-size: 15px;
    color: var(--ama-blue, #0b84c6);
    text-decoration: none !important;
}
.sh-all:hover { color: var(--ama-pink, #e6157f); }

.sh-drop { list-style: none; margin: 0; padding: 10px 12px; min-width: 230px; }
.sh-drop li { margin: 0; padding: 0; }
.sh-drop a { margin: 0; padding: 10px 12px; }

/* ---------- Правая часть ---------- */
.sh-actions { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; margin-left: auto; }
/* ---------- Страна + телефоны: кнопка с флагом и меню (клик) ---------- */
.sh-loc { position: relative; }
.sh-loc-btn {
    display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
    border: 1px solid var(--ama-line, #e3e8f1); border-radius: 12px; background: #fff;
    font: 600 14px/1 var(--ama-font-body, 'Inter', sans-serif); color: var(--ama-ink, #1c2541);
    cursor: pointer; white-space: nowrap; transition: border-color .2s ease, background .2s ease;
}
.sh-loc-btn:hover, .sh-loc.is-open .sh-loc-btn { border-color: #cbd5e6; background: var(--ama-bg, #f5f7fb); }
.sh-loc-btn:focus:not(:focus-visible) { outline: none; box-shadow: none; }
.sh-loc-btn:focus-visible { outline: 2px solid var(--ama-blue, #0b84c6); outline-offset: 2px; }
.sh-loc.is-open .sh-caret { transform: rotate(180deg); }
.sh-flag {
    flex: 0 0 auto; width: 20px; height: 14px; border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(28, 37, 65, .12); background: #d7dde8;
}
.sh-flag--ru { background: linear-gradient(#fff 0 33.4%, #0039a6 33.4% 66.7%, #d52b1e 66.7%); }
.sh-flag--by { background: linear-gradient(90deg, #fff 0 18%, transparent 18%), linear-gradient(#c8313e 0 66.7%, #4aa657 66.7%); }
.sh-flag--kz { background: #00afca; }
.sh-flag--uz { background: linear-gradient(#0099b5 0 32%, #ce1126 32% 34%, #fff 34% 66%, #ce1126 66% 68%, #1eb53a 68%); }
.sh-flag--kg { background: radial-gradient(circle at 50% 50%, #ffef00 0 22%, #e8112d 23%); }
.sh-flag--tm { background: linear-gradient(90deg, #00843d 0 18%, #c8102e 18% 30%, #00843d 30%); }
.sh-flag--az { background: linear-gradient(#0092bc 0 33.4%, #e4002b 33.4% 66.7%, #00af66 66.7%); }
.sh-flag--us { background: linear-gradient(90deg, #3c3b6e 0 40%, transparent 40%) top left / 100% 54% no-repeat, repeating-linear-gradient(#b22234 0 7.7%, #fff 7.7% 15.4%); }
.sh-loc-pop {
    position: absolute; top: calc(100% + 10px); right: 0; z-index: 30; min-width: 240px; padding: 10px;
    background: #fff; border-radius: 16px;
    box-shadow: 0 18px 48px rgba(28, 37, 65, .18), 0 0 0 1px rgba(28, 37, 65, .05);
}
.sh-loc-title { padding: 8px 10px 4px; font: 600 12px/1.2 var(--ama-font-body, 'Inter', sans-serif); letter-spacing: .04em; text-transform: uppercase; color: var(--ama-muted, #5c6680); }
.sh-loc-title:not(:first-child) { margin-top: 6px; border-top: 1px solid var(--ama-line, #e3e8f1); padding-top: 12px; }
.sh-loc-opt, .sh-loc-tel {
    display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px;
    font: 600 15px/1.2 var(--ama-font-body, 'Inter', sans-serif); color: var(--ama-ink, #1c2541) !important; text-decoration: none !important;
}
a.sh-loc-opt:hover, .sh-loc-tel:hover { background: var(--ama-bg, #f5f7fb); color: var(--ama-pink, #e6157f) !important; }
.sh-loc-opt.is-current { color: var(--ama-blue, #0b84c6) !important; cursor: default; }
.sh-check { width: 16px; height: 16px; margin-left: auto; }
.sh-loc-tel { font-weight: 700; white-space: nowrap; }
.sh-loc-note { padding: 2px 10px 8px; font-size: 13px; line-height: 1.4; color: var(--ama-muted, #5c6680); }
.sh-tel { font: 700 15px/1 var(--ama-font-body, 'Inter', sans-serif); color: var(--ama-ink, #1c2541) !important; text-decoration: none !important; white-space: nowrap; }
.sh-tel:hover { color: var(--ama-pink, #e6157f) !important; }
/* Подсказка «Ваша страна — X?» (только если по IP другая страна) */
.sh-geo {
    position: absolute; top: calc(100% + 10px); right: 0; z-index: 31; width: 300px; padding: 16px;
    background: #fff; border-radius: 16px; box-shadow: 0 18px 48px rgba(28, 37, 65, .18), 0 0 0 1px rgba(28, 37, 65, .05);
}
.sh-geo p { margin: 0 0 12px; font: 700 16px/1.3 var(--ama-font-head, 'Nunito', sans-serif); color: var(--ama-ink, #1c2541); }
.sh-geo-yes, .sh-geo-no {
    display: block; width: 100%; padding: 10px 12px; margin-top: 6px; border-radius: 10px; border: 0;
    font: 600 14px/1.2 var(--ama-font-body, 'Inter', sans-serif); text-align: center; text-decoration: none !important; cursor: pointer;
}
.sh-geo-yes { background: var(--ama-pink, #e6157f); color: #fff !important; }
.sh-geo-yes:hover { background: var(--ama-pink-dark, #c40f6a); }
.sh-geo-no { background: var(--ama-bg, #f5f7fb); color: var(--ama-ink, #1c2541); }
/* Мобильное меню: страна и телефоны */
.sh-m-loc { margin-bottom: 14px; }
.sh-m-loc-title { margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--ama-muted, #5c6680); }
.sh-m-loc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sh-chip {
    display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 12px;
    border: 1px solid var(--ama-line, #e3e8f1); background: #fff; font-weight: 600; font-size: 15px;
    color: var(--ama-ink, #1c2541) !important; text-decoration: none !important;
}
.sh-chip.is-current { border-color: var(--ama-blue, #0b84c6); background: #eef7fd; color: var(--ama-blue, #0b84c6) !important; }
.sh-m-tels { margin-bottom: 14px; }
.sh-m-tel { display: block; padding: 6px 0; font-weight: 700; font-size: 18px; color: var(--ama-ink, #1c2541) !important; text-decoration: none !important; }
.sh-m-tels .sh-loc-note { padding: 0; }

.sh-login {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    font-family: var(--ama-font-head, 'Nunito', sans-serif);
    font-weight: 700;
    font-size: 15px;
    color: var(--ama-blue, #0b84c6) !important;
    text-decoration: none !important;
    transition: background-color .15s ease;
}
.sh-login:hover { background: #eef7fd; }
.sh-login svg { width: 18px; height: 18px; }

.sh-cta {
    height: 44px;
    padding: 0 22px;
    border: 0;
    border-radius: 12px;
    background: var(--ama-pink, #e6157f);
    color: #fff;
    font-family: var(--ama-font-head, 'Nunito', sans-serif);
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 6px 16px rgba(230, 21, 127, .25);
    transition: background-color .15s ease, transform .15s ease;
}
.sh-cta:hover { background: var(--ama-pink-dark, #c40f6a); transform: translateY(-1px); }

/* Бургер */
.sh-burger {
    display: none;
    width: 44px;
    height: 44px;
    padding: 12px 11px;
    border: 0;
    border-radius: 12px;
    background: var(--ama-bg, #f5f7fb);
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
}
.sh-burger span { display: block; height: 2px; border-radius: 2px; background: var(--ama-ink, #1c2541); }

/* ---------- Мобильное меню ---------- */
.sh-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, .45);
    z-index: 1001;
    opacity: 0;
    transition: opacity .25s ease;
}
.sh-overlay.is-visible { opacity: 1; }
.sh-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(400px, 100vw);
    background: #fff;
    z-index: 1002;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.2, .8, .2, 1);
    box-shadow: -20px 0 50px rgba(17, 24, 39, .18);
    visibility: hidden;
}
.sh.is-menu-open .sh-drawer { transform: translateX(0); visibility: visible; }
.sh-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
    padding: 0 16px 0 20px;
    border-bottom: 1px solid var(--ama-line, #e3e8f1);
    flex: 0 0 auto;
}
.sh-drawer-head .sh-logo img { height: 24px; }
.sh-close {
    width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--ama-bg, #f5f7fb);
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ama-ink, #1c2541);
}
.sh-close svg { width: 20px; height: 20px; }
.sh-drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 8px 12px 16px; -webkit-overflow-scrolling: touch; }

.sh-acc { border-bottom: 1px solid var(--ama-line, #e3e8f1); }
.sh-acc > summary, .sh-m-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    padding: 0 8px;
    font-family: var(--ama-font-head, 'Nunito', sans-serif);
    font-weight: 800;
    font-size: 18px;
    color: var(--ama-ink, #1c2541);
    cursor: pointer;
    list-style: none;
    text-decoration: none !important;
}
.sh-m-top { border-bottom: 1px solid var(--ama-line, #e3e8f1); }
.sh-m-top.is-active { color: var(--ama-pink, #e6157f); }
.sh-acc > summary::-webkit-details-marker { display: none; }
.sh-acc > summary::after {
    content: "";
    width: 9px; height: 9px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform .2s ease;
    opacity: .6;
}
.sh-acc[open] > summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.sh-acc-body { padding: 0 8px 12px; }
.sh-acc-sub { border-bottom: 0; }
.sh-acc-sub > summary { min-height: 46px; font-size: 16px; color: var(--ama-blue, #0b84c6); padding: 0; }
.sh-acc-sub ul { list-style: none; margin: 0 0 8px; padding: 0 0 0 12px; border-left: 2px solid var(--ama-line, #e3e8f1); }
.sh-acc-sub a, .sh-m-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    font-family: var(--ama-font-text, 'Inter', sans-serif);
    font-size: 16px;
    font-weight: 500;
    color: var(--ama-ink, #1c2541);
    text-decoration: none !important;
}
.sh-acc-sub a { padding-left: 4px; }
.sh-m-muted { color: var(--ama-muted, #5c6680); }

.sh-drawer-foot {
    flex: 0 0 auto;
    display: grid;
    gap: 10px;
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--ama-line, #e3e8f1);
    background: #fff;
}
.sh-cta-block { width: 100%; height: 52px; font-size: 16px; }
.sh-login-block { justify-content: center; width: 100%; height: 48px; background: #eef7fd; }

body.sh-lock { overflow: hidden; }

/* ---------- Адаптив ---------- */
/* Есть номер в шапке — на кнопке страны только флаг (иначе не помещается) */
.sh-actions.has-tel .sh-loc-name { display: none; }
@media (max-width: 1365px) {
    .sh-tel { display: none; } /* номер остаётся в меню страны */
    .sh-actions.has-tel .sh-loc-name { display: inline; }
}
@media (max-width: 1279px) {
    /* мега-меню — по ширине шапки, не выходит за экран */
    .sh-inner { position: relative; }
    .sh-has-mega { position: static; }
    .sh-mega { left: 16px; right: 16px; width: auto; max-width: 880px; }
    .sh-actions .sh-loc-name, .sh-actions.has-tel .sh-loc-name { display: none; }
    .sh-login span { display: none; }
    .sh-login { padding: 0 10px; }
}
@media (max-width: 1199px) {
    .sh-inner { gap: 16px; }
    .sh-link { padding: 0 10px; font-size: 15px; }
    .sh-tel { display: none; }
}
@media (max-width: 1023px) {
    .sh-nav, .sh-loc, .sh-actions > .sh-login { display: none; }
    .sh-burger { display: inline-flex; }
    .sh-inner { height: 64px; padding: 0 16px; }
    .sh-logo img { height: 26px; }
}
@media (max-width: 420px) {
    .sh-cta { padding: 0 14px; font-size: 14px; }
    .sh-logo img { height: 22px; }
}
@media (prefers-reduced-motion: reduce) {
    .sh-drawer, .sh-overlay, .sh-mega, .sh-drop { transition: none; }
}

/* ---------- Лендинг франшизы ---------- */
header.sh-franchise { position: sticky; top: 0; z-index: 1000; padding: 0 !important; background: #fff; }
.franchise-main [id] { scroll-margin-top: 90px; }
@media (max-width: 1279px) {
    .sh-franchise .sh-menu .sh-item:nth-child(n+5) { display: none; } /* остальные разделы — в мобильном меню */
}

/* ---------- Подвал (views/layouts/_footer.php) ---------- */
footer { border-top: 0; background: transparent; overflow: visible; }
.sf { margin-top: 40px; background: #fff; border-top: 1px solid var(--ama-line, #e3e8f1); color: var(--ama-ink, #1c2541); }
.sf-inner { max-width: 1280px; margin: 0 auto; padding: 48px 24px 40px; display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px 40px; }
.sf-logo img { height: 28px; width: auto; display: block; }
.sf-about { margin: 16px 0 18px; max-width: 320px; font-size: 14px; line-height: 1.55; color: var(--ama-muted, #5c6680); }
.sf-ages { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: -6px 0 18px; max-width: 320px; font-size: 14px; line-height: 1.5; color: var(--ama-muted, #5c6680); }
.sf-ages span { width: 100%; font-size: 14px; }
.sf-ages a { display: inline-block; padding: 4px 0; color: var(--ama-blue, #0b84c6) !important; font-weight: 600; text-decoration: none !important; }
.sf-ages a:hover { text-decoration: underline !important; }
.sf-tel { display: block; margin-bottom: 6px; font-weight: 700; font-size: 17px; color: var(--ama-ink, #1c2541) !important; text-decoration: none !important; }
.sf-tel:hover { color: var(--ama-pink, #e6157f) !important; }
.sf-cta {
    display: inline-flex; align-items: center; justify-content: center; height: 46px; margin-top: 12px; padding: 0 20px;
    border: 0; border-radius: 12px; background: var(--ama-pink, #e6157f); color: #fff;
    font: 700 15px/1 var(--ama-font-head, 'Nunito', sans-serif); cursor: pointer; transition: background .2s ease;
}
.sf-cta:hover { background: var(--ama-pink-dark, #c40f6a); }
.sf-col { display: flex; flex-direction: column; gap: 10px; }
.sf-title { margin-bottom: 4px; font: 800 15px/1.2 var(--ama-font-head, 'Nunito', sans-serif); color: var(--ama-ink, #1c2541); }
.sf-col a { font-size: 14px; line-height: 1.35; color: var(--ama-muted, #5c6680) !important; text-decoration: none !important; }
.sf-col a:hover { color: var(--ama-blue, #0b84c6) !important; }
.sf-bottom { border-top: 1px solid var(--ama-line, #e3e8f1); background: var(--ama-bg, #f5f7fb); }
.sf-bottom-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; padding-top: 18px; padding-bottom: 18px; font-size: 13px; color: var(--ama-muted, #5c6680); }
.sf-docs { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.sf-docs a { color: var(--ama-muted, #5c6680) !important; text-decoration: none !important; }
.sf-docs a:hover { color: var(--ama-blue, #0b84c6) !important; text-decoration: underline !important; }
@media (max-width: 1023px) {
    .sf-inner { grid-template-columns: 1fr 1fr; }
    .sf-brand { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
    .sf-inner { grid-template-columns: 1fr; padding: 36px 16px 28px; gap: 28px; }
    .sf-cta { width: 100%; }
    .sf-bottom-inner { flex-direction: column; align-items: flex-start; padding-left: 16px; padding-right: 16px; }
    .sf-docs { flex-direction: column; gap: 8px; }
}
/* Подвал на мобильных: ссылки с областью нажатия ~31 px вместо 19 px */
@media (max-width: 767px) {
    .sf-col { gap: 0; }
    .sf-col a, .sf-docs a { display: block; padding: 6px 0; }
    .sf-docs { gap: 0; }
}

/* Bootstrap 3 рисует кольцо фокуса у ссылок и после клика мышью (пункт меню «Как запустить» оставался в рамке).
   Убираем для мыши, оставляем для клавиатуры (:focus-visible) — 18.11.2026 */
a:focus:not(:focus-visible), button:focus:not(:focus-visible) { outline: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--ama-blue, #0b84c6); outline-offset: 2px; }

/* Мега-меню «Программы» без карточек справа (репетиторы и логопеды скрыты): две колонки, ссылка строкой под ними (19.11.2026) */
.sh-mega.sh-mega-two { grid-template-columns: 1fr 1fr; width: min(600px, calc(100vw - 48px)); }
.sh-mega-foot { grid-column: 1 / -1; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--ama-line, #e3e8f1); }
@media (max-width: 1279px) { .sh-mega.sh-mega-two { max-width: 600px; } }
