/*
  Стили персонального сайта.
  Тёмная тема, неон (циан/бирюза/зелёный), минимальный фон.
  Подробнее: description.md.
*/

:root {
  --bg: #0a0e14;
  --text: #e6e6e6;
  --muted: #8b949e;
  --accent: #39bae6;
  --accent-dim: #59c2e6;
  --card-bg: rgba(20, 26, 35, 0.8);
  --card-border: rgba(57, 186, 230, 0.3);
  --font-heading: 'Exo 2', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body), system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body.has-custom-cursor {
  cursor: none;
}

body.has-custom-cursor a,
body.has-custom-cursor button {
  cursor: none;
}

/* Фон — слой для параллакса и сетки на всю страницу */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

/* Фоновая сетка: дрейф + «дыхание» прозрачности */
.bg-grid {
  position: absolute;
  inset: -50%;
  background-image:
    linear-gradient(rgba(57, 186, 230, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 186, 230, 0.07) 1px, transparent 1px);
  background-size: 48px 48px;
  animation:
    bg-grid-move 24s linear infinite,
    bg-grid-breathe 8s ease-in-out infinite;
}

@keyframes bg-grid-move {
  0% { transform: translate(0, 0); }
  100% { transform: translate(48px, 48px); }
}

@keyframes bg-grid-breathe {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

/* Пульс в узлах сетки: точки строго в пересечениях линий (0,0 каждого тайла 48×48) */
.bg-grid-nodes {
  position: absolute;
  inset: -50%;
  background-image: radial-gradient(
    circle at 0 0,
    rgba(57, 186, 230, 0.35) 0,
    transparent 3px
  );
  background-size: 48px 48px;
  background-position: 0 0;
  animation:
    bg-grid-move 24s linear infinite,
    bg-grid-nodes-pulse 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes bg-grid-nodes-pulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.7; }
}

/* Случайное мерцание линий: два слоя с разным ритмом (движение как у сетки) */
.bg-grid-flicker {
  position: absolute;
  inset: -50%;
  background-image:
    linear-gradient(rgba(57, 186, 230, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 186, 230, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  animation:
    bg-grid-move 24s linear infinite,
    bg-grid-flicker-blip 5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes bg-grid-flicker-blip {
  0%, 25%, 50%, 75%, 100% { opacity: 0; }
  12% { opacity: 0.5; }
  37% { opacity: 0.35; }
  62% { opacity: 0.45; }
  87% { opacity: 0.3; }
}

@media (prefers-reduced-motion: reduce) {
  .bg-grid {
    animation: none;
    opacity: 0.9;
  }
  .bg-grid-nodes,
  .bg-grid-flicker {
    animation: none;
  }
  .bg-grid-nodes {
    opacity: 0.35;
  }
  .bg-grid-flicker {
    opacity: 0;
  }
}

/* Робот в стиле ВАЛЛИ — убегает при наведении мыши; всегда поверх layout и панели */
.bg-robot-scene {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  width: 120px;
  height: 110px;
  opacity: 0.7;
  z-index: 100;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  overflow: visible;
  transform-origin: bottom left;
  transition: transform 0.35s ease-in-out;
}

body.detail-panel-open .bg-robot-scene {
  transform: scale(0.5);
}

.bg-robot-scene .robot-figure {
  pointer-events: auto;
  cursor: default;
}

.robot-figure {
  flex-shrink: 0;
  width: 95px;
  height: 95px;
  transition: transform 0.35s ease-out;
}

.bg-robot-scene.robot-runaway .robot-figure {
  transition: transform 0.7s ease-in-out;
}

@keyframes robot-scared-shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4px, -2px); }
  40% { transform: translate(4px, 2px); }
  60% { transform: translate(-3px, 1px); }
  80% { transform: translate(3px, -1px); }
}

.bg-robot-scene.robot-runaway .robot-figure {
  transform: translate(var(--robot-run-x, 80px), var(--robot-run-y, 0));
}

