/* Apple Tower theme — базовый каркас. Дизайн по макетам придёт позже. */

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #222;
    background: #fff;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 16px;
}

a { color: #0b5fa5; }
img { max-width: 100%; height: auto; }

/* Шапка */
.site-header {
    border-bottom: 1px solid #e2e2e2;
    padding: 12px 0;
}
.site-header__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}
.site-title {
    font-size: 22px;
    font-weight: 700;
    color: inherit;
    text-decoration: none;
}
.main-nav { flex: 1 1 auto; }
.main-nav .menu {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.main-nav .menu a {
    color: inherit;
    text-decoration: none;
}
.main-nav .menu a:hover { color: #0b5fa5; }
.header-phone {
    font-weight: 700;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

/* Хлебные крошки */
.breadcrumbs {
    margin: 16px 0 8px;
    font-size: 14px;
    color: #666;
}

/* Контент */
.site-main { padding: 24px 16px 40px; }
.entry-title { margin: 8px 0 16px; }
.entry-content { max-width: 100%; }

/* Преимущества на главной */
.advantages { margin: 32px 0; }
.advantages__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.advantage {
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    padding: 20px;
}
.advantage__icon { font-size: 28px; }
.advantage__title { margin: 8px 0; font-size: 18px; }
.advantage__text { margin: 0; }

/* Футер */
.site-footer {
    border-top: 1px solid #e2e2e2;
    padding: 24px 0;
    background: #f7f7f7;
    font-size: 15px;
}
.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: space-between;
}
.site-footer .menu {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.site-footer__socials {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}
.site-footer__copy { width: 100%; color: #777; }

@media (max-width: 768px) {
    .site-header__inner { flex-direction: column; align-items: flex-start; }
    .main-nav .menu { flex-direction: column; gap: 8px; }
    .advantages__grid { grid-template-columns: 1fr; }
    .site-footer__inner { flex-direction: column; }
}

/* Форма «Он-лайн заказ» */
.appletower-form { max-width: 520px; }
.appletower-form .pf-row { margin: 0 0 14px; }
.appletower-form label { display: block; margin-bottom: 4px; }
.appletower-form input[type="text"],
.appletower-form input[type="tel"],
.appletower-form input[type="email"],
.appletower-form textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font: inherit;
}
.appletower-form .pf-req { color: #c00; }
/* Чекбокс согласия: селектор обязан оставаться с префиксом .appletower-form
   (специфичность 0,3,1), иначе его перебивает .<slug>-form .pf-row > label
   и flex ломается - чекбокс уезжает над текстом (прецедент print5.ru). */
.appletower-form .pf-consent label { display: flex; gap: 8px; align-items: flex-start; }
.appletower-form .pf-consent input { margin-top: 4px; flex: 0 0 auto; }
.appletower-form .pf-consent span { flex: 1; }
.appletower-form .pf-captcha-note { font-size: 13px; color: #777; }
.appletower-form .pf-hp { display: none; }
.appletower-form .pf-submit {
    padding: 10px 24px;
    border: 0;
    border-radius: 4px;
    background: #0b5fa5;
    color: #fff;
    font: inherit;
    cursor: pointer;
}
.appletower-form .pf-submit:disabled { opacity: .6; cursor: default; }
.appletower-form .pf-result { margin-top: 10px; }
.appletower-form .pf-result.pf-ok { color: #1a7a1a; }
.appletower-form .pf-result.pf-error { color: #c00; }
.cookie-notice__inner {
    max-width: 1140px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
}
.cookie-notice__text { margin: 0; flex: 1 1 auto; }
.cookie-notice__more { color: #9ec7ee; margin-left: 6px; white-space: nowrap; }
.cookie-notice__accept {
    flex: 0 0 auto;
    padding: 8px 20px;
    border: 0;
    border-radius: 4px;
    background: #0b5fa5;
    color: #fff;
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}
@media (max-width: 600px) {
    .cookie-notice__inner { flex-direction: column; align-items: stretch; text-align: center; }
    .cookie-notice__accept { width: 100%; }
}

/* Страховка: display на элементе с атрибутом hidden перебивает UA-стиль [hidden]{display:none}. */
.cookie-notice[hidden] { display: none; }

/* ---------- Карточки направлений (главная, опция home_cards) ---------- */
.home-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin: 24px 0;
}
.home-card {
    display: block;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
}
.home-card__img img { width: 100%; height: auto; display: block; }
.home-card__label { padding: 12px 16px; font-weight: 700; }

/* ---------- Попап с формой ---------- */
/* Видимость только классом .is-open: display:flex перебил бы атрибут hidden. */
.appletower-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.55);
    overflow-y: auto;
}
.appletower-popup.is-open { display: flex; }
body.appletower-popup-open { overflow: hidden; }
.appletower-popup__box {
    position: relative;
    width: 100%;
    max-width: 560px;
    margin: auto;
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.4);
}
.appletower-popup__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    appearance: none;
    border: 0;
    border-radius: 50%;
    background: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
    .appletower-popup__close:hover { background: #f0f0f1; }
}
.appletower-popup__title { margin: 0 0 8px; font-size: 24px; }
.appletower-popup__sub { margin: 0 0 16px; color: #555; }
/* Режим «Заказать звонок»: только имя и телефон. */
.appletower-popup--callback .pf-row--email,
.appletower-popup--callback .pf-row--message { display: none; }

@media (max-width: 600px) {
    .appletower-popup { padding: 12px; align-items: flex-start; }
    .appletower-popup__box { padding: 20px 16px; }
    .appletower-popup__title { font-size: 20px; }
}

/* ---------- Типовая страница: сайдбар с меню услуг + форма под текстом ---------- */
/* Мобильный аккордеон сайдбара (правило 42): на десктопе toggle инертен,
   на мобильном список свернут и открывается кнопкой. */
.site-sidebar__toggle {
    display: none;
    appearance: none;
    border: 0;
    background: none;
    width: 100%;
    padding: 0;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
}
.site-sidebar__arrow {
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s;
    flex: 0 0 auto;
}
.site-sidebar.is-open .site-sidebar__arrow { transform: rotate(225deg); }
@media (max-width: 768px) {
    .site-sidebar__toggle { display: flex; }
    .site-sidebar__title { display: none; }
    .site-sidebar .menu { display: none; margin-top: 12px; }
    .site-sidebar.is-open .menu { display: block; }
}
.layout-with-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}
@media (min-width: 1024px) {
    .layout-with-sidebar { grid-template-columns: minmax(0, 1fr) 280px; gap: 56px; }
}

.site-sidebar {
    border: 1px solid #e2e2e2;
    border-radius: 12px;
    padding: 20px;
    background: #fafafa;
}
.site-sidebar__title {
    margin: 0 0 12px;
    font-size: 11px;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    color: #666;
}
.site-sidebar .menu { margin: 0; padding: 0; list-style: none; }
.site-sidebar .menu li { margin: 0; }
.site-sidebar .menu a {
    display: block;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    color: #222;
    text-decoration: none;
}
.site-sidebar .menu a:hover { background: #eee; }
.site-sidebar .menu .current-menu-item > a,
.site-sidebar .menu .current-menu-ancestor > a { background: #222; color: #fff; }
.site-sidebar .menu .sub-menu {
    margin: 2px 0 6px;
    padding-left: 14px;
    list-style: none;
    border-left: 1px solid #e2e2e2;
}

.page-feedback {
    margin-top: 40px;
    padding: 28px;
    border: 1px solid #e2e2e2;
    border-radius: 12px;
    background: #fafafa;
}
.page-feedback h2 { margin: 0 0 8px; font-size: 24px; }
.page-feedback > p { margin: 0 0 20px; color: #666; font-size: 14px; }
