/* Портфолио Руслана Зажигина */

:root {
  --paper: #f5f1ea;
  --paper-2: #ece6db;
  --ink: #1c1b19;
  --ink-2: #4a4741;
  --muted: #7a756c;
  --line: #d9d2c5;
  --accent: #b5462a;
  --accent-dark: #933720;
  --dark: #1f2421;
  --serif: "PT Serif", Georgia, "Times New Roman", serif;
  --sans: "Golos Text", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

h1, h2, h3 { margin: 0; font-weight: 700; }

p { margin: 0 0 1em; }

.wrap { width: min(1120px, 100% - 48px); margin-inline: auto; }
.wrap--narrow { width: min(780px, 100% - 48px); }

/* Шапка */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(245, 241, 234, .9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
}

.logo {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 20px;
  text-decoration: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
}

.nav { display: flex; gap: 28px; margin-right: auto; }

.nav a {
  text-decoration: none;
  font-size: 15px;
  color: var(--ink-2);
  transition: color .2s;
}

.nav a:hover { color: var(--accent); }

/* Кнопки */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 26px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  border: 1.5px solid var(--accent);
  transition: background .2s, border-color .2s, color .2s;
}

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

.btn--small { padding: 9px 18px; font-size: 15px; }

.btn--ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.btn--light { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn--light:hover { background: #fff; border-color: #fff; }

/* Общие элементы секций */

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.eyebrow--light { color: #e3896f; }

.section { padding: 100px 0; }
.section--paper { background: var(--paper-2); }
.section--dark { background: var(--dark); color: #ece8e0; }

.section__title {
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.15;
  max-width: 760px;
  margin-bottom: 18px;
}

.section__intro { color: var(--muted); max-width: 640px; margin-bottom: 48px; }
.section--dark .section__intro { color: #a9a49a; }

.note { font-size: 14px; color: var(--muted); }

/* Первый экран */

.hero { padding: 96px 0 80px; }

.hero__title {
  font-family: var(--serif);
  font-size: clamp(48px, 8vw, 96px);
  line-height: 1;
  letter-spacing: -.02em;
  margin-bottom: 24px;
}

.hero__lead {
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.55;
  max-width: 720px;
  color: var(--ink-2);
  margin-bottom: 36px;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 72px; }

.hero__facts {
  list-style: none;
  margin: 0;
  padding: 28px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.hero__facts b {
  display: block;
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.2;
  margin-bottom: 6px;
}

.hero__facts span { font-size: 15px; color: var(--muted); line-height: 1.4; display: block; }

/* Результаты */

.results {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: #3a403c;
  border: 1px solid #3a403c;
  border-radius: var(--radius);
  overflow: hidden;
}

.result { background: var(--dark); padding: 36px; display: flex; flex-direction: column; }

.result__num {
  font-family: var(--serif);
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1.1;
  color: #fff;
  margin-bottom: 14px;
}

.result__text { color: #bdb8ae; flex-grow: 1; }

.result__link {
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  align-self: flex-start;
}

.section--dark .result__link { color: #e3896f; }
.result__link:hover { color: var(--accent-dark); }

/* Кейсы */

.case {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 48px;
  padding: 56px 0;
  border-top: 1px solid var(--line);
}

.case:first-of-type { margin-top: 32px; }

.case__head { position: sticky; top: 100px; align-self: start; }

.case__tag {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .04em;
  margin-bottom: 10px;
}

.case__title { font-family: var(--serif); font-size: 28px; line-height: 1.2; }

.case__body { color: var(--ink-2); min-width: 0; }
.case__body b { color: var(--ink); }

.table-wrap { overflow-x: auto; margin: 24px 0 28px; }

.table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 560px; }

.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }

.table th { font-weight: 600; color: var(--ink); background: var(--paper-2); }

.table .bad { color: var(--accent); font-weight: 600; }

.steps { padding-left: 22px; margin: 20px 0; }
.steps li { margin-bottom: 10px; padding-left: 6px; }
.steps li::marker { color: var(--accent); font-weight: 600; }

.gallery { margin: 24px 0; }
.gallery img { border-radius: 10px; width: 100%; }
.gallery figcaption { font-size: 14px; color: var(--muted); margin-top: 10px; }

.minis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding-top: 56px;
  border-top: 1px solid var(--line);
}

.mini {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
}

.mini p:not(.case__tag) { font-size: 15px; color: var(--ink-2); flex-grow: 1; }

.mini__title { font-family: var(--serif); font-size: 21px; line-height: 1.25; margin-bottom: 12px; }

.topics { margin-top: 56px; }

.topics__title { font-family: var(--serif); font-size: 24px; margin-bottom: 20px; }

.topics__list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.topics__list li {
  font-size: 15px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}

/* Навыки */

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

.skill { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; }

.skill h3 { font-family: var(--serif); font-size: 22px; margin-bottom: 16px; }

.skill ul { list-style: none; margin: 0; padding: 0; }

.skill li {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  color: var(--ink-2);
}

.skill li:last-child { border-bottom: 0; }

.process { margin-top: 64px; }

.process__title { font-family: var(--serif); font-size: 24px; margin-bottom: 24px; }

.process__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.process__list li { font-size: 15px; color: var(--ink-2); border-top: 2px solid var(--ink); padding-top: 16px; }

.process__list span {
  display: block;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
}

/* Опыт */

.timeline { list-style: none; margin: 40px 0 32px; padding: 0; }

.timeline li {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.timeline__date { font-family: var(--serif); font-size: 18px; color: var(--muted); margin: 0; }

.timeline h3 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }

.timeline p { color: var(--ink-2); margin: 0; }

.edu { color: var(--ink-2); padding-top: 24px; border-top: 1px solid var(--line); }

/* Призыв */

.cta { background: var(--accent); color: #fff; padding: 64px 0; }

.cta__inner { display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; }

.cta__title { font-family: var(--serif); font-size: clamp(28px, 3.5vw, 38px); margin-bottom: 8px; }

.cta p { margin: 0; font-size: 18px; opacity: .92; }

/* FAQ */

.faq { border-top: 1px solid var(--line); }
.faq:last-of-type { border-bottom: 1px solid var(--line); }

.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 24px 40px 24px 0;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  position: relative;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 28px;
  color: var(--accent);
  transition: transform .2s;
}

.faq[open] summary::after { transform: translateY(-50%) rotate(45deg); }

.faq p { color: var(--ink-2); padding-bottom: 12px; max-width: 680px; }

/* Подвал */

.footer { background: var(--dark); color: #ece8e0; padding: 88px 0 40px; }

.footer__title { font-family: var(--serif); font-size: clamp(32px, 4.5vw, 52px); margin-bottom: 12px; }

.footer__note { color: #a9a49a; margin-bottom: 40px; }

.contacts {
  list-style: none;
  margin: 0 0 64px;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr 1fr;
  gap: 1px;
  background: #3a403c;
  border: 1px solid #3a403c;
  border-radius: var(--radius);
  overflow: hidden;
}

.contacts li { background: var(--dark); padding: 24px; }

.contacts span { display: block; font-size: 13px; color: #8f8a80; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px; }

.contacts a { color: #fff; text-decoration: none; font-weight: 500; word-break: break-word; }
.contacts a:hover { color: #e3896f; }

.footer__copy { font-size: 14px; color: #8f8a80; margin: 0; }

/* Фокус с клавиатуры */

a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* Планшет */

@media (max-width: 960px) {
  .nav { display: none; }
  .topbar__inner { justify-content: space-between; }
  .hero__facts { grid-template-columns: repeat(2, 1fr); }
  .case { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .case__head { position: static; }
  .minis, .skills { grid-template-columns: 1fr; }
  .process__list { grid-template-columns: repeat(2, 1fr); }
  .contacts { grid-template-columns: repeat(2, 1fr); }
}

/* Телефон */

@media (max-width: 600px) {
  body { font-size: 16px; }
  .wrap, .wrap--narrow { width: calc(100% - 32px); }
  .section { padding: 72px 0; }
  .hero { padding: 56px 0 56px; }
  .hero__actions .btn { width: 100%; }
  .hero__facts b { font-size: 22px; }
  .results { grid-template-columns: 1fr; }
  .result { padding: 28px 24px; }
  .timeline li { grid-template-columns: 1fr; gap: 6px; }
  .process__list, .contacts { grid-template-columns: 1fr; }
  .faq summary { font-size: 19px; }
}

/* ===== Анимации и интерактив ===== */

/* Фото на первом экране */
.hero__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 64px;
  align-items: center;
  margin-bottom: 72px;
}

.hero__main { grid-column: 1; grid-row: 1; }
.hero__main .hero__actions { margin-bottom: 0; }

.hero__photo {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  margin: 0;
}

/* Смещённая рамка-подложка в фирменном цвете */
.hero__photo::before {
  content: "";
  position: absolute;
  inset: 18px -18px -18px 18px;
  border: 2px solid var(--accent);
  border-radius: 22px;
  z-index: 0;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}

.hero__photo:hover::before { transform: translate(-8px, -8px); }

.hero__photo img {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 30px 60px -30px rgba(28, 27, 25, .5);
}

.hero__photo figcaption {
  position: absolute;
  z-index: 2;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
  font-size: 14px;
  font-weight: 500;
}

.hero__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2fa36b;
  box-shadow: 0 0 0 0 rgba(47, 163, 107, .6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 9px rgba(47, 163, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 163, 107, 0); }
}

@media (max-width: 960px) {
  .hero__top { grid-template-columns: minmax(0, 1fr) 260px; gap: 40px; }
}

@media (max-width: 720px) {
  .hero__top { grid-template-columns: 1fr; gap: 36px; margin-bottom: 56px; }
  .hero__photo { grid-column: 1; grid-row: 1; width: min(260px, 75%); }
  .hero__main { grid-row: 2; }
}

/* Полоса чтения */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 20;
}

/* Подзаголовок в H1 и печатающаяся строка */
.hero__role {
  display: block;
  font-family: var(--sans);
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--accent);
  margin-top: 14px;
}

.hero__typed {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(24px, 3.2vw, 36px);
  line-height: 1.2;
  margin-bottom: 24px;
  min-height: 1.2em;
}

.typer {
  color: var(--accent);
  border-right: 3px solid var(--accent);
  padding-right: 4px;
  animation: caret 1s steps(1) infinite;
}

@keyframes caret { 50% { border-color: transparent; } }

/* Появление блоков при прокрутке */
.js .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1);
}

.js .reveal.is-in { opacity: 1; transform: none; }

/* Счётчики не прыгают по ширине */
.count { font-variant-numeric: tabular-nums; }

/* Столбики заспамленности */
.bars { margin: 0 0 28px; }

.bars__title { font-size: 14px; color: var(--muted); margin-bottom: 12px; }

.bar {
  display: grid;
  grid-template-columns: 80px 1fr 48px;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 14px;
}

.bar__name { color: var(--ink); font-weight: 500; }

.bar__track {
  position: relative;
  height: 14px;
  background: var(--paper-2);
  border-radius: 7px;
  overflow: hidden;
}

.bar__norm {
  position: absolute;
  left: 30%;
  width: 25%;
  top: 0;
  bottom: 0;
  background: rgba(45, 160, 110, .45);
  border-left: 2px solid #1f6b50;
  border-right: 2px solid #1f6b50;
  z-index: 1;
}

.bar__fill {
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: var(--v);
  background: var(--accent);
  border-radius: 4px;
  transform-origin: left;
  transition: transform 1.4s cubic-bezier(.2, .7, .2, 1);
}

.js .bars .bar__fill { transform: scaleX(0); }
.js .bars.is-in .bar__fill { transform: scaleX(1); }
.bars .bar:nth-of-type(2) .bar__fill { transition-delay: .15s; }
.bars .bar:nth-of-type(3) .bar__fill { transition-delay: .3s; }

.bar__val { color: var(--accent); font-weight: 600; text-align: right; }

/* Линия опыта прорисовывается */
.timeline li { border-top: 0; position: relative; }

.timeline li::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--ink);
  opacity: .25;
  transform-origin: left;
  transition: transform 1.2s cubic-bezier(.2, .7, .2, 1);
}

.timeline li::after {
  content: "";
  position: absolute;
  left: 0;
  top: -5px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform .5s .6s cubic-bezier(.3, 1.6, .5, 1);
}

.js .timeline li.reveal::before { transform: scaleX(0); }
.js .timeline li.reveal::after { transform: scale(0); }
.js .timeline li.reveal.is-in::before { transform: scaleX(1); }
.js .timeline li.reveal.is-in::after { transform: scale(1); }

/* Раздел про тексты от нейросети */
.ai {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 56px;
  align-items: center;
}

.ai__text p { color: var(--ink-2); }

.ai__signs { list-style: none; padding: 0; margin: 0 0 20px; }

.ai__signs li {
  position: relative;
  padding: 8px 0 8px 30px;
  border-bottom: 1px dashed var(--line);
  color: var(--ink-2);
  font-size: 16px;
}

.ai__signs li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 15px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  border-radius: 50%;
}

.ai__signs li::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 27px;
  width: 7px;
  height: 2px;
  background: var(--accent);
  transform: rotate(45deg);
}

.ai__text .btn { margin-top: 8px; }

/* Рентгеновская лупа */
.xray {
  --r: 90px;
  --x: 50%;
  --y: 45%;
  position: relative;
  aspect-ratio: 3 / 2;
  background: #2a2420;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: none;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 30px 60px -30px rgba(28, 27, 25, .45);
}

.xray__layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; -webkit-user-drag: none; pointer-events: none; }

.xray__reveal {
  position: absolute;
  inset: 0;
  clip-path: circle(var(--r) at var(--x) var(--y));
}

/* Строки развёртки и бегущая полоса скана внутри линзы */
.xray__reveal::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(111, 224, 255, .07) 0 2px, transparent 2px 4px);
  pointer-events: none;
}

