/* Магнезит Азия — компоненты. Все значения берутся из tokens.css (var(--…)). Префикс классов: mg- */

.mg-root, .mg-root * { box-sizing: border-box; }
.mg-root { font-family: var(--font-sans); font-size: 16px; line-height: 26px; color: var(--ink); background: var(--surface); -webkit-font-smoothing: antialiased; }
.mg-root :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mg-dark { background: var(--graphite); color: var(--on-graphite); }
.mg-dark :focus-visible { outline-color: var(--focus-on-graphite); }

/* ——— Типографика ——— */
.mg-display { font-family: var(--font-display); font-size: 56px; line-height: 60px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.mg-h1 { font-family: var(--font-display); font-size: 40px; line-height: 46px; font-weight: 600; margin: 0; }
.mg-h2 { font-family: var(--font-display); font-size: 30px; line-height: 36px; font-weight: 600; margin: 0; }
.mg-h3 { font-family: var(--font-display); font-size: 22px; line-height: 28px; font-weight: 600; margin: 0; }
.mg-eyebrow { font-family: var(--font-display); font-size: 13px; line-height: 16px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--heat); margin: 0; }
.mg-dark .mg-eyebrow { color: var(--heat-bright); }
.mg-lead { font-size: 19px; line-height: 29px; color: var(--ink-muted); max-width: var(--measure); margin: 0; }
.mg-dark .mg-lead { color: var(--on-graphite-muted); }
.mg-small { font-size: 14px; line-height: 20px; }
.mg-muted { color: var(--ink-muted); }
.mg-data { font-family: var(--font-mono); font-size: 14px; line-height: 20px; font-variant-numeric: tabular-nums; }
.mg-mark { font-family: var(--font-mono); font-size: 16px; line-height: 20px; font-weight: 500; }
.mg-link { color: var(--link); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.mg-link:hover { text-decoration-thickness: 2px; }

/* ——— Кнопки ——— */
.mg-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 48px; padding: var(--space-3) var(--space-6); border: 1px solid transparent; border-radius: var(--radius-sm); font-family: var(--font-sans); font-size: 16px; line-height: 20px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s; }
.mg-btn svg { width: 20px; height: 20px; flex: none; }
.mg-btn--primary, .mg-btn--primary:visited { background: var(--heat); color: var(--on-heat); }
.mg-btn--primary:hover, .mg-btn--primary:active { background: var(--heat-hover); color: var(--on-heat); }
.mg-btn--secondary, .mg-btn--secondary:visited { background: transparent; color: var(--ink); border-color: var(--ink); }
.mg-btn--secondary:hover { background: var(--ink); color: var(--surface-raised); }
.mg-dark .mg-btn--secondary { color: var(--on-graphite); border-color: var(--on-graphite); }
.mg-dark .mg-btn--secondary:hover { background: var(--on-graphite); color: var(--graphite); }
.mg-btn--text { min-height: 40px; padding: var(--space-2) 0; background: none; color: var(--link); }
.mg-btn--text:hover { text-decoration: underline; text-underline-offset: 3px; }
.mg-btn--sm { min-height: 40px; padding: var(--space-2) var(--space-4); font-size: 14px; }
.mg-btn[disabled] { background: var(--surface-sunken); color: var(--ink-muted); border-color: var(--line); cursor: not-allowed; }

/* ——— Бейджи ——— */
.mg-badge { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px var(--space-2); border-radius: var(--radius-xs); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; background: var(--surface-sunken); color: var(--ink); white-space: nowrap; }
.mg-badge--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink-muted); }
.mg-badge--heat { background: var(--heat-soft); color: var(--heat); }

/* ——— Логотип и фирменная линия ——— */
.mg-logo { display: inline-flex; align-items: center; text-decoration: none; }
.mg-logo img { display: block; height: 44px; width: auto; }
.mg-brand-rule { display: block; height: 3px; background: linear-gradient(90deg, var(--logo-orange), var(--logo-red)); border: 0; margin: 0; }

