/* =============================================================
   ГРИННАВИ — дизайн-система + стили сайта
   1. Токены
   2. База / типографика
   3. Утилиты и сетка
   4. Компоненты
   5. Секции
   6. Адаптив
   ============================================================= */

/* ---------- 1. ТОКЕНЫ ---------- */
:root {
  /* Палитра: нейтральная графитовая база + один акцент — приборный янтарь */
  --bg:            #F7F6F3;
  --bg-2:          #FFFFFF;
  --bg-3:          #EFEDE8;
  --bg-inverse:    #0C0E10;
  --fg:            #14171A;
  --fg-2:          #4A5158;
  --fg-3:          #6E767E;
  --fg-inverse:    #EDEDEA;
  --line:          #DDDAD3;
  --line-2:        #C6C2B9;
  --accent:        #8A5E06;  /* контрастный для текста по светлому фону */
  --accent-gfx:    #C98A14;  /* для графики, рамок, штрихов */
  --accent-soft:   #FBF1DC;
  --accent-fg:     #0C0E10;
  --focus:         #0B63CE;

  /* Типографика */
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --step--1: clamp(0.80rem, 0.78rem + 0.10vw, 0.86rem);
  --step-0:  clamp(0.95rem, 0.92rem + 0.16vw, 1.05rem);
  --step-1:  clamp(1.10rem, 1.03rem + 0.34vw, 1.30rem);
  --step-2:  clamp(1.35rem, 1.20rem + 0.72vw, 1.80rem);
  --step-3:  clamp(1.70rem, 1.40rem + 1.45vw, 2.60rem);
  --step-4:  clamp(2.10rem, 1.55rem + 2.70vw, 4.00rem);

  /* Ритм */
  --maxw: 1240px;
  --gutter: clamp(1.15rem, 4vw, 3rem);
  --sec-y: clamp(4rem, 9vw, 7.5rem);
  --r: 3px;               /* радиус: почти прямой угол — инженерная точность */

  --shadow: 0 1px 2px rgba(12,14,16,.05), 0 12px 32px -18px rgba(12,14,16,.28);
  --ease: cubic-bezier(.22,.61,.36,1);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg:            #0C0E10;
  --bg-2:          #131619;
  --bg-3:          #191D21;
  --bg-inverse:    #EDEDEA;
  --fg:            #EDEDEA;
  --fg-2:          #A7AEB6;
  --fg-3:          #79818A;
  --fg-inverse:    #0C0E10;
  --line:          #23282D;
  --line-2:        #363E45;
  --accent:        #E5B04A;
  --accent-gfx:    #E0A526;
  --accent-soft:   #21201A;
  --accent-fg:     #0C0E10;
  --focus:         #6FA8F5;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 40px -22px rgba(0,0,0,.85);
  color-scheme: dark;
}

/* ---------- 2. БАЗА ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}

h1, h2, h3, h4 { line-height: 1.14; font-weight: 600; letter-spacing: -0.018em; text-wrap: balance; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); letter-spacing: -0.01em; }
p  { text-wrap: pretty; }

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: var(--accent-gfx); color: #0C0E10; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--fg); color: var(--bg);
  padding: .6rem 1rem; border-radius: var(--r);
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------- 3. УТИЛИТЫ ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

.mono {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: .10em;
  text-transform: uppercase;
  font-weight: 500;
}

.lede { font-size: var(--step-1); color: var(--fg-2); line-height: 1.55; max-width: 62ch; }
.muted { color: var(--fg-2); }
.small { font-size: var(--step--1); color: var(--fg-3); line-height: 1.6; }

.section { padding-block: var(--sec-y); position: relative; }
.section--alt { background: var(--bg-2); border-block: 1px solid var(--line); }

/* Заголовок секции с инженерным индексом */
.sec-head { margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.sec-index {
  display: flex; align-items: center; gap: .75rem;
  color: var(--accent); margin-bottom: 1rem;
}
.sec-index::after {
  content: ""; flex: 1; height: 1px; background: var(--line-2); max-width: 120px;
}
.sec-head p { margin-top: 1.1rem; }

/* Реврил-анимации */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
  transition-delay: var(--d, 0ms);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ---------- 4. КОМПОНЕНТЫ ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .78rem 1.35rem;
  border: 1px solid transparent;
  border-radius: var(--r);
  font-weight: 500; font-size: var(--step-0);
  cursor: pointer;
  transition: background-color .18s var(--ease), border-color .18s var(--ease),
              color .18s var(--ease), transform .18s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--accent-gfx); color: var(--accent-fg); border-color: var(--accent-gfx); }
