/* ============================================================
   ping-win.dev — сайт-визитка
   Токены: тёмная тема по умолчанию, светлая через [data-theme]
   ============================================================ */

:root,
:root[data-theme="dark"] {
  --bg:          #0a0d10;
  --bg-soft:     #10151a;
  --bg-card:     #12181e;
  --border:      #1e262e;
  --border-soft: #171e25;
  --fg:          #e6edf3;
  --fg-muted:    #8b98a5;
  --fg-dim:      #5c6874;
  --accent:      #3ddc97;
  --accent-dim:  rgba(61, 220, 151, 0.14);
  --accent-fg:   #06251a;
  --glow:        rgba(61, 220, 151, 0.35);
  --shadow:      0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
}

:root[data-theme="light"] {
  --bg:          #fbfcfd;
  --bg-soft:     #f2f5f8;
  --bg-card:     #ffffff;
  --border:      #dde4ea;
  --border-soft: #e8edf2;
  --fg:          #10171e;
  --fg-muted:    #56636f;
  --fg-dim:      #8a959f;
  --accent:      #0f9d63;
  --accent-dim:  rgba(15, 157, 99, 0.10);
  --accent-fg:   #ffffff;
  --glow:        rgba(15, 157, 99, 0.28);
  --shadow:      0 1px 2px rgba(16,23,30,.06), 0 8px 24px rgba(16,23,30,.07);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

/* Мягкое свечение на фоне */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60rem 32rem at 15% -10%, var(--accent-dim), transparent 70%),
    radial-gradient(48rem 28rem at 95% 5%, var(--accent-dim), transparent 70%);
}

.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.02em; }
p { margin: 0 0 1rem; }
ul, ol, dl { margin: 0; padding: 0; list-style: none; }

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

