/* ==========================================================================
   Polychem Group — Design System
   Static site, no build step. Cyrillic-first typography.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Golos+Text:wght@500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* --- Brand palette: true neutral grey/black + red (Huntsman-like, no blue cast) --- */
  --graphite-900: #18181a;
  --graphite-800: #232325;
  --graphite-700: #313133;
  --graphite-600: #4d4d50;
  --graphite-400: #85858a;

  --silver-500: #8b8b8f;
  --silver-300: #c9c9cc;
  --silver-100: #e9e9ea;

  --burgundy-700: #5c0813;
  --burgundy-600: #880c1c;
  --burgundy-500: #b8202f;
  --burgundy-400: #ef4444;

  --white: #ffffff;

  /* --- Semantic tokens (light surface, default) --- */
  --bg: #f8f8f8;
  --bg-alt: #eeeeef;
  --surface: var(--white);
  --text: var(--graphite-900);
  --text-muted: #57575a;
  --border: var(--silver-100);

  --accent: var(--burgundy-600);
  --accent-strong: var(--burgundy-700);
  --accent-soft: #f4e7e9;
  --accent-on-dark: var(--burgundy-500);

  /* --- Semantic tokens (on dark sections) --- */
  --text-on-dark: #f3f4f5;
  --text-on-dark-muted: #a9afb6;
  --border-on-dark: rgba(255, 255, 255, 0.12);

  /* --- Type --- */
  --font-display: 'Golos Text', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* --- Spacing (8px rhythm) --- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-24: 96px;
  --sp-32: 128px;

  /* --- Shape --- */
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 10px;

  /* --- Motion --- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 150ms;
  --dur-base: 250ms;
  --dur-slow: 400ms;

  /* --- Layout --- */
  --container-max: 1240px;
  --header-h: 112px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--graphite-900);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.on-dark h1, .on-dark h2, .on-dark h3, .on-dark h4 { color: var(--text-on-dark); }

h1 { font-size: clamp(2.25rem, 4vw + 1rem, 3.75rem); font-weight: 800; }
h2 { font-size: clamp(1.75rem, 2.4vw + 1rem, 2.5rem); font-weight: 700; }
h3 { font-size: clamp(1.25rem, 1vw + 1rem, 1.5rem); font-weight: 600; }