.bg-robot-scene.robot-return-bounce .robot-figure {
  animation: robot-land-bounce 0.4s ease-out;
}

@keyframes robot-land-bounce {
  0% { transform: translate(0, 0); }
  45% { transform: translate(0, -8px); }
  100% { transform: translate(0, 0); }
}

.robot-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 6px rgba(57, 186, 230, 0.3));
}

.bg-robot-scene:not(.robot-runaway):not(.robot-scared) .robot-svg {
  animation: robot-glow-pulse 2.8s ease-in-out infinite;
}

@keyframes robot-glow-pulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(57, 186, 230, 0.35)); }
  50% { filter: drop-shadow(0 0 14px rgba(57, 186, 230, 0.55)); }
}

.robot-body-group {
  transform-origin: 50px 85px;
  animation: robot-idle-bounce 2.5s ease-in-out infinite;
}

@keyframes robot-idle-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-2px) rotate(0deg); }
}

.bg-robot-scene.robot-scared .robot-body-group,
.bg-robot-scene.robot-runaway .robot-body-group {
  animation: none;
}

.bg-robot-scene.robot-scared .robot-body-group {
  animation: robot-scared-shake 0.28s ease-in-out;
}

.bg-robot-scene.robot-runaway .robot-body-group {
  transform: none;
}

.wall-e-body {
  fill: rgba(40, 48, 56, 0.98);
  stroke: var(--accent);
  stroke-width: 1.8;
}

.wall-e-arm {
  fill: rgba(35, 42, 52, 0.98);
  stroke: var(--accent);
  stroke-width: 1.2;
}

.wall-e-arm-l {
  transform-origin: 22px 63px;
}

.wall-e-arm-r {
  transform-origin: 78px 63px;
}

.bg-robot-scene:not(.robot-runaway):not(.robot-scared) .wall-e-arm-l {
  animation: robot-arm-sway-l 3s ease-in-out infinite;
}

.bg-robot-scene:not(.robot-runaway):not(.robot-scared) .wall-e-arm-r {
  animation: robot-arm-sway-r 3s ease-in-out infinite;
}

@keyframes robot-arm-sway-l {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

@keyframes robot-arm-sway-r {
  0%, 100% { transform: rotate(4deg); }
  50% { transform: rotate(-4deg); }
}

.bg-robot-scene.robot-scared .wall-e-arm-l {
  animation: arm-flail-l 0.26s ease-out;
}

.bg-robot-scene.robot-scared .wall-e-arm-r {
  animation: arm-flail-r 0.26s ease-out;
}

@keyframes arm-flail-l {
  0% { transform: rotate(0deg); }
  40% { transform: rotate(-25deg); }
  100% { transform: rotate(0deg); }
}

@keyframes arm-flail-r {
  0% { transform: rotate(0deg); }
  40% { transform: rotate(25deg); }
  100% { transform: rotate(0deg); }
}

.wall-e-treads { }

.wall-e-tread {
  fill: rgba(28, 36, 44, 0.98);
  stroke: var(--accent);
  stroke-width: 1.2;
}

.bg-robot-scene:not(.robot-runaway):not(.robot-scared) .wall-e-tread {
  animation: robot-idle-tread 2.2s ease-in-out infinite;
}

@keyframes robot-idle-tread {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}

.bg-robot-scene.robot-runaway .wall-e-tread:first-child {
  animation: tread-roll 0.15s linear infinite;
}

.bg-robot-scene.robot-runaway .wall-e-tread:last-child {
  animation: tread-roll 0.15s linear infinite;
}

@keyframes tread-roll {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(2px); }
}

.wall-e-neck {
  fill: rgba(35, 44, 54, 0.98);
  stroke: var(--accent);
  stroke-width: 1.2;
}

.wall-e-head-group {
  transform-origin: 50px 30px;
}