.btn--primary:hover { background: #B8830F; border-color: #B8830F; }
[data-theme="dark"] .btn--primary:hover { background: #EFB643; border-color: #EFB643; }

.btn--ghost { border-color: var(--line-2); color: var(--fg); background: transparent; }
.btn--ghost:hover { border-color: var(--fg); background: var(--bg-3); }

.btn--sm { padding: .5rem .9rem; font-size: var(--step--1); }

/* Шапка */
.header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease), background-color .25s var(--ease);
}
.header.is-stuck { border-bottom-color: var(--line); }
.header__inner {
  display: flex; align-items: center; gap: 1.5rem;
  height: 68px;
}
.brand { display: flex; align-items: center; gap: .65rem; flex-shrink: 0; }
.brand svg { width: 30px; height: 30px; color: var(--accent-gfx); }
.brand__name {
  font-weight: 600; font-size: 1.06rem; letter-spacing: .16em;
}
.brand__sub {
  display: none;
  font-family: var(--font-mono); font-size: .62rem; letter-spacing: .14em;
  color: var(--fg-3); text-transform: uppercase; margin-top: 1px;
}
@media (min-width: 1100px) { .brand__sub { display: block; } }

.nav { display: none; margin-left: auto; }
.nav ul { display: flex; gap: clamp(.6rem, 1.5vw, 1.6rem); list-style: none; padding: 0; }
.nav a {
  font-size: .9rem; color: var(--fg-2); padding: .4rem 0; position: relative;
  transition: color .18s var(--ease);
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px;
  background: var(--accent-gfx); transition: right .25s var(--ease);
}
.nav a:hover { color: var(--fg); }
.nav a:hover::after, .nav a[aria-current="true"]::after { right: 0; }
.nav a[aria-current="true"] { color: var(--fg); }
@media (min-width: 980px) { .nav { display: block; } }

.header__actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
@media (min-width: 980px) { .header__actions { margin-left: 0; } }
.header .btn--primary { display: none; }
@media (min-width: 720px) { .header .btn--primary { display: inline-flex; } }

.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line); border-radius: var(--r);
  cursor: pointer; color: var(--fg-2);
  transition: border-color .18s var(--ease), color .18s var(--ease);
}
.icon-btn:hover { border-color: var(--line-2); color: var(--fg); }
.icon-btn svg { width: 17px; height: 17px; }
.theme-toggle .i-sun { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: block; }
[data-theme="dark"] .theme-toggle .i-moon { display: none; }

.burger { display: grid; }
@media (min-width: 980px) { .burger { display: none; } }

/* Мобильное меню */
.mobile-nav {
  position: fixed; inset: 68px 0 0; z-index: 49;
  background: var(--bg);
  padding: 1.5rem var(--gutter) 2rem;
  overflow-y: auto;
  transform: translateY(-8px); opacity: 0; pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.mobile-nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
.mobile-nav ul { list-style: none; padding: 0; }
.mobile-nav li { border-bottom: 1px solid var(--line); }
.mobile-nav a { display: block; padding: 1rem 0; font-size: 1.12rem; }
.mobile-nav .btn { width: 100%; margin-top: 1.5rem; }
@media (min-width: 980px) { .mobile-nav { display: none; } }

/* Карточки */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: clamp(1.35rem, 2.4vw, 1.9rem);
  transition: border-color .22s var(--ease), transform .22s var(--ease), box-shadow .22s var(--ease);
}
.section--alt .card { background: var(--bg); }
.card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.card h3 { margin-bottom: .6rem; }
.card p { color: var(--fg-2); font-size: .95rem; }
.card__idx {
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .1em;
  color: var(--accent); margin-bottom: 1.1rem; display: block;
}

.grid { display: grid; gap: 1px; }
.grid--3 { grid-template-columns: 1fr; }
@media (min-width: 700px) { .grid--3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .grid--3 { grid-template-columns: repeat(3, 1fr); } }

.grid--2 { grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 860px) { .grid--2 { grid-template-columns: repeat(2, 1fr); } }

/* Список-«спека» */
.spec { list-style: none; padding: 0; display: grid; gap: .55rem; }
.spec li {
  display: grid; grid-template-columns: 12px 1fr; gap: .7rem;
  font-size: .93rem; color: var(--fg-2); line-height: 1.5;
}
.spec li::before {
  content: ""; width: 6px; height: 6px; margin-top: .58em;
  border: 1px solid var(--accent-gfx); background: transparent;
}

/* ---------- 5. СЕКЦИИ ---------- */

