/* kyomufs.github.io — Material 3 Expressive.
   Компоненты — @m3e/web (<m3e-theme> даёт токены --md-sys-*), здесь только
   раскладка страницы, типографика и композиция. */

/* ---------- shape ---------- */
:root {
  --md-sys-shape-none: 0px;
  --md-sys-shape-xs: 4px;
  --md-sys-shape-sm: 8px;
  --md-sys-shape-md: 12px;
  --md-sys-shape-lg: 16px;
  --md-sys-shape-lg-increased: 20px;
  --md-sys-shape-xl: 28px;
  --md-sys-shape-xl-increased: 32px;
  --md-sys-shape-xxl: 48px;
  --md-sys-shape-full: 999px;
}

/* ---------- motion ----------
   Fallback — санкционированная конверсия пружин в cubic-bezier; ниже, если браузер
   умеет linear(), подставляются настоящие step response пружины. */
:root {
  --dur-fast-spatial: 350ms;
  --dur-default-spatial: 500ms;
  --dur-slow-spatial: 700ms;
  --dur-fast-effects: 150ms;
  --dur-default-effects: 200ms;
  --dur-slow-effects: 300ms;

  --ease-fast-spatial: cubic-bezier(0.42, 1.67, 0.21, 0.9);
  --ease-default-spatial: cubic-bezier(0.38, 1.21, 0.22, 1);
  --ease-slow-spatial: cubic-bezier(0.39, 1.29, 0.35, 0.98);
  --ease-fast-effects: cubic-bezier(0.31, 0.94, 0.34, 1);
  --ease-default-effects: cubic-bezier(0.34, 0.8, 0.34, 1);
  --ease-slow-effects: cubic-bezier(0.34, 0.88, 0.34, 1);
}

@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --ease-fast-spatial: linear(0, 0.0079 1.3%, 0.0298 2.6%, 0.0665 4%, 0.1178 5.5%, 0.1742 6.9%, 0.2412 8.4%, 0.5471 14.7%, 0.6871 17.8%, 0.7523 19.4%, 0.8119 21%, 0.8655 22.6%, 0.9129 24.2%, 0.9564 25.9%, 0.995 27.7%, 1.0264 29.5%, 1.0521 31.4%, 1.071 33.3%, 1.0843 35.3%, 1.0922 37.4%, 1.0948 39.7%, 1.0919 42.3%, 1.0835 45.2%, 1.0299 57.4%, 1.0082 63.9%, 0.9951 71%, 0.991 79.3%, 1 100%);
    --ease-default-spatial: linear(0, 0.0054 1.1%, 0.0205 2.2%, 0.046 3.4%, 0.0851 4.8%, 0.1248 6%, 0.1762 7.4%, 0.4754 14.8%, 0.551 16.8%, 0.6176 18.7%, 0.6874 20.9%, 0.7492 23.1%, 0.8027 25.3%, 0.8502 27.6%, 0.8928 30.1%, 0.928 32.7%, 0.9571 35.5%, 0.9792 38.4%, 0.9953 41.5%, 1.0066 45%, 1.0131 49%, 1.0152 53.7%, 1.0029 79.4%, 0.9999 99.9%, 1 100%);
    --ease-slow-spatial: linear(0, 0.0056 1.1%, 0.0211 2.2%, 0.0473 3.4%, 0.0843 4.7%, 0.1245 5.9%, 0.1767 7.3%, 0.4725 14.5%, 0.5495 16.5%, 0.6172 18.4%, 0.6881 20.6%, 0.7507 22.8%, 0.8047 25%, 0.8507 27.2%, 0.8938 29.7%, 0.9293 32.3%, 0.9576 35%, 0.9797 37.9%, 0.9959 41%, 1.0069 44.4%, 1.0132 48.3%, 1.0152 52.9%, 1.0027 78.6%, 0.9998 99.9%, 1 100%);
    --ease-fast-effects: linear(0, 0.0048 1.1%, 0.0197 2.3%, 0.0445 3.6%, 0.0817 5.1%, 0.16 7.7%, 0.3647 13.8%, 0.4629 16.9%, 0.557 20.2%, 0.6365 23.4%, 0.7062 26.7%, 0.7661 30.1%, 0.8175 33.7%, 0.8606 37.5%, 0.8988 41.9%, 0.9297 46.8%, 0.9537 52.3%, 0.9713 58.5%, 0.9833 65.4%, 0.9914 73.7%, 1 100%);
    --ease-default-effects: linear(0, 0.005 1.3%, 0.0202 2.7%, 0.0453 4.2%, 0.0818 5.9%, 0.1628 9%, 0.3604 15.8%, 0.4542 19.2%, 0.5443 22.8%, 0.6214 26.3%, 0.6881 29.8%, 0.7447 33.3%, 0.7948 37%, 0.837 40.8%, 0.8782 45.5%, 0.9113 50.5%, 0.9379 56%, 0.9588 62.2%, 0.9733 68.7%, 0.9841 76.3%, 0.9922 86.6%, 0.997 99.9%, 1 100%);
    --ease-slow-effects: linear(0, 0.0048 1.2%, 0.0196 2.5%, 0.0461 4%, 0.0828 5.6%, 0.1603 8.4%, 0.3635 15%, 0.4569 18.2%, 0.5493 21.7%, 0.628 25.1%, 0.6955 28.5%, 0.7541 32%, 0.8039 35.6%, 0.8466 39.4%, 0.8868 44%, 0.9193 49%, 0.9448 54.5%, 0.9644 60.7%, 0.9781 67.5%, 0.9877 75.4%, 1 100%);
  }
}

