/* ───────── Topbar ───────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px var(--pad-x);
  font-family: var(--mono);
  font-size: 12.5px;
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.tb-brand {
  display: inline-flex; align-items: center; gap: 10px;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.tb-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in oklab, var(--accent) 60%, transparent);
}
.tb-right { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.seg-label { color: var(--muted-2); }
.seg-btn {
  padding: 3px 6px; border-radius: 4px;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}
.seg-btn:hover { color: var(--fg-2); }
.seg-btn.is-on { color: var(--bg); background: var(--accent); }
.seg-sep { color: var(--muted-2); }
.seg-cv {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-2);
  color: var(--bg);
  padding: 3px 8px;
  border-radius: var(--radius);
  margin-left: 6px;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.2s;
}
.seg-cv svg { transition: transform 0.2s ease; }
.seg-cv:hover {
  background: color-mix(in oklab, var(--accent-2) 85%, white);
  box-shadow: 0 0 12px color-mix(in oklab, var(--accent-2) 50%, transparent);
}
.seg-cv:hover svg { transform: translateY(2px); }

/* ───────── Scroll progress ───────── */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: var(--accent);
  width: 0%;
  z-index: 30;
  will-change: width;
}

/* ───────── Кнопка "наверх" ───────── */
.btn-top {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--fg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 25;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) rotate(-90deg);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.15s;
}
.btn-top svg { display: block; }
.btn-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: rotate(-90deg);
}
.btn-top:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* ───────── Терминал ───────── */
.terminal-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.tdot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.tdot:nth-child(1) { background: #ff5f56; }
.tdot:nth-child(2) { background: #ffbd2e; }
.tdot:nth-child(3) { background: #27c93f; }
.tname { margin-left: 10px; }
.terminal-body {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 16px 14px 20px;
  font-family: var(--mono);
  font-size: 13px;
  min-height: 340px;
}
.tline { margin-bottom: 6px; color: var(--fg-2); }
.prompt-line { white-space: pre-wrap; word-break: break-all; }
.prompt-user  { color: var(--accent); }
.prompt-sep   { color: var(--muted); }
.prompt-host  { color: var(--fg-2); }
.prompt-tilde { color: var(--accent-2); }

/* Cursor */
.cursor {
  display: inline-block;
  width: 0.55em; height: 1.05em;
  background: var(--accent);
  vertical-align: -0.15em;
  margin-left: 0.15em;
  animation: blink 1s steps(1) infinite;
  box-shadow: 0 0 0.6em color-mix(in oklab, var(--accent) 60%, transparent);
}

/* ───────── Hero контент ───────── */
.hero-body {
  margin-top: 28px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.hero-body.is-on { opacity: 1; transform: none; }

.hero-role {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: lowercase;
  margin-bottom: 10px;
}
.hero-name {
  font-family: var(--display);
  font-weight: 700;
  /* min 36px чтобы «Соловьев Максим» не сжимался впритык на 390px */
  font-size: clamp(36px, 6vw, 68px);
  line-height: 1.02;
  letter-spacing: -0.05em;
  margin: 0 0 18px;
  color: var(--fg);
}
.hero-tagline {
  font-family: var(--sans);
  font-size: clamp(17px, 1.5vw, 20px);
  color: var(--fg-2);
  line-height: 1.45;
  margin: 0 0 12px;
  max-width: 52ch;
  text-wrap: pretty;
}
.hero-sub {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 24px;
  max-width: 60ch;
  line-height: 1.6;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.hero-sub::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
  position: relative;
  top: -1px;
}
@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; box-shadow: 0 0 8px 2px color-mix(in oklab, var(--accent) 40%, transparent); }
}
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }

/* ───────── Аватар ───────── */
.avatar-wrap {
  display: flex; flex-direction: column; gap: 14px;
}
.avatar-frame {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--panel);
  cursor: pointer;
}
.avatar-frame img {
  width: 100%; height: 100%; object-fit: cover;
  filter: contrast(1.02) saturate(1.05);
  transition: opacity 0.3s ease;
}
.avatar-photo {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.avatar-frame.show-photo .avatar-img { opacity: 0; }
.avatar-frame.show-photo .avatar-photo { opacity: 1; }
.avatar-frame.glitching img {
  transition: none;
}
.avatar-rgb {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
}
.avatar-rgb-r { background-blend-mode: screen; background-color: var(--accent); }
.avatar-rgb-b { background-blend-mode: screen; background-color: var(--accent-2); }
.avatar-meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.status-on    { color: oklch(0.78 0.14 145); } /* зелёный */
.status-work  { color: var(--accent); }        /* amber — работает */
.status-chill { color: var(--accent-2); }      /* cyan — отдыхает */
.status-sleep { color: var(--muted-2); }       /* приглушённый — спит */

/* ───────── Meta row ───────── */
/* Grid (не flex) — чтобы dots-колонка (minmax(0, 1fr)) могла сжаться
   до нуля при нехватке места и не выталкивала row за viewport на мобиле. */
.meta-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: 6px;
  align-items: baseline;
  font-family: var(--mono); font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
  overflow: hidden;
}
.meta-k { color: var(--muted-2); }
.meta-dot {
  overflow: hidden;
  color: var(--line-2);
  white-space: nowrap;
  text-overflow: clip;
  letter-spacing: 2px;
}
.meta-v { color: var(--fg-2); white-space: nowrap; }