/* HERO */
.hero { position: relative; padding-block: clamp(3.5rem, 8vw, 6.5rem) clamp(3rem, 6vw, 5rem); overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(120% 90% at 70% 10%, #000 0%, transparent 72%);
  opacity: .55;
}
.hero__grid { display: grid; gap: clamp(2.5rem, 5vw, 4rem); align-items: center; }
@media (min-width: 1000px) { .hero__grid { grid-template-columns: 1.08fr .92fr; } }

.hero__eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  color: var(--accent); border: 1px solid var(--line-2);
  padding: .35rem .75rem; border-radius: 100px; margin-bottom: 1.6rem;
}
.hero__eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent-gfx); flex-shrink: 0;
}
.hero h1 { margin-bottom: 1.5rem; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero__cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

.hero__stats {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 1px; margin-top: clamp(2.5rem, 5vw, 3.5rem);
  background: var(--line); border: 1px solid var(--line);
}
@media (min-width: 620px) { .hero__stats { grid-template-columns: repeat(4, 1fr); } }
.hero__stat { background: var(--bg); padding: 1rem 1.1rem; }
.hero__stat b { display: block; font-size: 1.35rem; font-weight: 600; letter-spacing: -.02em; }
.hero__stat span { font-size: .78rem; color: var(--fg-3); line-height: 1.4; display: block; margin-top: .2rem; }

.hero__art { display: none; }
@media (min-width: 1000px) { .hero__art { display: block; } }
.hero__art svg { width: 100%; height: auto; }

/* О компании */
.about__grid { display: grid; gap: clamp(2rem, 4vw, 3.5rem); }
@media (min-width: 900px) { .about__grid { grid-template-columns: 1fr 1fr; } }
.about__mission {
  border-left: 2px solid var(--accent-gfx);
  padding: .2rem 0 .2rem 1.5rem;
  font-size: var(--step-2);
  line-height: 1.32; letter-spacing: -.015em; font-weight: 500;
}
.facts { display: grid; gap: 0; border-top: 1px solid var(--line); margin-top: 2rem; }
.facts div {
  display: grid; grid-template-columns: 1fr auto; gap: 1rem;
  padding: .85rem 0; border-bottom: 1px solid var(--line); font-size: .92rem;
}
.facts dt { color: var(--fg-3); }
.facts dd { margin: 0; text-align: right; font-family: var(--font-mono); font-size: .86rem; }

/* Услуги — сетка с хайрлайнами */
.services { border: 1px solid var(--line); background: var(--line); }
.services .card { border: 0; border-radius: 0; }
.services .card:hover { transform: none; box-shadow: none; background: var(--accent-soft); }

/* Компетенции */
.comp { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
@media (min-width: 780px) { .comp { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1080px) { .comp { grid-template-columns: repeat(4, 1fr); } }
.comp__col { background: var(--bg-2); padding: clamp(1.35rem, 2.2vw, 1.75rem); }
.section--alt .comp__col { background: var(--bg); }
.comp__col h3 { font-size: 1rem; margin-bottom: 1.1rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--line); }

/* Процесс */
.steps { counter-reset: s; display: grid; gap: 0; }
.step {
  display: grid; gap: .4rem 1.75rem;
  grid-template-columns: 1fr;
  padding: 1.75rem 0; border-top: 1px solid var(--line);
  position: relative;
}
.step:last-child { border-bottom: 1px solid var(--line); }
@media (min-width: 780px) { .step { grid-template-columns: 64px 260px 1fr; align-items: start; } }
.step__num {
  font-family: var(--font-mono); font-size: .8rem; color: var(--accent);
  padding-top: .2rem;
}
.step h3 { font-size: 1.08rem; }
.step p { color: var(--fg-2); font-size: .95rem; }
.step__out {
  font-family: var(--font-mono); font-size: .74rem; color: var(--fg-3);
  margin-top: .6rem; letter-spacing: .04em;
}

/* Направления */
.dirs { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
@media (min-width: 720px) { .dirs { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1080px) { .dirs { grid-template-columns: repeat(3, 1fr); } }
.dir { background: var(--bg-2); padding: clamp(1.4rem, 2.4vw, 1.9rem); }
.section--alt .dir { background: var(--bg); }
.dir__tag {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em;
  color: var(--accent); text-transform: uppercase;
}
.dir h3 { font-size: 1.05rem; margin: .9rem 0 .55rem; }
.dir p { font-size: .92rem; color: var(--fg-2); }

/* Команда */
.team { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
@media (min-width: 700px) { .team { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1060px) { .team { grid-template-columns: repeat(3, 1fr); } }
.role { background: var(--bg-2); padding: clamp(1.3rem, 2.2vw, 1.7rem); }
.section--alt .role { background: var(--bg); }
.role h3 { font-size: .98rem; margin-bottom: .5rem; }
.role p { font-size: .9rem; color: var(--fg-2); }
.role__key {
  font-family: var(--font-mono); font-size: .68rem; color: var(--fg-3);
  letter-spacing: .1em; display: block; margin-bottom: .9rem;
}

/* FAQ */
.faq { max-width: 900px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem;
  padding: 1.35rem 0; cursor: pointer; list-style: none;
  font-weight: 500; font-size: 1.03rem; line-height: 1.4;
  transition: color .18s var(--ease);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--accent); }
.faq summary::after {
  content: ""; flex-shrink: 0; width: 13px; height: 13px; margin-top: .35em;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .22s var(--ease);
}
.faq details[open] summary::after { transform: rotate(-135deg) translate(-3px, -3px); }
.faq details p { padding-bottom: 1.35rem; color: var(--fg-2); max-width: 76ch; font-size: .96rem; }

/* Форма */
.lead { display: grid; gap: clamp(2.5rem, 5vw, 4rem); }
@media (min-width: 980px) { .lead { grid-template-columns: .82fr 1.18fr; } }

.form {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: clamp(1.4rem, 3vw, 2.25rem);
}
.field { margin-bottom: 1.15rem; }
.field label { display: block; font-size: .86rem; font-weight: 500; margin-bottom: .4rem; }
.field .req { color: var(--accent); }
.field .hint { display: block; font-size: .76rem; color: var(--fg-3); margin-top: .35rem; line-height: 1.45; }
.field input, .field select, .field textarea {
  width: 100%; padding: .7rem .85rem;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r);
  transition: border-color .18s var(--ease), background-color .18s var(--ease);
  font-size: .95rem;
}
.field textarea { resize: vertical; min-height: 118px; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--fg-3); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent-gfx); }
.field input::placeholder, .field textarea::placeholder { color: var(--fg-3); }
.field select { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 19px) 51%, calc(100% - 14px) 51%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.field--err input, .field--err select, .field--err textarea { border-color: #C0392B; }
[data-theme="dark"] .field--err input,
[data-theme="dark"] .field--err select,
[data-theme="dark"] .field--err textarea { border-color: #E06C5C; }
.err-msg { display: none; font-size: .78rem; color: #C0392B; margin-top: .35rem; }
[data-theme="dark"] .err-msg { color: #E06C5C; }
.field--err .err-msg { display: block; }

.form__row { display: grid; gap: 0 1rem; }
@media (min-width: 560px) { .form__row { grid-template-columns: 1fr 1fr; } }
.form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: .5rem; }
.form__foot .small { flex: 1 1 240px; }

.form__status {
  display: none; margin-top: 1.25rem; padding: 1rem 1.15rem;
  border: 1px solid var(--accent-gfx); background: var(--accent-soft);
  border-radius: var(--r); font-size: .92rem;
}
.form__status.is-shown { display: block; }
.form__status.is-error { border-color: #C0392B; background: transparent; }
.form__status b { display: block; margin-bottom: .25rem; }

.lead__aside .spec { margin-top: 1.5rem; }
.contact-list { list-style: none; padding: 0; margin-top: 2rem; display: grid; gap: 1rem; }
.contact-list a { border-bottom: 1px solid var(--line-2); transition: border-color .18s var(--ease); }
.contact-list a:hover { border-color: var(--accent-gfx); }
.contact-list .mono { color: var(--fg-3); display: block; margin-bottom: .15rem; letter-spacing: .08em; }

/* Футер */
.footer { border-top: 1px solid var(--line); padding-block: clamp(3rem, 5vw, 4rem) 2rem; background: var(--bg-2); }
.footer__grid { display: grid; gap: 2.5rem; }
@media (min-width: 760px) { .footer__grid { grid-template-columns: 1.6fr 1fr 1fr; } }
.footer h4 { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3);
  font-family: var(--font-mono); font-weight: 500; margin-bottom: 1rem; }
.footer ul { list-style: none; padding: 0; display: grid; gap: .6rem; }
.footer ul a { font-size: .92rem; color: var(--fg-2); transition: color .18s var(--ease); }
.footer ul a:hover { color: var(--accent); }
.footer__legal {
  margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between;
}
.footer__legal p { font-size: .78rem; color: var(--fg-3); line-height: 1.6; max-width: 62ch; }
