/* Магнезит Азия — раскладка страниц по финальным макетам (claude/maket). */

html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; background: var(--surface); }
.wp-site-blocks { padding: 0; }
.wp-site-blocks > * { margin-block-start: 0; }
:where(.mg-root) a { color: var(--link); }
:where(.mg-root) a:hover { color: var(--heat-hover); }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }
.mg-skip { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 8px 16px; background: var(--ink); color: #fff !important; border-radius: var(--radius-sm); }
.mg-skip:focus { top: 8px; }

/* Контейнер */
.mg-wrap { max-width: var(--container-max); margin: 0 auto; padding-left: clamp(16px, 4vw, 32px); padding-right: clamp(16px, 4vw, 32px); }
.mg-section { padding-top: 80px; padding-bottom: 80px; }
.mg-section--raised { background: var(--surface-raised); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.mg-stack { display: flex; flex-direction: column; gap: 32px; }
.mg-head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }

/* Шапка */
.mg-header { flex-wrap: wrap; padding: 0 clamp(16px, 4vw, 32px); position: relative; z-index: 20; }
.mg-header .mg-nav { gap: 32px; }
.mg-header__tools { flex-wrap: wrap; padding: 12px 0; }
.mg-root .mg-header .mg-nav a { color: var(--ink); }
.mg-root .mg-header .mg-nav a:hover { color: var(--heat); }
.mg-root .mg-btn--primary, .mg-root .mg-btn--primary:hover { color: var(--on-heat); }
.mg-root .mg-btn--secondary { color: var(--ink); }
.mg-root .mg-btn--secondary:hover { color: var(--surface-raised); }
.mg-root .mg-dark .mg-btn--secondary { color: var(--on-graphite); }
.mg-root .mg-dark .mg-btn--secondary:hover { color: var(--graphite); }
.mg-menu-toggle { display: none; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: transparent; color: var(--ink); cursor: pointer; }
.mg-menu-toggle svg { width: 22px; height: 22px; }

@media (max-width: 900px) {
  .mg-header { gap: 12px; padding-top: 10px; padding-bottom: 10px; }
  .mg-menu-toggle { display: inline-flex; margin-left: auto; }
  .mg-header__nav { order: 3; flex-basis: 100%; display: none; }
  .mg-header.is-open .mg-header__nav { display: block; }
  .mg-header .mg-nav { flex-direction: column; gap: 0; border-top: 1px solid var(--line); }
  .mg-header .mg-nav a { padding: 14px 0; border-bottom: 1px solid var(--line); }
  .mg-header .mg-nav a[aria-current="page"] { border-bottom-color: var(--line); color: var(--heat); }
  .mg-header__tools { order: 4; flex-basis: 100%; margin-left: 0; display: none; padding: 12px 0 8px; }
  .mg-header.is-open .mg-header__tools { display: flex; }
  .mg-logo img { height: 36px; }
}

/* Первый экран */
.mg-hero { position: relative; background: var(--graphite) center / cover no-repeat; overflow: hidden; }
.mg-hero__shade { position: absolute; inset: 0; background: rgba(43, 42, 41, .6); }
.mg-hero__note { position: absolute; right: 24px; bottom: 16px; left: 24px; text-align: right; }
.mg-hero__inner { position: relative; display: flex; flex-direction: column; gap: 24px; padding-top: 120px; padding-bottom: 120px; }
.mg-hero__inner--page { gap: 20px; padding-top: 72px; padding-bottom: 80px; }
.mg-hero .mg-display { max-width: 820px; }
.mg-hero .mg-lead { max-width: 680px; }
.mg-actions { display: flex; flex-wrap: wrap; gap: 16px; }
.mg-crumbs { font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.mg-crumbs a { color: inherit !important; text-decoration: none; }
.mg-crumbs a:hover { text-decoration: underline; }
.mg-crumbs [aria-current] { color: var(--heat); }
.mg-dark .mg-crumbs { color: var(--on-graphite-muted); }
.mg-dark .mg-crumbs [aria-current] { color: var(--heat-bright); }
@media (max-width: 720px) {
  .mg-hero__inner { padding-top: 64px; padding-bottom: 64px; }
  .mg-hero__inner--page { padding-top: 40px; padding-bottom: 48px; }
  .mg-section { padding-top: 48px; padding-bottom: 48px; }
}

/* Сетки карточек */
.mg-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.mg-grid--wide { grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
.mg-grid--fit { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Плитка с фото (раздел, изделие) */
.mg-tile { display: flex; flex-direction: column; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; text-decoration: none; color: var(--ink) !important; transition: border-color .15s; }
a.mg-tile:hover { border-color: var(--ink); }
.mg-tile__media { display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--surface-sunken); color: var(--ink-muted) !important; font-size: 13px; line-height: 18px; text-align: center; padding: 16px; overflow: hidden; text-decoration: none; }
.mg-tile__media:has(img) { padding: 0; }
.mg-tile__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mg-tile__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; }
.mg-tile__body { display: flex; flex-direction: column; gap: 8px; padding: 16px 20px 20px; flex: 1; }
.mg-tile__title { font-family: var(--font-display); font-weight: 600; font-size: 19px; line-height: 25px; margin: 0; }
.mg-tile__title a { color: var(--ink) !important; text-decoration: none; }
.mg-tile__arrow { color: var(--heat); font-weight: 600; }
.mg-tile__body .mg-btn { margin-top: 8px; align-self: flex-start; }

/* Плитка отрасли (тёмная, с фото) */
.mg-industry { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 280px; border-radius: var(--radius-md); overflow: hidden; background: var(--graphite) center / cover no-repeat; text-decoration: none; color: var(--on-graphite) !important; }
.mg-industry::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(43,42,41,.15) 0%, rgba(43,42,41,.85) 100%); }
.mg-industry__note { position: absolute; top: 16px; left: 20px; right: 20px; color: var(--on-graphite-muted); font-size: 13px; line-height: 18px; }
.mg-industry__body { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 24px; }
.mg-industry__title { font-family: var(--font-display); font-weight: 600; font-size: 26px; line-height: 32px; }
.mg-industry__more { margin-top: 8px; color: var(--heat-bright); font-weight: 600; }
.mg-industry:hover .mg-industry__more { text-decoration: underline; }