/* ───────── Кнопки ───────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: color-mix(in oklab, var(--accent) 85%, white);
}
.btn-ghost { color: var(--fg-2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--fg); }

/* ───────── ASCII rule ───────── */
.ascii-rule {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted-2);
  margin-bottom: 28px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}
.ar-left { color: var(--accent); }
.ar-label { color: var(--muted); display: inline-flex; gap: 8px; }
.ar-n { color: var(--accent); }
.ar-right { flex: 1; }

/* ───────── Секции: общее ───────── */
.sect-title h2 {
  font-family: var(--display);
  font-size: clamp(28px, 3.2vw, 40px);
  letter-spacing: -0.05em;
  margin: 0 0 10px;
  font-weight: 700;
  color: var(--fg);
}
.sect-sub {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
  max-width: 36ch;
  /* opacity (не visibility) — чтобы блок продолжал занимать место в layout,
     а не schemomorph'ировал. JS typing-reveal переключает opacity на 1. */
  opacity: 0;
}
.cursor-sub {
  width: 0.5em; height: 0.95em;
  vertical-align: -0.1em;
}
.para {
  font-size: 17px;
  color: var(--fg-2);
  line-height: 1.6;
  margin: 0 0 14px;
  text-wrap: pretty;
}

/* ───────── Value ───────── */
.value-list { list-style: none; }
.value-item {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 20px;
  align-items: baseline;
  padding: 22px 4px;
  border-top: 1px solid var(--line);
  /* Синхронный ритм 0.2s для всех hover-свойств (background и vi-t::after
     ниже — тот же timing). Короткая длительность + одна easing-кривая не
     дают анимациям «догонять» друг друга при скольжении между карточками. */
  transition: background 0.2s ease;
  cursor: default;
}
.value-item:last-child { border-bottom: 1px solid var(--line); }
.value-item:hover {
  background: color-mix(in oklab, var(--accent) 3%, transparent);
}
.vi-key {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.vi-t {
  font-family: var(--sans);
  font-size: 20px;
  color: var(--fg);
  font-weight: 500;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
  display: inline-block;
  position: relative;
}
/* Тонкий typewriter-underline на hover: эффект «активации строки»
   без ярких amber-акцентов, чтобы не конкурировать с Principles. */
.vi-t::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  height: 1px;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease;
}
.value-item:hover .vi-t::after { width: 100%; }
.vi-d {
  font-size: 15px;
  color: var(--fg-2);
  line-height: 1.55;
  max-width: 62ch;
}
/* ───────── Principles ───────── */
.principle {
  background: var(--panel);
  padding: 26px 24px;
  transition: background 0.2s;
}
.principle:hover { background: var(--panel-2); }
.p-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.p-n {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}
.p-rule {
  flex: 1; height: 1px;
  background: repeating-linear-gradient(to right, var(--line-2) 0 4px, transparent 4px 8px);
}
.p-t {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  line-height: 1.3;
}
.p-d {
  font-size: 14.5px;
  color: var(--fg-2);
  line-height: 1.55;
  margin: 0;
}

