/*
Theme Name: AMET
Description: Тема сайта ООО «АМЕТ»: изготовление металлоизделий по чертежам. Серверный рендер, SEO-модуль, тёмная база.
Version: 0.1.0
Requires PHP: 8.0
Text Domain: amet
*/

/* Токены. Варианты дизайна меняют этот блок, а не разметку. */
:root {
  --bg: #0f1113;
  --bg-2: #171a1d;
  --bg-3: #202428;
  --line: #2c3136;
  --text: #e9ecef;
  --muted: #9aa3ab;
  --accent: #f08a24;
  --accent-ink: #111;
  --ok: #4caf7a;
  --err: #e5534b;
  --radius: 6px;
  --wrap: 1200px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-head: "Manrope", "Inter", "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }
a:hover { color: #ffb066; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: clamp(30px, 5vw, 52px); }
h2 { font-size: clamp(24px, 3.4vw, 34px); }
h3 { font-size: 20px; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; }
.section { padding: 64px 0; border-top: 1px solid var(--line); }
.section--tight { padding: 40px 0; }
.lead { font-size: 19px; color: var(--muted); max-width: 720px; }
.muted { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; color: var(--accent); font-weight: 700; margin-bottom: 12px; display: block; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 14px 22px; border-radius: var(--radius); font-weight: 700; text-decoration: none; border: 1px solid transparent; cursor: pointer; font-size: 16px; font-family: inherit; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: #ffa04a; color: var(--accent-ink); }
.btn--ghost { border-color: var(--line); color: var(--text); background: transparent; }
.btn--ghost:hover { border-color: var(--muted); color: var(--text); }
.btn__short, .nav-toggle__icon { display: none; }

/* Шапка */
.topbar { background: var(--bg-2); border-bottom: 1px solid var(--line); font-size: 14px; }
.topbar .wrap { display: flex; gap: 20px; align-items: center; justify-content: flex-end; min-height: 36px; flex-wrap: wrap; }
.topbar a { color: var(--muted); text-decoration: none; }
.topbar a:hover { color: var(--text); }
.topbar__phone { display: none; }
.topbar .tg-icon { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: #229ED9; }
.topbar .tg-icon:hover { background: #1b8bc2; }
.header { position: sticky; top: 0; z-index: 50; background: rgba(15,17,19,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.header .wrap { display: flex; align-items: center; gap: 24px; min-height: 68px; }
.logo { font-family: var(--font-head); font-weight: 800; font-size: 22px; color: var(--text); text-decoration: none; letter-spacing: .04em; }
.logo small { display: block; font: 400 11px/1.2 var(--font); color: var(--muted); letter-spacing: 0; }
.nav { margin-left: auto; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 22px; }
.nav a { color: var(--text); text-decoration: none; font-weight: 600; font-size: 15px; }
.nav a:hover, .nav .current-menu-item > a { color: var(--accent); }
.header__phone { color: var(--text); text-decoration: none; font-weight: 700; white-space: nowrap; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); color: var(--text); padding: 8px 10px; border-radius: var(--radius); }

/* Хлебные крошки */
.crumbs { font-size: 14px; color: var(--muted); padding: 18px 0 0; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line); }
.crumbs a { color: var(--muted); text-decoration: none; }

/* Первый экран */
.hero { padding: 72px 0 64px; background: linear-gradient(180deg, var(--bg-2), var(--bg)); }
.hero__grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 48px; align-items: start; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 20px; }
.hero__facts { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hero__facts li { border-left: 2px solid var(--accent); padding-left: 12px; font-size: 14px; color: var(--muted); }
.hero__facts b { display: block; color: var(--text); font-size: 16px; }
.hero__photo { margin: 0; }
.hero__photo img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); }
.hero__photo figcaption { font-size: 14px; margin-top: 6px; }
.hero .hero__process { margin-top: 40px; }
.section.gallery { margin: 0; }
.process { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.process li { counter-increment: s; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; font-size: 14px; }
.process li::before { content: counter(s, decimal-leading-zero); display: block; color: var(--accent); font-weight: 800; margin-bottom: 6px; }

/* Карточки */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: var(--text); transition: border-color .15s; }
.card:hover { border-color: var(--accent); color: var(--text); }
.card__img { aspect-ratio: 3 / 2; background: var(--bg-3); object-fit: cover; width: 100%; }
.card__img--empty { display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.card__body { padding: 18px; }
.card__body h3 { margin-bottom: 6px; }
.card__body p { color: var(--muted); font-size: 15px; margin: 0; }

/* Контент страницы */
.content { max-width: 820px; }
.content h2 { margin-top: 1.6em; }
.content ul, .content ol { padding-left: 1.2em; }
.content table, .spec { width: 100%; border-collapse: collapse; margin: 1em 0 1.6em; font-size: 15px; }
.content th, .content td, .spec th, .spec td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.content th, .spec th { color: var(--muted); font-weight: 600; width: 38%; }
/* Прайс: широкая таблица прокручивается внутри своего блока, страница — нет; толщина закреплена слева */
.price-table { overflow-x: auto; margin: 1em 0 1.6em; border: 1px solid var(--line); border-radius: var(--radius); }
.price-table table { margin: 0; min-width: 640px; font-variant-numeric: tabular-nums; }
.price-table caption { caption-side: top; text-align: left; padding: 10px 12px; color: var(--muted); font-size: 14px; }
.price-table th, .price-table td { width: auto; white-space: nowrap; text-align: right; padding: 8px 10px; }
.price-table thead th { text-align: center; color: var(--text); }
.price-table tbody th { position: sticky; left: 0; background: var(--bg-2); color: var(--text); text-align: left; }
.price-table tbody tr:hover td { background: var(--bg-2); }
.content details { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; margin: 0 0 10px; background: var(--bg-2); }
.content summary { cursor: pointer; padding: 14px 0; font-weight: 700; }
.content details[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.note { border-left: 3px solid var(--accent); background: var(--bg-2); padding: 12px 16px; color: var(--muted); font-size: 15px; }
.page-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 48px; padding: 32px 0 64px; }
.aside-cta { position: sticky; top: 96px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.aside-cta h2 { font-size: 20px; }

/* Подвал: заявка + контакты */
.footer { background: var(--bg-2); border-top: 1px solid var(--line); padding: 48px 0 24px; font-size: 15px; color: var(--muted); scroll-margin-top: 80px; }
.footer__main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.footer h2 { font-size: 22px; color: var(--text); margin: 0 0 8px; }
.footer__lead { margin: 0 0 18px; }
.footer__contacts { display: grid; gap: 4px; }
.footer__contacts p { margin: 0 0 8px; }
.footer__phone a { font-size: 24px; font-weight: 700; color: var(--text); }
.footer__tg { display: inline-flex; align-items: center; gap: 8px; }
.footer__tg svg { color: #229ED9; }
.footer__addr { font-size: 14px; }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--text); }
.footer .rfq__step--short { background: var(--bg); }
.footer .rfq__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.footer__grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 28px; border-top: 1px solid var(--line); margin-top: 40px; padding-top: 28px; font-size: 14px; }
.footer__grid h3 { font-size: 14px; color: var(--text); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 10px; }
.footer__grid ul { list-style: none; margin: 0; padding: 0; }
.footer__grid li { margin-bottom: 6px; line-height: 1.35; }
.related ul { list-style: none; padding: 0; margin: 0 0 1em; }
.related li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.footer__legal { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 14px; font-size: 13px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

/* Уведомление об аналитике */
.consent { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 90; max-width: 560px; background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.consent p { margin: 0 0 10px; color: var(--muted); }
.consent .btn { padding: 8px 14px; font-size: 14px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

@media (max-width: 960px) {
  .hero__grid, .page-layout { grid-template-columns: 1fr; }
  .process { grid-template-columns: repeat(2, 1fr); }
  .footer__main { grid-template-columns: 1fr; gap: 32px; }
  .footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aside-cta { position: static; }
  /* Телефон остаётся в закреплённой шапке на любой ширине: логотип · телефон · меню · кнопка */
  .header__phone { order: 1; margin-left: auto; }
  .nav-toggle { display: inline-block; order: 2; }
  .header .btn { order: 3; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--bg); border-bottom: 1px solid var(--line); }
  .nav.is-open { display: block; }
  .nav ul { flex-direction: column; gap: 0; padding: 8px 16px 16px; }
  .nav a { display: block; padding: 10px 0; }
}
@media (max-width: 560px) {
  .hero { padding: 40px 0; }
  .hero__facts { grid-template-columns: 1fr; }
  .footer .rfq__grid { grid-template-columns: 1fr; }
  .footer__grid { grid-template-columns: 1fr; }
  .topbar .wrap { justify-content: space-between; gap: 12px; flex-wrap: nowrap; }
  .topbar__region, .topbar a[data-goal="contact_channel"] { display: none; }
  .header .wrap { gap: 8px; min-height: 60px; }
  .logo { font-size: 20px; }
  .logo small { display: none; }
  .header__phone { font-size: 14px; }
  .header .btn { padding: 9px 10px; font-size: 14px; white-space: nowrap; }
  .btn__long { display: none; }
  .btn__short { display: inline; }
  .nav-toggle { padding: 6px 10px; font-size: 18px; line-height: 1; }
  .nav-toggle__icon { display: inline; }
  .nav-toggle__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 400px) {
  .header .wrap { gap: 6px; }
  .header__phone { font-size: 13px; }
  .logo { font-size: 18px; }
}

/* Галерея «Фото работ» и главное фото страницы */
.gallery { margin: 2em 0; }
/* Видео услуги: ролик без звука или обложка полного видео (плеер — по клику) */
.video { margin: 0 0 1.6em; }
.video__clip, .video__facade, .video__frame { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); background: var(--bg-3) center / cover no-repeat; }
.video__clip { object-fit: cover; }
.video__facade { position: relative; cursor: pointer; color: #fff; }
.video__play { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 24px; }
.video__label { position: absolute; left: 12px; bottom: 12px; background: rgba(0,0,0,.6); padding: 4px 10px; border-radius: 4px; font-size: 14px; }
.video figcaption { font-size: 14px; margin-top: 6px; }
/* Ролики видеосервера: пропорции по обложке (вертикальные с телефона не растягиваются), не выше экрана. */
.vlib { margin: 2em 0; }
.vlib .video__lib { aspect-ratio: auto; width: auto; max-width: 100%; height: auto; max-height: min(78vh, 640px); margin: 0 auto; background: #000; object-fit: contain; }
.vlib__title { font-size: 17px; margin: 10px 0 4px; }
.vlib figcaption p { margin: 0; }
.gallery__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius); }
.gallery figcaption { font-size: 14px; margin-top: 6px; }
article > figure img { border-radius: var(--radius); }
article > figure figcaption { font-size: 14px; margin: 6px 0 16px; }

/* Нижняя панель быстрой связи — только на телефоне */
.mbar { display: none; }
@media (max-width: 760px) {
  .mbar { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--bg); border-top: 1px solid var(--line); }
  .mbar__btn { display: flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--text); text-decoration: none; font-weight: 600; font-size: 15px; }
  .mbar__btn--main { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  body { padding-bottom: 64px; }
  .consent { bottom: 76px; }
}
@media (max-width: 760px) { .ai-btn { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); } .ai-panel { bottom: calc(124px + env(safe-area-inset-bottom, 0px)); } }
