/* ==========================================================================
   Oleg Belsky — resume
   Один столбец чтения, разделы в выдвижной панели справа. Тема тёмная.
   ========================================================================== */

:root {
  --bg:        #121214;
  --surface:   #18181b;
  --text:      #e4e4e7;
  --muted:     #a1a1aa;
  --faint:     #71717a;
  --accent:    #d1e8b5;
  --border:    #27272a;
  --border-2:  #3f3f46;
  --border-hi: #52525b;

  --f-sans: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, monospace;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ----------------------------------------------------------------- база */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}

a { color: inherit; }
ul { list-style: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }

section[id] { scroll-margin-top: 84px; }

.page { max-width: 1040px; margin: 0 auto; padding-inline: 56px; }
main.page { position: relative; z-index: 1; }

/* дымка: медленный крупный шум за содержимым */
#fog {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.skip { position: absolute; left: -9999px; top: 0; z-index: 99; background: var(--surface); padding: 12px 18px; border: 1px solid var(--border-2); }
.skip:focus { left: 12px; top: 12px; }

/* -------------------------------------------------------- верхняя строка */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar .page { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; }

/* монограмма: та же плашка, что во вкладке браузера */
.mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-hi);
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.mark::after {
  content: '';
  position: absolute;
  top: 5px; right: 5px;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--accent);
}
.mark:hover { border-color: var(--accent); color: var(--accent); }

.topbar-right { display: flex; align-items: center; gap: 22px; }

.lang { display: flex; align-items: center; gap: 10px; }
.lang button {
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--muted);
  transition: color 0.25s var(--ease);
}
.lang button:hover { color: var(--text); }
.lang button[aria-pressed="true"] { color: var(--accent); }
.lang i { width: 1px; height: 13px; background: var(--border-hi); display: block; }

.menu-btn {
  display: flex;
  align-items: center;
  padding: 10px 0 10px 10px;
  color: var(--muted);
}
.menu-btn u { display: block; width: 22px; text-decoration: none; }
.menu-btn u b { display: block; height: 2px; background: currentColor; transition: background-color 0.25s var(--ease); }
.menu-btn u b + b { margin-top: 6px; }
.menu-btn:hover { color: var(--accent); }

/* ------------------------------------------------------------- панель */

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 40;
  width: 330px;
  max-width: 86vw;
  padding: 24px 30px 34px;
  background: var(--surface);
  border-left: 1px solid var(--border-2);
  overflow-y: auto;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.32s var(--ease), visibility 0.32s;
}
.drawer.open { transform: none; visibility: visible; }

.drawer h4 {
  margin-top: 34px;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}
.drawer nav { margin-top: 10px; }
.drawer nav a {
  display: block;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.25s var(--ease);
}
.drawer nav a:hover { color: var(--text); }
.drawer nav a.on { color: var(--accent); }

.drawer .cnt { margin-top: 12px; font-size: 13.5px; line-height: 2.1; }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.32s var(--ease);
}
.scrim.open { opacity: 1; }

/* ------------------------------------------------------ шапка документа */

.head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 52px;
  align-items: start;
  padding-top: 54px;
}

h1 { font-size: clamp(30px, 3.4vw, 40px); font-weight: 600; letter-spacing: -0.035em; line-height: 1.06; }

.meta { margin-top: 24px; }
.meta div {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  align-items: baseline;
  gap: 14px;
  padding: 5px 0;
}
.meta dt {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
}
.meta dd { font-size: 14.5px; }
.meta dd.hi { color: var(--accent); }

.btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: 28px;
  display: inline-flex;
  padding: 12px 22px;
  border: 1px solid var(--border-2);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease),
              border-color 0.15s linear;
}
/* заливка входит наискось из левого нижнего угла, край рваный;
   коробка нарочно много больше кнопки, чтобы в конце не осталось светлого клина */
.btn::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -120% -50% -320% -50%;
  background: var(--accent);
  transform-origin: 0 0;
  transform: translate(-45%, 140%) rotate(11deg);
  clip-path: polygon(0 13%, 18% 5%, 42% 12%, 65% 3%, 87% 11%, 100% 6%, 100% 100%, 0 100%);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.7, 1);   /* уход быстрый */
}
/* Надпись инвертируется ровно там, где под неё зашла заливка: режим наложения
   difference переворачивает цвет попиксельно, поэтому момент переключения
   подгадывать не нужно. */
.btn span { mix-blend-mode: difference; color: #e4e4e7; font-weight: 700; }
/* рамка не перекрашивается: со светлой рамкой кнопка кажется больше, чем она есть */
.btn:hover::before {
  transform: translate(0, -24%) rotate(11deg);
  transition: transform 0.52s cubic-bezier(0.3, 0.85, 0.25, 1);   /* приход неспешный */
}

.portrait { overflow: hidden; border-radius: 14px; }
.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 16%;
  background: var(--surface);
  filter: saturate(0.85) contrast(1.02);
  transition: opacity 0.7s var(--ease), transform 1.1s var(--ease), filter 1.1s var(--ease);
}
.portrait:hover img { transform: scale(1.04); filter: saturate(1) contrast(1.02); }

/* ----------------------------------------------------------- разделы */

section { padding-top: 33px; }

h2 {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-2);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

h3 { margin-top: 38px; font-size: 17px; font-weight: 500; letter-spacing: -0.01em; }
h3 em { font-style: normal; font-weight: 400; color: var(--accent); }

