/* ===== Variables (accent = цвет кнопки «Связаться») ===== */
:root {
  --accent: #2563eb;
  --text: #1a1a1f;
  --muted: #4b5563;
  --muted-light: #6b7280;
  --bg: #f8f9fb;
  --card: #fff;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --container: 1100px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 1.5rem; }
.container--wide { max-width: var(--container); }
.section { padding: 4rem 0; }
.section--alt { background: var(--card); }
.section__subtitle {
  font-size: 0.9rem;
  color: var(--accent);
  margin: 0 0 0.25rem;
  letter-spacing: 0.02em;
}
.section__title {
  font-size: clamp(1.5rem, 4vw, 1.75rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.section__line {
  width: 2.5rem;
  height: 3px;
  background: var(--accent);
  margin: 0 0 2rem;
}
.section__lead {
  margin: 0 0 2rem;
  color: var(--muted);
  max-width: 48ch;
}

/* ===== Scroll reveal (animate-on-scroll + --i) ===== */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
}
.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}
.section__title.animate-on-scroll.visible,
.timeline__item.animate-on-scroll.visible,
#projects .card.animate-on-scroll.visible,
.skills__group.animate-on-scroll.visible {
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.timeline__item.animate-on-scroll.visible {
  transition-delay: calc(var(--i, 0) * 0.12s);
}
#projects .card.animate-on-scroll.visible {
  transition-delay: calc(var(--i, 0) * 0.1s);
}
.skills__group.animate-on-scroll.visible {
  transition-delay: calc(var(--i, 0) * 0.08s);
}
.trusted__card.animate-on-scroll.visible,
.contacts__links.animate-on-scroll.visible,
.contacts__form-wrap.animate-on-scroll.visible {
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.contacts__links.animate-on-scroll.visible { transition-delay: 0.05s; }
.contacts__form-wrap.animate-on-scroll.visible { transition-delay: 0.15s; }

/* ===== Header & Nav (прозрачный над hero; при скролле — фон на весь экран) ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  width: 100%;
  background: transparent;
  border-bottom: none;
  transition: background 0.25s ease, border-color 0.25s ease;
}
.header--scrolled {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.header__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--text);
  transition: color 0.2s;
}
.logo:hover { text-decoration: none; }
.logo-accent { color: var(--accent); }
.header:not(.header--scrolled) .nav a {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
.header:not(.header--scrolled) .nav a:hover { color: rgba(255, 255, 255, 0.85); }
.header:not(.header--scrolled) .nav a.is-active {
  border-bottom-color: transparent;
}
.header--scrolled .nav a {
  color: var(--muted);
}
.header--scrolled .nav a:hover { color: var(--accent); }
.header--scrolled .nav a.is-active {
  color: var(--accent);
  border-bottom-color: transparent;
}
.nav {
  display: flex;
  gap: 1.5rem;
}
.nav a {
  position: relative;
  display: block;
  width: 4.1rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s, border-color 0.2s;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
  box-sizing: border-box;
}
.nav a:hover { color: var(--accent); }
.nav a.is-active::after {
  content: "";
  display: block;
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background-image: linear-gradient(to right, currentColor 60%, transparent 60%),
    repeating-linear-gradient(90deg, currentColor 0, currentColor 3px, transparent 3px, transparent 8px);
  background-size: 100% 2px, 8px 2px;
  background-position: 0 0, 60% 0;
  background-repeat: no-repeat, repeat-x;
}
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--muted);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.header:not(.header--scrolled) .nav-toggle span { background: #fff; }
.header--scrolled .nav-toggle span { background: var(--muted); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Hero: синяя заливка справа, граница — диагональ слева направо (от ~Главная через центр фото) ===== */
.hero {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  padding: 0;
  padding-top: calc(4rem + 1px);
  box-sizing: border-box;
}
.hero::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--accent);
  clip-path: polygon(44% 0, 100% 0, 100% 170%);
  z-index: 0;
}
.hero__inner {
  position: relative;
  z-index: 1;
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 2.5rem;
  align-items: center;
  min-height: calc(100vh - 4rem - 1px);
  padding: 2rem 1.5rem 4rem;
}
.hero__social {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem 0.5rem;
  background: var(--card);
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: var(--shadow);
}
.hero__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
  border-radius: 50%;
}
.hero__social-link:hover { color: var(--accent); background: rgba(37, 99, 235, 0.08); text-decoration: none; }
.hero__social-icon { flex-shrink: 0; }
.hero__content { min-width: 0; }
.hero__name {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.25rem;
  color: var(--text);
  animation: fadeUp 0.6s ease-out;
}
.hero__role {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  color: var(--accent);
  margin: 0 0 1rem;
  animation: fadeUp 0.6s ease-out 0.1s both;
}
.hero__intro {
  margin: 0 0 1.5rem;
  color: var(--muted);
  max-width: 42ch;
  animation: fadeUp 0.6s ease-out 0.2s both;
}
.hero__cta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  animation: fadeUp 0.6s ease-out 0.3s both;
}
.hero__photo {
  animation: fadeUp 0.6s ease-out 0.2s both;
  width: clamp(200px, 26vw, 280px);
  height: clamp(200px, 26vw, 280px);
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--shadow-hover);
  border: 3px solid rgba(255,255,255,0.5);
}
.hero__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: #1d4ed8; box-shadow: 0 4px 12px rgba(37,99,235,0.35); text-decoration: none; }
.btn--outline {
  background: transparent;
  color: var(--muted);
  border: 1px solid #d1d5db;
}
.btn--outline:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ===== Experience / Timeline: слева/справа — описание в блоке, напротив — должность/место/период без блока ===== */
.timeline {
  position: relative;
  padding: 2rem 0;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--accent);
  border-radius: 2px;
  z-index: 0;
}
.timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 2.5rem;
}
.timeline__item:last-child { margin-bottom: 0; }
/* нечётные (01, 03): слева — описание в блоке, справа — мета без блока */
.timeline__item:nth-child(odd) { grid-template-areas: "content num meta"; }
.timeline__item:nth-child(odd) .timeline__content { grid-area: content; justify-self: end; }
.timeline__item:nth-child(odd) .timeline__meta { grid-area: meta; justify-self: start; }
.timeline__item:nth-child(odd) .timeline__num { grid-area: num; }
/* чётные (02): слева — мета, справа — описание в блоке */
.timeline__item:nth-child(even) { grid-template-areas: "meta num content"; }
.timeline__item:nth-child(even) .timeline__meta { grid-area: meta; justify-self: end; }
.timeline__item:nth-child(even) .timeline__content { grid-area: content; justify-self: start; }
.timeline__item:nth-child(even) .timeline__num { grid-area: num; }
.timeline__num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  border: 3px solid var(--card);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 1;
  flex-shrink: 0;
}
.timeline__content {
  max-width: 380px;
  padding: 1.25rem 1.5rem;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid #e5e7eb;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.timeline__item--featured .timeline__content {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.timeline__item--featured .timeline__desc { color: rgba(255,255,255,0.95); }
.timeline__item:hover .timeline__content {
  box-shadow: var(--shadow-hover);
  border-color: #d1d5db;
}
.timeline__item--featured:hover .timeline__content { border-color: var(--accent); }
/* мета: должность, место, период — без фона/блока */
.timeline__meta {
  max-width: 320px;
}
.timeline__role {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--text);
}
.timeline__company {
  font-size: 0.9rem;
  color: var(--accent);
  margin: 0 0 0.25rem;
}
.timeline__period {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--muted-light);
  margin: 0 0 0.5rem;
}
.timeline__desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
}
.timeline__content .timeline__desc { margin: 0; }

