:root {
  --primary-color: #003366;
  --accent-color: #005baa;
  --bg-light: #ffffff;
  --bg-soft: #f6f9fc;
  --text-main: #1f2a37;
  --shadow-soft: 0 8px 30px rgba(0,0,0,.08);
  --transition-base: 0.35s ease;
}

/* =========================
   BASE / RESET
========================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(120deg, #f7fafd 80%, #e4ecf6 100%),
    url('data:image/svg+xml;utf8,<svg width="160" height="160" xmlns="http://www.w3.org/2000/svg"><path d="M0 0 L160 0 L160 160 M0 160 L0 0" stroke="%23d3dbe8" stroke-width="1.2"/></svg>') repeat,
    url('data:image/svg+xml;utf8,<svg width="540" height="540" xmlns="http://www.w3.org/2000/svg"><circle cx="110" cy="80" r="64" stroke="%237fa4c8" stroke-width="3" fill="none" opacity="0.2"/></svg>') no-repeat right bottom;
  background-size: 100% 100%, 160px 160px, 540px 540px;
  color: #222;
}

/* =========================
   TYPOGRAPHY
========================= */

h1, h2, h3, h4 {
  margin: 0 0 0.6em 0;
  line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

h3, h4 {
  color: var(--primary-color);
}

/* =========================
   HEADER
========================= */

header {
  background: var(--primary-color);
  color: #fff;
  padding: 1rem 1rem;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 0 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Логотип - уменьшенный размер */
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-logo img {
  max-height: 90px;
  height: auto;
  width: auto;
  transition: transform 0.3s ease;
}

.header-logo img:hover {
  transform: scale(1.05);
}

/* Сертификат */
.header-cert {
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
}

.certificate {
  font-size: 13px;
  color: white;
  line-height: 1.4;
}

.certificate strong {
  font-size: 14px;
}

/* Информационный блок - ИСПРАВЛЕНО */
.header-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  text-align: center;
  flex: 1;
  min-width: 300px;
}

.header-info-title {
  color: white;
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.header-info-subtitle {
  color: white;
  font-size: 18px;
  font-weight: 500;
  margin: 0;
  line-height: 1.3;
}

.header-info-location {
  color: white;
  font-size: 14px;
  font-weight: 400;
  margin: 0;
  line-height: 1.3;
}

/* Контакты */
.header-contacts {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-direction: column;
  flex-shrink: 0;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* SVG иконки - уменьшенный размер */
.contact-icon {
  width: 16px;
  height: 16px;
  fill: white;
  flex-shrink: 0;
}

.contact-item a {
  font-size: 15px;
  white-space: nowrap;
}



/* =========================
   АДАПТИВНОСТЬ HEADER
========================= */

@media (max-width: 1200px) {
  .header-content {
    gap: 1rem;
  }
  
  .header-info-title {
    font-size: 20px;
  }
  
  .header-info-subtitle {
    font-size: 16px;
  }
}

@media (max-width: 992px) {
  .header-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .header-logo img {
    max-height: 60px;
  }
  
  .header-info {
    min-width: auto;
    width: 100%;
  }
  
  .header-info-title {
    font-size: 18px;
  }
  
  .header-info-subtitle {
    font-size: 15px;
  }
  
  .header-info-location {
    font-size: 13px;
  }
  
  .header-cert {
    text-align: center;
  }
  
  .header-contacts {
    align-items: center;
  }
}

@media (max-width: 768px) {
  header {
    padding: 0.8rem 0.5rem;
  }
  
  .header-content {
    padding: 0 0.5rem;
    gap: 0.8rem;
  }
  
  .header-logo img {
    max-height: 50px;
  }
  
  .certificate {
    font-size: 12px;
  }
  
  .certificate strong {
    font-size: 13px;
  }
  
  .header-info-title {
    font-size: 16px;
  }
  
  .header-info-subtitle {
    font-size: 14px;
  }
  
  .contact-item a {
    font-size: 14px;
  }
}

@media (max-width: 576px) {
  .header-logo img {
    max-height: 45px;
  }
  
  .header-info-title {
    font-size: 15px;
  }
  
  .header-info-subtitle {
    font-size: 13px;
  }
  
  .header-info-location {
    font-size: 12px;
  }
  
  .contact-icon {
    width: 14px;
    height: 14px;
  }
  
  .contact-item a {
    font-size: 13px;
  }
}

/* =========================
   АДАПТИВНОСТЬ ABOUT
========================= */

@media (max-width: 768px) {
  #about-flex {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }
  
  #about-flex img {
    max-width: 200px;
  }
  
  .text-content h4 {
    font-size: 1.1rem;
  }
}

@media (max-width: 576px) {
  #about-flex img {
    max-width: 180px;
  }
  
  .text-content h4 {
    font-size: 1rem;
  }
  
  .text-content p {
    font-size: 0.95rem;
  }
}


/* =========================
   FOOTER
========================= */

footer {
  background: var(--primary-color);
  color: #fff;
  padding: 0.6rem 1rem;
  margin-top: 1rem;
  text-align: left;
}

footer p {
  margin: 0;
}

/* =========================
   CONTACT LINKS
========================= */

a.contact-link {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a.contact-link:hover {
  text-decoration: underline;
  opacity: 0.9;
}

/* В секции контактов */
.contact-block a.contact-link {
  color: var(--primary-color) !important;
}

/* =========================
   SECTIONS
========================= */

section {
  max-width: 1200px;
  margin: 1rem auto;
  padding: 1.5rem;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

/* =========================
   ABOUT SECTION
========================= */

.about-content {
  margin-top: 1rem;
  position: relative;
}

/* Контент, который всегда виден */
.about-always-visible {
  opacity: 1;
}

/* Скрываемый контент */
.about-collapsible {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.6s ease, opacity 0.4s ease, margin-top 0.4s ease;
  margin-top: 0;
}

.about-collapsible.expanded {
  max-height: 5000px;
  opacity: 1;
  margin-top: 1rem;
}

/* Кнопка "Читать далее" / "Свернуть" */
.toggle-read-more {
  background: none;
  border: none;
  color: var(--accent-color);
  font-size: 15px;
  cursor: pointer;
  padding: 0.5rem 0;
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s ease;
  font-weight: 500;
}

.toggle-read-more:hover {
  opacity: 0.7;
}

.toggle-read-more .arrow-icon {
  transition: transform 0.3s ease;
  font-size: 12px;
}

.toggle-read-more.expanded .arrow-icon {
  transform: rotate(180deg);
}

/* Flex-контейнер для фото и текста */
#about-flex {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

#about-flex img {
  max-width: 250px;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
}

.text-content h4 {
  color: var(--primary-color);
  margin-top: 1.5rem;
  margin-bottom: 0.8rem;
  font-size: 1.2rem;
}

.text-content h4:first-of-type {
  margin-top: 0;
}

.text-content p {
  margin: 0.8rem 0;
  line-height: 1.6;
  color: var(--text-main);
}

/* =========================
   FAQ
========================= */

.faq-item {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.5rem 0;
}

.faq-question {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 0.8rem;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s ease;
  border-radius: 4px;
}

.faq-question:hover {
  background-color: var(--bg-soft);
}

.faq-question .arrow {
  transition: transform 0.3s ease;
  font-size: 1.2rem;
}

.faq-question.active .arrow {
  transform: rotate(180deg);
}

.faq-answer {
  display: none;
  padding: 0.6rem 0.8rem;
  color: var(--text-main);
  line-height: 1.6;
}

/* =========================
   SERVICES
========================= */

.services-list {
  list-style: none;
  padding: 0;
}

.services-list li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
}

.services-list li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent-color);
  font-weight: bold;
}