:root {
  --motion-fast-spatial: var(--dur-fast-spatial) var(--ease-fast-spatial);
  --motion-default-spatial: var(--dur-default-spatial) var(--ease-default-spatial);
  --motion-slow-spatial: var(--dur-slow-spatial) var(--ease-slow-spatial);
  --motion-fast-effects: var(--dur-fast-effects) var(--ease-fast-effects);
  --motion-default-effects: var(--dur-default-effects) var(--ease-default-effects);
  --motion-slow-effects: var(--dur-slow-effects) var(--ease-slow-effects);
}

/* ---------- typescale (rem = sp / 16) ---------- */
:root {
  --ts-display-large-size: 3.5625rem;
  --ts-display-large-line: 4rem;

  --ts-display-medium-size: 2.8125rem;
  --ts-display-medium-line: 3.25rem;

  --ts-display-small-size: 2.25rem;
  --ts-display-small-line: 2.75rem;

  --ts-headline-large-size: 2rem;
  --ts-headline-large-line: 2.5rem;

  --ts-headline-small-size: 1.5rem;
  --ts-headline-small-line: 2rem;
  --ts-headline-small-track: 0rem;

  --ts-title-medium-size: 1rem;
  --ts-title-medium-line: 1.5rem;
  --ts-title-medium-track: 0.009375rem;

  --ts-body-large-size: 1rem;
  --ts-body-large-line: 1.5rem;
  --ts-body-large-track: 0.03125rem;

  --ts-body-medium-size: 0.875rem;
  --ts-body-medium-line: 1.25rem;
  --ts-body-medium-track: 0.015625rem;

  --ts-label-large-size: 0.875rem;
  --ts-label-large-line: 1.25rem;
  --ts-label-large-track: 0.00625rem;

  --ts-label-medium-size: 0.75rem;
  --ts-label-medium-line: 1rem;
  --ts-label-medium-track: 0.03125rem;
}