p { color: var(--text-muted); }
.on-dark p { color: var(--text-on-dark-muted); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.on-dark .eyebrow { color: var(--accent-on-dark); }
.eyebrow::before {
  content: '';
  width: 24px;
  height: 2px;
  background: currentColor;
  display: inline-block;
}

/* --- Layout helpers --- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}
.section { padding: var(--sp-24) 0; }
.section-alt { background: var(--bg-alt); }
.section-dark { background: var(--graphite-900); }

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-12);
  border-bottom: 2px solid var(--accent);
}
.section-heading h2 {
  font-size: clamp(1.75rem, 2vw + 1rem, 2.25rem);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.on-dark .section-heading h2 { color: var(--accent-on-dark); }
.section-heading::after {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.grid { display: grid; gap: var(--sp-6); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section { padding: var(--sp-16) 0; }
  :root { --sp-24: 64px; }
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 13px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
  border: 1.5px solid transparent;
  transition: background var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
  cursor: pointer;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: var(--white);
  box-shadow: 0 8px 20px -8px rgba(136, 12, 28, 0.55);
}
.btn-primary:hover { background: var(--accent-strong); transform: translateY(-2px); box-shadow: 0 12px 26px -8px rgba(136, 12, 28, 0.65); }
.btn-outline {
  background: transparent;
  border-color: var(--silver-300);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.on-dark .btn-outline { border-color: var(--border-on-dark); color: var(--text-on-dark); }
.on-dark .btn-outline:hover { border-color: var(--accent-on-dark); color: var(--accent-on-dark); }
.btn svg { width: 18px; height: 18px; transition: transform var(--dur-base) var(--ease-out); }
.btn:hover svg { transform: translateX(3px); }

/* --- Header / Nav --- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-base) var(--ease-out);
}
.header-inner {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-8);
}

.logo { display: flex; align-items: center; margin-left: 32px; }
.logo img { height: 100px; width: auto; }

.main-nav { display: flex; align-items: center; gap: var(--sp-8); }
.main-nav ul { display: flex; gap: var(--sp-6); }
.main-nav a:not(.btn) {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  padding: 6px 0;
  transition: color var(--dur-base) var(--ease-out);
}
.main-nav a:not(.btn):hover, .main-nav a[aria-current="page"]:not(.btn) { color: var(--text); }
.main-nav a[aria-current="page"]::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  padding: var(--sp-2);
}

@media (max-width: 1180px) {
  .main-nav ul {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    flex-direction: column;
    background: var(--white);
    padding: var(--sp-6);
    gap: var(--sp-4);
    border-bottom: 1px solid var(--border);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
  }
  .main-nav.is-open ul {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .main-nav .btn { display: none; }
  .nav-toggle { display: inline-flex; }
}

/* --- Hero (contained rounded photo card, text overlaid) --- */
.hero {
  padding: calc(var(--header-h) + var(--sp-6)) var(--sp-6) var(--sp-6);
  background: var(--bg);
}
.hero-card {
  position: relative;
  max-width: 1600px;
  min-height: 78vh;
  margin: 0 auto;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: hero-photo-in 1.6s var(--ease-out) both;
}
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(10,10,11,0.68) 0%, rgba(10,10,11,0.4) 40%, rgba(10,10,11,0.05) 65%);
}
@keyframes hero-photo-in {
  from { opacity: 0; transform: scale(1.05); }
  to { opacity: 1; transform: scale(1); }
}
.hero-content {
  position: relative;
  z-index: 1;
  padding: var(--sp-8) var(--sp-12) var(--sp-12);
  max-width: 900px;
}
.hero-content h1 {
  color: var(--text-on-dark);
  margin-bottom: var(--sp-6);
  text-transform: uppercase;
  font-size: clamp(1.6rem, 2.9vw + 0.85rem, 2.75rem);
  text-shadow: 0 4px 24px rgba(0,0,0,0.45);
}
.hero-content p {
  font-size: 1.0625rem;
  max-width: 560px;
  margin-bottom: var(--sp-8);
  color: var(--text-on-dark);
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
.hero-actions { display: flex; gap: var(--sp-4); flex-wrap: wrap; }

/* --- Plain page header (interior pages, no photo) --- */
.page-header {
  padding: calc(var(--header-h) + var(--sp-16)) 0 var(--sp-12);
  background: var(--bg-alt);
}
.page-header h1 { max-width: 900px; }

@media (prefers-reduced-motion: reduce) {
  .hero-bg img { animation: none; }
}

@media (max-width: 640px) {
  .hero { padding: calc(var(--header-h) + var(--sp-8)) var(--sp-4) var(--sp-4); }
  .hero-card { min-height: 70vh; border-radius: 14px; }
  .hero-content { padding: var(--sp-6) var(--sp-6) var(--sp-8); }
}

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-8);
  transition: border-color var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px -20px rgba(20,23,27,0.35);
}
.card-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: var(--sp-6);
}
.card-icon svg { width: 26px; height: 26px; }
.card h3 { margin-bottom: var(--sp-3); }

.card-dark {
  background: var(--graphite-800);
  border: 1px solid var(--border-on-dark);
}
.card-dark h3 { color: var(--text-on-dark); }
.card-dark p { color: var(--text-on-dark-muted); }
.card-dark .card-icon { background: rgba(131, 32, 48, 0.25); color: #d97b86; }

/* --- Expandable card (О компании directions) --- */
.expand-card {
  border-top: 3px solid var(--accent);
}
.expand-card summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}
.expand-card summary::-webkit-details-marker { display: none; }
.expand-card .chevron { width: 20px; height: 20px; flex-shrink: 0; transition: transform var(--dur-base) var(--ease-out); }
.expand-card[open] .chevron { transform: rotate(180deg); }
.expand-card .expand-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--dur-slow) var(--ease-out);
}
.expand-card[open] .expand-body { max-height: 600px; }
.expand-body-inner { padding-top: var(--sp-6); margin-top: var(--sp-6); border-top: 1px solid var(--border); }

/* --- Certifications / stat strip --- */
.strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-8);
  padding: var(--sp-8) 0;
}
.strip-item { display: flex; align-items: center; gap: var(--sp-3); }
.strip-item svg { width: 28px; height: 28px; color: var(--silver-500); flex-shrink: 0; }
.strip-item span { font-weight: 600; font-size: 0.9375rem; color: var(--text-muted); }