/* ===== Projects / Cards (3/2/1 колонки, featured акцентом) ===== */
.projects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.card {
  padding: 1.5rem;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid #e5e7eb;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.card:hover {
  box-shadow: var(--shadow-hover);
  border-color: #d1d5db;
}
.card--featured {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.card--featured .card__title,
.card--featured .card__text { color: rgba(255,255,255,0.95); }
.card--featured .card__tags span { background: rgba(255,255,255,0.25); color: #fff; }
.card--featured:hover { border-color: var(--accent); }
.card__title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--text);
}
.card__text { margin: 0 0 0.75rem; font-size: 0.9rem; color: var(--muted); line-height: 1.6; }
.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.card__tags span {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
  border-radius: 4px;
}

/* ===== Skills (акцент: полоска слева, буллеты, уровень) ===== */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}
.skills__group {
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
}
.skills__level {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.75rem;
}
.skills__list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.8;
}
.skills__list li::before { content: "· "; color: var(--accent); font-weight: 600; }

/* ===== Trusted Developers (акцент: полоска сверху, имя) ===== */
.trusted { display: flex; justify-content: center; }
.trusted__card {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
  max-width: 480px;
  padding: 1.5rem;
  background: var(--card);
  border-radius: var(--radius);
  border: 2px solid var(--accent);
  box-shadow: var(--shadow);
  animation: fadeUp 0.5s ease-out;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.trusted__card:hover {
  box-shadow: var(--shadow-hover), 0 0 0 1px var(--accent);
}
.trusted__photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(37, 99, 235, 0.5);
}
.trusted__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.trusted__info { flex: 1; min-width: 200px; }
.trusted__name {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--text);
}
.trusted__desc { margin: 0; font-size: 0.9rem; color: var(--muted); line-height: 1.6; }

