/* ============================================================
   МАТРИЦА — общий стиль сайта (шапка, футер, модалка, база)
   Единый источник правды вместо копий в каждом html-файле.
   ============================================================ */

/* --- Base: reset, tokens, typography, container, buttons --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html,body{overflow-x:hidden;}

    :root {
      --navy:       #1c2733;
      --accent:     #5CB757;
      --accent-dark:#3f8a3c;
      --blue:       #5CB757;
      --light-blue: #A8D4F0;
      --paper:      #faf9f6;
      --gray-mid:   #e8e5df;
      --text:       #1c2733;
      --muted:      #5b6470;
      --white:      #FFFFFF;
    }

    html { scroll-behavior: smooth; }

    body {
      font-family: 'IBM Plex Sans', system-ui, sans-serif;
      color: var(--text);
      background: var(--white);
      line-height: 1.65;
      font-size: 17px;
    }

    h1, h2, h3, h4 {
      font-family: 'IBM Plex Sans Condensed', sans-serif;
      font-weight: 600;
      line-height: 1.15;
    }
    h1 { font-size: clamp(2rem, 5vw, 3rem); }
    h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
    p { margin-bottom: 1em; }
    p:last-child { margin-bottom: 0; }

    a { color: inherit; }

    .container       { max-width: 900px;  margin: 0 auto; padding: 0 24px; }
    .container--wide { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

    section { padding: 72px 0; }

    .section-label { font-family: 'IBM Plex Mono', monospace; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #889097; margin-bottom: 12px; }
    .section-label::after { content: ""; display: inline-block; width: 16px; height: 1px; background: var(--accent); margin-left: 8px; vertical-align: middle; }
    .section-title { font-family: 'IBM Plex Sans Condensed', sans-serif; font-weight: 700; color: var(--navy); margin-bottom: 24px; letter-spacing: -.01em; }

    .btn {
      display: inline-block;
      padding: 14px 32px;
      border-radius: 2px;
      font-family: 'IBM Plex Sans', sans-serif;
      font-size: 0.95rem;
      font-weight: 500;
      text-decoration: none;
      cursor: pointer;
      border: none;
      transition: opacity 0.2s, transform 0.1s;
      letter-spacing: 0.01em;
    }
    .btn:hover { }
    .btn--navy    { background: var(--navy);  color: var(--white); }
    .btn--border  { background: transparent;  color: var(--navy);  border: 1.5px solid var(--navy); }
    .btn--white   { background: var(--white); color: var(--navy); }
    .btn--outline { background: transparent;  color: var(--white); border: 1.5px solid rgba(255,255,255,0.35); }
    .btn--dark    { background: var(--navy);  color: var(--white); }

    .section-label--light { color: rgba(255,255,255,0.65); }
    .section-title--light { color: var(--white); }


/* --- Header / navigation --- */
.site-header {
      position: sticky; top: 0; z-index: 100;
      background: #fff;
      padding: 14px 0;
      min-height: 78px;
      border-bottom:1px solid rgba(28,39,51,.08);
    }
    .site-header .container--wide {
      display: flex; align-items: center; justify-content: space-between; gap: 16px;
    }
    .logo { display: flex; flex-direction: column; text-decoration: none; line-height: 1; }
    .logo__main { font-family: 'IBM Plex Sans Condensed', sans-serif; font-size: 1.45rem; font-weight: 600; color: var(--navy); letter-spacing: 0.1em; }
    .logo__sub  { font-size: 0.55rem; color: #889097; letter-spacing: 0.06em; text-transform: uppercase; margin-top: 3px; font-family: 'IBM Plex Mono',monospace; }
    .header-right { display: flex; align-items: center; gap: 14px; }
    .site-nav { display: flex; gap: 4px; align-items: center; }
    .site-nav > a, .nav-dropdown__toggle {
      font-size: 0.88rem; font-weight: 500; color: var(--navy);
      text-decoration: none; letter-spacing: 0.02em; transition: color 0.2s;
      padding: 6px 10px; border-radius: 2px;
    }
    .site-nav > a:hover, .nav-dropdown__toggle:hover { color: var(--accent-dark); }
    .site-nav > a.active, .nav-dropdown.active > .nav-dropdown__toggle { color: var(--accent-dark); }
    .nav-dropdown { position: relative; }
    .nav-dropdown__toggle { cursor: default; display: flex; align-items: center; gap: 5px; }
    .nav-dropdown__toggle::after { content: "▾"; font-size: 0.7rem; opacity: 0.6; }
    .nav-dropdown__menu {
      display: none; position: absolute; top: 100%; left: 0; padding-top: 6px;
      background: #fff !important; border: 0.5px solid var(--gray-mid);
      border-radius: 2px; min-width: 230px; padding: 6px 0;
      box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    }
    .nav-dropdown:hover .nav-dropdown__menu { display: block; }
    .nav-dropdown__menu__inner { display: contents; }
    .nav-dropdown__menu a {
      display: block; padding: 10px 16px;
      font-size: 0.86rem; color: var(--navy) !important;
      text-decoration: none; transition: background 0.15s, color 0.15s;
    }
    .nav-dropdown__menu a:hover { background: var(--paper); color: var(--accent-dark) !important; }
    .nav-dropdown__menu a.active { color: var(--accent-dark); }
    .nav-cta { font-family:'IBM Plex Sans',sans-serif; font-size:0.88rem; padding:10px 22px; background:var(--navy); color:#fff; border-radius:0; font-weight:600; cursor:pointer; border:none; transition:background .18s; } .nav-cta:hover { background:var(--accent); color:#0f1a12; }
    .tg-link { display:inline-flex; align-items:center; width:34px; height:34px; border:1px solid rgba(28,39,51,.18); border-radius:50%; justify-content:center; color:#889097; font-family:'IBM Plex Mono',monospace; font-size:0.72rem; text-decoration:none; transition:border-color .18s,color .18s; }
    .tg-link:hover { border-color:var(--accent); color:var(--accent-dark); }
    .tg-link svg { display: none; }
    .burger {
      display: none; flex-direction: column; gap: 5px;
      background: none; border: none; cursor: pointer; padding: 4px;
    }
    .nav-mobile-cta{display:none;}
    .burger span {
      display: block; width: 22px; height: 2px;
      background: var(--navy); border-radius: 1px;
      transition: transform 0.2s, opacity 0.2s;
    }
    #burger.open span:nth-child(1){transform:translateY(7px) rotate(45deg);}
    #burger.open span:nth-child(2){opacity:0;}
    #burger.open span:nth-child(3){transform:translateY(-7px) rotate(-45deg);}
    @media (max-width: 860px) {
      .site-nav { display: none; flex-direction: column; align-items: stretch; gap: 0; }
      .site-nav.open {
        display: flex; position: absolute; top: 100%; left: 0; right: 0;
        background: #fff; border-top:1px solid rgba(28,39,51,.08);
        padding: 12px 0; box-shadow:0 8px 24px rgba(0,0,0,.08); z-index: 99;
      }
      .site-nav > a, .nav-dropdown__toggle { padding: 12px 24px; border-radius: 0; }
      .nav-dropdown__menu {
        position: static; display: none; box-shadow: none; border: none;
        background: rgba(0,0,0,0.03); padding: 0;
      }
      .nav-dropdown.open .nav-dropdown__menu { display: block; }
      .nav-dropdown__menu a { padding: 10px 36px; }
      .nav-dropdown__toggle::after { margin-left: auto; }
      .burger { display: flex; }
      .tg-link { display: none; }
      .logo__sub { display: none; }
      .nav-mobile-cta { display: block !important; }
      .nav-cta { font-size: 0.78rem; padding: 8px 10px; letter-spacing: 0; }
      .nav-cta, .burger { touch-action: manipulation; }
    }
    /* footer styles above */


/* --- Footer --- */
footer { background:var(--navy); color:rgba(255,255,255,0.6); padding:48px 0 28px; }
    .footer-grid { display:grid; grid-template-columns:1.4fr 1fr 1fr; gap:32px 48px; margin-bottom:36px; }
    @media(max-width:680px){.footer-grid{grid-template-columns:1fr;}}
    .footer-main-grid { display:grid; gap:32px 24px; margin-bottom:36px; }
    @media(max-width:640px){
      .footer-main-grid { grid-template-columns:1fr!important; }
      .footer-main-grid .footer-col ul { display:flex; flex-direction:column; gap:6px; }
    }
    .footer-brand__name { font-family:'IBM Plex Sans Condensed',sans-serif; font-size:1.1rem; font-weight:700; color:var(--white); letter-spacing:0.08em; margin-bottom:6px; }
    .footer-brand__desc { font-size:0.82rem; line-height:1.6; margin-bottom:16px; }
    .footer-col__title { font-family:'IBM Plex Sans Condensed',sans-serif; font-size:0.72rem; font-weight:600; letter-spacing:0.16em; text-transform:uppercase; color:rgba(255,255,255,0.4); margin-bottom:12px; }
    .footer-col ul { list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:8px; }
    .footer-col ul li { margin-bottom:0; }
    .footer-col ul li a { color:rgba(255,255,255,0.6); text-decoration:none; font-size:0.85rem; transition:color 0.2s; }
    .footer-col ul li a:hover { color:var(--white); }
    .footer-bottom { border-top:0.5px solid rgba(255,255,255,0.1); padding-top:20px; display:flex; flex-wrap:wrap; gap:12px; justify-content:space-between; align-items:center; }
    .footer-bottom__copy { font-size:0.78rem; color:rgba(255,255,255,0.6); }
    footer a { color:rgba(255,255,255,0.6); text-decoration:none; }
    footer a:hover { color:var(--white); }


/* --- Contact modal --- */
.modal-overlay {
      display: none; position: fixed; inset: 0; z-index: 9999;
      background: rgba(28,43,58,0.65); backdrop-filter: blur(3px);
      align-items: center; justify-content: center; padding: 20px;
    }
    .modal-overlay.open { display: flex; }
    .modal-box {
      background: #fff; border-radius: 16px; width: 100%; max-width: 460px;
      padding: 40px 36px 32px; position: relative; box-shadow: 0 24px 60px rgba(0,0,0,0.18);
    }
    @media (max-width: 500px) { .modal-box { padding: 32px 20px 24px; } }
    .modal-close {
      position: absolute; top: 16px; right: 20px; background: none; border: none;
      font-size: 1.5rem; cursor: pointer; color: #5A6470; line-height: 1;
    }
    .modal-title {
      font-family: 'IBM Plex Sans Condensed', sans-serif; font-size: 1.5rem; font-weight: 600;
      color: #1c2733; margin-bottom: 6px; letter-spacing: 0.04em; text-transform: uppercase;
    }
    .modal-sub { font-size: 0.88rem; color: #5b6470; margin-bottom: 24px; }
    .modal-group { margin-bottom: 16px; }
    .modal-group label { display: block; font-size: 0.8rem; font-weight: 600; color: #1c2733; margin-bottom: 6px; letter-spacing: 0.04em; text-transform: uppercase; }
    .modal-control {
      width: 100%; padding: 11px 14px; border: 1.5px solid #e8e5df;
      border-radius: 8px; font-size: 0.95rem; color: #1c2733;
      background: #fff; box-sizing: border-box; transition: border-color 0.2s;
    }
    .modal-control:focus { outline: none; border-color: #5CB757; }
    .modal-check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; font-size: 0.82rem; color: #5b6470; line-height: 1.5; }
    .modal-check input { margin-top: 3px; flex-shrink: 0; accent-color: #5CB757; }
    .modal-check a { color: #3f8a3c; }
    .modal-submit {
      width: 100%; margin-top: 20px; padding: 14px; background: #1c2733; color: #fff;
      border: none; border-radius: 8px; font-family: 'IBM Plex Sans Condensed', sans-serif;
      font-size: 1rem; font-weight: 600; letter-spacing: 0.08em; cursor: pointer;
      text-transform: uppercase; transition: opacity 0.2s;
    }
    .modal-submit:hover { opacity: 0.88; }
    .modal-submit:disabled { opacity: 0.5; cursor: default; }

    /* второй вариант модалки (используется частью шаблонов — matricy.html, uslugi.html,
       library/*, каталог матриц и др.): та же .modal-overlay, но упрощённая внутренняя карточка */
    .modal { background: var(--white); border-radius: 4px; padding: 40px 36px; max-width: 480px; width: 100%; position: relative; }
    .modal__close { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); }
    .form-group { margin-bottom: 16px; }
    .form-label { display: block; font-size: 0.82rem; font-weight: 500; margin-bottom: 6px; color: var(--muted); }
    .form-control { width: 100%; border: 1px solid var(--gray-mid); border-radius: 2px; padding: 10px 12px; font-size: 0.95rem; font-family: inherit; background: var(--white); }
    .form-control:focus { outline: none; border-color: var(--accent); }
    .form-check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 20px; font-size: 0.82rem; color: var(--muted); }
    .form-check input { margin-top: 3px; flex-shrink: 0; }
    .form-submit { width: 100%; font-family: 'IBM Plex Sans', sans-serif; font-weight: 600; font-size: 0.9rem; letter-spacing: 0.04em; text-transform: uppercase; background: var(--navy); color: var(--white); border: none; border-radius: 0; padding: 14px; cursor: pointer; transition: background .18s; }
    .form-submit:hover { background: var(--accent); color: #0f1a12; }
    .form-note { font-size: 0.78rem; color: var(--muted); margin-top: 10px; text-align: center; }
    .req { color: var(--accent-dark); }