/* =========================
   WORKFLOW
========================= */

.workflow-steps {
  list-style: none;
  padding: 0;
  counter-reset: step-counter;
}

.workflow-steps li {
  counter-increment: step-counter;
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--bg-soft);
  border-radius: 8px;
  position: relative;
  padding-left: 4rem;
}

.workflow-steps li:before {
  content: counter(step-counter);
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: var(--accent-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
}

/* =========================
   DOCUMENTS
========================= */

#documents .thumbnail-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.doc-thumb {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.doc-thumb img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.doc-thumb:hover img {
  transform: scale(1.05);
  box-shadow: 0 12px 40px rgba(0,0,0,.15);
}

/* =========================
   ARTICLES
========================= */

.article-list {
  list-style: none;
  padding: 0;
}

.popup-trigger {
  display: block;
  width: 100%;
  padding: 0.8rem;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--primary-color);
  position: relative;
  font-size: 1.05rem;
  transition: color 0.2s ease;
}

.popup-trigger:hover {
  color: var(--accent-color);
}

.popup-trigger::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--accent-color);
  transition: width var(--transition-base);
}

.popup-trigger:hover::after {
  width: 100%;
}

/* =========================
   POPUP (UNIFIED)
========================= */

.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,40,80,0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.popup-overlay.open {
  display: flex;
}

.popup-window {
  background: #fff;
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: relative;
  animation: popupFadeIn 0.3s ease;
}

@keyframes popupFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.popup-content h2 {
  color: var(--primary-color);
  margin-top: 0;
}

.popup-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.close-popup {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 2rem;
  color: #999;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.close-popup:hover {
  background-color: #f0f0f0;
  color: #333;
}

/* Loader */
.loader {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  color: var(--accent-color);
  font-size: 1.2rem;
}

.loader:after {
  content: "";
  width: 30px;
  height: 30px;
  margin-left: 10px;
  border: 3px solid var(--accent-color);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================
   CTA BUTTON (Sticky)
========================= */

.cta-sticky {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
}

.cta-button {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,91,170,0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(0,91,170,0.5);
}

.cta-button:active {
  transform: translateY(0);
}

/* =========================
   CONTACT FORM
========================= */

.contact-form {
  max-width: 600px;
  margin: 2rem auto;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--primary-color);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-color);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

.submit-button {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 6px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.submit-button:hover {
  background: var(--primary-color);
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 768px) {
  #about-flex {
    flex-direction: column;
    align-items: center;
  }
  
  section {
    padding: 1rem;
    margin: 0.5rem;
  }
  
  .workflow-steps li {
    padding-left: 3rem;
  }
  
  .workflow-steps li:before {
    width: 30px;
    height: 30px;
    font-size: 1rem;
  }
  
  .cta-sticky {
    bottom: 10px;
    right: 10px;
  }
  
  .cta-button {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
  }
  
  #documents .thumbnail-container {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
}

/* =========================
   DARK MODE
========================= */

@media (prefers-color-scheme: dark) {
  :root {
    --bg-light: #0f172a;
    --bg-soft: #111827;
    --text-main: #e5e7eb;
  }

  body {
    background: #0f172a;
    color: var(--text-main);
  }

  section {
    background: #111827;
  }
  
  .faq-question:hover {
    background-color: #1e293b;
  }
  
  .workflow-steps li {
    background: #1e293b;
  }
  
  .popup-window {
    background: #111827;
  }
  
  .close-popup:hover {
    background-color: #1e293b;
  }
}

/* =========================
   UTILITY CLASSES
========================= */

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