/* --- Footer --- */
.site-footer {
  background: var(--graphite-900);
  color: var(--text-on-dark-muted);
  padding: var(--sp-24) 0 var(--sp-8);
}
.site-footer .logo-box {
  display: inline-block;
  background: var(--white);
  padding: var(--sp-4) var(--sp-6);
  border-radius: var(--radius-sm);
}
.site-footer .logo-box img { height: 32px; width: auto; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: var(--sp-12);
  padding-bottom: var(--sp-16);
  border-bottom: 1px solid var(--border-on-dark);
}
.footer-grid h4 { color: var(--text-on-dark); font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--sp-4); }
.footer-grid ul { display: flex; flex-direction: column; gap: var(--sp-3); }
.footer-grid a { transition: color var(--dur-base) var(--ease-out); }
.footer-grid a:hover { color: var(--text-on-dark); }
.footer-bottom {
  text-align: center;
  padding-top: var(--sp-6);
  font-size: 0.875rem;
}
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* --- About section (text + photo) --- */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: var(--sp-16);
  align-items: center;
}
.about-photo {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.about-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; gap: var(--sp-8); }
  .about-photo { order: -1; }
}

/* --- Direction summary cards --- */
.direction-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-12);
  display: flex;
  flex-direction: column;
}
.direction-card h3 { margin-bottom: var(--sp-6); }
.direction-card p { margin-bottom: var(--sp-6); }
.direction-card .capacity { font-weight: 600; color: var(--text); margin-bottom: var(--sp-8); }
.direction-card .btn { margin-top: auto; align-self: flex-start; }

/* --- Mini stat-card grid (Ключевые параметры) --- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-6);
  border-top: 3px solid var(--accent);
}
.stat-card .value { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.375rem; color: var(--text); margin-bottom: var(--sp-2); }
.stat-card .label { font-size: 0.875rem; color: var(--text-muted); }
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* --- Concept principle blocks --- */
.principle {
  display: flex;
  gap: var(--sp-6);
  padding: var(--sp-8) 0;
  border-top: 1px solid var(--border);
}
.principle:first-of-type { border-top: none; padding-top: 0; }
.principle-icon {
  width: 44px; height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}
.principle-icon svg { width: 22px; height: 22px; }
.principle h3 { color: var(--accent); text-transform: uppercase; font-size: 1.0625rem; margin-bottom: var(--sp-3); }
.principle p + p { margin-top: var(--sp-3); }

/* --- Services grid (6-up) --- */
.grid-6 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-6); }
@media (max-width: 1024px) {
  .grid-6 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .grid-6 { grid-template-columns: 1fr; }
}

/* --- Contact section --- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: var(--sp-24); }
.contact-details { display: flex; flex-direction: column; gap: var(--sp-6); }
.contact-details .lede { font-weight: 600; text-transform: uppercase; font-size: 0.875rem; letter-spacing: 0.04em; margin-bottom: var(--sp-2); color: var(--text); }
.contact-item { display: flex; align-items: flex-start; gap: var(--sp-4); }
.contact-item .ci-icon {
  width: 40px; height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.contact-item .ci-icon svg { width: 20px; height: 20px; }
.contact-item strong { display: block; font-weight: 700; color: var(--text); }

.form-field {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px var(--sp-4);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  margin-bottom: var(--sp-4);
  transition: border-color var(--dur-base) var(--ease-out);
}
.form-field::placeholder { color: var(--text-muted); }
.form-field:focus { border-color: var(--accent); outline: none; }
textarea.form-field { min-height: 120px; resize: vertical; }
.form-consent { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: var(--sp-6); }
.form-consent a { color: var(--text); text-decoration: underline; }
.btn-text {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  padding-bottom: var(--sp-2);
  border-bottom: 1.5px solid var(--accent);
  background: none;
  border-top: none; border-left: none; border-right: none;
  cursor: pointer;
}
.btn-text svg { width: 16px; height: 16px; transition: transform var(--dur-base) var(--ease-out); }
.btn-text:hover svg { transform: translate(2px, -2px); }

@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; gap: var(--sp-12); }
}

/* --- Scroll reveal --- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}
[data-reveal-group] > * { transition-delay: calc(var(--stagger-index, 0) * 60ms); }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; }
}

/* --- Skip link --- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--white);
  padding: var(--sp-3) var(--sp-4);
  z-index: 1000;
}
.skip-link:focus { left: var(--sp-4); top: var(--sp-4); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