/* ───────── Human cards ───────── */
.human-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}
.human-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}
.hc-img {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.hc-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.human-card:hover .hc-img img { transform: scale(1.05); }
.hc-body { padding: 18px 20px 22px; }
.hc-t {
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.hc-d { font-size: 14px; color: var(--fg-2); margin: 0; line-height: 1.55; }

/* ───────── Exploring (сейчас копаю) ───────── */
.exploring-list {
  display: grid;
  gap: 16px;
}
.exploring-item {
  padding: 20px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: border-color 0.2s;
}
.exploring-item:hover { border-color: var(--accent); }
.exploring-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 24px;
  align-items: start;
}
.exploring-item .p-t { grid-column: 1; grid-row: 1; margin-bottom: 6px; }
.exploring-item .p-d { grid-column: 1; grid-row: 2; margin: 0; }

/* Status-badge: мини prod-monitoring индикатор справа от заголовка */
.exp-status {
  grid-column: 2; grid-row: 1 / span 2;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  white-space: nowrap;
}
.exp-dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block;
}
.exp-status[data-status="hot"] { color: var(--accent); }
.exp-status[data-status="hot"] .exp-dot {
  background: var(--accent);
  box-shadow: 0 0 8px color-mix(in oklab, var(--accent) 60%, transparent);
  animation: exp-pulse 1.8s ease-in-out infinite;
}
.exp-status[data-status="active"] { color: oklch(0.78 0.14 145); }
.exp-status[data-status="active"] .exp-dot {
  background: oklch(0.78 0.14 145);
  box-shadow: 0 0 6px color-mix(in oklab, oklch(0.78 0.14 145) 50%, transparent);
}
.exp-status[data-status="exploring"] { color: var(--accent-2); }
.exp-status[data-status="exploring"] .exp-dot { background: var(--accent-2); }
@keyframes exp-pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

/* На узком экране — бейдж вниз под карточку */
@media (max-width: 600px) {
  .exploring-item {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .exp-status { grid-column: 1; grid-row: 3; margin-top: 8px; justify-self: start; }
}

/* ───────── Experience (CV) ───────── */
.exp-item {
  padding: 0 0 40px 24px;
  border-left: 2px solid var(--line);
  position: relative;
}
.exp-item::before {
  content: "";
  position: absolute;
  left: -6px; top: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.exp-item:last-child { padding-bottom: 0; }
.exp-head {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
  margin-bottom: 8px;
}
.exp-title {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.03em;
}
.exp-period {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}
.exp-company {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.exp-project {
  font-size: 15px;
  color: var(--fg-2);
  margin-bottom: 16px;
  line-height: 1.5;
}
.exp-group-title {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin: 16px 0 8px;
}
.exp-list-items {
  list-style: none;
}
.exp-list-items li {
  position: relative;
  padding-left: 16px;
  font-size: 14.5px;
  color: var(--fg-2);
  line-height: 1.55;
  margin-bottom: 6px;
}
.exp-list-items li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--mono);
}

/* ───────── Cases (CV) ───────── */
.case-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: border-color 0.2s;
}
.case-item.is-open { border-color: var(--accent); }
.case-header {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 20px 24px;
  cursor: pointer;
  text-align: left;
}
.case-header:hover { background: var(--panel-2); border-radius: var(--radius-lg); }
.case-item.is-open .case-header { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.case-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.08em;
  flex-shrink: 0;
}
.case-title {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.01em;
  flex: 1;
  margin: 0;
}
.case-chevron {
  color: var(--muted);
  transition: transform 0.25s ease;
  transform: rotate(90deg);
  flex-shrink: 0;
}
.case-item.is-open .case-chevron { transform: rotate(-90deg); }
.case-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
  padding: 0 24px;
}
.case-item.is-open .case-body {
  max-height: 600px;
  padding: 0 24px 24px;
}
.case-block { margin-bottom: 12px; }
.case-block:last-child { margin-bottom: 0; }
.case-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.case-text {
  font-size: 14.5px;
  color: var(--fg-2);
  line-height: 1.55;
}

