:root {
  --bg: #f7f8fc;
  --surface: #ffffff;
  --surface-soft: #f1f3fa;
  --text: #1f2025;
  --text-muted: #62646d;
  --accent: #315dcc;
  --accent-soft: #e9edf9;
  --line: #e2e4ea;
  --shadow: 0 8px 24px rgba(34, 40, 66, 0.05);
  --max-width: 1180px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.65;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.container {
  width: min(100% - 48px, var(--max-width));
  margin: 0 auto;
}

.narrow {
  max-width: 900px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.header-inner {
  display: grid;
  min-height: 76px;
  grid-template-columns: 72px 1fr 72px;
  align-items: stretch;
}

.logo,
.language-button {
  display: flex;
  align-items: center;
  font-size: 21px;
  font-weight: 800;
}

.logo {
  justify-content: flex-start;
}

.language-button {
  width: 48px;
  justify-content: flex-end;
  border: 0;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: color 160ms ease, transform 160ms ease;
}

.language-button:hover,
.language-button:focus-visible {
  color: var(--accent);
  transform: translateY(-2px);
}

.site-nav {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
}

.site-nav a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border-radius: 0 0 12px 12px;
  font-size: 15px;
  font-weight: 700;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.site-nav a:nth-child(1) {
  width: 104px;
}

.site-nav a:nth-child(2) {
  width: 142px;
}

.site-nav a:nth-child(3) {
  width: 104px;
}

.site-nav a:nth-child(4) {
  width: 92px;
}

.site-nav a:nth-child(5) {
  width: 110px;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(8px);
}

.site-nav a::after {
  position: absolute;
  right: 10px;
  bottom: 6px;
  left: 10px;
  height: 3px;
  background: var(--accent);
  content: "";
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 160ms ease-out;
}

.site-nav a:hover::after,
.site-nav a:focus-visible::after,
.site-nav a.is-active::after {
  transform: scaleX(1);
}

.menu-button {
  display: none;
}

.hero {
  padding: 72px 0 94px;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 22px;
  font-size: clamp(58px, 8vw, 92px);
  line-height: 1.02;
}

h2 {
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1.08;
}

h3 {
  margin-bottom: 10px;
  font-size: 22px;
  line-height: 1.28;
}

.hero-text,
.lead {
  color: var(--text-muted);
  font-size: 19px;
}

.hero-text {
  min-height: 94px;
  max-width: 920px;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.55;
}

.hero-university {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(49, 93, 204, 0.28);
  text-decoration-thickness: 2px;
  text-underline-offset: 7px;
  transition: color 180ms ease, text-decoration-color 180ms ease;
}

.hero-university:hover,
.hero-university:focus-visible {
  color: #244cae;
  text-decoration-color: var(--accent);
}

.organization-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(49, 93, 204, 0.24);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  transition: color 180ms ease, text-decoration-color 180ms ease;
}

.organization-link:hover,
.organization-link:focus-visible {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease,
    box-shadow 180ms ease, transform 180ms ease;
}

.button-primary {
  color: #fff;
  background: var(--accent);
}

.button-secondary {
  color: var(--accent);
  background: var(--surface);
}

.button-primary:hover,
.button-primary:focus-visible,
.button-secondary:hover,
.button-secondary:focus-visible {
  color: #fff;
  background: #244cae;
  box-shadow: 0 8px 18px rgba(49, 93, 204, 0.2);
  transform: translateY(-3px);
}

.button-disabled {
  border-color: var(--line);
  color: var(--text-muted);
  background: var(--surface-soft);
  cursor: not-allowed;
}

.button-disabled:hover,
.button-disabled:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
  transform: translateY(-3px);
}

.hero-photo-wrap {
  overflow: hidden;
  width: 230px;
  height: 230px;
  margin-bottom: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 14px 30px rgba(34, 40, 66, 0.12);
}

.hero-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.section {
  padding: 104px 0;
}

.section-bordered {
  position: relative;
}

.section-bordered::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: min(calc(100% - 48px), var(--max-width));
  height: 3px;
  background: var(--line);
  content: "";
  transform: translateX(-50%);
}