/* ——— Шапка ——— */
.mg-header { display: flex; align-items: center; gap: var(--space-8); min-height: 72px; padding: 0 var(--space-6); background: var(--surface-raised); border-bottom: 1px solid var(--line); }
.mg-nav { display: flex; gap: var(--space-8); margin: 0; padding: 0; list-style: none; }
.mg-nav a { display: block; padding: var(--space-6) 0 calc(var(--space-6) - 3px); border-bottom: 3px solid transparent; color: var(--ink); text-decoration: none; font-size: 16px; line-height: 21px; font-weight: 500; }
.mg-nav a:hover { color: var(--heat); }
.mg-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--brand-red); }
.mg-header__tools { margin-left: auto; display: flex; align-items: center; gap: var(--space-4); }
.mg-phone { font-family: var(--font-mono); font-size: 15px; font-weight: 500; color: var(--ink); text-decoration: none; white-space: nowrap; }
.mg-phone:hover { color: var(--heat); }
.mg-lang { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.mg-lang a { padding: 6px 10px; font-size: 13px; line-height: 16px; font-weight: 600; color: var(--ink-muted); text-decoration: none; }
.mg-lang a[aria-current="true"] { background: var(--ink); color: var(--surface-raised); }

/* ——— Таблицы ——— */
.mg-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-raised); }
.mg-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.mg-table caption { text-align: left; padding: var(--space-3) var(--space-4); font-size: 12px; line-height: 16px; color: var(--ink-muted); caption-side: bottom; border-top: 1px solid var(--line); }
.mg-table th { text-align: left; font-weight: 600; font-size: 12px; line-height: 16px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); background: var(--surface-sunken); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); vertical-align: bottom; }
.mg-table td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); vertical-align: top; }
.mg-table tbody tr:last-child td { border-bottom: 0; }
.mg-table .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mg-table th.num { text-align: right; font-family: var(--font-sans); }
.mg-table tbody th { text-transform: none; letter-spacing: 0; font-size: 14px; line-height: 20px; color: var(--ink); background: transparent; font-weight: 500; vertical-align: top; border-bottom: 1px solid var(--line); }
.mg-table tbody tr:last-child th { border-bottom: 0; }

/* ——— Зоны: номер-маркер в цвете термошкалы ——— */
.mg-zone-key { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: var(--radius-xs); font-family: var(--font-mono); font-size: 13px; line-height: 1; font-weight: 600; }
.mg-zone-key--1 { background: var(--zone-1); color: var(--on-heat); }
.mg-zone-key--2 { background: var(--zone-2); color: var(--on-heat); }
.mg-zone-key--3 { background: var(--zone-3); color: var(--ink); }
.mg-zone-key--4 { background: var(--zone-4); color: var(--ink); }
.mg-zone-key--5 { background: var(--zone-5); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* ——— Схема агрегата (SVG) ——— */
.mg-scheme { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-6); margin: 0; }
.mg-scheme svg { display: block; width: 100%; height: auto; overflow: visible; }
.mg-scheme .shell { fill: none; stroke: var(--graphite); stroke-width: 3; }
.mg-scheme .axis { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 6 4; fill: none; }
.mg-scheme .dim { stroke: var(--ink-muted); stroke-width: 1; fill: none; }
.mg-scheme .z1 { fill: var(--zone-1); } .mg-scheme .z2 { fill: var(--zone-2); } .mg-scheme .z3 { fill: var(--zone-3); }
.mg-scheme .z4 { fill: var(--zone-4); } .mg-scheme .z5 { fill: var(--zone-5); stroke: var(--line-strong); stroke-width: 1; }
.mg-scheme .zone { cursor: pointer; transition: opacity .15s; }
.mg-scheme .zone:hover { opacity: 1 !important; }
.mg-scheme .zone:focus-visible { outline: none; stroke: var(--focus); stroke-width: 3; opacity: 1 !important; }
.mg-scheme.has-active .zone:not(.is-active) { opacity: .35; }
.mg-scheme .zone.is-active { stroke: var(--ink); stroke-width: 2; }
.mg-scheme .lbl { font-family: var(--font-mono); font-size: 13px; font-weight: 600; pointer-events: none; }
.mg-scheme .lbl-light { fill: var(--on-heat); } .mg-scheme .lbl-dark { fill: var(--ink); }
.mg-scheme .note { font-family: var(--font-sans); font-size: 12px; fill: var(--ink-muted); }
.mg-scheme .flame { fill: none; stroke: var(--heat); stroke-width: 2; }
.mg-scheme__panel { margin-top: var(--space-4); padding: var(--space-4); background: var(--surface-sunken); border-radius: var(--radius-sm); display: grid; gap: var(--space-1); }