/* Страница с боковым меню */
.mg-layout { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; padding-top: 56px; padding-bottom: 80px; }
.mg-layout--tight { padding-top: 40px; }
.mg-layout__aside { flex: 1 1 240px; max-width: 100%; display: flex; flex-direction: column; gap: 16px; }
.mg-layout__aside .mg-eyebrow { color: var(--ink-muted); }
.mg-layout__main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 56px; }
.mg-layout__main--32 { gap: 32px; }
.mg-block { display: flex; flex-direction: column; gap: 24px; }

/* Шапка раздела каталога */
.mg-pagehead { background: var(--surface-raised); border-bottom: 1px solid var(--line); }
.mg-pagehead__inner { display: flex; flex-direction: column; gap: 16px; padding-top: 24px; padding-bottom: 40px; }
.mg-pagehead .mg-h1 { padding-bottom: 16px; border-bottom: 4px solid var(--brand-red); align-self: flex-start; }
.mg-pagehead .mg-lead { color: var(--ink); }

/* Карточка товара */
.mg-product-top { display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; }
.mg-product-top__media { flex: 1 1 440px; min-width: 0; display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--surface-sunken); border-radius: var(--radius-md); color: var(--ink-muted); font-size: 14px; text-align: center; padding: 24px; overflow: hidden; }
.mg-product-top__media:has(img) { padding: 0; }
.mg-product-top__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mg-product-top__info { flex: 1 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.mg-product-top__intro { margin: 0; font-size: 18px; line-height: 28px; }
.mg-props { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.mg-props dt { color: var(--ink-muted); }
.mg-props dd { margin: 0; font-weight: 500; }
@media (max-width: 520px) { .mg-props { grid-template-columns: 1fr; gap: 2px; } .mg-props dd { margin-bottom: 10px; } }
.mg-chips { display: flex; flex-wrap: wrap; gap: 12px; }

/* Текст из редактора (описание товара, страницы решения) */
.mg-prose { max-width: 820px; display: flex; flex-direction: column; gap: 16px; }
.mg-prose > * { margin: 0; }
.mg-prose h2 { margin-top: 24px; font-size: 28px; line-height: 34px; display: flex; flex-direction: column; gap: 10px; }
.mg-prose h2::before { content: ""; width: 40px; height: 4px; border-radius: 2px; background: var(--brand-red); }
.mg-prose h2:first-child { margin-top: 0; }
.mg-prose h3 { font-size: 22px; line-height: 28px; }
.mg-prose ul, .mg-prose ol { padding-left: 1.25em; }
.mg-prose figure.wp-block-table { margin: 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-raised); }
.mg-prose .wp-block-table table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.mg-prose .wp-block-table th, .mg-prose .wp-block-table td { padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.mg-prose .wp-block-table thead th { font-size: 12px; line-height: 16px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); background: var(--surface-sunken); }
.mg-prose .wp-block-table td:last-child { font-family: var(--font-mono); text-align: right; white-space: nowrap; }
.mg-prose .wp-block-table thead th:last-child { text-align: right; }
.mg-prose .wp-block-table tbody tr:last-child td { border-bottom: 0; }
.mg-prose .wp-block-table figcaption { margin: 0; padding: 12px 16px; font-size: 12px; line-height: 16px; color: var(--ink-muted); border-top: 1px solid var(--line); text-align: left; }
.mg-prose--wide { max-width: none; }

/* Схема печи */
.mg-areas { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.mg-area { display: flex; align-items: flex-start; gap: 12px; min-height: 64px; padding: 14px 16px; border-radius: var(--radius-md); font: inherit; cursor: pointer; text-align: left; background: var(--surface-raised); color: var(--ink); border: 1px solid var(--line-strong); }
.mg-area:hover { border-color: var(--ink); }
.mg-area[aria-pressed="true"] { background: var(--ink); color: var(--surface-raised); border-color: var(--ink); }
.mg-area__text { display: flex; flex-direction: column; gap: 2px; }
.mg-area__name { font-weight: 600; }
.mg-area__mat { font-size: 14px; line-height: 20px; opacity: .8; }

/* Блок «Поставка и монтаж» */
.mg-note-box { display: flex; flex-wrap: wrap; gap: 24px; padding: 32px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); }
.mg-note-box > div { flex: 1 1 320px; display: flex; flex-direction: column; gap: 8px; }
.mg-note-box p { margin: 0; color: var(--ink-muted); }

/* Форма и контакты */
.mg-form-section { background: var(--surface-raised); border-top: 1px solid var(--line); }
.mg-form-layout { display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; }
.mg-form-layout__text { flex: 1 1 320px; display: flex; flex-direction: column; gap: 12px; }
.mg-form-layout__text p { margin: 0; color: var(--ink-muted); }
.mg-form-layout .mg-form { flex: 1 1 420px; min-width: 0; }
.mg-contacts-list { display: flex; flex-direction: column; gap: 16px; }
.mg-contacts-list .mg-btn { align-self: flex-start; }
.mg-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.mg-alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 15px; line-height: 22px; }
.mg-alert--ok { background: var(--success-soft); color: var(--success); }
.mg-alert--err { background: var(--danger-soft); color: var(--danger); }
.mg-file input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mg-file:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.mg-file__name { display: block; margin-top: 2px; color: var(--ink); font-weight: 500; }