/* ---------- elevation + layout ---------- */
:root {
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --elev-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
  --elev-3: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
  --max: 1120px;
  --gutter: 24px;
  --font: "Roboto Flex", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* подложка до апгрейда <m3e-theme>: неизвестный элемент не красит body */
html[data-theme="dark"] { background: #0d0e12; color-scheme: dark; }
html[data-theme="light"] { background: #faf9fe; color-scheme: light; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
/* плавающий nav перекрывает якорь, если не оставить ему место */
html { scroll-padding-top: 96px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--ts-body-large-size);
  line-height: var(--ts-body-large-line);
  letter-spacing: var(--ts-body-large-track);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* тема задаёт токены и красит поверхность */
m3e-theme {
  display: block;
  min-height: 100dvh;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  transition: background-color var(--motion-default-effects), color var(--motion-default-effects);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
::selection { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
:focus-visible { outline: 3px solid var(--md-sys-color-primary); outline-offset: 2px; border-radius: var(--md-sys-shape-xs); }

/* иконки приходят из Material Symbols; размер задаёт сам m3e-icon */
m3e-icon { --m3e-icon-size: 20px; }

/* ---------- top app bar ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 12px var(--gutter) 0;
}
/* плавающая панель: контейнер surface + CornerFull, тень появляется при скролле */
.nav__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 8px 12px 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--md-sys-shape-full);
  background: var(--md-sys-color-surface-container);
  transition:
    border-color var(--motion-default-effects),
    box-shadow var(--motion-default-effects);
}
.nav.is-stuck .nav__inner {
  border-color: var(--md-sys-color-outline-variant);
  box-shadow: var(--elev-2);
}
.brand { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; text-decoration: none; }
.brand__avatar {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: var(--md-sys-shape-full);
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 1px;
  object-fit: cover;
  transition: transform var(--motion-fast-spatial), outline-color var(--motion-fast-effects);
  will-change: transform;
}
.brand:hover .brand__avatar {
  transform: scale(1.08);
  outline-color: var(--md-sys-color-tertiary);
}
.brand__text {
  font-size: var(--ts-title-medium-size);
  line-height: var(--ts-title-medium-line);
  font-weight: 500;
  letter-spacing: var(--ts-title-medium-track);
}
.nav__links { display: flex; gap: 2px; margin-left: auto; }
.nav__links a {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--md-sys-shape-full);
  font-size: var(--ts-label-large-size);
  line-height: var(--ts-label-large-line);
  font-weight: 500;
  letter-spacing: var(--ts-label-large-track);
  color: var(--md-sys-color-on-surface-variant);
  transition: background-color var(--motion-fast-effects), color var(--motion-fast-effects);
}
.nav__links a:hover {
  color: var(--md-sys-color-on-surface);
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
}
/* selected tab: secondary container; emphasized label bold (M3E label large emph.) */
.nav__links a[aria-current="page"],
.nav__links a[aria-current="page"]:hover {
  color: var(--md-sys-color-on-secondary-container);
  background: var(--md-sys-color-secondary-container);
  font-weight: 700;
}
.nav__controls { display: flex; align-items: center; gap: 6px; margin-left: 8px; }
#langGroup { flex: 0 0 auto; display: inline-flex; }

/* ---------- layout ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
/* секция — тональная плита, а не голая сетка: containment как expressive-тактика */
.section {
  margin-top: 24px;
  padding: 40px;
  border-radius: var(--md-sys-shape-xl-increased);
  background: var(--md-sys-color-surface-container-low);
}
.section:last-of-type { margin-bottom: 48px; }
.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}
.section__title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.section__index {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--md-sys-shape-full);
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-family: var(--mono);
  font-size: var(--ts-label-medium-size);
  font-weight: 500;
  letter-spacing: var(--ts-label-medium-track);
}
.section__head h2 {
  font-size: var(--ts-headline-large-size);
  line-height: var(--ts-headline-large-line);
  /* emphasized headline large: тот же размер, вес Medium и трекинг 0 */
  font-weight: 500;
  letter-spacing: 0;
}

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
  padding: 80px 0 32px;
  min-height: calc(100dvh - 64px);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--md-sys-shape-full);
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  font-size: var(--ts-label-large-size);
  line-height: var(--ts-label-large-line);
  font-weight: 500;
  letter-spacing: var(--ts-label-large-track);
  margin-bottom: 20px;
}
.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--md-sys-shape-full);
  background: currentColor;
}
.hero__title {
  display: flex;
  flex-direction: column;
  font-size: var(--ts-display-large-size);
  line-height: var(--ts-display-large-line);
  /* emphasized display large: трекинг нормализуется в 0, вес Medium */
  letter-spacing: 0;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}