.bg-robot-scene:not(.robot-runaway):not(.robot-scared) .wall-e-head-group {
  animation: robot-head-sway 4s ease-in-out infinite;
}

@keyframes robot-head-sway {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

.wall-e-head {
  fill: rgba(45, 55, 68, 0.98);
  stroke: var(--accent);
  stroke-width: 1.5;
}

.wall-e-eye {
  fill: rgba(20, 28, 36, 0.98);
  stroke: var(--accent);
  stroke-width: 1.2;
}

.wall-e-pupil {
  fill: var(--accent);
  transition: transform 0.15s ease-out;
}

.bg-robot-scene:not(.robot-runaway):not(.robot-scared):not(.robot-blink) .wall-e-pupil {
  animation: robot-eye-glow 2.4s ease-in-out infinite;
}

@keyframes robot-eye-glow {
  0%, 100% { opacity: 0.88; }
  50% { opacity: 1; }
}

.wall-e-pupil-l {
  transform-origin: 44px 28px;
  transform: translate(var(--pupil-dx, 0), var(--pupil-dy, 0));
}

.wall-e-pupil-r {
  transform-origin: 56px 28px;
  transform: translate(var(--pupil-dx, 0), var(--pupil-dy, 0));
}

.bg-robot-scene.robot-blink .wall-e-pupil {
  animation: robot-blink-once 0.18s ease-out;
}

@keyframes robot-blink-once {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.bg-robot-scene.robot-scared .wall-e-pupil {
  animation: robot-scared-eyes 0.28s ease-out;
}

@keyframes robot-scared-eyes {
  0% { opacity: 1; transform: scale(1); }
  30% { opacity: 0.2; transform: scale(1.2); }
  60% { opacity: 1; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

/* Кастомный курсор — отключён: скрыт, системный курсор всегда виден */
.cursor-custom {
  display: none;
  position: fixed;
  left: -20px;
  top: -20px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 0.08s ease-out, width 0.2s, height 0.2s, border-color 0.2s;
}

.cursor-custom.hover {
  width: 32px;
  height: 32px;
  border-color: var(--accent-dim);
  background: rgba(57, 186, 230, 0.1);
}

.cursor-custom.is-hidden {
  opacity: 0;
  visibility: hidden;
}

/* Layout: основная колонка + панель детали справа; z-index ниже робота */
.site-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 0;
}

.main-col {
  flex: 1 1 auto;
  min-width: 0;
  transition: flex 0.4s ease-in-out;
}

.detail-panel {
  flex: 0 0 0;
  width: 0;
  overflow: hidden;
  background: var(--card-bg);
  border-left: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  transition: flex 0.4s ease-in-out, width 0.4s ease-in-out, border-color 0.2s;
  position: relative;
}

/* При открытой панели: страница не скроллится, layout по высоте экрана */
body.detail-panel-open {
  overflow: hidden;
}

.site-layout.detail-open {
  height: 100vh;
  overflow: hidden;
}

.site-layout.detail-open .main-col {
  flex: 0 0 52%;
  min-height: 0;
  overflow-y: auto;
}

.site-layout.detail-open .detail-panel {
  flex: 0 0 48%;
  width: 48%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.detail-panel-close {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--accent);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.detail-panel-close:hover {
  background: rgba(57, 186, 230, 0.15);
  color: var(--text);
}

.detail-panel-content {
  padding: 2rem 2rem 2rem 1.5rem;
  overflow: auto;
  flex: 1;
}

.detail-panel-content .section-title {
  margin-top: 0;
  padding-right: 3rem;
}

.detail-panel-content #hero .hero-name {
  margin-top: 0;
}

section[data-detail] {
  cursor: pointer;
}

section[data-detail]:hover {
  outline: 1px solid transparent;
}

/* Главная: сетка карточек без скролла, карточки одного размера */
main {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 1rem;
  padding: 1rem;
  max-width: 1920px;
  margin: 0 auto;
  height: 100%;
  min-height: 0;
  align-content: start;
}

.main-col {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body:not(.detail-panel-open) .main-col {
  max-height: 100vh;
  overflow: hidden;
}

main .section-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 160px;
  height: 100%;
}

#hero {
  grid-column: 1 / -1;
}

#education { grid-column: 1; grid-row: 2; }
#experience { grid-column: 2; grid-row: 2; }
#projects { grid-column: 3; grid-row: 2; }

#contacts {
  display: none;
}

.site-footer {
  grid-column: 1 / -1;
  grid-row: 3;
}

/* Контакты — одна линия в самом низу страницы */
#contacts {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem 1.25rem;
  margin-top: auto;
}