/* Подвал */
.mg-footer__inner { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: center; padding-top: 40px; padding-bottom: 40px; }
.mg-footer img { height: 40px; width: auto; display: block; }
.mg-footer nav { display: flex; flex-wrap: wrap; gap: 24px; }
.mg-root .mg-footer nav a { color: var(--on-graphite); text-decoration: none; }
.mg-root .mg-footer nav a:hover { color: var(--heat-bright); }
.mg-footer__copy { font-size: 14px; line-height: 20px; color: var(--on-graphite-muted); }
.mg-root .mg-footer__copy a { color: var(--on-graphite-muted); }

/* Плавающая кнопка WhatsApp */
.mg-float { position: fixed; right: 24px; top: 104px; z-index: 30; }
@media (max-width: 900px) { .mg-float { top: auto; bottom: 16px; right: 16px; } .mg-float .mg-rail a { min-height: 48px; padding: 10px 16px; font-size: 16px; } }

/* Пустое состояние / 404 */
.mg-empty { padding: 32px; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); color: var(--ink-muted); }

/* Обёртки блочной темы без лишних отступов */
.mg-main > *, .mg-part > * { margin-block-start: 0 !important; margin-block-end: 0 !important; }
.mg-main, .mg-part { margin: 0 !important; }
.wp-site-blocks > .mg-part, .wp-site-blocks > main { margin-block-start: 0; }

/* Таблица: тонкая линия под шапкой */
.mg-prose .wp-block-table thead { border-bottom: 1px solid var(--line); }

/* Телефон: плитки каталога в две колонки */
@media (max-width: 600px) {
  .mg-grid:not(.mg-grid--wide):not(.mg-grid--fit) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .mg-grid:not(.mg-grid--wide):not(.mg-grid--fit) .mg-tile__row { padding: 12px; align-items: flex-start; }
  .mg-grid:not(.mg-grid--wide):not(.mg-grid--fit) .mg-tile__title { font-size: 15px !important; line-height: 20px !important; }
  .mg-grid:not(.mg-grid--wide):not(.mg-grid--fit) .mg-tile__body { padding: 12px; }
  .mg-grid:not(.mg-grid--wide):not(.mg-grid--fit) .mg-tile__body .mg-btn { width: 100%; padding-left: 8px; padding-right: 8px; white-space: normal; }
  .mg-industry { min-height: 200px; }
}

/* Телефон: боковое меню раздела — после содержимого */
@media (max-width: 900px) { .mg-layout__aside { order: 2; } }