.hero__title .hero__last { color: var(--md-sys-color-primary); }
.hero__lead {
  margin-top: 20px;
  max-width: 46ch;
  font-size: var(--ts-body-large-size);
  line-height: var(--ts-body-large-line);
  letter-spacing: var(--ts-body-large-track);
  color: var(--md-sys-color-on-surface-variant);
}
.hero__cta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 32px;
}
/* ---------- Tech Stickers ---------- */
.sticker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--md-sys-shape-md);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  font-size: var(--ts-label-large-size);
  font-weight: 600;
  letter-spacing: var(--ts-label-large-track);
  border: 2px solid var(--md-sys-color-surface);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22), 0 1px 2px rgba(0, 0, 0, 0.12);
  transform: rotate(var(--sticker-rot, 0deg));
  transform-style: preserve-3d;
  will-change: transform, box-shadow;
  cursor: default;
  user-select: none;
  transition:
    transform var(--motion-fast-spatial),
    box-shadow var(--motion-fast-spatial),
    background-color var(--motion-fast-effects);
}
.sticker m3e-icon {
  --m3e-icon-size: 18px;
  color: var(--md-sys-color-primary);
}
.sticker:hover {
  z-index: 10;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
}
.sticker:active {
  transform: scale(0.96) rotate(var(--sticker-rot, 0deg));
}
.sticker--accent {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-color: color-mix(in srgb, var(--md-sys-color-on-primary-container) 25%, transparent);
}
.sticker--accent m3e-icon { color: inherit; }
.sticker--tertiary {
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
  border-color: color-mix(in srgb, var(--md-sys-color-on-tertiary-container) 25%, transparent);
}
.sticker--tertiary m3e-icon { color: inherit; }
.sticker--secondary {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-color: color-mix(in srgb, var(--md-sys-color-on-secondary-container) 25%, transparent);
}
.sticker--secondary m3e-icon { color: inherit; }
.dot { width: 6px; height: 6px; border-radius: var(--md-sys-shape-full); background: var(--md-sys-color-primary); }
/* статус — настоящий бейдж M3, а не пульсирующая точка */
.dot-status {
  --m3e-badge-container-color: var(--md-sys-color-tertiary);
  --m3e-badge-small-size: 8px;
  flex: 0 0 auto;
}

.hero__panel { position: relative; display: flex; flex-direction: column; gap: 12px; }
.hero__panel::before {
  content: "";
  position: absolute;
  inset: -40px -32px -32px -28px;
  z-index: -1;
  border-radius: var(--md-sys-shape-xxl);
  background: var(--md-sys-color-primary-container);
  opacity: 0.4;
}
.terminal { --m3e-card-padding: 0px; overflow: hidden; border-radius: var(--md-sys-shape-xl); }
.terminal__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  background: var(--md-sys-color-surface-container-high);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.terminal__dots {
  display: flex;
  align-items: center;
  gap: 6px;
}
.terminal__dot {
  width: 10px;
  height: 10px;
  border-radius: var(--md-sys-shape-full);
}
.terminal__dot--close { background: #ff5f56; }
.terminal__dot--min { background: #ffbd2e; }
.terminal__dot--max { background: #27c93f; }

.terminal__tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
}
.terminal__tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--md-sys-shape-xs);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color var(--motion-fast-effects), color var(--motion-fast-effects);
}
.terminal__tab:hover {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
  color: var(--md-sys-color-on-surface);
}
.terminal__tab.is-active {
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.terminal__tab m3e-icon { --m3e-icon-size: 14px; }

.terminal__copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--md-sys-shape-xs);
  background: transparent;
  border: none;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
}
.terminal__copy:hover {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
  color: var(--md-sys-color-on-surface);
}
.terminal__copy m3e-icon { --m3e-icon-size: 14px; }

