/* =========================================================
   Михаил Киселев — сайт-визитка
   Палитра и типографика перенесены из макета Mikhail Kiselev.dc.html
   ========================================================= */

:root {
  --bg:          #F2F0EA;
  --bg-alt:      #EEEBE4;
  --bg-hover:    #F7F6F1;
  --ink:         #14161A;
  --body:        #33373D;
  --muted:       #6B6F76;
  --accent:      #C2410C;

  --line:        rgba(20, 22, 26, 0.12);
  --line-strong: rgba(20, 22, 26, 0.18);

  --dark:        #14161A;
  --dark-hover:  #1A1D22;
  --on-dark:     #F2F0EA;
  --on-dark-70:  rgba(242, 240, 234, 0.72);
  --on-dark-50:  rgba(242, 240, 234, 0.5);
  --on-dark-45:  rgba(242, 240, 234, 0.45);
  --line-dark:   rgba(242, 240, 234, 0.16);

  --sans: Archivo, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --shell:    1240px;
  --pad:      24px;
  --header-h: 57px;
  --section-y: 72px;
}

/* ---------- base ---------- */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* clip, а не hidden: hidden на html/body делает элемент контейнером прокрутки
     и ломает переход к якорям и position: sticky */
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

body.is-locked { overflow: hidden; }

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

img, canvas { display: block; max-width: 100%; }

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

::selection { background: var(--accent); color: #fff; }

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

@keyframes blink { 0%, 49% { opacity: 1 } 50%, 100% { opacity: 0 } }
@keyframes rise  { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: none } }

/* ---------- языковой переключатель ---------- */

html[data-lang="ru"] [data-en] { display: none !important; }
html[data-lang="en"] [data-ru] { display: none !important; }

/* ---------- служебное ---------- */

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  border-radius: 4px;
  transform: translateY(-160%);
  transition: transform 0.18s ease;
}
.skip-link:focus-visible { transform: none; }

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding-inline: var(--pad);
}

/* ---------- шапка ---------- */

