/* =========================================================
   Базовые настройки и палитра
   ========================================================= */
:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --accent: #1d4ed8;
  --accent-soft: #eff6ff;
  --border: #e2e8f0;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
textarea {
  font-family: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.container {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

/* =========================================================
   Шапка
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.logo {
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.logo:hover {
  text-decoration: none;
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-links a {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--accent);
  text-decoration: none;
}

.print-btn {
  justify-self: end;
}

/* =========================================================
   Кнопки
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #1743bd;
  color: #ffffff;
}

.btn-outline {
  background: #ffffff;
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: #cbd5e1;
  color: var(--accent);
  background: var(--accent-soft);
}

.btn-github {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  width: 100%;
}

.btn-github:hover {
  background: #1e293b;
  color: #ffffff;
}

/* =========================================================
   Секции и карточки
   ========================================================= */
.section {
  padding: 28px 0 8px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-title {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-lead {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.block-subtitle {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

/* =========================================================
   Профиль: 2 колонки
   ========================================================= */
.profile-card {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  padding: 24px 26px;
}

.profile-left,
.profile-right {
  min-width: 0;
}

.identity-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.photo-wrap {
  flex: 0 0 140px;
  width: 140px;
  height: 140px;
}

.profile-photo {
  width: 140px;
  height: 140px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--accent-soft);
}

.identity-text h1 {
  margin: 0 0 4px;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.role {
  margin: 0 0 10px;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid #dbeafe;
  color: #1e40af;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.about-text {
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 13px;
  max-width: 620px;
}

.contacts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.contact-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px dashed #cbd5e1;
  padding-bottom: 1px;
}

.contact-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

/* Шкалы навыков */
.profile-right {
  border-left: 1px solid var(--border);
  padding-left: 26px;
}

.skills-list {
  display: block;
}

.skill-item {
  margin-bottom: 10px;
}

.skill-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.skill-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.skill-percent {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.skill-bar {
  height: 3px;
  width: 100%;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
}

.skill-fill {
  height: 6px;
  background: var(--accent);
  border-radius: 999px;
  max-width: 100%;
}

/* =========================================================
   Горизонтальные ленты
   ========================================================= */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-btn {
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: #cbd5e1;
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.slider-wrap {
  position: relative;
}

.arrow-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.arrow-prev {
  left: -52px;
}

.arrow-next {
  right: -52px;
}

@media (max-width: 1260px) {
  .arrow-prev {
    left: -14px;
  }
  .arrow-next {
    right: -14px;
  }
}

.arrow-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.h-track {
  display: flex;
  overflow-x: auto;
  gap: 20px;
  scroll-behavior: smooth;
  padding: 2px 2px 14px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.h-track::-webkit-scrollbar {
  height: 8px;
}

.h-track::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.h-track::-webkit-scrollbar-track {
  background: transparent;
}

/* =========================================================
   Карточки проектов
   ========================================================= */
.project-card {
  flex: 0 0 350px;
  width: 350px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.project-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-2px);
}


.card-image-wrap {
  height: 190px;
  width: 100%;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-card .card-image-wrap {
  height: 190px;
}

.certificate-card .card-image-wrap {
  height: 170px;
}

.card-content {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card-category {
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid #dbeafe;
  color: #1e40af;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.card-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
}

.card-line {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.card-line strong {
  color: var(--text);
}

.card-action {
  margin-top: auto;
  padding-top: 4px;
}

.card-action .btn {
  width: 100%;
}

/* =========================================================
   Образование и сертификаты
   ========================================================= */
.edu-card {
  padding: 16px 20px;
  margin-bottom: 20px;
}

.edu-title {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 700;
}

.edu-specialty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.certificates-head {
  align-items: center;
}

.certificate-card {
  flex: 0 0 280px;
  width: 280px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.certificate-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

.cert-meta {
  margin-top: auto;
  font-size: 11.5px;
  color: var(--muted);
}

.cert-id {
  font-size: 11px;
  color: #94a3b8;
  word-break: break-all;
}

/* =========================================================
   Контакты и футер
   ========================================================= */
.contact-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding: 24px 26px;
}

.contact-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.contact-right {
  border-left: 1px solid var(--border);
  padding-left: 26px;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.contact-form label span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  outline: none;
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.contact-form .btn {
  align-self: flex-start;
}

.site-footer {
  margin-top: 32px;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.footer-inner {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
}

/* =========================================================
   Модальные окна
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal {
  position: relative;
  width: 92vw;
  max-width: 1200px;
  height: 90vh;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-certificate {
  max-width: 960px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.modal-nav {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: #fbfdff;
}

.modal-nav .btn {
  min-width: 180px;
}

.modal-kicker {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid #dbeafe;
  color: #1e40af;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.modal-title {
  margin: 0 0 14px;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.02em;
  padding-right: 40px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 22px;
  align-items: start;
}

.modal-shot {
  width: 100%;
  height: 380px;
  object-fit: contain;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.modal-cert-shot {
  height: 60vh;
}

.modal-section {
  margin-bottom: 14px;
}

.modal-section h4 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.modal-section p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-github-wrap {
  margin-top: 18px;
}

.modal-github-wrap .btn-github {
  width: 100%;
  font-size: 14px;
  padding: 12px 16px;
}

.modal-id {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.modal-id strong {
  color: var(--text);
  word-break: break-all;
}

/* =========================================================
   Адаптивность
   ========================================================= */
@media (max-width: 900px) {
  .header-inner {
    grid-template-columns: 1fr auto;
    row-gap: 6px;
    padding: 8px 0;
  }

  .nav-links {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 18px;
  }

  .print-btn {
    grid-column: 2;
    grid-row: 1;
  }

  html {
    scroll-padding-top: 108px;
  }

  .profile-card,
  .contact-card {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .profile-right,
  .contact-right {
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 18px;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  .modal-shot {
    height: 280px;
  }
}

@media (max-width: 600px) {
  .container,
  .header-inner {
    width: min(100% - 20px, 1160px);
  }

  .logo {
    font-size: 13px;
  }

  .print-btn {
    padding: 7px 10px;
    font-size: 12px;
  }

  .nav-links a {
    font-size: 12px;
  }

  .section {
    padding-top: 20px;
  }

  .profile-card,
  .contact-card {
    padding: 18px;
  }

  .identity-row {
    align-items: flex-start;
    gap: 12px;
  }

  .photo-wrap,
  .profile-photo {
    width: 104px;
    height: 104px;
    flex-basis: 104px;
  }

  .identity-text h1 {
    font-size: 21px;
  }

  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .arrows {
    justify-content: flex-end;
  }

  .project-card {
    flex-basis: min(350px, calc(100vw - 44px));
    width: min(350px, calc(100vw - 44px));
  }

  .certificate-card {
    flex-basis: min(280px, calc(100vw - 44px));
    width: min(280px, calc(100vw - 44px));
  }

  .modal-overlay {
    padding: 8px;
  }

  .modal {
    width: 96vw;
    height: 94vh;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-nav {
    padding: 12px 16px;
  }

  .modal-nav .btn {
    min-width: 0;
    flex: 1;
    padding: 9px 8px;
    font-size: 12px;
  }

  .modal-title {
    font-size: 20px;
  }

  .modal-shot {
    height: 220px;
  }

  .modal-cert-shot {
    height: 46vh;
  }

  .footer-inner {
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    text-align: center;
  }
}

/* =========================================================
   Печать / PDF
   ========================================================= */
@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  html,
  body {
    background: #ffffff;
    color: #000000;
    font-size: 11px;
  }

  .site-header,
  .print-btn,
  .filters,
  .arrows-btn,
  .modal-overlay,
  .contact-form,
  .card-action,
  .site-footer {
    display: none !important;
  }

  .container {
    width: 100%;
  }

  .section {
    padding: 10px 0;
    break-inside: avoid;
  }

  .card,
  .project-card,
  .certificate-card {
    box-shadow: none;
    border-color: #cccccc;
  }

  .profile-card,
  .contact-card {
    grid-template-columns: 1fr 1fr;
  }

  .h-track {
    overflow: visible;
    flex-wrap: wrap;
    gap: 10px;
  }

  .project-card,
  .certificate-card {
    flex: 0 0 calc(33.33% - 10px);
    width: calc(33.33% - 10px);
    break-inside: avoid;
  }

  .card-image-wrap img {
    max-height: 110px;
    object-fit: cover;
  }

  a {
    color: #000000;
    text-decoration: none;
  }

  .contact-buttons .btn {
    border: 1px solid #999999;
    color: #000000;
    background: #ffffff;
  }
}