.terminal__body {
  margin: 0;
  padding: 18px 20px 22px;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.75;
  color: var(--md-sys-color-on-surface);
  background: color-mix(in srgb, var(--md-sys-color-surface) 95%, black);
  min-height: 240px;
  white-space: pre-wrap;
  word-break: break-word;
}
.terminal__pane { display: none; }
.terminal__pane.is-active { display: block; }

.terminal__prompt-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.term-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--mono);
  font-size: 0.84rem;
  color: var(--md-sys-color-on-surface);
  caret-color: var(--md-sys-color-primary);
  padding: 0;
}
.term-input::placeholder {
  color: var(--md-sys-color-on-surface-variant);
  opacity: 0.55;
  font-style: italic;
}
.term-output {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--md-sys-color-on-surface-variant);
}
.term-output:not(:empty) {
  padding: 8px 12px;
  border-radius: var(--md-sys-shape-xs);
  background: color-mix(in srgb, var(--md-sys-color-surface) 80%, black);
  border-left: 3px solid var(--md-sys-color-primary);
}
#matrixCanvas {
  display: block;
  width: 100%;
  height: 230px;
  border-radius: var(--md-sys-shape-sm);
  background: #000;
}

.t-prompt { color: var(--md-sys-color-primary); font-weight: 700; }
.t-cmd { color: var(--md-sys-color-on-surface); font-weight: 600; }
.t-out { color: var(--md-sys-color-on-surface-variant); }
.t-key { color: var(--md-sys-color-primary); font-weight: 600; }
.t-val { color: var(--md-sys-color-on-surface); }
.t-accent { color: var(--md-sys-color-tertiary); }
.t-kw { color: #bb9af7; font-weight: 600; }
.t-str { color: #9ece6a; }
.t-fn { color: #7aa2f7; }
.t-comment { color: #565f89; font-style: italic; }
.t-cursor { color: var(--md-sys-color-primary); animation: blink 1.15s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.terminal__palette {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px;
}
.t-pill {
  width: 12px;
  height: 12px;
  border-radius: var(--md-sys-shape-full);
}

.avatar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -28px 16px 0;
  padding: 12px 16px;
  border-radius: var(--md-sys-shape-lg);
  background: var(--md-sys-color-surface-container-high);
  box-shadow: var(--elev-2);
}
.avatar img { width: 40px; height: 40px; border-radius: var(--md-sys-shape-full); outline: 2px solid var(--md-sys-color-primary); outline-offset: 2px; }
.avatar__name {
  font-size: var(--ts-title-medium-size);
  line-height: var(--ts-title-medium-line);
  font-weight: 500;
  letter-spacing: var(--ts-title-medium-track);
}
.avatar__role {
  font-size: var(--ts-label-medium-size);
  line-height: var(--ts-label-medium-line);
  letter-spacing: var(--ts-label-medium-track);
  color: var(--md-sys-color-on-surface-variant);
}

/* ---------- about ---------- */
.about { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }
.about__text p {
  font-size: var(--ts-body-large-size);
  line-height: var(--ts-body-large-line);
  letter-spacing: var(--ts-body-large-track);
  color: var(--md-sys-color-on-surface-variant);
}
.about__text p + p { margin-top: 16px; }
.about__card {
  --m3e-card-padding: 24px;
  --m3e-card-container-color: var(--md-sys-color-secondary-container);
  --m3e-card-text-color: var(--md-sys-color-on-secondary-container);
  --m3e-card-shape: var(--md-sys-shape-xl);
}
.about__card-label {
  display: inline-block;
  padding: 2px 8px;
  margin-bottom: 8px;
  border-radius: var(--md-sys-shape-xs);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-primary);
  font-size: var(--ts-label-medium-size);
  line-height: var(--ts-label-medium-line);
  font-weight: 500;
  letter-spacing: var(--ts-label-medium-track);
}
.about__card-title {
  font-size: var(--ts-title-medium-size);
  line-height: var(--ts-title-medium-line);
  font-weight: 500;
  letter-spacing: var(--ts-title-medium-track);
}
.about__card-sub {
  font-size: var(--ts-body-medium-size);
  line-height: var(--ts-body-medium-line);
  letter-spacing: var(--ts-body-medium-track);
  opacity: 0.82;
}
.about__card-year {
  margin-top: 12px;
  font-size: var(--ts-label-medium-size);
  line-height: var(--ts-label-medium-line);
  letter-spacing: var(--ts-label-medium-track);
  opacity: 0.82;
}

/* ---------- skills ---------- */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(248px, 100%), 1fr)); gap: 12px; }
.skills-graph-wrap {
  position: relative;
  width: 100%;
  border-radius: var(--md-sys-shape-xl);
  background: var(--md-sys-color-surface-container);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
  margin-bottom: 8px;
}
#skillsGraph {
  display: block;
  width: 100%;
  height: 520px;
  touch-action: none;
}
.skills-graph-hint {
  position: absolute;
  bottom: 14px;
  right: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--md-sys-shape-full);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--ts-label-medium-size);
  font-family: var(--mono);
  box-shadow: var(--elev-1);
  pointer-events: none;
  opacity: 0.85;
}
.skills-graph-hint m3e-icon {
  --m3e-icon-size: 16px;
  color: var(--md-sys-color-primary);
}
.skill {
  --m3e-card-padding: 20px;
  --m3e-card-container-color: var(--md-sys-color-surface-container-highest);
  --m3e-card-shape: var(--md-sys-shape-lg-increased);
}
/* первая группа — акцентная карточка: цвет, а не растяжка, иначе сетка 3x3 рвётся */
.skill--lead {
  --m3e-card-container-color: var(--md-sys-color-primary-container);
  --m3e-card-text-color: var(--md-sys-color-on-primary-container);
}
.skill__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--ts-title-medium-size);
  line-height: var(--ts-title-medium-line);
  font-weight: 500;
  letter-spacing: var(--ts-title-medium-track);
  margin-bottom: 14px;
}
.skill__badge {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--md-sys-shape-sm);
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-primary);
}
.skill--lead .skill__badge {
  background: color-mix(in srgb, var(--md-sys-color-on-primary-container) 12%, transparent);
  color: var(--md-sys-color-on-primary-container);
}
.skill__count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: var(--ts-label-medium-size);
  font-weight: 500;
  opacity: 0.66;
}
.skill__chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* тег, не чип-действие: ассистивные чипы здесь были бы ложным affordance */
.chip {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-sm);
  font-size: var(--ts-label-medium-size);
  line-height: var(--ts-label-medium-line);
  font-weight: 500;
  letter-spacing: var(--ts-label-medium-track);
  color: var(--md-sys-color-on-surface-variant);
  background: transparent;
}
.skill--lead .chip {
  border-color: color-mix(in srgb, var(--md-sys-color-on-primary-container) 45%, transparent);
  color: var(--md-sys-color-on-primary-container);
}