p { margin-top: 16px; color: var(--muted); }
p b { color: var(--text); font-weight: 500; }

.sub { margin-top: 6px; font-family: var(--f-mono); font-size: 12px; color: var(--faint); }

/* таблица «подпись, содержимое»: одна ось чтения */
/* линейки оставлены только в разделе с опытом: там они отбивают длинные списки */
.kv { width: 100%; border-collapse: collapse; margin-top: 20px; }
.kv td { padding: 9px 0; vertical-align: baseline; }
#work .kv td { padding: 13px 0; border-bottom: 1px solid var(--border); }
#work .kv tr:last-child td { border-bottom: 0; }
.kv td.k {
  width: 210px;
  padding-right: 28px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
  transition: color 0.25s var(--ease);
}
.kv tr:hover td.k { color: var(--text); }

/* каретка: одна метка едет по левому полю за курсором */
.caret {
  position: absolute;
  left: 38px;
  top: 0;
  width: 2px;
  height: 0;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s var(--ease), height 0.28s var(--ease), opacity 0.22s var(--ease);
}
.caret.on { opacity: 1; }
.kv td.v { color: var(--text); }
.kv td.v .note { color: var(--muted); font-size: 14px; }
.kv td.v a { color: var(--muted); }

.kv ul li { position: relative; padding-left: 18px; color: var(--muted); }
.kv ul li + li { margin-top: 8px; }
.kv ul li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.78em;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--border-hi);
}

.chips { font-family: var(--f-mono); font-size: 13px; line-height: 1.95; color: var(--text); }

.plain { margin-top: 16px; }
.plain li { position: relative; padding-left: 18px; color: var(--muted); }
.plain li + li { margin-top: 8px; }
.plain li::before { content: ''; position: absolute; left: 0; top: 0.78em; width: 4px; height: 4px; border-radius: 50%; background: var(--border-hi); }


/* подчёркивание растёт от левого края */
.link, .drawer .cnt a {
  position: relative;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border-2);
  transition: color 0.25s var(--ease);
}
.link::after, .drawer .cnt a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.35s var(--ease);
}
.link:hover, .drawer .cnt a:hover { color: var(--accent); }
.link:hover::after, .drawer .cnt a:hover::after { transform: none; }

footer {
  margin-top: 28px;
  padding: 22px 0 46px;
  text-align: center;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--faint);
}

/* ------------------------------------------- появление шапки при загрузке */
/* Скрытое состояние включается только классом js-anim, который ставит скрипт:
   без JS и при отключённой анимации страница видна сразу.                    */

h1 { transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.meta dt, .meta dd { transition: opacity 0.5s var(--ease); }

.js-anim h1 { opacity: 0; transform: translateY(8px); }
.js-anim .head .btn { opacity: 0; transform: translateY(6px); }
.js-anim .portrait img { opacity: 0; transform: scale(1.025); }
.js-anim .meta dt, .js-anim .meta dd { opacity: 0; }

.head.in h1,
.head.in .btn { opacity: 1; transform: none; }
.head.in .portrait img { opacity: 1; transform: none; }
.head.in .meta dt,
.head.in .meta dd { opacity: 1; }

/* строки таблицы подхватываются по очереди, --i выставляет скрипт */
.head.in .portrait img { transition-delay: 0.12s; }
.head.in .meta dt,
.head.in .meta dd { transition-delay: calc(0.20s + var(--i, 0) * 0.06s); }
.head.in .btn { transition-delay: 0.68s; }

/* Когда появление отыграло, задержки снимаются: иначе они остаются висеть
   на элементах и тормозят отклик на курсор (кнопка гасла на полсекунды позже). */
.head.done h1,
.head.done .btn,
.head.done .portrait img,
.head.done .meta dt,
.head.done .meta dd { transition-delay: 0s; }

/* на печати и при отключённой анимации всё показываем сразу */
@media print {
  .js-anim h1,
  .js-anim .head .btn,
  .js-anim .portrait img,
  .js-anim .meta dt,
  .js-anim .meta dd { opacity: 1 !important; transform: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .js-anim h1,
  .js-anim .head .btn,
  .js-anim .portrait img,
  .js-anim .meta dt,
  .js-anim .meta dd { opacity: 1; transform: none; }
}

/* -------------------------------------------------------- адаптив */

@media (max-width: 900px) {
  .page { padding-inline: 26px; }
  .head { grid-template-columns: 1fr; gap: 32px; padding-top: 34px; }
  .portrait { max-width: 280px; }
  h1 { font-size: 30px; }
  .caret { left: 12px; }
}

/* на тач-экранах каретке негде жить: строки и так занимают всю ширину */
@media (hover: none) {
  .caret { display: none; }
}

@media (max-width: 560px) {
  body { font-size: 15px; }
  .page { padding-inline: 20px; }
  .meta div { grid-template-columns: 118px minmax(0, 1fr); gap: 10px; }
  .kv td.k { width: auto; display: block; padding: 14px 0 0; }
  .kv td.v { display: block; padding-top: 8px; }
  .kv tr { display: block; border-bottom: 1px solid var(--border); }
  .kv tr:last-child { border-bottom: 0; }
  .kv td { border-bottom: 0; padding-bottom: 14px; }
  footer { flex-direction: column; gap: 6px; }
}