.header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  padding: 14px clamp(16px, 4vw, 28px);
  background: rgba(242, 240, 234, 0.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand__name { font-weight: 500; }
.brand__role { color: var(--muted); }

.nav {
  display: flex;
  align-items: center;
  gap: 12px 22px;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav__link {
  color: var(--muted);
  transition: color 0.15s ease;
}
.nav__link:hover { color: var(--ink); }
.nav__link[aria-current="true"] {
  color: var(--ink);
  box-shadow: inset 0 -1px 0 var(--accent);
}

.header__tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid rgba(20, 22, 26, 0.2);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.lang-toggle:hover { color: var(--accent); border-color: var(--accent); }
.lang-toggle__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* бургер — только на узких экранах */
.burger { display: none; }

.burger__box {
  position: relative;
  display: block;
  width: 20px;
  height: 12px;
}
.burger__bar,
.burger__bar::before,
.burger__bar::after {
  position: absolute;
  left: 0;
  width: 20px;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.22s ease, opacity 0.15s ease;
}
.burger__bar { top: 5px; }
.burger__bar::before { content: ""; top: -5px; }
.burger__bar::after  { content: ""; top: 5px; }

.burger[aria-expanded="true"] .burger__bar { background: transparent; }
.burger[aria-expanded="true"] .burger__bar::before { transform: translateY(5px) rotate(45deg); }
.burger[aria-expanded="true"] .burger__bar::after  { transform: translateY(-5px) rotate(-45deg); }

/* ---------- секции ---------- */

.section {
  border-top: 1px solid var(--line);
  padding-block: var(--section-y);
  scroll-margin-top: var(--header-h);
}
.section--alt  { background: var(--bg-alt); }
.section--dark { background: var(--dark); color: var(--on-dark); }
.section--contact { padding-bottom: 96px; }

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
}
.section__note {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow__num { color: var(--accent); }
.section--dark .eyebrow { color: var(--on-dark-50); }

.h2 {
  margin: 20px 0 0;
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.prose {
  margin: 0;
  font-size: clamp(16px, 1.4vw, 18px);
  line-height: 1.6;
  color: var(--body);
}

.inline-link {
  border-bottom: 1px solid rgba(20, 22, 26, 0.3);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.inline-link:hover { color: var(--accent); border-color: var(--accent); }

.ulink {
  border-bottom: 1px solid rgba(20, 22, 26, 0.25);
  padding-bottom: 3px;
  transition: color 0.15s ease, border-color 0.15s ease;
  word-break: break-word;
}
.ulink:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.85;
}

.hero__inner {
  position: relative;
  padding-block: clamp(76px, 13vw, 120px) clamp(84px, 15vw, 136px);
  pointer-events: none;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.status__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 2.4s infinite;
}

.hero__title {
  margin: 20px 0 0;
  font-size: clamp(50px, 10.5vw, 158px);
  line-height: 0.86;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.hero__lede {
  margin: clamp(24px, 3vw, 34px) 0 0;
  max-width: 30ch;
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.4;
  color: var(--body);
}

.hero__links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  margin-top: clamp(44px, 7vw, 72px);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  pointer-events: auto;
}

/* ---------- о себе ---------- */

.about {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 48px;
}
.about__title { max-width: 22ch; }
.about__body {
  display: grid;
  gap: 26px;
  align-content: start;
}

.facts {
  display: grid;
  gap: 1px;
  margin-top: 6px;
  background: var(--line);
  border: 1px solid var(--line);
}
.facts__row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  background: var(--bg-alt);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
}
.facts__key { color: var(--muted); flex: none; }
.facts__val { text-align: right; }

/* ---------- стек ---------- */

.grid {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.grid--stack {
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  margin-top: 34px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px 22px 26px;
  background: var(--bg);
  transition: background 0.15s ease;
}
.card:hover { background: var(--bg-hover); }

.card__eyebrow {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.card__num { color: var(--accent); }

.card__note {
  margin: auto 0 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.tag {
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.2;
}
.tags--dark { gap: 6px; margin-top: auto; }
.tags--dark .tag {
  padding: 4px 9px;
  border-color: rgba(242, 240, 234, 0.22);
  font-size: 11.5px;
  color: rgba(242, 240, 234, 0.8);
}

/* ---------- open source ---------- */

.oss__head {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 32px 56px;
  align-items: end;
}
.oss__title { max-width: 20ch; }

.oss__lede {
  margin: 0;
  max-width: 48ch;
  font-size: clamp(16px, 1.4vw, 17px);
  line-height: 1.6;
  color: var(--on-dark-70);
}
.oss__lede b { color: var(--on-dark); font-weight: 600; }

.oss__motto {
  margin: 16px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--on-dark-45);
}

.grid--oss {
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  margin-top: 44px;
  background: var(--line-dark);
  border-color: var(--line-dark);
}

.repo {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px 24px 24px;
  background: var(--dark);
  color: var(--on-dark);
  transition: background 0.15s ease;
}
.repo:hover { background: var(--dark-hover); }
.repo:hover .repo__arrow { color: var(--accent); transform: translate(2px, -2px); }

.repo__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}
.repo__name {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.repo__arrow {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--on-dark-45);
  transition: color 0.15s ease, transform 0.15s ease;
}
.repo__desc {
  display: block;
  font-size: 15px;
  line-height: 1.55;
  color: var(--on-dark-70);
}
.repo__meta {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--on-dark-45);
}

.repo--profile { justify-content: space-between; gap: 16px; }
.repo__head--profile {
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--on-dark-50);
}
.repo__handle {
  display: block;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.repo__meta--profile { margin-top: 10px; font-size: 12px; color: rgba(242, 240, 234, 0.6); }

/* ---------- контакты ---------- */

.contact__title {
  font-size: clamp(30px, 4.6vw, 60px);
  line-height: 1;
  letter-spacing: -0.035em;
  max-width: 24ch;
}

.contacts {
  display: grid;
  gap: 1px;
  margin-top: 40px;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.contacts__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 4px;
  background: var(--bg);
  transition: background 0.15s ease, padding-left 0.15s ease;
}
.contacts__row:hover { background: var(--bg-alt); padding-left: 14px; }
.contacts__row:hover .contacts__arrow { color: var(--accent); }

.contacts__key {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.contacts__val {
  font-size: clamp(17px, 2.4vw, 28px);
  font-weight: 500;
  letter-spacing: -0.02em;
  word-break: break-word;
}
.contacts__arrow {
  flex: none;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
  transition: color 0.15s ease;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 16px;
  margin-top: 36px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* ---------- появление блоков ---------- */

.js .reveal { opacity: 0; }
.js .reveal.is-visible { animation: rise 0.55s ease both; }

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

/* планшет */
@media (max-width: 900px) {
  :root { --section-y: 60px; }
  .about { gap: 36px; }
  .oss__head { gap: 28px 40px; }
  .grid--oss { margin-top: 32px; }
}

/* мобильное меню */
@media (max-width: 780px) {
  /* шапка выше из-за кнопки меню — значение на случай, если JS не отработал */
  :root { --header-h: 69px; }

  .burger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-right: -8px;
  }

  .nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    z-index: 39;
    display: grid;
    gap: 0;
    margin: 0;
    padding: 8px clamp(16px, 4vw, 28px) 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    box-shadow: 0 18px 40px -28px rgba(20, 22, 26, 0.6);

    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  }
  .nav.is-open {
    visibility: visible;
    opacity: 1;
    transform: none;
  }

  .nav__link {
    padding: 15px 2px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
  }
  .nav__link:last-child { border-bottom: none; }
  .nav__link[aria-current="true"] {
    box-shadow: none;
    color: var(--accent);
  }
}

/* телефон */
@media (max-width: 640px) {
  :root { --pad: 20px; --section-y: 52px; }

  .section--contact { padding-bottom: 68px; }

  .hero__lede { max-width: 24ch; }
  .hero__links { gap: 14px 22px; font-size: 11.5px; }

  .facts__row {
    flex-direction: column;
    gap: 5px;
    padding: 13px 14px;
  }
  .facts__val { text-align: left; }

  .card { padding: 22px 18px 24px; }
  .repo { padding: 22px 18px 22px; }

  .contacts__row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: 8px 12px;
    padding: 18px 4px;
  }
  .contacts__key { grid-column: 1; }
  .contacts__arrow { grid-column: 2; grid-row: 1; }
  .contacts__val { grid-column: 1 / -1; }
  .contacts__row:hover { padding-left: 4px; }

  .footer { margin-top: 28px; }
}

/* узкие телефоны */
@media (max-width: 380px) {
  .brand__role { display: none; }
  .hero__title { font-size: 46px; }
  .repo__name { font-size: 19px; }
}

/* ---------- ввод и предпочтения пользователя ---------- */

/* на тач-устройствах hover-состояния не залипают */
@media (hover: none) {
  .card:hover { background: var(--bg); }
  .repo:hover { background: var(--dark); }
  .contacts__row:hover { background: var(--bg); padding-left: 4px; }
  .nav__link:hover { color: var(--muted); }
}

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

@media print {
  .header, .hero__canvas, .skip-link { display: none !important; }
  body { background: #fff; }
  .section--dark { background: #fff; color: #14161A; }
  .section--dark .repo { background: #fff; color: #14161A; border: 1px solid #ddd; }
  .repo__desc, .repo__meta, .oss__lede { color: #33373D; }
  .hero__inner { padding-block: 24px; }
  a { color: #14161A; }
}
