/* =====================================================
   ТОКЕНЫ ТЕМ
   ===================================================== */
:root {
  color-scheme: light;

  --bg:            #FFFFFF;
  --bg-frame:      #F5F7FA;
  --bg-tile:       #F5F7FA;
  --bg-tile-hover: #EBEDF0;
  --bg-pill:       #FFFFFF;
  --text:          #3D434C;
  --text-sec:      #828FA3;
  --text-hover:    #191B1F;
  --btn-dark:      #191B1F;
  --btn-dark-hover:#0F1114;
  --btn-dark-text: #FFFFFF;
  --bar:           #E6E6EA;
  --bar-blue:      #CFE0F7;
  --accent:        #1F73ED;
  --green:         #28A745;
  --note-bg:       #FAF7E6;
  --success-bg:    #DCF5E0;
  --shadow:        rgba(68, 69, 85, 0.08);
  --thumb:         linear-gradient(135deg, #E6E8EC, #D5D8DE);
  --book-foreedge: repeating-linear-gradient(90deg, #efe7d4 0 1px, #d9cfb6 1px 3px, #f5eeda 3px 4px);
  --book-top:      repeating-linear-gradient(90deg, #efe7d4 0 1px, #d6cbb0 1px 3px, #f7f1e0 3px 4px);
  --book-bottom:   repeating-linear-gradient(90deg, #cbbfa4 0 1px, #b8ab8e 1px 3px);

  --r-tile:  16px;
  --r-btn:   12px;
  --r-frame: 20px;
  --r-cover: 24px;
  --r-sm:    8px;
  --r-xs:    6px;

  --h-tile: 64px;
  --h-btn:  48px;
  --sticky-top: 24px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg:            #000000;
  --bg-frame:      #191B1F;
  --bg-tile:       #191B1F;
  --bg-tile-hover: #23262C;
  --bg-pill:       #2A3038;
  --text:          #E6E9ED;
  --text-sec:      #8A94A3;
  --text-hover:    #FFFFFF;
  --btn-dark:      #E6E9ED;
  --btn-dark-hover:#FFFFFF;
  --btn-dark-text: #191B1F;
  --bar:           #3A424D;
  --bar-blue:      #3B5A8C;
  --accent:        #4A9EFF;
  --green:         #4ADE80;
  --note-bg:       #2A2620;
  --success-bg:    #1B2A1F;
  --shadow:        rgba(0, 0, 0, 0.35);
  --thumb:         linear-gradient(135deg, #2C333D, #232830);
  --book-foreedge: repeating-linear-gradient(90deg, #3a3428 0 1px, #2a2519 1px 3px, #443d2c 3px 4px);
  --book-top:      repeating-linear-gradient(90deg, #3a3428 0 1px, #2f2a1e 1px 3px, #443d2c 3px 4px);
  --book-bottom:   repeating-linear-gradient(90deg, #2a251a 0 1px, #1f1a12 1px 3px);
}

/* =====================================================
   БАЗА
   ===================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 24px 24px 60px;
  transition: background-color .25s ease, color .25s ease;
}

.container { max-width: 720px; margin: 0 auto; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-btn);
}

.noscript-note {
  max-width: 720px;
  margin: 0 auto 24px;
  padding: 14px 20px;
  background: var(--bg-tile);
  border-radius: var(--r-btn);
  font-size: 15px; line-height: 24px;
  color: var(--text-sec);
}

/* =====================================================
   ABOUT
   ===================================================== */
.about {
  display: flex;
  gap: 20px;
  align-items: stretch;    /* обе колонки одной высоты */
}

.about-photo-frame {
  width: 240px; height: 320px;
  border-radius: var(--r-frame);
  background: var(--bg-frame);
  overflow: hidden;
  flex-shrink: 0;
  transition: background-color .25s ease;
}
.about-photo-frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

/* Правая колонка: три зоны — верх / центр / низ */
.about-content {
  flex: 1;
  min-width: 0;
  height: 320px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
}

.about-top { }
.about-middle {
  align-self: center;   /* центр вертикально в свободном месте */
}
.about-bottom { }

.name { font-size: 30px; line-height: 40px; font-weight: 600; }
.role { font-size: 20px; line-height: 30px; font-weight: 500; color: var(--text-sec); }

.intro {
  font-size: 18px; line-height: 32px;
  margin-bottom: 8px;
}

/* =====================================================
   EMAIL ROW
   ===================================================== */
.email-row {
  font-size: 18px; line-height: 32px;
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 0 4px;
}
.email-line { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

.email-link {
  color: var(--text-sec);
  text-decoration: underline;
  text-decoration-color: var(--text-sec);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color .2s, text-decoration-color .2s;
}
.email-link:hover { color: var(--text); text-decoration-color: var(--text); }

.copy-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 6px;
  background: transparent; border: none; border-radius: var(--r-xs);
  font: 500 16px/1 inherit; color: var(--text);
  cursor: pointer;
  transition: color .2s;
}
.copy-btn:hover { color: var(--text-sec); }
.copy-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.copy-btn .icon-check { display: none; }
.copy-btn .copy-label {
  position: absolute; left: 100%; top: 50%;
  transform: translateY(-50%);
  margin-left: 4px;
  white-space: nowrap;
  pointer-events: none;
  display: none;
}
.copy-btn:hover .copy-label { display: inline; }
.copy-btn.copied .icon-copy { display: none; }
.copy-btn.copied .icon-check { display: inline-block; }
.copy-btn.copied .copy-label { display: inline; }

/* Низ */
.get-in-touch {
  font-size: 20px; line-height: 30px; font-weight: 500;
}

/* =====================================================
   SOCIAL BUTTONS
   ===================================================== */
.social-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.social-buttons .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h-btn); padding: 0 12px;
  background: var(--bg-tile); color: var(--text);
  border-radius: var(--r-btn);
  font: 500 18px/1 'Inter', sans-serif;
  text-decoration: none;
  transition: background .25s;
}
.social-buttons .btn:hover { background: var(--bg-tile-hover); }
[data-theme="dark"] .social-buttons .btn lottie-player {
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

/* =====================================================
   CONTENT / TOOLBAR
   ===================================================== */
.content {
  margin-top: 24px;
  position: relative;
}

.tabs {
  position: sticky;
  top: var(--sticky-top);
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--h-tile);
  padding: 8px;
  background: var(--bg-tile);
  border-radius: var(--r-tile);
  box-shadow: 0 4px 32px rgba(68, 69, 85, 0);
  transition: box-shadow .25s ease, background-color .25s ease;
}
.tabs.stuck { box-shadow: 0 4px 32px var(--shadow); }

.controls {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: var(--h-tile);
  padding: 8px;
  background: var(--bg-tile);
  border-radius: var(--r-tile);
  transition: background-color .25s ease;
}

.tab-pill {
  position: absolute; top: 8px; left: 0;
  height: var(--h-btn);
  background: var(--bg-pill);
  border-radius: var(--r-btn);
  box-shadow: 0 4px 32px var(--shadow);
  transition: left .35s cubic-bezier(.4,0,.2,1),
              width .35s cubic-bezier(.4,0,.2,1),
              background-color .25s ease;
  z-index: 0; pointer-events: none;
}

.tab {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center;
  height: var(--h-btn); padding: 0 12px;
  background: transparent; border: none;
  border-radius: var(--r-btn);
  font: 500 20px/24px 'Inter', sans-serif;
  color: var(--text-sec);
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s;
}
.tab:hover, .tab.active { color: var(--text); }

.ctrl-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: var(--h-btn); min-width: var(--h-btn);
  padding: 0 14px;
  background: transparent; border: none;
  border-radius: var(--r-btn);
  font: 500 20px/24px 'Inter', sans-serif;
  color: var(--text-sec);
  cursor: pointer;
  transition: color .2s, background .2s, box-shadow .2s;
}
.ctrl-btn:hover {
  color: var(--text);
  background: var(--bg-pill);
  box-shadow: 0 4px 32px var(--shadow);
}
.ctrl-btn svg { width: 22px; height: 22px; }
.ctrl-btn .icon-moon { display: block; }
.ctrl-btn .icon-sun  { display: none;  }
[data-theme="dark"] .ctrl-btn .icon-moon { display: none;  }
[data-theme="dark"] .ctrl-btn .icon-sun  { display: block; }

/* =====================================================
   ПАНЕЛИ
   ===================================================== */
.tab-panels { margin-top: 24px; }
.panel { display: none; animation: fadeIn .3s ease; }
.panel.active { display: block; }
.panel.active.panel--stack { display: flex; flex-direction: column; gap: 20px; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bio, .experience-intro, .about-intro {
  font-size: 18px; line-height: 32px; color: var(--text);
}
.bio { margin-bottom: 40px; max-width: 640px; }

/* =====================================================
   ПРОЕКТЫ
   ===================================================== */
.project { margin-bottom: 64px; }
.project:last-child { margin-bottom: 0; }

.project-link { display: block; color: inherit; text-decoration: none; }

.project-cover {
  width: 100%;
  aspect-ratio: 720 / 400;
  border-radius: var(--r-cover);
  overflow: hidden;
  position: relative;
  background: var(--bg-tile);
  transition: background-color .25s ease;
}
.project-title {
  margin-top: 16px;
  font-size: 20px; line-height: 30px; font-weight: 500;
  transition: color .2s;
}
.project-link:hover .project-title { color: var(--text-hover); }
.project-desc  { margin-top: 4px;  font-size: 18px; line-height: 30px; color: var(--text-sec); }

.cover-grid {
  position: absolute; inset: 40px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.cover-grid.g3 { grid-template-columns: repeat(3, 1fr); }

.cover-card {
  background: var(--bg-pill);
  border-radius: var(--r-btn);
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  display: flex; flex-direction: column; gap: 8px;
  transition: background-color .25s ease;
}
.cover-card .label { font-size: 10px; font-weight: 600; }
.bar { height: 5px; border-radius: 3px; background: var(--bar); }
.bar.short { width: 60%; }
.bar.tiny  { width: 40%; }
.bar.blue  { background: var(--bar-blue); }

.chips { display: flex; gap: 5px; }
.chip { width: 12px; height: 12px; border-radius: 3px; }
.chip.b { background: #3B82F6; } .chip.g { background: #22C55E; }
.chip.y { background: #EAB308; } .chip.r { background: #EF4444; }
.chip.k { background: #1F2937; }

.thumb-row { display: flex; gap: 6px; flex: 1; }
.thumb { flex: 1; border-radius: 4px; min-height: 40px; background: var(--thumb); }

.cover-img { border-radius: var(--r-btn); position: relative; overflow: hidden; min-height: 100%; }
.cover-img.car {
  background:
    radial-gradient(80% 60% at 50% 70%, rgba(0,0,0,.5), transparent 60%),
    linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
}
.cover-img.car::after {
  content: ""; position: absolute; left: 15%; right: 15%; bottom: 25%;
  height: 22%; border-radius: 20px 20px 6px 6px;
  background: linear-gradient(180deg, #2F3E52, #16202E);
}
.cover-img.beauty { background: linear-gradient(135deg, #E8C9B8 0%, #D9A992 100%); }
.cover-img.beauty::after {
  content: ""; position: absolute; left: 30%; right: 30%; top: 25%; bottom: 25%;
  background: linear-gradient(180deg, #F5E6D8, #D9B09A);
  border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.15);
}
.cover-img.agro { background: linear-gradient(180deg, #9CC79A 0%, #4A7D54 100%); }
.cover-img.agro::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 55%;
  background: repeating-linear-gradient(90deg, #3D6B46 0 6px, #4A7D54 6px 12px);
  opacity: .6;
}

/* =====================================================
   EXPERIENCE
   ===================================================== */
.experience-list { padding-top: 32px; display: flex; flex-direction: column; gap: 64px; }
.job { display: flex; flex-direction: column; gap: 16px; }
.job-header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.job-icon {
  width: 64px; height: 64px;
  border-radius: var(--r-tile);
  background: var(--icon-bg, transparent);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.job-icon-mark {
  display: block;
  width: var(--mark-w, 0);
  height: var(--mark-h, 0);
  background: #F5F7FA;
  border-radius: 4px;
}

.job-meta { display: flex; flex-direction: column; }
.job-role  { font-size: 20px; line-height: 32px; font-weight: 500; }
.job-role .at { color: var(--text-sec); }
.job-dates { font-size: 18px; line-height: 32px; color: var(--text-sec); }

.job-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  padding: 4px 8px;
  background: var(--bg-tile);
  border-radius: var(--r-sm);
  font-size: 16px; line-height: 24px; font-weight: 500;
  color: var(--text-sec);
  transition: background-color .25s ease;
}

.job-desc, .job-block { font-size: 18px; line-height: 32px; }
.job-desc strong, .job-block-title { font-weight: 600; }
.job-block-title, .job-block > div { font-size: 18px; line-height: 32px; }

.job-link {
  display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap;
  font-size: 18px; line-height: 32px;
}
.job-link a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.job-link svg { width: 24px; height: 24px; }

/* =====================================================
   ABOUT TAB
   ===================================================== */
.about-heading { font-size: 20px; line-height: 30px; font-weight: 500; margin-bottom: 8px; }
.about-text    { font-size: 18px; line-height: 32px; margin-bottom: 12px; }

/* =====================================================
   КНИЖНАЯ ПОЛКА
   ===================================================== */
.bookshelf { width: 100%; }
.bookshelf .stage {
  width: 100%; height: 340px;
  overflow: hidden; position: relative;
}
.bookshelf .shelf {
  position: absolute; left: 50%; top: 14.5px;
  transform: translateX(-50%) scale(0.9);
  transform-origin: center top;
}
.bookshelf .books { display: flex; align-items: flex-end; gap: 2px; }

.bookshelf .book {
  position: relative; flex: 0 0 auto;
  width: 50px; height: 346px;
  perspective: 2000px; perspective-origin: 50% 50%;
  cursor: pointer;
}
.bookshelf .inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transform: translateZ(-120px);
  transition: transform .4s cubic-bezier(.2,.9,.25,1);
  will-change: transform;
}
.bookshelf .book:hover { z-index: 5; }
.bookshelf .book:hover .inner { transform: translateZ(-120px) scale(1.08); }
.bookshelf .book.open { z-index: 30; cursor: zoom-out; }
.bookshelf .book.open .inner { transform: translateZ(-80px) rotateY(-90deg) scale(1.08); }

.bookshelf .face {
  position: absolute; left: 50%; top: 50%;
  backface-visibility: hidden; overflow: hidden;
}
.bookshelf .spine {
  width: 50px; height: 346px;
  transform: translate(-50%,-50%) translateZ(120px);
  border-radius: 4px;
  background: var(--spine-img) center/100% 100% no-repeat;
}
.bookshelf .foreedge {
  width: 50px; height: 346px;
  transform: translate(-50%,-50%) translateZ(-120px) rotateY(180deg);
  background: var(--book-foreedge);
}
.bookshelf .cover {
  width: 240px; height: 346px;
  transform: translate(-50%,-50%) rotateY(90deg) translateZ(25px);
  border-radius: 4px;
  background: var(--cover-img) center/100% 100% no-repeat;
}
.bookshelf .backcover {
  width: 240px; height: 346px;
  transform: translate(-50%,-50%) rotateY(-90deg) translateZ(25px);
  border-radius: 4px;
  background: #2a2438;
}
.bookshelf .top {
  width: 50px; height: 240px;
  transform: translate(-50%,-50%) rotateX(90deg) translateZ(173px);
  background: var(--book-top);
}
.bookshelf .bottom {
  width: 50px; height: 240px;
  transform: translate(-50%,-50%) rotateX(-90deg) translateZ(173px);
  background: var(--book-bottom);
}
.bookshelf .caption {
  padding: 4px 12px 16px;
  font-size: 18px; line-height: 32px;
  text-align: center;
}
.bookshelf .caption .line { min-height: 32px; }
.bookshelf .caption .title  { color: var(--text); }
.bookshelf .caption .author { color: var(--text-sec); margin-left: 8px; }
.bookshelf .caption .hint   { color: var(--text-sec); }

/* =====================================================
   CASE STUDY
   ===================================================== */
.case { margin-top: 24px; }

.case-hero { display: flex; flex-direction: column; gap: 24px; margin-bottom: 100px; }
.case-hero-cover {
  width: 100%;
  aspect-ratio: 720 / 400;
  border-radius: var(--r-cover);
  background: var(--bg-tile);
  overflow: hidden;
  position: relative;
  transition: background-color .25s ease;
}
.case-hero-meta { display: flex; flex-direction: column; gap: 4px; }
.case-hero-title { font-size: 24px; line-height: 36px; font-weight: 500; }
.case-hero-title .year { color: var(--text-sec); }
.case-hero-sub { font-size: 18px; line-height: 30px; color: var(--text-sec); }

.case-section {
  display: flex; flex-direction: column; gap: 64px;
  margin-bottom: 100px;
}
.case-section:last-child { margin-bottom: 0; }

.case-heading { display: flex; flex-direction: column; gap: 8px; }
.case-label {
  font-size: 20px; line-height: 32px; font-weight: 600;
  color: var(--text-sec);
}
.case-h2 { font-size: 24px; line-height: 36px; font-weight: 600; }
.case-h3 { font-size: 20px; line-height: 32px; font-weight: 600; }
.case-lead { font-size: 18px; line-height: 32px; }
.case-body { font-size: 18px; line-height: 32px; }
.case-body strong { font-weight: 600; }

.case-metrics { display: flex; flex-wrap: wrap; gap: 12px; }
.case-metric {
  width: 170px;
  padding: 20px;
  background: var(--bg-tile);
  border-radius: var(--r-cover);
  display: flex; flex-direction: column; gap: 8px;
  transition: background-color .25s ease;
}
.case-metric-label {
  font-size: 14px; line-height: 24px; font-weight: 500;
  color: var(--text-sec);
}
.case-metric-value {
  font-size: 18px; line-height: 24px; font-weight: 500;
  color: var(--text);
}
.case-metric-delta {
  font-size: 16px; line-height: 20px; font-weight: 500;
  color: var(--green);
}

.case-note {
  padding: 24px;
  background: var(--note-bg);
  border-radius: var(--r-cover);
  font-size: 18px; line-height: 32px;
  transition: background-color .25s ease;
}
.case-note strong { font-weight: 700; }
.case-note--success { background: var(--success-bg); }

.case-card {
  padding: 24px;
  background: var(--bg-pill);
  box-shadow: 0 8px 24px var(--shadow);
  border-radius: var(--r-cover);
  display: flex; flex-direction: column; gap: 16px;
  transition: background-color .25s ease, box-shadow .25s ease;
}

.case-cards-row { display: flex; flex-wrap: wrap; gap: 12px; }

.case-figure { display: flex; flex-direction: column; gap: 12px; }
.case-figure img {
  width: 100%; height: auto;
  border-radius: var(--r-cover);
  display: block;
}
.case-caption {
  text-align: center;
  font-size: 18px; line-height: 32px;
  color: var(--text-sec);
  font-style: italic;
}

.case-figures-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.case-figures-grid img {
  width: 100%; height: auto;
  border-radius: var(--r-cover);
  display: block;
}

/* =====================================================
   FOOTER
   ===================================================== */
.footer {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--bar);
  font-size: 16px; line-height: 24px;
  color: var(--text-sec);
  transition: border-color .25s ease, color .25s ease;
}
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a {
  color: var(--text-sec);
  text-decoration: none;
  transition: color .2s;
}
.footer-links a:hover { color: var(--text); }

/* =====================================================
   АДАПТИВ
   ===================================================== */
@media (max-width: 719px) {
  .about { flex-direction: column; align-items: stretch; }

  /* На мобилке высота фиксированная больше не нужна */
  .about-content {
    height: auto;
    grid-template-rows: auto auto auto;
  }
  .about-middle { align-self: auto; }

  .cover-grid { inset: 20px; gap: 10px; }
  .cover-grid.g3 { grid-template-columns: 1fr; }

  .case-figures-grid { grid-template-columns: 1fr; }
  .case-metric { width: calc(50% - 6px); }

  .bookshelf .stage {
    height: 340px;
    padding: 0 10px;
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; -ms-overflow-style: none;
  }
  .bookshelf .stage::-webkit-scrollbar { display: none; }
  .bookshelf .shelf {
    position: static; left: auto; top: auto;
    transform: none;
  }

  .footer { flex-direction: column; align-items: flex-start; }
}