.section-title {
  width: fit-content;
  margin: 0 auto 58px;
  padding-bottom: 10px;
  border-bottom: 4px solid var(--accent);
  text-align: center;
}

.section-title-left {
  margin-right: 0;
  margin-left: 0;
  color: var(--text);
  text-align: left;
}

#about .narrow {
  min-height: 340px;
}

.education-list {
  display: grid;
  gap: 26px;
}

.education-item {
  padding: 30px 34px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.education-item h3 {
  margin-bottom: 8px;
  font-size: 28px;
}

.education-meta {
  margin-bottom: 0;
  color: var(--accent);
  font-size: 17px;
}

.projects-carousel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.projects-viewport {
  overflow: hidden;
}

.projects-track {
  display: flex;
  transition: transform 320ms ease;
}

.project-slide {
  display: grid;
  min-width: 100%;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.1fr);
}

.project-image-wrap {
  min-height: 520px;
  background: var(--surface-soft);
}

.project-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 520px;
  object-fit: cover;
  object-position: center;
}

.project-content {
  padding: 40px;
}

.project-type {
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.project-content h3 {
  margin-bottom: 20px;
  font-size: 29px;
}

.project-content p {
  color: var(--text-muted);
}

.carousel-footer {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}

.carousel-controls {
  display: flex;
  gap: 8px;
}

.carousel-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  background: var(--surface);
  font-size: 22px;
  cursor: pointer;
}

.carousel-button:hover,
.carousel-button:focus-visible {
  color: #fff;
  background: var(--accent);
}

.carousel-counter {
  display: flex;
  gap: 8px;
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
}

.skill-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 34px;
}

.skill-filters button {
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.skill-filters button:nth-child(1) {
  width: 66px;
}

.skill-filters button:nth-child(2) {
  width: 120px;
}

.skill-filters button:nth-child(3) {
  width: 70px;
}

.skill-filters button:nth-child(4) {
  width: 174px;
}

.skill-filters button:nth-child(5) {
  width: 182px;
}

.skill-filters button:nth-child(6) {
  width: 72px;
}

.skill-filters button:hover,
.skill-filters button:focus-visible,
.skill-filters button.is-active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.skill-card {
  min-height: 280px;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.skill-card:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(49, 93, 204, 0.12);
  transform: translateY(-4px);
}

.skill-card.is-hidden {
  display: none;
}

.skill-card ul {
  margin: 0;
  padding: 0;
  color: var(--text-muted);
  list-style: none;
}

.skill-card li {
  position: relative;
  margin-top: 7px;
  padding-left: 18px;
  transition: color 180ms ease, transform 180ms ease;
}

.skill-card li::before {
  position: absolute;
  top: 0.72em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line);
  content: "";
  transform: translateY(-50%);
  transition: background 180ms ease, transform 180ms ease;
}

.skill-card li:hover {
  color: var(--text);
  transform: translateX(6px);
}

.skill-card li:hover::before {
  background: var(--accent);
  transform: translateY(-50%) scale(1.2);
}

.contact-section {
  position: relative;
  background: var(--surface-soft);
}

.contact-section::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: min(calc(100% - 48px), var(--max-width));
  height: 3px;
  background: var(--line);
  content: "";
  transform: translateX(-50%);
}

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

.message-field {
  display: flex;
  width: min(100%, 680px);
  min-height: 52px;
  align-items: center;
  margin: 0 auto 34px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text-muted);
  font-size: 15px;
  text-align: left;
  transition: border-color 180ms ease, box-shadow 180ms ease,
    transform 180ms ease;
}

.message-field:hover,
.message-field:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 10px 26px rgba(49, 93, 204, 0.12);
  transform: translateY(-2px);
}

.typewriter-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.typewriter-cursor {
  display: inline-block;
  flex: 0 0 auto;
  width: 2px;
  height: 1.15em;
  margin-left: 4px;
  background: var(--accent);
  animation: cursor-blink 800ms steps(2, start) infinite;
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

.contact-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.contact-links a {
  display: flex;
  min-height: 152px;
  flex-direction: column;
  justify-content: center;
  padding: 22px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 180ms ease;
}

.contact-links a:hover,
.contact-links a:focus-visible {
  border-color: var(--accent);
}

.contact-links strong {
  display: block;
}

.contact-icon {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--accent);
}