/* ——— Формы ——— */
.mg-form { display: grid; gap: var(--space-4); padding: var(--space-8); background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); margin: 0; }
.mg-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.mg-field { display: grid; gap: var(--space-1); }
.mg-label { font-size: 14px; line-height: 20px; font-weight: 600; }
.mg-label .req { color: var(--heat); }
.mg-input, .mg-select, .mg-textarea { width: 100%; min-height: 48px; padding: var(--space-3) var(--space-4); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-raised); color: var(--ink); font: inherit; font-size: 16px; line-height: 22px; }
.mg-textarea { min-height: 112px; resize: vertical; }
.mg-input::placeholder, .mg-textarea::placeholder { color: var(--ink-muted); }
.mg-input:hover, .mg-select:hover, .mg-textarea:hover { border-color: var(--ink); }
.mg-input:focus-visible, .mg-select:focus-visible, .mg-textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.mg-hint { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.mg-file { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); font-size: 14px; line-height: 20px; color: var(--ink-muted); cursor: pointer; }
.mg-file svg { width: 24px; height: 24px; color: var(--ink); flex: none; }
.mg-file strong { color: var(--ink); }
.mg-check { display: flex; gap: var(--space-2); align-items: flex-start; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.mg-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--heat); flex: none; }

/* ——— Плавающая кнопка WhatsApp: одна, зелёная, справа вверху под шапкой ——— */
.mg-rail { display: flex; }
.mg-rail a { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 12px 20px; border-radius: 26px; background: var(--whatsapp); color: #ffffff; text-decoration: none; font-size: 19px; line-height: 24px; font-weight: 700; box-shadow: var(--shadow-float); white-space: nowrap; }
.mg-rail a svg { width: 24px; height: 24px; color: #ffffff; flex: none; }
.mg-rail a:hover { background: var(--whatsapp-hover); color: #ffffff; }
.mg-rail a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ——— Заголовок секции и меню раздела ——— */
.mg-bar-heading { margin: 0; padding: 0; background: none; border: 0; font-family: var(--font-display); font-size: 28px; line-height: 34px; font-weight: 600; display: flex; flex-direction: column; gap: 10px; }
.mg-bar-heading::before { content: ""; width: 40px; height: 4px; border-radius: 2px; background: var(--brand-red); }
.mg-sidenav { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.mg-sidenav a { display: block; padding: var(--space-3) var(--space-2); background: none; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 15px; line-height: 20px; font-weight: 500; }
.mg-sidenav a:hover { color: var(--heat); }
.mg-sidenav a[aria-current="page"] { background: var(--graphite); color: var(--on-graphite); padding-left: var(--space-4); border-radius: var(--radius-sm); border-bottom-color: transparent; }

@media (max-width: 720px) {
  .mg-display { font-size: 36px; line-height: 40px; }
  .mg-h1 { font-size: 30px; line-height: 36px; }
  .mg-h2 { font-size: 24px; line-height: 30px; }
  .mg-bar-heading { font-size: 24px; line-height: 30px; }
  .mg-form { padding: var(--space-6) var(--space-4); }
  .mg-form__row { grid-template-columns: 1fr; }
}