/* ---------- projects (Bento Grid) ---------- */
.projects__filters {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.bento-col-12 { grid-column: span 12; }
.bento-col-8 { grid-column: span 8; }
.bento-col-6 { grid-column: span 6; }
.bento-col-4 { grid-column: span 4; }

@media (max-width: 991px) and (min-width: 680px) {
  .bento-col-8 { grid-column: span 12; }
  .bento-col-4 { grid-column: span 6; }
  .bento-col-6 { grid-column: span 6; }
}
@media (max-width: 679px) {
  .bento-col-8, .bento-col-4, .bento-col-6, .bento-col-12 {
    grid-column: span 12 !important;
  }
}

.project-link { display: block; height: 100%; border-radius: var(--md-sys-shape-xl); }
.project-link:focus-visible { outline-offset: 3px; }
.project {
  --m3e-card-padding: 22px;
  --m3e-card-shape: var(--md-sys-shape-xl);
  height: 100%;
}
.project--flagship {
  --m3e-card-padding: 28px;
  --m3e-card-container-color: var(--md-sys-color-secondary-container);
  --m3e-card-text-color: var(--md-sys-color-on-secondary-container);
}
.project__inner { display: flex; flex-direction: column; gap: 14px; height: 100%; }
.project__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.project__title-group { display: flex; flex-direction: column; gap: 4px; }
.project__name {
  font-size: var(--ts-title-medium-size);
  line-height: var(--ts-title-medium-line);
  font-weight: 600;
  letter-spacing: var(--ts-title-medium-track);
}
.project--flagship .project__name {
  font-size: var(--ts-headline-small-size);
  line-height: var(--ts-headline-small-line);
  letter-spacing: var(--ts-headline-small-track);
}
.project__badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.project-sticker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--md-sys-shape-xs);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--mono);
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transform: rotate(var(--rot, -1deg));
}
.project--flagship .project-sticker {
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-primary);
  border-color: transparent;
}
.project__arrow {
  --m3e-icon-size: 20px;
  color: var(--md-sys-color-on-surface-variant);
  transition: color var(--motion-fast-effects), translate var(--motion-fast-spatial);
}
.project-link:hover .project__arrow {
  color: var(--md-sys-color-primary);
  translate: 2px -2px;
}
.project--flagship .project__arrow { color: inherit; }
.project__desc {
  flex: 1;
  font-size: var(--ts-body-medium-size);
  line-height: var(--ts-body-medium-line);
  letter-spacing: var(--ts-body-medium-track);
  color: var(--md-sys-color-on-surface-variant);
}
.project--flagship .project__desc { color: inherit; opacity: 0.9; max-width: 65ch; }