.contact-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.contact-icon-vk {
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
}

.contact-links strong {
  overflow-wrap: anywhere;
  font-size: 17px;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(220px, 0.8fr) minmax(260px, 1fr);
  gap: 54px;
  min-height: 190px;
  align-items: center;
  padding: 38px 0;
}

.footer-profile {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-photo {
  width: 72px;
  height: 72px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.footer-name,
.footer-role,
.footer-heading {
  margin: 0;
}

.footer-name {
  font-size: 19px;
  font-weight: 800;
}

.footer-role {
  color: var(--text-muted);
  font-size: 15px;
}

.footer-heading {
  margin-bottom: 14px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.footer-nav {
  display: grid;
  grid-template-columns: 130px 130px;
  gap: 8px 26px;
}

.footer-nav .footer-heading {
  grid-column: 1 / -1;
}

.footer-nav a {
  color: var(--text-muted);
  font-size: 15px;
  transition: color 180ms ease;
}

.footer-nav a:hover,
.footer-nav a:focus-visible {
  color: var(--accent);
}

.footer-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-socials a {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-muted);
  background: var(--surface);
  transition: color 180ms ease, border-color 180ms ease;
}

.footer-socials a:hover,
.footer-socials a:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.footer-socials svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.footer-socials .footer-vk {
  font-size: 17px;
  font-weight: 800;
}

.error-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px 0;
}

.error-content {
  max-width: 620px;
}

.error-code {
  margin-bottom: 18px;
  color: var(--accent);
  font-size: 96px;
  font-weight: 700;
  line-height: 1;
}

@media (max-width: 900px) {
  .skills-grid,
  .contact-links {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .footer-connect {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .container {
    width: min(100% - 32px, var(--max-width));
  }

  .section-bordered::before,
  .contact-section::before {
    width: min(calc(100% - 32px), var(--max-width));
  }

  .header-inner {
    min-height: 68px;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
  }

  .menu-button {
    display: block;
    order: 2;
    width: 42px;
    height: 42px;
    padding: 9px;
    border: 0;
    background: transparent;
    cursor: pointer;
  }

  .menu-button span {
    display: block;
    height: 2px;
    margin: 5px 0;
    background: var(--text);
    transition: transform 180ms ease, opacity 180ms ease;
  }

  .menu-button.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .menu-button.is-open span:nth-child(2) {
    opacity: 0;
  }

  .menu-button.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .language-button {
    order: 3;
    font-size: 16px;
  }

  .site-nav {
    position: absolute;
    top: 68px;
    right: 0;
    left: 0;
    display: none;
    padding: 8px 16px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .site-nav.is-open {
    display: grid;
  }

  .site-nav a:nth-child(n) {
    width: auto;
    min-height: 44px;
    padding: 0 12px;
  }

  .hero {
    padding: 58px 0 68px;
  }

  h1 {
    font-size: 52px;
  }

  .hero-photo-wrap {
    width: 190px;
    height: 190px;
    margin-bottom: 32px;
  }

  .section {
    padding: 76px 0;
  }

  .section-title {
    margin-bottom: 42px;
  }

  .project-slide {
    grid-template-columns: 1fr;
  }

  .project-image-wrap,
  .project-image {
    min-height: 240px;
  }

  .project-content {
    padding: 24px 22px;
  }

  .project-content h3 {
    font-size: 24px;
  }

  .skills-grid,
  .contact-links {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 34px 0;
  }

  .footer-connect {
    grid-column: auto;
  }

  .message-field {
    min-height: 50px;
    padding-right: 13px;
    padding-left: 13px;
    font-size: 14px;
  }

  .skill-card {
    min-height: 0;
  }
}

@media (max-width: 380px) {
  .message-field {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .typewriter-cursor {
    display: none;
  }
}