.section-contacts-inline {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 1.25rem;
  width: 100%;
  max-width: 720px;
  padding: 0.5rem 0;
  border-top: 1px solid var(--card-border);
  text-align: center;
}

.contacts-label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-right: 0.5rem;
}

.section-contacts-inline .contacts-groups {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 1.25rem;
}

.section-contacts-inline .contacts-group {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.section-contacts-inline .contacts-group-title {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin: 0;
}

.section-contacts-inline .contacts-group-list {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.section-contacts-inline .contacts-group:not(:last-child)::after {
  content: '·';
  margin-left: 1rem;
  color: var(--muted);
  font-weight: bold;
}

.section-contacts-inline .contact-link {
  font-size: 0.875rem;
  padding: 0.3rem 0.6rem;
}

/* На главной видна только карточка (сводка), детали скрыты; контакты внизу — всегда видны */
.main-col .section-body {
  display: none;
}

.main-col .section-body.section-contacts-inline {
  display: flex;
}

.detail-panel-content .section-body {
  display: block;
}

/* Карточка-сводка: кликабельный блок */
.section-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  text-align: center;
  border-radius: 8px;
  padding: 1.25rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.section-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(57, 186, 230, 0.2);
}

.section-card .section-title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.section-card-summary {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.4;
}

.section-card-hero {
  padding: 1.5rem;
  text-align: left;
}

.section-card-hero .hero-inner-summary {
  text-align: left;
}

.section-card-hero .hero-name-row {
  margin-bottom: 0.25rem;
}
.section-card-hero .hero-name-row .hero-name {
  margin: 0;
  font-size: 1.75rem;
}

.section-card-hero .hero-tag,
.section-card-hero .hero-birth,
.section-card-hero .hero-about {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}

.section-card-hint {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--accent);
  opacity: 0.85;
}

/* Строка описания на карточках (Опыт, Образование, Проекты) */
.section-card .section-card-line,
.project-card-line {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.section-card .section-card-line:last-of-type,
.project-card-line:last-child {
  margin-bottom: 0;
}

.project-card-lines {
  margin-top: 0;
}

/* Эффект печати на карточках + пульс для привлечения внимания */
.section-card-typing {
  animation: section-card-typing-pulse 2.5s ease-in-out infinite;
}

.section-card-typing .typing-value {
  color: var(--accent-dim);
}

.section-card-typing .typing-cursor {
  display: inline-block;
  color: var(--accent);
  font-weight: bold;
  opacity: 0;
  margin-left: 1px;
  animation: typing-cursor-blink 0.9s step-end infinite;
}

.section-card-typing .typing-cursor.typing-cursor-visible {
  opacity: 1;
}

@keyframes typing-cursor-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

@keyframes section-card-typing-pulse {
  0%, 100% { opacity: 1; text-shadow: 0 0 0 rgba(57, 186, 230, 0); }
  50% { opacity: 0.92; text-shadow: 0 0 12px rgba(57, 186, 230, 0.4); }
}

@media (prefers-reduced-motion: reduce) {
  .section-card-typing { animation: none; }
}

/* Секции — появление при загрузке */
section {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
  position: relative;
  overflow: hidden;
}

section.in-view {
  opacity: 1;
  transform: translateY(0);
  animation: section-glitch 0.15s ease-out;
}

@keyframes section-glitch {
  0%, 100% { filter: none; }
  50% { filter: brightness(1.02); }
}

section.in-view::after {
  animation: section-scanline 0.7s ease-out forwards;
}

@keyframes section-scanline {
  0% {
    top: 0;
    opacity: 0.8;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}

section::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  pointer-events: none;
  opacity: 0;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--accent);
  margin-bottom: 1.25rem;
  font-weight: 600;
}

