/* ---------- Токены ---------- */
:root {
  --bg: #0a1122;
  --surface: #0e1830;
  --card: #0b1428;
  --border: #1b2a47;
  --card-border: #233659;
  --text: #d3dcee;
  --heading: #f2f6ff;
  --muted: #7f8ca8;
  --accent: #5aa9ff;

  --blue: 90, 169, 255;
  --green: 95, 211, 154;
  --purple: 180, 140, 255;
  --orange: 240, 179, 90;
  --red: 255, 95, 87;
  --gray: 211, 220, 238;

  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --inter: 'Inter', system-ui, sans-serif;
  --oswald: 'Oswald', 'Arial Narrow', sans-serif;

  --pad-x: 47px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f6fc;
  --surface: #ffffff;
  --card: #ffffff;
  --border: #d5ddeb;
  --card-border: #cbd6ea;
  --text: #2a3754;
  --heading: #0a1122;
  --muted: #5f6d8a;
  --accent: #2f86ea;
  color-scheme: light;
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* Разделы не прячутся под липкой шапкой при переходе по якорю */
[id] { scroll-margin-top: 73px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .25s, color .25s;
}
h1, h2, h3, p, ul, blockquote, pre { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img { display: block; }
em { font-style: normal; color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* ---------- Шапка ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header__inner {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 23px 12px var(--pad-x);
}

.logo { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.logo__icon { font-weight: 700; font-size: 24px; color: var(--accent); }
.logo__name { font-weight: 500; font-size: 15px; color: var(--text); }
.logo--footer .logo__name { font-size: 14px; }

.nav { display: flex; align-items: flex-end; gap: 38px; }
.nav__item {
  padding: 8px 0;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav__item:hover { color: var(--text); }
.nav__item.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.header__actions { display: flex; align-items: center; gap: 20px; }
.icon-btn {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: transform .2s;
}
.icon-btn:hover { transform: rotate(20deg); }
.btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: 500;
  font-size: 11px;
  color: var(--text);
  transition: border-color .2s;
}
.btn:hover { border-color: var(--accent); }

/* Светлые иконки затемняем в светлой теме */
[data-theme="light"] .btn img,
[data-theme="light"] .socials img,
[data-theme="light"] .to-top img { filter: brightness(.25); }

/* ---------- Hero ---------- */
/* Hero всегда тёмный: композиция фото и свечений нарисована под тёмный фон */
.hero {
  --s: 1;
  --x: 0px;
  --hero-bg: #0a1122;
  position: relative;
  height: calc(518px * var(--s));
  overflow: hidden;
  background: var(--hero-bg);
  color: #d3dcee;
}
.hero em { color: #5aa9ff; }

.hero__art,
.hero__text {
  position: absolute;
  left: 0;
  top: 0;
  width: 1200px;
  height: 518px;
  transform-origin: 0 0;
  transform: translateX(var(--x)) scale(var(--s));
}
.hero__art { overflow: hidden; isolation: isolate; background: var(--hero-bg); }
.hero__art > * { position: absolute; }

.hero__bigword {
  left: 67px;
  top: -31px;
  font-family: 'Anton', sans-serif;
  font-size: 300px;
  line-height: normal;
  white-space: nowrap;
  background: linear-gradient(to bottom,
    rgba(90,169,255,.6) 14.423%,
    rgba(35,65,104,.6) 46.635%,
    rgba(10,17,34,.6) 78.365%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: blur(2px);
}
.glow img { position: absolute; width: auto; height: auto; max-width: none; }
.hero__fade {
  left: 146px;
  top: 375px;
  width: 874px;
  height: 289px;
  background: var(--hero-bg);
  filter: blur(76.3px);
}
.hero__fish {
  left: 771px;
  top: 123px;
  width: 372px;
  height: 358px;
  object-fit: cover;
  mix-blend-mode: multiply;
}
.art { object-fit: cover; }

.code-card {
  left: 112px;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 14px;
  background: rgba(10,23,48,.2);
  border: 1px solid #2b4c7e;
  border-radius: 6px;
}
.code-card pre {
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 20px;
  color: #d3dcee;
}
.c-kw { color: #5aa9ff; }
.c-fn { color: #f2f6ff; }
.c-str { color: #5fd39a; }
.c-cls { color: #e8c468; }

.hero__center-icon {
  left: 569px;
  top: 458px;
  font-weight: 700;
  font-size: 33.874px;
  color: #5aa9ff;
}

/* Текстовый слой */
.person { position: absolute; }
.person--left { left: 32px; top: 198px; }
.person--right { right: 79px; top: 198px; text-align: right; }

.person__hello {
  font-family: 'Caveat', cursive;
  font-size: 36px;
  line-height: normal;
  color: #5aa9ff;
}
.person--left .person__hello { margin-left: 46px; }
.person--right .person__hello { margin-right: -1px; }

.person__name {
  font-family: var(--oswald);
  font-weight: 700;
  font-size: 68px;
  line-height: 1.082;
  text-transform: uppercase;
  color: #f2f6ff;
  white-space: pre;
}
.person--left .person__name { margin-top: -16px; }
.person--right .person__name { margin-top: -15px; white-space: normal; }
.person__bracket { font-family: var(--inter); color: #5aa9ff; }

.person__lead {
  font-size: 15px;
  line-height: 24px;
  white-space: nowrap;
}
.person--left .person__lead { margin: 23px 0 0 46px; }
.person--right .person__lead { margin-top: 20px; }

.person .tags { margin-top: 22px; }
.person--left .tags { margin-left: 46px; }
.person--right .tags { justify-content: flex-end; margin-top: 23px; }

/* ---------- Теги ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 10px; }
.tag {
  --c: var(--blue);
  padding: 5px 12px;
  border: 1px solid rgba(var(--c), .7);
  background: rgba(var(--c), .08);
  border-radius: 100px;
  font-weight: 500;
  font-size: 11px;
  line-height: normal;
  color: rgb(var(--c));
  white-space: nowrap;
}
.tag--blue { --c: var(--blue); }
.tag--green { --c: var(--green); }
.tag--purple { --c: var(--purple); }
.tag--orange { --c: var(--orange); }
.tag--red { --c: var(--red); }
.tag--gray { --c: var(--gray); }
[data-theme="light"] .tag--gray { --c: 95, 109, 138; }
[data-theme="light"] .tag--green { --c: 36, 160, 100; }
[data-theme="light"] .tag--orange { --c: 205, 135, 30; }
.tags--sm { gap: 8px; }
.tags--sm .tag { padding: 4px 10px; font-size: 9.5px; }

/* ---------- Полоса ---------- */
.strip { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.strip__inner {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 90px 0 var(--pad-x);
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.crumbs__line { width: 450px; height: 1px; background: var(--border); }
.whoami { font-size: 10px; line-height: 17px; color: var(--muted); }

/* ---------- О нас ---------- */
.about { border-bottom: 1px solid var(--border); overflow: hidden; }
.about__inner {
  position: relative;
  min-height: 470px;
  display: flex;
  align-items: flex-start;
  padding: 48px var(--pad-x) 43px;
}
.about__inner > :not(.code-window) { position: relative; z-index: 1; }

.code-window {
  position: absolute;
  left: 738.4px;
  top: 87.9px;
  width: 738.305px;
  height: 508.21px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 36px 44px;
  background: rgba(14,24,48,.5);
  border: 2px solid rgba(39,66,110,.5);
  border-radius: 12px;
  filter: blur(2px);
  transform: rotate(12.55deg);
  pointer-events: none;
}
.code-window pre {
  font-family: var(--mono);
  font-size: 21px;
  line-height: 35px;
  color: rgba(211,220,238,.5);
}
.code-window .c-kw { color: rgba(90,169,255,.5); }
.code-window .c-fn { color: rgba(242,246,255,.5); }
.code-window .c-cls { color: rgba(232,196,104,.5); }
[data-theme="light"] .code-window { opacity: .15; }

.section-title {
  font-weight: 700;
  font-size: 28px;
  line-height: normal;
  color: var(--heading);
  white-space: nowrap;
}
.section-title span { color: var(--accent); }

.about__text { width: 469px; flex: none; }
.about__body {
  margin-top: 20px;
  width: 460px;
  max-width: 100%;
  font-size: 12px;
  line-height: 22px;
}
.about__body p + p { margin-top: 22px; }
.about__underline { width: 417px; max-width: 100%; height: 35px; margin-top: 0; }

.about__divider {
  flex: none;
  width: 1px;
  height: 200px;
  margin: 0 32px 0 19px;
  background: var(--border);
}

.about__info {
  width: 280px;
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.info { display: flex; align-items: center; gap: 16px; }
.info > div { display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; line-height: 18px; }
.info__label { color: var(--muted); }
.info__value { color: var(--text); }
a.info__value:hover { color: var(--accent); }

.doodle, .about__arrow, .about__stars { pointer-events: none; }
.about__arrow {
  position: absolute !important;
  left: 474.7px;
  top: 341px;
  width: 235.156px;
  height: 53.127px;
  transform: rotate(-39.84deg);
}
.about__stars { position: absolute !important; left: 1009px; top: 33px; }
/* Белые рукописные элементы в светлой теме делаем тёмными */
[data-theme="light"] .doodle { filter: invert(1) brightness(.35); }

/* ---------- Проекты ---------- */
.projects__inner {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 36px var(--pad-x);
}
.projects__header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.link-more {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--accent);
  font-weight: 700;
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
}
.link-more img { transition: transform .2s; }
.link-more:hover img { transform: translateX(3px); }

.projects__controls { display: flex; align-items: center; gap: 8px; }
.projects__controls .link-more { margin-right: 8px; }
.slider-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  background: var(--card);
  cursor: pointer;
  transition: border-color .2s;
}
.slider-btn:hover { border-color: var(--accent); }
.slider-btn--prev img { transform: scaleX(-1); }

/* Слайдер проектов: видно --per-view карточек, лента сдвигается на одну */
.cards {
  --per-view: 3;
  --gap: 24px;
  overflow: hidden;
  /* запас, чтобы не обрезались подъём карточки и рамка при наведении */
  margin: -4px;
  padding: 4px;
}
.cards__track { display: flex; align-items: flex-start; gap: var(--gap); will-change: transform; }
.card {
  flex: 0 0 calc((100% - (var(--per-view) - 1) * var(--gap)) / var(--per-view));
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }

.thumb {
  position: relative;
  height: 100px;
  overflow: hidden;
  background: #0a1326;
  border: 1px solid #1b2a47;
  border-radius: 4px;
}
.thumb > * { position: absolute; }
.thumb__block { background: #0f1b33; }
.thumb__stat { left: 221px; width: 60px; height: 22px; background: #13223f; border-radius: 3px; }
.thumb__line { height: 3px; }
.thumb__city { left: 117px; top: 25px; font-size: 8px; color: #7f8ca8; }
.thumb__temp { left: 103px; top: 43px; font-weight: 500; font-size: 15px; color: #f2f6ff; }
.thumb--galaxy { background: linear-gradient(110deg, #0a1326 40%, #1a1240); }
.thumb__brand { font-family: var(--mono); font-weight: 700; font-size: 13px; letter-spacing: 2px; color: #f2f6ff; }
.thumb__caption { font-size: 8px; color: #7f8ca8; }
.thumb__pill { height: 12px; border-radius: 6px; }

.card__title {
  font-family: var(--inter);
  font-weight: 500;
  font-size: 15px;
  line-height: normal;
  color: var(--heading);
}
.card__desc { font-size: 11.5px; line-height: 18px; color: var(--muted); }
.card__footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card__open { flex: none; transition: transform .2s; }
/* Вся карточка — ссылка: невидимый слой ссылки «открыть» растянут на карточку */
.card { position: relative; }
.card__open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card__open:hover { transform: translate(2px, -2px); }

/* ---------- Подвал ---------- */
.footer { border-top: 1px solid var(--border); }
.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px var(--pad-x);
}
.quote {
  padding: 2px 0 2px 14px;
  border-left: 1px solid var(--border);
  font-size: 10px;
  line-height: 16px;
  color: var(--muted);
}
.footer__right { display: flex; align-items: center; gap: 40px; }
.socials { display: flex; align-items: center; gap: 28px; }
.socials a { opacity: .9; transition: opacity .2s, transform .2s; }
.socials a:hover { opacity: 1; transform: translateY(-2px); }
.to-top {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--text);
  border-radius: 6px;
  transition: border-color .2s;
}
.to-top:hover { border-color: var(--accent); }

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
  .about__inner { flex-wrap: wrap; row-gap: 32px; }
  .about__arrow, .about__stars { display: none; }
}

@media (max-width: 960px) {
  .nav { display: none; }
  .cards { --per-view: 2; }
  .crumbs__line { width: 120px; }
  .strip__inner { padding-right: var(--pad-x); }
}

@media (max-width: 719px) {
  :root { --pad-x: 16px; }
  .cards { --per-view: 1; --gap: 16px; }
  .projects__controls .link-more { display: none; }
  .header__inner { padding: 12px 16px; }

  /* На телефоне: обрезанная композиция сверху, текст — обычным потоком */
  .hero { height: auto; }
  .hero__art { position: relative; margin-bottom: calc(518px * (var(--s) - 1)); }
  .hero__text {
    position: relative;
    width: auto;
    height: auto;
    transform: none;
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding: 8px 16px 40px;
  }
  .person { position: static; }
  .person--left .person__hello,
  .person--left .person__lead,
  .person--left .tags { margin-left: 0; }
  .person__name { font-size: 52px; }
  .person--left .person__name { white-space: normal; }
  .person__lead { white-space: normal; font-size: 14px; }
  .person__lead br { display: none; }

  .strip__inner { height: auto; padding-top: 14px; padding-bottom: 14px; }
  .crumbs { gap: 10px; }
  .crumbs__line { display: none; }

  .about__inner { flex-direction: column; padding-top: 40px; padding-bottom: 32px; }
  .about__text, .about__info { width: 100%; }
  .about__divider { width: 100%; height: 1px; margin: 0; }
  .code-window { display: none; }

  .projects__header .section-title, .about .section-title { font-size: 24px; }
  .thumb { max-width: 320px; width: 100%; }

  .footer__inner { flex-direction: column; align-items: flex-start; }
  .footer__right { width: 100%; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---------- Окно контактов ---------- */
.btn { cursor: pointer; }

.modal {
  width: min(420px, calc(100% - 32px));
  padding: 16px 24px 24px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.modal::backdrop {
  background: rgba(5, 9, 20, .65);
  backdrop-filter: blur(4px);
}
.modal[open] { animation: modal-in .2s ease-out; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
}
.modal__head { display: flex; align-items: center; justify-content: space-between; }
.modal__close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  transition: color .2s, background-color .2s;
}
.modal__close:hover { color: var(--text); background: var(--border); }
.modal__title { margin-top: 16px; font-size: 24px; }
.modal__text { margin-top: 8px; font-size: 11.5px; line-height: 18px; color: var(--muted); }
.modal__list { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.contact {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  transition: border-color .2s, transform .2s;
}
.contact:hover { border-color: var(--accent); transform: translateY(-1px); }
.contact__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font-size: 11.5px;
  line-height: 18px;
}
.contact__text .info__value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact__arrow { margin-left: auto; flex: none; }

/* ---------- Демо-доступ в карточке ---------- */
.card__footer { align-items: flex-end; }

.demo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 8px 10px;
  border: 1px dashed var(--card-border);
  border-radius: 6px;
  font-size: 10.5px;
  color: var(--muted);
}
.demo__label {
  margin-right: 8px;
  padding: 2px 8px;
  border: 1px solid rgba(var(--green), .7);
  border-radius: 4px;
  font-family: var(--mono);
  color: rgb(var(--green));
}