/* ───────── Skills (CV) ───────── */
.skill-group {
  padding: 20px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.skill-group-title {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.skill-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.skill-tag {
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-2);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.skill-tag:hover {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

/* ───────── Languages (CV) ───────── */
.lang-list { display: grid; gap: 8px; }
.lang-item {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 15px;
}
.lang-name {
  font-family: var(--sans);
  font-weight: 500;
  color: var(--fg);
}
.lang-level {
  font-size: 14px;
  color: var(--fg-2);
}

/* ───────── Education (CV) ───────── */
.edu-item {
  padding: 20px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
}
.edu-item:last-child { margin-bottom: 0; }
.edu-title {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 4px;
}
.edu-detail {
  font-size: 14px;
  color: var(--fg-2);
}
.edu-year {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

/* ───────── Blog ───────── */
.blog-links { display: grid; gap: 8px; }
.blog-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  font-family: var(--mono);
  font-size: 14px;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}
.blog-link:hover {
  border-color: var(--accent);
  background: var(--panel-2);
}
.blog-link:hover .cr-ext { color: var(--accent); transform: translate(2px, -2px); }
.blog-link-label { color: var(--fg); }
.blog-link-handle { color: var(--muted); margin-left: auto; }

/* ───────── Contact ───────── */
.contact-list { list-style: none; }
.contact-row {
  display: grid;
  /* Mobile: icon | label | dots (flex-fill) | handle — dot-leader на всех экранах */
  grid-template-columns: 26px auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  padding: 18px 6px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  text-decoration: none;
  transition: background 0.15s, padding-left 0.15s;
}
.cr-ext { display: none; }
.contact-list li:last-child .contact-row { border-bottom: 1px solid var(--line); }
.contact-row:hover {
  background: color-mix(in oklab, var(--accent) 7%, transparent);
  padding-left: 18px;
}
.contact-row:hover .cr-ext { color: var(--accent); transform: translate(2px, -2px); }
.cr-icon { color: var(--accent); display: inline-flex; align-self: center; }
.cr-label { color: var(--fg); font-size: 14px; white-space: nowrap; }
.cr-dots {
  color: var(--line-2);
  font-size: 13px;
  letter-spacing: 1px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
}
.cr-handle { color: var(--fg-2); font-size: 13px; }
.cr-ext {
  color: var(--muted-2);
  align-self: center;
  transition: color 0.15s, transform 0.15s;
}

/* ───────── Footer ───────── */
.foot {
  max-width: var(--maxw);
  margin: 40px auto 0;
  padding: 28px var(--pad-x) 40px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted-2);
  border-top: 1px dashed var(--line);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}

/* ═════════ Side quests — лабораторный журнал, группы по сюжетам ═════════ */
/* Самодостаточный блок: удаление откатит секцию без следов в базовых стилях. */
.sect-sidequests .sq-body {
  display: flex;
  flex-direction: column;
}
.sect-sidequests .sq-sagas {
  display: grid;
  gap: 44px;
}
.sq-saga-head {
  margin-bottom: 18px;
  padding-left: 16px;
  border-left: 2px solid var(--accent);
}
.sq-saga-title {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 0.01em;
  margin: 0 0 6px;
  text-transform: lowercase;
}
.sq-saga-title::before {
  content: "// ";
  color: var(--accent);
  opacity: 0.7;
}
.sq-saga-intro {
  font-size: 14.5px;
  color: var(--fg-2);
  line-height: 1.6;
  margin: 0;
  max-width: 68ch;
}
.sq-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.sq-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sq-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
}
.sq-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px 16px;
}
.sq-img {
  aspect-ratio: 16 / 9;
  background: #0a0a0a;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.sq-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(1.05);
  transition: transform 0.6s ease;
}
.sq-card.has-img:hover .sq-img img { transform: scale(1.03); }
.sq-metric {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: lowercase;
  margin-top: -2px;
}
.sq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sq-name {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.sq-link {
  display: inline-flex;
  align-items: center;
  color: var(--muted-2);
  transition: color 0.2s ease, transform 0.2s ease;
}
.sq-link:hover { color: var(--accent); transform: translate(2px, -2px); }
.sq-d {
  font-size: 14px;
  color: var(--fg-2);
  line-height: 1.55;
  margin: 0;
}
.sq-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.sq-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted-2);
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.sq-card:hover .sq-tag { color: var(--fg-2); border-color: color-mix(in oklab, var(--accent) 40%, var(--line)); }
.sq-outros {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 28px;
  margin-top: 32px;
}
.sq-outro {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted-2);
  text-decoration: none;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.sq-outro:hover { color: var(--accent); border-bottom-color: var(--accent); }