/* Hero — вариант A: фото слева, текст справа */
#hero {
  position: relative;
  padding: 3rem 0;
  overflow: hidden;
}

.hero-inner {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1.5rem;
  position: relative;
  z-index: 1;
  text-align: left;
  max-width: 560px;
  margin: 0 auto;
}

.hero-photo-wrap {
  flex-shrink: 0;
}

.hero-photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid var(--card-border);
}

.hero-photo-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(57, 186, 230, 0.12);
  border: 2px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.hero-value {
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.45;
}

.hero-meta {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.4;
}

.hero-meta-sep {
  margin: 0 0.35rem;
  color: var(--accent-dim);
  user-select: none;
}

.hero-languages {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.4;
}

.hero-available {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.4;
}

.hero-status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: rgba(57, 186, 230, 0.15);
  color: var(--accent);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  animation: hero-status-pulse 2s ease-in-out infinite;
}

@keyframes hero-status-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(57, 186, 230, 0.35); }
  50% { opacity: 0.9; box-shadow: 0 0 0 6px rgba(57, 186, 230, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-status { animation: none; }
}

/* Hero — частицы/звёзды, реагирующие на мышь */
.hero-particles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.hero-particles .particle-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.5;
  will-change: transform;
  transition: transform 0.15s ease-out;
}

#hero .hero-name,
#hero .hero-tag,
#hero .hero-birth,
#hero .hero-about {
  position: relative;
  z-index: 1;
}

.hero-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.hero-name-row .hero-name {
  margin: 0;
}

.hero-name {
  font-family: var(--font-heading);
  font-size: 2rem;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.hero-tag {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  color: var(--accent);
  margin: 0 0 1rem;
  min-height: 1.5em;
}

.hero-tag-rotating {
  transition: opacity 0.35s ease;
}

.hero-tag-rotating.fade-out {
  opacity: 0;
}

.hero-tag-cursor {
  margin-left: 2px;
  animation: hero-cursor-blink 1s step-end infinite;
}

@keyframes hero-cursor-blink {
  50% { opacity: 0; }
}

.hero-birth {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.hero-age {
  color: var(--accent-dim);
}

.hero-about {
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.45;
  margin: 0 0 0.5rem;
}

/* Таймлайн для опыта и образования */
.section-with-timeline {
  display: flex;
  gap: 1.5rem;
  position: relative;
}

.timeline {
  flex-shrink: 0;
  width: 24px;
  align-self: stretch;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--card-border);
  transform: translateX(-50%) scaleY(0);
  transform-origin: top;
  transition: transform 0.6s ease-out;
}

.timeline-line.in-view {
  transform: translateX(-50%) scaleY(1);
}

.timeline-dots {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--card-border);
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.35s ease, transform 0.35s ease, background 0.25s ease;
}

.timeline-dot.in-view {
  opacity: 1;
  transform: scale(1);
}

.timeline-cards {
  flex: 1;
  min-width: 0;
}

/* Карточки */
.cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 1.25rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease, padding 0.25s ease;
  position: relative;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(57, 186, 230, 0.15);
  transform: translateY(-2px);
}

/* Опыт и образование — полоска «загрузки» при hover */
.card-experience::after,
.card-education::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  border-radius: 0 2px 0 0;
  transition: width 0.4s ease-out;
}