/* Bento micro-widgets inside cards */
.bento-mockup {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: var(--md-sys-shape-lg);
  background: color-mix(in srgb, var(--md-sys-color-surface) 60%, transparent);
  border: 1px solid var(--md-sys-color-outline-variant);
  margin-top: 4px;
}
.bento-mockup__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.bento-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--md-sys-shape-full);
  font-size: var(--ts-label-medium-size);
  font-weight: 500;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.bento-pill m3e-icon { --m3e-icon-size: 14px; }
.bento-pill--grade {
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
}

.pipeline-flow {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--md-sys-shape-md);
  background: var(--md-sys-color-surface-container);
  font-family: var(--mono);
  font-size: 0.78rem;
  overflow-x: auto;
}
.pipeline-node {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-primary);
}
.pipeline-arrow { opacity: 0.5; }

.probe-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  border-radius: var(--md-sys-shape-md);
  background: var(--md-sys-color-surface-container);
  font-family: var(--mono);
  font-size: 0.75rem;
}
.probe-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.probe-status { color: #4ade80; font-weight: 600; }

.theme-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
}
.theme-dot {
  width: 14px;
  height: 14px;
  border-radius: var(--md-sys-shape-full);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.project__foot {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: auto;
  font-size: var(--ts-label-medium-size);
  line-height: var(--ts-label-medium-line);
  font-weight: 500;
  letter-spacing: var(--ts-label-medium-track);
  color: var(--md-sys-color-on-surface-variant);
}
.project--flagship .project__foot { color: inherit; opacity: 0.85; }
.project__lang { display: inline-flex; align-items: center; gap: 6px; }
.lang-dot { width: 8px; height: 8px; border-radius: var(--md-sys-shape-full); }
.project__stars { display: inline-flex; align-items: center; gap: 6px; }
.project__stars m3e-icon { --m3e-icon-size: 14px; }
.projects__more { margin-top: 24px; display: flex; justify-content: center; }

/* ---------- contact (primary container, hero moment #2) ---------- */
.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 40px;
  border-radius: var(--md-sys-shape-xl);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.contact__text {
  max-width: 34ch;
  font-size: var(--ts-headline-small-size);
  line-height: var(--ts-headline-small-line);
  letter-spacing: var(--ts-headline-small-track);
  font-weight: 500;
}
.contact__links { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- FAB ---------- */
#toTop {
  position: fixed;
  right: max(var(--gutter), env(safe-area-inset-right, 0px));
  bottom: max(24px, env(safe-area-inset-bottom, 0px));
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  translate: 0 16px;
  pointer-events: none;
  transition:
    opacity var(--motion-default-effects),
    visibility 0s linear var(--dur-default-effects),
    translate var(--motion-default-spatial);
}
#toTop.is-shown {
  opacity: 1;
  visibility: visible;
  translate: 0 0;
  pointer-events: auto;
  transition-delay: 0s, 0s, 0s;
}