/* ===== Contacts (акцент: подписи, полоска у ссылок, кнопка) ===== */
.section--contacts .section__title { margin-bottom: 1.5rem; }
.contacts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}
.contacts__links { display: flex; flex-direction: column; gap: 1rem; }
.contacts__item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0 0.75rem 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  border-left: 3px solid transparent;
  color: inherit;
  transition: color 0.2s, border-left-color 0.2s;
}
.contacts__item:hover {
  color: var(--accent);
  text-decoration: none;
  border-left-color: var(--accent);
}
.contacts__label {
  font-size: 0.8rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.contacts__value { font-weight: 500; }
.form { display: flex; flex-direction: column; gap: 1rem; }
.form__label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.form__label span { color: var(--accent); font-weight: 600; }
.form__input {
  padding: 0.6rem 0.85rem;
  font-family: inherit;
  font-size: 0.95rem;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  background: var(--card);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.form__textarea { resize: vertical; min-height: 100px; }
.form__hint { font-size: 0.8rem; color: var(--muted-light); margin: 0; }

/* ===== Footer ===== */
.footer {
  padding: 1.5rem 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg);
}

/* ===== Responsive: tablet 768–1023 ===== */
@media (max-width: 1023px) {
  .projects { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .header__inner {
    flex-wrap: wrap;
    padding: 0.75rem 1.25rem;
  }
  .header .nav { display: none; }
  .header .nav.is-open {
    display: flex;
    order: 3;
    width: 100%;
    flex-direction: column;
    padding: 1rem 0;
    gap: 0.5rem;
    border-top: 1px solid rgba(0,0,0,0.06);
  }
  .header .nav.is-open a {
    width: 100%;
    text-align: center;
  }
  .nav-toggle { display: flex; }
  .hero::after {
    clip-path: polygon(75% 0, 100% 0, 100% 22%);
  }
  .hero__inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 1.5rem;
    min-height: auto;
    padding: 2rem 0;
  }
  .hero__social {
    flex-direction: row;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
  }
  .hero__content { text-align: center; }
  .hero__intro { margin-left: auto; margin-right: auto; }
  .hero__cta { justify-content: center; }
  .hero__photo { justify-self: center; }
  .projects { grid-template-columns: 1fr; }
  .timeline::before { left: 22px; margin-left: 0; }
  .timeline__item {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas: "num meta" "num content" !important;
    gap: 1rem;
    margin-bottom: 2rem;
  }
  .timeline__item .timeline__num {
    grid-area: num !important;
    grid-row: 1 / -1;
    align-self: start;
    width: 36px;
    height: 36px;
    font-size: 0.75rem;
  }
  .timeline__item .timeline__meta {
    grid-area: meta !important;
    justify-self: stretch !important;
    max-width: none;
  }
  .timeline__item .timeline__content {
    grid-area: content !important;
    justify-self: stretch !important;
    max-width: none;
  }
  .contacts { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .container, .container--wide { padding: 0 1.25rem; }
}

/* ===== Reduce motion ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .animate-on-scroll { opacity: 1; transform: none; }
}