.card-experience:hover::after,
.card-education:hover::after {
  width: 100%;
}

/* Образование — полоска прогресса «база знаний» (100% загружено) */
.education-progress {
  margin-top: 0.75rem;
  height: 4px;
  background: rgba(57, 186, 230, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

.education-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.6s ease-out;
}

/* Образование — иконка «база знаний» (книга) */
.card-education-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.card-education-icon {
  display: block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z'/%3E%3Cpath d='M8 7h8'/%3E%3Cpath d='M8 11h8'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z'/%3E%3Cpath d='M8 7h8'/%3E%3Cpath d='M8 11h8'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

#education.in-view .education-progress-fill {
  animation: education-progress-fill 0.6s ease-out forwards;
}

.card-education:hover .education-progress-fill {
  width: 100%;
}

@keyframes education-progress-fill {
  to { width: 100%; }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-role,
.card-company,
.card-institution,
.card-name {
  color: var(--text);
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.card-company,
.card-institution,
.card-name {
  font-family: var(--font-heading);
}

.card-company,
.card-institution {
  font-size: 1.125rem;
}

.card-institution-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--accent-dim);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.card-institution-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.card-education-country {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  color: var(--accent);
  background: rgba(57, 186, 230, 0.12);
  border: 1px solid rgba(57, 186, 230, 0.25);
  border-radius: 6px;
}

.card-education-entities {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.card-entity {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  line-height: 1.3;
  border-radius: 6px;
  border: 1px solid rgba(57, 186, 230, 0.22);
  background: rgba(57, 186, 230, 0.10);
  color: var(--accent);
}

.card-entity--institution {
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  background: rgba(57, 186, 230, 0.12);
}

.card-entity--duration {
  color: var(--accent-dim);
  border-color: rgba(57, 186, 230, 0.18);
  background: rgba(57, 186, 230, 0.08);
}

.card-entity--city,
.card-entity--country {
  color: var(--muted);
  border-color: rgba(139, 148, 158, 0.25);
  background: rgba(139, 148, 158, 0.08);
}

.card-company-link {
  color: inherit;
  text-decoration: none;
}
.card-company-link:hover {
  text-decoration: underline;
}

.card-period,
.card-years {
  font-size: 0.875rem;
  color: var(--muted);
}

.card-meta {
  font-size: 0.8125rem;
  color: var(--muted);
}

.card-period-block {
  display: block;
  margin: 0.5rem 0 0;
  padding: 0.4rem 0.65rem;
  background: rgba(57, 186, 230, 0.08);
  border-radius: 6px;
  font-size: 0.8125rem;
  color: var(--muted);
}


.card-description,
.card-degree {
  color: var(--muted);
  font-size: 0.9375rem;
  margin: 0.5rem 0 0;
}

.card-description .card-description-line {
  display: block;
  margin-bottom: 0.35rem;
}

.card-description .card-description-line:last-child {
  margin-bottom: 0;
}

.card-status {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--accent-dim);
  margin-bottom: 0.5rem;
}

.card-tags {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: rgba(57, 186, 230, 0.15);
  color: var(--accent-dim);
  border-radius: 4px;
}

/* Панель проектов: список названий + короткое описание, по клику — детали (аккордеон) */
.project-panel-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.project-panel-item {
  border: 1px solid var(--card-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card-bg);
  opacity: 0;
  transform: translateY(14px);
  animation: project-panel-item-in 0.4s ease-out forwards;
}

@keyframes project-panel-item-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-panel-item {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

.project-panel-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  outline: none;
}

.project-panel-head:hover,
.project-panel-head:focus-visible {
  background: rgba(57, 186, 230, 0.08);
}

.project-panel-item.is-expanded .project-panel-head {
  border-bottom: 1px solid var(--card-border);
}

.project-panel-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
}

.project-panel-short {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.4;
}

.project-panel-body {
  display: none;
  padding: 1rem 1.25rem 1.25rem;
}

.project-panel-item.is-expanded .project-panel-body {
  display: block;
}

.project-detail-inner {
  padding-top: 0.25rem;
}

.project-detail-inner .project-detail-block:first-child,
.project-detail-inner .card-tags + .project-detail-block {
  margin-top: 0;
}

.project-detail-inner .card-period-block {
  margin-bottom: 0.75rem;
}

.project-detail-text-lines .card-description-line {
  display: block;
  margin-bottom: 0.35rem;
}

.project-detail-text-lines .card-description-line:last-child {
  margin-bottom: 0;
}

.project-detail-inner .card-tags {
  margin-bottom: 1rem;
}

/* Детальное описание проекта в панели справа (внутри раскрытого блока) */
.project-detail-card {
  margin-bottom: 2rem;
}

.project-detail-card:last-child {
  margin-bottom: 0;
}

.project-detail-name {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  color: var(--accent);
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--card-border);
}