/* ---------- footer ---------- */
.footer {
  max-width: var(--max);
  margin: 72px auto 0;
  padding: 24px var(--gutter) 40px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  font-size: var(--ts-label-medium-size);
  line-height: var(--ts-label-medium-line);
  letter-spacing: var(--ts-label-medium-track);
  color: var(--md-sys-color-on-surface-variant);
}
.footer__sig { font-family: var(--mono); }

/* ---------- reveal: geometry on spatial, opacity on effects ---------- */
.js .reveal {
  opacity: 0;
  translate: 0 24px;
  transition:
    opacity var(--motion-default-effects),
    translate var(--motion-default-spatial);
}
.js .reveal.is-visible { opacity: 1; translate: 0 0; }

/* Hero entrance. Stagger is a design decision, not an M3 token. */
@media (prefers-reduced-motion: no-preference) {
  .js .hero__copy > *,
  .js .hero__panel > * {
    opacity: 0;
    translate: 0 18px;
    animation: rise var(--dur-default-spatial) var(--ease-default-spatial) both;
  }
  .js .hero__copy > :nth-child(1) { animation-delay: 0ms; }
  .js .hero__copy > :nth-child(2) { animation-delay: 60ms; }
  .js .hero__copy > :nth-child(3) { animation-delay: 120ms; }
  .js .hero__copy > :nth-child(4) { animation-delay: 180ms; }
  .js .hero__copy > :nth-child(5) { animation-delay: 240ms; }
  .js .hero__panel > :nth-child(1) { animation-delay: 140ms; }
  .js .hero__panel > :nth-child(2) { animation-delay: 220ms; }
}
@keyframes rise {
  to { opacity: 1; translate: 0 0; }
}

/* ---------- responsive ---------- */
@media (max-width: 839px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding-top: 48px; min-height: 0; }
  .hero__title { font-size: var(--ts-display-medium-size); line-height: var(--ts-display-medium-line); }
  .about { grid-template-columns: 1fr; }
  .brand__text { display: none; }
  .nav__links { gap: 0; }
  .nav__links a { padding: 0 10px; }
  .section { padding: 28px; }
  /* декор вылезает за gutter на узких экранах — там он только мешает */
  .hero__panel::before { display: none; }
}
@media (max-width: 680px) {
  :root { --gutter: 16px; }
  .section { padding: 20px; border-radius: var(--md-sys-shape-xl); }
  .hero { padding-top: 24px; padding-bottom: 48px; }
  .hero__title { font-size: var(--ts-display-small-size); line-height: var(--ts-display-small-line); }
  .hero__lead { font-size: var(--ts-body-large-size); }
  .contact { padding: 20px; border-radius: var(--md-sys-shape-lg); }
  .footer { margin-top: 48px; padding-bottom: 96px; }

  /* Верхний бар на мобилке: аватар + kyomufs слева, язык + тема справа */
  .nav {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 10px var(--gutter) 0;
  }
  .nav__inner {
    padding: 6px 12px;
    justify-content: space-between;
  }
  .brand__text {
    display: inline-block !important;
    font-size: 0.95rem;
  }

  /* Навигация переносится вниз в удобный плавающий Mobile Bottom Bar под палец */
  .nav__links {
    position: fixed;
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex !important;
    gap: 4px;
    padding: 6px 8px;
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-full);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.2);
    max-width: calc(100vw - 32px);
    overflow-x: auto;
  }
  .nav__links a {
    height: 36px;
    padding: 0 10px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
  }

  /* FAB "наверх" приподнимается над нижней панелью навигации */
  #toTop {
    bottom: max(84px, calc(env(safe-area-inset-bottom, 16px) + 68px));
  }
}

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