.sq-outro-ext {
  display: inline-flex;
  align-items: center;
  color: var(--muted-2);
  transition: color 0.2s ease, transform 0.2s ease;
}
.sq-outro:hover .sq-outro-ext { color: var(--accent); transform: translate(2px, -2px); }

@media (min-width: 700px) {
  .sq-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  /* Сага с hero-скриншотом или с единственной карточкой — single-column,
     чтобы ничего не висело в половину ширины рядом с пустотой. */
  .sq-grid:has(.sq-card.has-img),
  .sq-grid:has(.sq-card:only-child) { grid-template-columns: 1fr; }
  .sq-card.has-img .sq-img { aspect-ratio: 21 / 9; }
  /* Hero-карточка кладёт скриншот слева, текст справа — более читаемо на wide */
  .sq-card.has-img {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: stretch;
  }
  .sq-card.has-img .sq-img {
    aspect-ratio: auto;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    min-height: 100%;
  }
}
@media (min-width: 1100px) {
  .sq-card.has-img { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
}

/* ═════════ Polaroid wall — pattern break для секции «По-человечески» ═════════ */
/* Переопределяет .human-card с высшей specificity через префикс .sect-human.
   Если откатить этот блок, базовые .human-card стили вернутся. */
.sect-human .human-card {
  background: #f2e8d5;
  border: 0;
  border-radius: 2px;
  padding: 10px 10px 18px;
  box-shadow: 0 6px 24px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.3);
  transform-origin: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.sect-human .hc-img {
  aspect-ratio: 1 / 1;
  border-radius: 0;
  background: #000;
}
.sect-human .hc-img img { filter: saturate(1.08) contrast(1.04); }
.sect-human .human-card:hover .hc-img img { transform: none; }
.sect-human .hc-body { padding: 14px 6px 6px; text-align: center; }
.sect-human .hc-t {
  font-family: 'Caveat', 'Shadows Into Light', cursive;
  font-size: 22px;
  font-weight: 500;
  color: #2a2520;
  letter-spacing: 0;
  margin-bottom: 4px;
}
.sect-human .hc-d {
  font-family: var(--mono);
  font-size: 11.5px;
  color: #5a5046;
  line-height: 1.5;
}

/* Rotate и lift только там, где достаточно ширины (планшет+) */
@media (min-width: 700px) {
  .sect-human .human-card:nth-child(1) { transform: rotate(-1.6deg) translateY(4px); }
  .sect-human .human-card:nth-child(2) { transform: rotate(1.2deg); }
  .sect-human .human-card:nth-child(3) { transform: rotate(-0.8deg) translateY(10px); }
  .sect-human .human-card:nth-child(4) { transform: rotate(2deg); }
  .sect-human .human-card:nth-child(5) { transform: rotate(-1.4deg) translateY(6px); }
  .sect-human .human-card:nth-child(6) { transform: rotate(0.8deg); }
  .sect-human .human-card:hover {
    transform: rotate(0deg) translateY(-6px) scale(1.03);
    box-shadow: 0 18px 40px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.3);
    border-color: transparent;
    z-index: 5;
  }
}

/* На больших экранах 3 колонки — чтобы polaroid'ы дышали */
@media (min-width: 900px) {
  .sect-human .human-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px 28px;
    padding: 20px 0 40px;
  }
}