.project-detail-block {
  margin-top: 1rem;
}

.project-detail-heading {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--accent-dim);
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.project-detail-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.55;
}

.project-detail-list li {
  margin-bottom: 0.35rem;
}

.project-detail-text {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  white-space: pre-line;
  line-height: 1.55;
}

.card-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.25s ease, box-shadow 0.25s ease;
}

.card-link:hover {
  text-decoration: underline;
  opacity: 1;
}

/* Проекты — развёртывание при hover, «дыхание» сетки */
.card-project {
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease, padding 0.25s ease;
}

.card-project:hover {
  padding: 1.5rem;
}

.card-project:hover .card-link {
  opacity: 1;
  box-shadow: 0 0 12px rgba(57, 186, 230, 0.2);
}

#projects.in-view .cards {
  animation: projects-breathe 5s ease-in-out infinite;
}

@keyframes projects-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.97; }
}

/* Контакты */
.contacts-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.contact-link {
  position: relative;
  color: var(--accent);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  overflow: hidden;
}

.contact-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-dim));
  transition: width 0.35s ease-out;
}

.contact-link:hover::after {
  width: 100%;
}

.contact-link:hover {
  background: rgba(57, 186, 230, 0.1);
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(57, 186, 230, 0.2);
  transform: scale(1.03);
}

/* Кнопка «Связаться со мной» справа и popup со способами связи */
.contact-fab-wrap {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 50;
  pointer-events: none;
}

.contact-fab-wrap > * {
  pointer-events: auto;
}

