/*
 * Контакты — стили страницы /contacts/
 * Подключается из contacts.php: /local/templates/dolomit/css/contacts.css
 * Токены названы так же, как на странице «Доска почёта» (--accent, --muted, --border, --surface, --text, --r).
 */

.bx-breadcrumb, .breadcrumb-wrapper, .breadcrumb { display: none !important; }

/* Скрыт визуально, но доступен скринридерам */
.ct-sr-only {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.contacts-page-container {
    --surface: rgba(255, 255, 255, 0.03);
    --border: rgba(255, 255, 255, 0.1);
    --accent: #f90;
    --accent-border: rgba(255, 153, 0, 0.4);
    --text: #ffffff;
    --muted: #a0a0a0;
    --r: 14px;

    position: relative;
    max-width: 1600px;
    margin: 0 auto;
    padding: 90px 20px 120px;
}

/* Инженерная сетка на фоне, как на 404 */
.contacts-page-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center top;
    pointer-events: none;
    mask-image: linear-gradient(to bottom, transparent 0%, #000 15%, transparent 90%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 15%, transparent 90%);
    z-index: 0;
}

.contacts-ambient-light {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 480px;
    height: 280px;
    background: radial-gradient(circle, rgba(255, 153, 0, 0.14) 0%, transparent 70%);
    pointer-events: none;
    animation: contactsPulse 4s alternate infinite ease-in-out;
    z-index: 0;
}

@keyframes contactsPulse {
    0%   { opacity: 0.6; transform: translateX(-50%) scale(0.9); }
    100% { opacity: 1;   transform: translateX(-50%) scale(1.08); }
}

@keyframes fadeUpIn {
    0%   { opacity: 0; transform: translateY(24px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ── HERO ── */
.contacts-hero {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-bottom: 56px;
    animation: fadeUpIn 0.7s ease-out both;
}

.contacts-hero h1 {
    font-family: 'Inter', sans-serif;
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 800;
    color: var(--text);
    margin: 0 0 14px 0;
    letter-spacing: -0.5px;
}

.contacts-hero .subtitle-text {
    font-family: 'Inter', sans-serif;
    font-size: 17px;
    font-weight: 300;
    color: var(--muted);
    max-width: 620px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ── ОСНОВНОЙ МАКЕТ: ТАБЛИЦА СЛЕВА + САЙДБАР СПРАВА ── */
.contacts-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 28px;
    align-items: start;
}

/* ── ТАБЛИЦА КОНТАКТОВ (role="table" в разметке) ── */
.contacts-table-modern {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    animation: fadeUpIn 0.6s ease both;
}

.ct-head-row {
    display: grid;
    grid-template-columns: 1fr 340px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
}
.ct-head-row span { padding: 18px 32px; }
.ct-head-row span:first-child { border-right: 1px solid var(--border); }

.ct-row {
    display: grid;
    grid-template-columns: 1fr 340px;
    border-bottom: 1px solid var(--border);
    position: relative;
    transition: background .2s ease;
}
.ct-row:nth-child(even) { background: rgba(255, 255, 255, 0.012); }
.ct-row:last-child { border-bottom: none; }

.ct-row::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 3px;
    background: var(--accent);
    transform: scaleY(0);
    transition: transform .3s ease;
}
.ct-row:hover { background: rgba(255, 255, 255, 0.03); }
.ct-row:hover::before { transform: scaleY(1); }

.ct-role-col {
    padding: 22px 32px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.ct-contact-col {
    padding: 18px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Должность — спокойная серая подпись, ФИО — главный элемент строки */
.ct-row .role {
    font-size: 14px;
    font-weight: 400;
    color: var(--muted);
    line-height: 1.45;
}
.ct-row .fio {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}
/* Строки без ФИО (отделы, службы): название отдела становится заголовком строки */
.ct-row--dept .role {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}

.ct-row .no-contact { font-size: 15px; color: var(--muted); }

.contact-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
    font-size: 16px;
    color: var(--muted);
    text-decoration: none;
    transition: color .2s;
    white-space: nowrap;
}
a.contact-chip:hover { color: var(--accent); }

.contact-chip svg,
.org-meta-row svg {
    flex-shrink: 0;
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.contact-chip svg { width: 16px; height: 16px; }

/* ── САЙДБАР ── */
.contacts-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 32px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: fadeUpIn 0.6s ease 0.15s both;
}

.info-card h2 {
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text);
    margin: 0 0 18px 0;
}

.org-name {
    display: block;
    font-size: 18px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 16px;
    line-height: 1.5;
}

.org-meta-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 16px;
    color: var(--muted);
    margin-bottom: 12px;
    line-height: 1.5;
}
.org-meta-row:last-child { margin-bottom: 0; }
.org-meta-row svg { width: 17px; height: 17px; margin-top: 3px; }
.org-meta-row address { font-style: normal; }

.org-meta-row a,
.addr-link {
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color .2s;
}
.org-meta-row a:hover,
.addr-link:hover { color: var(--accent); }

/* Режим работы */
.hours { margin: 0; padding: 0; flex: 1; }
.hours > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 0 0 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.hours > div:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.hours dt { font-weight: 400; color: var(--muted); }
.hours dd { margin: 0; color: var(--text); text-align: right; }

/* Дилеры (логотипы не интерактивны — без hover-подъёма) */
.dealers-flags {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.dealer-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.dealer-chip img {
    max-width: 38px;
    max-height: 26px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.btn-primary-contacts {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    min-height: 44px;
    background: var(--accent);
    color: #000;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    padding: 13px 24px;
    border-radius: 8px;
    letter-spacing: 0.3px;
    transition: transform .25s cubic-bezier(.165,.84,.44,1), box-shadow .25s;
}
.btn-primary-contacts:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(255,153,0,.25);
    color: #000;
}

.map-card {
    position: relative;
    z-index: 1;
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    height: 300px;
    animation: fadeUpIn 0.6s ease 0.3s both;
}
.map-g-n { width: 100%; height: 100%; }

/* ── Фокус с клавиатуры ── */
.contact-chip:focus-visible,
.org-meta-row a:focus-visible,
.addr-link:focus-visible,
.btn-primary-contacts:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ── АДАПТИВ ── */
@media (max-width: 1000px) {
    .contacts-layout { grid-template-columns: 1fr; }
    .contacts-sidebar { flex-direction: row; flex-wrap: wrap; }
    .contacts-sidebar .info-card { flex: 1 1 280px; }
    .contacts-sidebar .map-card { flex: 1 1 100%; }
    .contacts-page-container { padding: 60px 16px 80px; }
}

/* Сенсорные экраны: ссылки-телефоны не меньше 44 px по высоте */
@media (max-width: 1000px), (pointer: coarse) {
    a.contact-chip { min-height: 44px; }
}

@media (max-width: 640px) {
    /* Шапка скрывается визуально, но остаётся для скринридеров */
    .ct-head-row {
        position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
        overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
    }
    .ct-row { grid-template-columns: 1fr; }
    .ct-role-col {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 16px 20px 12px;
    }
    .ct-contact-col { padding: 8px 20px 12px; }
    .contacts-sidebar { flex-direction: column; }
    .info-card { padding: 24px; }
}

/* Без анимации: ничего не пульсирует и не появляется */
@media (prefers-reduced-motion: reduce) {
    .contacts-ambient-light,
    .contacts-hero,
    .contacts-table-modern,
    .info-card,
    .map-card { animation: none; }
    .contacts-ambient-light { opacity: 0.8; }
    .ct-row::before, .ct-row, .btn-primary-contacts { transition: none; }
}