.wrap {
  width: 100%;
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem; top: 1rem;
  z-index: 50;
  padding: .5rem .875rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* ─────────────────────────── Топбар ─────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: 3.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--fg);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: .9375rem;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand__dot {
  width: .5rem; height: .5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--glow);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--glow); }
  70%  { box-shadow: 0 0 0 .55rem transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.nav {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
  font-size: .875rem;
}
.nav a { color: var(--fg-muted); transition: color .2s; }
.nav a:hover { color: var(--fg); text-decoration: none; }
.nav a.is-current { color: var(--accent); }

.controls {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.langs {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}
.langs__item {
  padding: .3125rem .5625rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .75rem;
  font-weight: 500;
  color: var(--fg-muted);
  background: transparent;
}
.langs__item:hover { color: var(--fg); background: var(--bg-soft); text-decoration: none; }
.langs__item.is-active { color: var(--accent-fg); background: var(--accent); }

.themeToggle {
  display: grid;
  place-items: center;
  width: 2rem; height: 2rem;
  padding: 0;
  color: var(--fg-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.themeToggle:hover { color: var(--fg); border-color: var(--fg-dim); }

.icon {
  width: 1rem; height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
:root[data-theme="dark"] .icon--moon,
:root[data-theme="light"] .icon--sun { display: none; }

/* ──────────────────────────── Hero ──────────────────────────── */

.hero { padding: 5.5rem 0 4rem; }
.hero--error { padding: 8rem 0; }

.hero__prompt {
  font-size: .875rem;
  color: var(--fg-muted);
  margin-bottom: 1.75rem;
}
.hero__cwd  { color: var(--fg-dim); }
.hero__sign { color: var(--accent); margin-right: .375rem; }

.hero__caret {
  display: inline-block;
  width: .5rem; height: 1rem;
  margin-left: .25rem;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero__name {
  font-size: clamp(2.5rem, 8vw, 4.25rem);
  font-weight: 700;
  letter-spacing: -0.035em;
}
.hero__role {
  margin: .625rem 0 0;
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--accent);
}
.hero__tagline {
  margin: 1rem 0 0;
  max-width: 34rem;
  font-size: 1.0625rem;
  color: var(--fg-muted);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin: 1.75rem 0 0;
  padding: .3125rem .75rem;
  font-size: .8125rem;
  color: var(--fg-muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.status__pulse {
  width: .4375rem; height: .4375rem;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s ease-out infinite;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .6875rem 1.25rem;
  font-size: .9375rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--fg);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: transform .15s, border-color .2s, background-color .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--fg-dim); }
.btn--primary {
  color: var(--accent-fg);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 4px 16px var(--glow);
}
.btn--primary:hover { border-color: var(--accent); filter: brightness(1.06); }
.btn--ghost { background: transparent; }

.social {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 2.5rem;
  font-size: .8125rem;
}
.social--wide { margin-top: 2rem; }
.social__item { color: var(--fg-muted); }
.social__item:hover { color: var(--accent); text-decoration: none; }

/* ────────────────────────── Секции ─────────────────────────── */

.section {
  padding: 4rem 0;
  border-top: 1px solid var(--border-soft);
}
.section--contact { padding-bottom: 5rem; }

.section__title {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}
.section__num {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--accent);
}
.section__lead {
  max-width: 38rem;
  color: var(--fg-muted);
  margin-bottom: 2rem;
}

/* Контент, отрендеренный из Markdown */
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 1rem; }
.md ul, .md ol { margin: 0 0 1rem; padding-left: 1.125rem; list-style: disc; }
.md ol { list-style: decimal; }
.md li { margin-bottom: .25rem; }
.md code {
  padding: .0625rem .3125rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .85em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.md blockquote {
  margin: 0 0 1rem;
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
  color: var(--fg-muted);
}
.md hr { margin: 1.5rem 0; border: 0; border-top: 1px solid var(--border); }
.md h4 { margin: 1.5rem 0 .5rem; font-size: 1rem; }

.about__text.md p:first-child { font-size: 1.0625rem; }
.about__text.md p:last-child { color: var(--fg-muted); }
.section__lead.md p { color: var(--fg-muted); }
.section__lead.md p:last-child { margin-bottom: 0; }

/* Обо мне */
.about {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 2.5rem;
  align-items: start;
}
.about__text p:last-child { margin-bottom: 0; color: var(--fg-muted); }

.facts {
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.facts__row + .facts__row {
  margin-top: .875rem;
  padding-top: .875rem;
  border-top: 1px solid var(--border-soft);
}
.facts dt {
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--fg-dim);
}
.facts dd { margin: .125rem 0 0; font-size: .9375rem; }

/* Теги-чипы */
.tags { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag {
  padding: .25rem .5625rem;
  font-size: .75rem;
  color: var(--fg);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* Опыт */
.timeline { border-left: 1px solid var(--border); }
.timeline__item {
  position: relative;
  padding: 0 0 2rem 1.75rem;
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: "";
  position: absolute;
  left: -.3125rem; top: .5rem;
  width: .5625rem; height: .5625rem;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.timeline__role { font-size: 1.0625rem; font-weight: 600; }
.timeline__meta {
  margin: .25rem 0 .625rem;
  font-size: .8125rem;
  color: var(--fg-muted);
}
.timeline__meta code {
  padding: .0625rem .375rem;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid transparent;
  border-radius: 5px;
}
.timeline__summary { color: var(--fg-muted); font-size: .9375rem; }
.timeline__summary p:last-child { margin-bottom: 0; }

/* Образование */
.subhead {
  margin: 2.5rem 0 1rem;
  font-size: .8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--fg-muted);
}
.edu__item {
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.edu__item + .edu__item { margin-top: .75rem; }
.edu__degree { margin: 0; font-size: 1rem; font-weight: 600; }

/* Карточки: единая сетка для «Стека», «Команды и продукта», «Результатов» */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.25rem;
}
.card {
  display: flex;
  flex-direction: column;
  gap: .875rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--fg-dim);
  box-shadow: var(--shadow);
}
.card__title { font-size: 1.0625rem; font-weight: 600; }
.card__text {
  font-size: .9375rem;
  color: var(--fg-muted);
  flex: 1;
}
.card__text p:last-child { margin-bottom: 0; }

/* Контакты */
.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
}
.contact__mail {
  font-size: clamp(1rem, 4vw, 1.375rem);
  font-weight: 500;
  color: var(--fg);
  border-bottom: 1px dashed var(--accent);
}
.contact__mail:hover { color: var(--accent); text-decoration: none; }

.contact__label {
  margin: 0 0 .5rem;
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--fg-dim);
}

/* ────────────────────────── Подвал ─────────────────────────── */

.footer {
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--border-soft);
  font-size: .8125rem;
  color: var(--fg-muted);
}
.footer__inner { display: grid; gap: .25rem; }
.footer__line { margin: 0; }
.sep { margin: 0 .5rem; color: var(--fg-dim); }

/* ───────────────────────── Адаптив ─────────────────────────── */

@media (max-width: 46rem) {
  .nav { display: none; }
  .controls { margin-left: auto; }
  .about, .cards { grid-template-columns: 1fr; }
  .hero { padding: 3.5rem 0 3rem; }
  .section { padding: 3rem 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  body::before, .topbar, .themeToggle, .langs { display: none; }
  body { background: #fff; color: #000; }
}