.contact-fab {
  display: block;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.contact-fab:hover {
  background: rgba(57, 186, 230, 0.12);
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(57, 186, 230, 0.25);
}

.contact-popup {
  position: absolute;
  right: 0;
  bottom: 100%;
  margin-bottom: 0.5rem;
  min-width: 220px;
  padding: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.contact-popup[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.contact-popup-inner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-popup-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.contact-popup-group-title {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.contact-popup-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.contact-popup-link {
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.contact-popup-link:hover {
  background: rgba(57, 186, 230, 0.1);
  border-color: var(--accent);
}

/* Кнопка «Скачать резюме» внизу страницы */
.site-footer {
  margin-top: 2rem;
  margin-bottom: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--card-border);
  text-align: center;
}

.btn-resume-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.btn-resume-download:hover {
  background: rgba(57, 186, 230, 0.12);
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(57, 186, 230, 0.25);
  transform: translateY(-2px);
}

/* Ошибка загрузки */
.error-msg {
  color: #f85149;
  padding: 1rem;
  margin: 1rem;
  border: 1px solid rgba(248, 81, 73, 0.4);
  border-radius: 8px;
}

/* ========== Адаптивность: одинаковое отображение на всех устройствах ========== */

/* Планшеты и узкие экраны: панель деталей на весь экран при открытии */
@media (max-width: 768px) {
  main {
    padding: 1rem;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  #hero { grid-column: 1; grid-row: auto; }

  .hero-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .hero-text { text-align: center; }

  #experience { grid-column: 1; grid-row: auto; }
  #education { grid-column: 1; grid-row: auto; }
  #projects { grid-column: 1; grid-row: auto; }
  #contacts { grid-column: 1; grid-row: auto; }
  .site-footer { grid-column: 1; grid-row: auto; }

  main .section-card {
    min-height: 120px;
  }

  .contact-popup {
    right: 0;
    left: auto;
    top: auto;
    bottom: 100%;
    margin-right: 0;
    margin-bottom: 0.5rem;
    transform: none;
  }

  body:not(.detail-panel-open) .main-col {
    max-height: none;
    overflow: auto;
  }

  .section-with-timeline {
    flex-direction: column;
    gap: 1rem;
  }

  .timeline {
    flex-shrink: 0;
  }

  .site-layout.detail-open .main-col {
    flex: 0 0 0;
    width: 0;
    overflow: hidden;
  }

  .site-layout.detail-open .detail-panel {
    flex: 1 1 100%;
    width: 100%;
  }

  .detail-panel-content {
    padding: 1.5rem 1rem 1.5rem 1rem;
    padding-top: 3.5rem;
  }

  .detail-panel-close {
    min-width: 44px;
    min-height: 44px;
    top: 0.75rem;
    right: 0.75rem;
  }

  .hero-name {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }

  #hero {
    padding: 2rem 0.5rem;
  }

  .hero-about {
    font-size: 0.95rem;
  }

  .section-title {
    font-size: 1.1rem;
  }

  .bg-robot-scene {
    width: 100px;
    height: 92px;
    bottom: 12px;
    left: 12px;
  }

  .robot-figure {
    width: 75px;
    height: 75px;
  }

  .btn-resume-download,
  .contact-link {
    min-height: 44px;
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
  }
}

/* Телефоны: компактнее контент, удобные зоны нажатия */
@media (max-width: 480px) {
  main {
    padding: 1.25rem 0.75rem calc(2.5rem + env(safe-area-inset-bottom, 0px));
  }

  section {
    margin-bottom: 2rem;
  }

  .hero-name {
    font-size: 1.5rem;
  }

  .hero-tag {
    font-size: 1rem;
  }

  .hero-about {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .section-title {
    font-size: 1rem;
    margin-bottom: 1rem;
  }

  .card {
    padding: 1rem;
  }

  .card-role,
  .card-company,
  .card-institution,
  .card-name {
    font-size: 0.95rem;
  }

  .card-description,
  .card-degree {
    font-size: 0.875rem;
  }

  .bg-robot-scene {
    width: 80px;
    height: 76px;
    bottom: 10px;
    left: 10px;
    opacity: 0.6;
  }

  .robot-figure {
    width: 60px;
    height: 60px;
  }

  body.detail-panel-open .bg-robot-scene {
    transform: scale(0.5);
  }

  .site-footer {
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    padding-top: 1rem;
  }

  .btn-resume-download {
    display: inline-flex;
    min-height: 48px;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  .contacts-list {
    flex-direction: column;
    gap: 0.5rem;
  }

  .contact-link {
    min-height: 48px;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    width: 100%;
    max-width: 200px;
  }
}

/* Высокие узкие экраны (например, повёрнутый телефон): робот не перекрывает контент */
@media (max-width: 380px) {
  .bg-robot-scene {
    width: 64px;
    height: 60px;
    bottom: 8px;
    left: 8px;
  }

  .robot-figure {
    width: 50px;
    height: 50px;
  }
}

/* Сенсорные устройства: убираем hover-масштаб, чтобы не было «залипания» */
@media (hover: none) {
  .contact-link:hover,
  .btn-resume-download:hover,
  .card-link:hover {
    transform: none;
  }

  .card-project:hover .card-link {
    transform: none;
  }
}

/* Уменьшенная графика для экономии трафика (по желанию) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
