/* KristinaHouse — /site.css — header, footer, mainpage */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --text-main: #1f2937;
    --text-muted: #4b5563;
    --border-color: #e5e7eb;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background-color: #f8fafc;
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* header */
.kh-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    position: sticky; top: 0; z-index: 100;
}
.kh-header-inner {
    max-width: 1400px; margin: 0 auto;
    padding: 12px 24px;
    display: flex; align-items: center; gap: 24px;
}
.kh-logo {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: var(--text-main);
}
.kh-logo-mark {
    width: 38px; height: 38px;
    background: var(--primary); color: white;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 800;
}
.kh-logo-text { font-size: 18px; font-weight: 700; line-height: 1.1; display: flex; flex-direction: column; }
.kh-logo-text small { font-size: 11px; font-weight: 500; color: var(--text-muted); }
.kh-nav { display: flex; gap: 18px; margin-left: auto; }
.kh-nav a {
    text-decoration: none; color: var(--text-muted);
    font-size: 14px; font-weight: 500;
    transition: color 0.15s;
}
.kh-nav a:hover { color: var(--primary); }

/* центр шапки: Квартиры/Недвижимость (dropdown) · Форум · Объявления */
.kh-nav-center { margin: 0 auto; align-items: center; }
.kh-header-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.kh-menu-cat { position: relative; }
.kh-cat-link { font-weight: 600; }
.kh-cat-link .t2 { display: none; }
.kh-menu-cat:hover .t1 { display: none; }
.kh-menu-cat:hover .t2 { display: inline; }
.kh-menu-drop {
    display: none;
    position: absolute; top: 100%; left: -12px;
    background: #fff; border: 1px solid var(--border-color);
    border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 6px; min-width: 160px; z-index: 200;
}
.kh-menu-cat:hover .kh-menu-drop { display: block; }
.kh-menu-item { position: relative; }
.kh-menu-item > a {
    display: block; padding: 8px 12px; border-radius: 7px;
    color: var(--text-main); font-size: 14px;
}
.kh-menu-item:hover > a { background: #f0f4ff; color: var(--primary); }
.kh-menu-sub {
    display: none;
    position: absolute; left: 100%; top: 0;
    background: #fff; border: 1px solid var(--border-color);
    border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 6px; min-width: 120px;
}
.kh-menu-item:hover .kh-menu-sub { display: block; }
.kh-menu-sub a { display: block; padding: 7px 12px; border-radius: 7px; font-size: 13px; }
.kh-menu-sub a:hover { background: #f0f4ff; }

/* переключение языка (без перезагрузки — по API карточек) */
.kh-lang-tabs { display: flex; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.kh-lang-tabs button {
    border: none; background: #fff; padding: 6px 9px;
    font-size: 11px; font-weight: 700; color: var(--text-muted);
    cursor: pointer; font-family: inherit;
}
.kh-lang-tabs button:hover { color: var(--primary); }
.kh-lang-tabs button.active { background: var(--primary); color: #fff; }

/* слайдер карточек на главной.
   Широкая область (до 1880px): hover-элементы карточек не зажимаются.
   Желоб 56px по бокам — стрелки; внутренние поля трека 96px — боковые
   hover-кнопки карточек (~84px) не режутся кромкой прокрутки. */
.kh-home-slider {
    position: relative; padding: 0 56px;
    max-width: 1880px; width: 100%; box-sizing: border-box;
    margin: 0 auto;
}
.kh-hs-track {
    display: flex; gap: 56px;               /* большие отступы между карточками */
    overflow-x: auto; scroll-behavior: smooth;
    padding: 34px 96px 40px;
    scrollbar-width: none;
    align-items: flex-start;                /* карточки разной высоты не растягиваются */
    /* scroll-snap: остановка по центру карточки — чёткое центрирование,
       карточка не бывает «обрезана на полпути белой рамкой» */
    scroll-snap-type: x proximity;
    scroll-padding: 0 96px;
}
/* всё влезло без прокрутки → карточки центрируются в области */
.kh-home-slider.kh-hs-centered .kh-hs-track { justify-content: center; }
/* во время wheel/свайпа управляем scrollLeft напрямую — без smooth-анимации */
.kh-hs-track.kh-hs-nosmooth { scroll-behavior: auto; }
.kh-hs-track::-webkit-scrollbar { display: none; }
.kh-hs-track > .card-wrapper, .kh-hs-track > .property-card {
    flex: 0 0 auto;
    scroll-snap-align: center;
    scroll-snap-stop: always;
}
.kh-hs-arrow {
    position: absolute; top: 154px; transform: translateY(-50%);
    width: 46px; height: 46px; border-radius: 50%;
    border: 1px solid var(--border-color); background: #fff;
    font-size: 22px; cursor: pointer;
    z-index: 60;   /* поверх hover-кнопок карточек (у них z-index 20) — клики не перехватываются */
    box-shadow: 0 6px 16px rgba(0,0,0,0.14);
    color: var(--text-main);
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, box-shadow 0.15s, opacity 0.2s;
}
.kh-hs-prev { left: 4px; }
.kh-hs-next { right: 4px; }
.kh-hs-arrow:hover:not(:disabled) { background: #f0f4ff; color: var(--primary); }
.kh-hs-arrow:disabled { opacity: 0.35; cursor: default; }
.kh-hs-all {
    display: block; width: max-content; margin: 4px auto 0;
    padding: 9px 22px; border-radius: 8px;
    background: var(--primary); color: #fff;
    text-decoration: none; font-size: 14px; font-weight: 600;
}
.kh-hs-all:hover { background: var(--primary-hover); }

/* режим форума: hover-табы админа в шапке */
.kh-fmode-wrap { position: relative; display: inline-block; }
.kh-fmode {
    display: none; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    background: #fff; border: 1px solid var(--border-color); border-radius: 10px;
    padding: 6px; z-index: 300; box-shadow: 0 10px 24px rgba(0,0,0,.14); white-space: nowrap;
}
.kh-fmode-wrap:hover .kh-fmode { display: flex; gap: 4px; }
.kh-fmode button {
    border: 1px solid var(--border-color); background: #fff; border-radius: 7px;
    padding: 4px 10px; font-size: 12px; cursor: pointer; font-family: inherit;
    transition: background .15s, color .15s;
}
.kh-fmode button:hover { border-color: var(--primary); color: var(--primary); }
.kh-fmode button.on { background: var(--primary); color: #fff; border-color: var(--primary); }

.kh-signin-link {
    text-decoration: none;
    font-size: 13px; font-weight: 600;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 7px 16px; border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.kh-signin-link:hover { background: var(--primary); color: white; }

/* hero */
.kh-hero {
    text-align: center;
    padding: 72px 24px 56px;
    background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);
}
.kh-hero h1 { font-size: 40px; margin: 0 0 12px; letter-spacing: -0.5px; }
.kh-hero p { font-size: 17px; color: var(--text-muted); margin: 0 0 28px; }
.kh-hero-btn {
    display: inline-block;
    background: var(--primary); color: white;
    text-decoration: none;
    padding: 13px 32px; border-radius: 10px;
    font-size: 15px; font-weight: 600;
    transition: background 0.15s, transform 0.15s;
}
.kh-hero-btn:hover { background: var(--primary-hover); transform: translateY(-1px); }

/* sections */
.kh-section { padding: 40px 0 24px; }
.kh-section-title {
    text-align: center;
    font-size: 28px; margin: 0 0 8px;
}
.kh-about { max-width: 720px; margin: 0 auto; padding: 40px 24px 64px; }
.kh-about p { color: var(--text-muted); line-height: 1.7; font-size: 15px; text-align: center; }

/* footer */
.kh-footer {
    background: #111827; color: #e5e7eb;
    margin-top: 48px;
}
.kh-footer-inner {
    max-width: 1400px; margin: 0 auto;
    padding: 40px 24px 24px;
    display: flex; flex-wrap: wrap; gap: 40px;
}
.kh-footer-col { display: flex; flex-direction: column; gap: 8px; min-width: 180px; }
.kh-footer-brand { font-size: 18px; font-weight: 700; }
.kh-footer-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #9ca3af; }
.kh-footer-muted { color: #9ca3af; font-size: 13px; }
.kh-footer-col a {
    color: #d1d5db; text-decoration: none;
    font-size: 14px;
    transition: color 0.15s;
}
.kh-footer-col a:hover { color: white; }
.kh-footer-copy {
    border-top: 1px solid #1f2937;
    text-align: center;
    padding: 16px;
    font-size: 12px; color: #6b7280;
}
.kh-footer-docs { text-align: center; padding: 6px 16px; font-size: 12px; }
.kh-footer-docs a { color: #6b7280; text-decoration: none; margin: 0 4px; }
.kh-footer-docs a:hover { color: white; text-decoration: underline; }

/* блог: лента шахматкой [фото][текст] / [текст][фото] */
.kh-blog-title { font-size: 26px; margin: 0 0 20px; }
.kh-feed { display: flex; flex-direction: column; gap: 28px; }
.kh-feed-item {
    display: flex; gap: 22px; align-items: stretch;
    background: #fff; border: 1px solid var(--border-color); border-radius: 14px;
    overflow: hidden; text-decoration: none; color: var(--text-main);
    transition: box-shadow 0.15s, transform 0.15s;
}
.kh-feed-item:hover { box-shadow: 0 10px 24px rgba(0,0,0,0.08); transform: translateY(-2px); }
.kh-feed-item.rev { flex-direction: row-reverse; }
.kh-feed-img { flex: 0 0 42%; min-height: 200px; background: #eef2f7; }
.kh-feed-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kh-feed-noimg { background: linear-gradient(135deg,#eef2f7,#e2e8f0); }
.kh-feed-text { flex: 1; padding: 22px 24px; display: flex; flex-direction: column; }
.kh-feed-text h3 { margin: 0 0 8px; font-size: 20px; }
.kh-feed-text p { margin: 0 0 12px; color: var(--text-muted); line-height: 1.6; font-size: 14px; }
.kh-feed-meta { margin-top: auto; font-size: 12px; color: #9ca3af; }
.kh-feed-sentinel { height: 1px; }

/* страница статьи */
.kh-article-full h1 { font-size: 30px; margin: 8px 0 6px; }
.kh-article-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kh-langswitch a { color: var(--text-muted); text-decoration: none; font-weight: 700; font-size: 12px; padding: 1px 5px; border-radius: 5px; }
.kh-langswitch a.active { background: var(--primary); color: #fff; }
.kh-comments { margin-top: 32px; border-top: 1px solid var(--border-color); padding-top: 20px; }
.kh-comments-h { font-size: 18px; margin: 0 0 14px; }

/* форум (cyberforum-стиль) */
.kh-forum-h { font-size: 26px; margin: 0 0 18px; }
.kh-forum-group { margin-bottom: 22px; border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; background: #fff; }
.kh-forum-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #1f2937; color: #fff; }
.kh-forum-head h2 { font-size: 16px; margin: 0; }
.kh-sf-list { display: flex; flex-direction: column; }
.kh-sf-row { display: grid; grid-template-columns: 1fr 80px 90px 220px; gap: 10px; align-items: center;
    padding: 12px 16px; border-top: 1px solid var(--border-color); }
.kh-sf-row:first-child { border-top: none; }
.kh-sf-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kh-sf-title { font-weight: 600; color: var(--text-main); text-decoration: none; font-size: 15px; }
.kh-sf-title:hover { color: var(--primary); }
.kh-sf-stat { text-align: center; font-size: 12px; color: var(--text-muted); }
.kh-sf-stat b { display: block; font-size: 16px; color: var(--text-main); }
.kh-sf-last { font-size: 12px; }
.kh-sf-last a { color: var(--primary); text-decoration: none; }
.kh-sf-last .m { color: #9ca3af; margin-top: 2px; }
.kh-badge-arch { font-size: 11px; background: #e0e7ff; color: #3730a3; border-radius: 999px; padding: 1px 8px; }
.kh-badge-hid { font-size: 11px; background: #fee2e2; color: #b91c1c; border-radius: 999px; padding: 1px 8px; }
/* контрол статуса раздела: раскрывается при наведении на строку/заголовок */
.kh-fstatus { opacity: 0; transition: opacity 0.15s; font-size: 11px; padding: 2px 4px;
    border: 1px solid var(--border-color); border-radius: 6px; background: #fff; cursor: pointer; font-family: inherit; }
.kh-forum-head .kh-fstatus { background: #374151; color: #fff; border-color: #4b5563; }
.kh-sf-row:hover .kh-fstatus, .kh-forum-head:hover .kh-fstatus, .kh-fstatus:focus { opacity: 1; }
.kh-ro-note { background: #eef2ff; border: 1px solid #c7d2fe; color: #3730a3; border-radius: 8px; padding: 8px 12px; }

/* меню пользователя (шапка) */
.kh-user-menu { position: relative; }
.kh-user-btn { text-decoration: none; font-size: 13px; font-weight: 600; color: var(--primary);
    border: 1px solid var(--primary); padding: 7px 14px; border-radius: 8px; display: inline-flex; align-items: center; gap: 5px; }
.kh-user-btn:hover { background: var(--primary); color: #fff; }
.kh-um-caret { font-size: 10px; }
.kh-user-drop { display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px;
    background: #fff; border: 1px solid var(--border-color); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    padding: 8px; z-index: 300; }
.kh-user-menu:hover .kh-user-drop { display: block; }
.kh-um-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 6px 8px; color: var(--text-muted); }
.kh-um-row b { color: var(--text-main); }
.kh-um-out { width: 100%; margin-top: 6px; padding: 8px; border: none; border-radius: 7px;
    background: #fee2e2; color: #b91c1c; font-weight: 600; font-size: 13px; cursor: pointer; font-family: inherit; }
.kh-um-out:hover { background: #fecaca; }

@media (max-width: 640px) {
    .kh-nav { display: none; }
    .kh-hero h1 { font-size: 28px; }
    .kh-feed-item, .kh-feed-item.rev { flex-direction: column; }
    .kh-feed-img { flex-basis: auto; min-height: 180px; }
    .kh-sf-row { grid-template-columns: 1fr 60px; }
    .kh-sf-last, .kh-sf-stat:nth-child(3) { display: none; }
    /* слайдер на мобильном: узкие поля, стрелки не нужны (свайп) */
    .kh-home-slider { padding: 0 12px; }
    .kh-hs-track { gap: 20px; padding: 16px 12px 20px; scroll-padding: 0 12px; }
    .kh-hs-arrow { display: none !important; }
}
