/* === ЗАЩИТА ОТ MIME-SNIFFING И CLICKJACKING (через серверные заголовки) === */
/* Примечание: для полной защиты добавьте на сервере:
   X-Content-Type-Options: nosniff
   Content-Security-Policy: frame-ancestors 'self';
*/

/* Обнуление */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Базовые стили — Merriweather */
body, input, textarea, select {
  font-family: 'Merriweather', 'PT Serif', Georgia, serif;
  font-size: 20px;
  color: #222; /* Улучшенная контрастность */
  background-color: #f9f9f9;
  line-height: 1.6;
}

/* Заголовки — Playfair Display */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  color: #0d47a1;
}

/* Основной контейнер сайта */
html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh; /* Более надёжно, чем height: 100% */
  display: flex;
  flex-direction: column;
}

/* Шапка сайта */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  background-color: #0d47a1;
  color: white;
  flex-wrap: wrap;
}

/* Фото юриста */
header img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

/* Центральный текст (ФИО и специализации) */
.center-text {
  text-align: center;
  flex-grow: 1;
  margin: 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.center-text h1 {
  font-size: 26px;
  margin: 0;
  color: white;
  white-space: nowrap;
}

.specializations {
  font-size: 14px;
  color: #e0e0ff;
  text-align: center;
  margin-top: 6px;
  line-height: 1.4;
  max-width: 500px;
  font-family: 'Merriweather', serif;
}

/* === УНИВЕРСАЛЬНЫЕ СТИЛИ ДЛЯ КНОПОК === */
.quick-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.quick-btn {
  background: #0d47a1;
  color: white;
  border: 1px solid #0d47a1;
  padding: 8px 20px;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Roboto', sans-serif;
  transition: transform 0.2s, box-shadow 0.2s;
  min-width: 100px;
  text-align: center;
}

.quick-btn:hover,
.quick-btn:focus {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  outline: 2px solid #0a3a8a; /* Доступность: видимый фокус */
  outline-offset: 2px;
}

/* Стили для кнопок внутри header (если понадобятся позже) */
.center-text .quick-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  width: 100%;
  gap: 10px;
}

.center-text .quick-btn {
  background: #0d47a1;
  color: white;
  border: 1px solid #0d47a1;
  padding: 8px 15px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Roboto', sans-serif;
  display: inline-block;
  transition: transform 0.2s, box-shadow 0.2s;
  min-width: 80px;
  text-align: center;
}

.center-text .quick-btn:hover,
.center-text .quick-btn:focus {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  outline: 2px solid #0a3a8a;
  outline-offset: 2px;
}

/* Контакты — кликабельные ссылки */
.contacts {
  text-align: right;
}

.contacts a {
  color: white;
  text-decoration: none;
  font-weight: 500;
}

.contacts a:hover,
.contacts a:focus {
  text-decoration: underline;
  outline: 2px solid white;
  outline-offset: 2px;
}

.contacts p {
  margin: 4px 0;
  font-size: 20px;
}

/* Карточки */
.cards-container {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 30px;
  padding: 40px 20px;
}

.card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 30px;
  width: 320px;
  min-height: 200px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  font-family: 'Merriweather', serif;
}

.card:hover,
.card:focus {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  outline: 2px solid #0d47a1;
  outline-offset: 4px;
}

.card h3 {
  margin-top: 0;
  font-size: 22px;
  color: #0d47a1;
  font-family: 'Playfair Display', serif;
}

.card p {
  margin-top: 12px;
  font-size: 18px;
  line-height: 1.6;
}

/* Футер */
footer {
  text-align: center;
  padding: 20px;
  background-color: #eee;
  font-size: 16px;
  color: #666;
  font-family: 'Merriweather', serif;
}

footer a {
  color: #0d47a1;
  text-decoration: none;
  margin: 0 10px;
}

footer a:hover,
footer a:focus {
  text-decoration: underline;
  outline: 2px solid #0d47a1;
  outline-offset: 2px;
}

/* Модальные окна */
.modal {
  display: none;
  position: fixed;
  z-index: 1000; /* Увеличено для надёжности */
  left: 0; top: 0;
  width: 100%; height: 100%;
  background-color: rgba(0,0,0,0.5);
}

.modal-content {
  background: white;
  margin: 5% auto;
  padding: 25px;
  border-radius: 10px;
  width: 90%;
  max-width: 700px;
  box-shadow: 0 5px 25px rgba(0,0,0,0.25);
  font-size: 18px;
  overflow-y: auto;
  max-height: 80vh;
  font-family: 'Merriweather', serif;
}

.modal h2 {
  font-family: 'Playfair Display', serif;
  color: #0d47a1;
  margin-bottom: 18px;
}

.close {
  float: right;
  font-size: 1.8rem;
  cursor: pointer;
  color: #999;
}

.close:hover,
.close:focus {
  color: #0d47a1;
  outline: 2px solid #0d47a1;
  border-radius: 50%;
  outline-offset: 2px;
}

.modal ul {
  padding-left: 24px;
  margin-bottom: 15px;
}

.modal li {
  margin-bottom: 10px;
  font-size: 18px;
}

.modal p {
  font-style: italic;
  color: #666;
  font-size: 16px;
  margin-top: 15px;
}

/* Адаптивность */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    padding: 15px;
  }

  .center-text {
    margin: 10px auto;
    text-align: center;
  }

  .center-text h1 {
    font-size: 22px;
    white-space: normal;
  }

  .specializations {
    font-size: 12px;
    line-height: 1.5;
  }

  /* === ИСПРАВЛЕНИЕ: КОНТАКТЫ ПО ЦЕНТРУ НА МОБИЛЬНЫХ === */
  .contacts {
    text-align: center;
    margin-top: 10px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }

  .contacts p {
    font-size: 18px;
    margin: 0;
    white-space: nowrap;
  }

  .cards-container {
    padding: 20px 10px;
    gap: 20px;
  }

  .card {
    width: 100%;
    max-width: none;
    padding: 20px;
  }

  .card h3 {
    font-size: 20px;
  }

  .card p {
    font-size: 16px;
  }

  .quick-links {
    flex-direction: column;
    gap: 10px;
    padding: 10px 20px;
  }

  .quick-btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    min-width: auto;
  }

  .modal-content {
    max-height: 80vh;
    width: 95%;
    padding: 15px;
    font-size: 16px;
  }

  body {
    font-size: 18px;
  }
}

/* Дополнительная защита от случайного масштабирования на iOS */
@media screen and (max-width: 768px) {
  html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
}