/* ═════════ Big typography manifesto — pattern break для секции «Принципы» ═════════ */
/* Убираем карточки, оставляем чистую типографику: огромные цифры + title/desc справа. */
@media (min-width: 700px) {
  .sect-principles .principles-grid {
    background: transparent;
    border: 0;
    border-radius: 0;
    grid-template-columns: 1fr;
    gap: 0;
  }
  .sect-principles .principle {
    background: transparent;
    padding: 28px 0;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: 140px 1fr;
    grid-template-rows: auto auto;
    column-gap: 40px;
    align-items: baseline;
  }
  .sect-principles .principle:last-child { border-bottom: 1px solid var(--line); }
  .sect-principles .principle:hover { background: transparent; }

  .sect-principles .p-head {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
    margin-bottom: 0;
    display: block;
  }
  .sect-principles .p-head .p-rule { display: none; }
  .sect-principles .p-n {
    font-family: var(--display);
    font-weight: 700;
    font-size: 84px;
    line-height: 1;
    color: var(--accent);
    letter-spacing: -0.05em;
    display: block;
  }
  .sect-principles .p-t {
    grid-column: 2;
    grid-row: 1;
    font-family: var(--display);
    font-weight: 700;
    font-size: 26px;
    letter-spacing: -0.04em;
    color: var(--fg);
    margin-bottom: 10px;
    line-height: 1.15;
  }
  .sect-principles .p-d {
    grid-column: 2;
    grid-row: 2;
    font-size: 16px;
    color: var(--fg-2);
    line-height: 1.55;
    max-width: 56ch;
  }
}

/* ───────── Tablet + Mobile: hero-аватар круг 120×120 над терминалом ───────── */
/* Порог 899px совпадает с desktop grid-threshold (min-width: 900px в layout.css) */
@media (max-width: 899px) {
  /* display: contents распускает обёртки — .avatar-frame и .avatar-meta становятся grid-items .hero-grid */
  .hero-right { display: contents; }
  .avatar-wrap { display: contents; }
  .hero-grid { gap: 20px; }

  .avatar-frame {
    display: block;
    width: 120px; height: 120px;
    max-width: none;
    margin: 0 auto;
    border-radius: 50%;
    border: 2px solid var(--accent);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 20%, transparent),
                0 0 30px color-mix(in oklab, var(--accent) 35%, transparent);
    order: -1;
  }
  .hero-left { order: 0; }
  .avatar-meta { order: 1; margin-top: 4px; }
}

/* ───────── Mobile (small screens) ───────── */
@media (max-width: 600px) {
  /* Topbar: убираем лейблы, компактнее */
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px var(--pad-x); }
  .seg-label { display: none; }
  .tb-right { gap: 8px; }
  .seg-btn { font-size: 12px; }

  /* Hero контент */
  .hero-tagline { font-size: 16px; }
  .hero-sub { font-size: 12px; }

  /* Avatar meta: узкий экран — ужать, чтобы длинные values
     (13 лет 1 мес ... HH:MM:SS) оставляли место для dot-leader */
  .avatar-meta { font-size: 10.5px; }

  /* Value */
  .value-item { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 16px 4px; }
  .vi-t { font-size: 17px; }
  .vi-d { font-size: 14px; }

  /* Skills */
  .skill-tag { font-size: 11px; padding: 3px 8px; }

  /* Education */
  .edu-title { font-size: 14px; line-height: 1.4; }
  .edu-detail { font-size: 13px; }

  /* Sections */
  .sect { padding: 32px var(--pad-x); }

  /* Experience */
  .exp-title { font-size: 18px; }

  /* Cases */
  .case-item { padding: 18px; }
  .case-title { font-size: 17px; }
}

/* ───────── Desktop enhancements ───────── */
@media (min-width: 700px) {
  .cr-ext { display: inline-flex; }
  .contact-row {
    grid-template-columns: 26px auto minmax(0, 1fr) auto 16px;
    gap: 14px;
  }
}

@media (min-width: 900px) {
  .terminal-body { padding: 22px 26px 30px; font-size: 14px; min-height: 340px; }
  .avatar-wrap { position: sticky; top: 80px; }
}

/* Ультра-узкий: прячем brand целиком, чтобы топбар умещался в 1 строку.
   Бренд остаётся виден в hero-промпте (`artfaal@artfaal.ru:~$`).
   Layout: nav (жизнь|работа) слева, lang+PDF группой справа — через
   width:100% на .tb-right и margin-left:auto на lang-сегменте. */
@media (max-width: 499px) {
  .tb-brand { display: none; }
  .tb-right {
    width: 100%;
    justify-content: flex-start;
  }
  .tb-right > [aria-label="lang"] { margin-left: auto; }
}