.xray__reveal::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 70px;
  top: -70px;
  background: linear-gradient(transparent, rgba(111, 224, 255, .22), transparent);
  animation: scan 2.6s linear infinite;
  pointer-events: none;
}

@keyframes scan { from { top: -70px; } to { top: 100%; } }

.xray__lens {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: calc(var(--r) * 2);
  height: calc(var(--r) * 2);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 7px solid #2b2724;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, .35),
    inset 0 0 30px rgba(111, 224, 255, .35),
    0 14px 30px rgba(0, 0, 0, .35);
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 38%);
  pointer-events: none;
}

.xray__lens::after {
  content: "";
  position: absolute;
  left: 86%;
  top: 86%;
  width: 18px;
  height: 92px;
  border-radius: 9px;
  background: linear-gradient(90deg, #4a3a2c, #241b14);
  transform-origin: top center;
  transform: translateX(-50%) rotate(-45deg);
}

.xray__hint {
  position: absolute;
  left: 16px;
  bottom: 16px;
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(28, 27, 25, .78);
  color: #fff;
  font-size: 14px;
  pointer-events: none;
  transition: opacity .4s;
}

.xray.is-touched .xray__hint { opacity: 0; }

@media (hover: none) {
  .xray { cursor: auto; }
}

@media (max-width: 960px) {
  .ai { grid-template-columns: 1fr; gap: 36px; }
}

@media (max-width: 600px) {
  .bar { grid-template-columns: 64px 1fr 40px; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .typer, .hero__dot { animation: none; }
  .xray__reveal::after { animation: none; display: none; }
  .js .bars .bar__fill, .js .timeline li.reveal::before, .js .timeline li.reveal::after { transform: none; transition: none; }
}
