/* ============================================================
   Vitaly K. — site shell. Layout + responsive only.
   All color / type / spacing comes from the design-system tokens.
   ============================================================ */

html, body { margin: 0; background: var(--bg-page); }

#root { min-height: 100vh; }

.app {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  /* §7 — full-bleed: the identity column pins to the LEFT viewport edge;
     the right content centers within the remaining space (see .canvas__inner). */
  max-width: none;
  margin: 0;
  background: var(--bg-surface);
}

/* Persistent left identity column — sticky on desktop */
.app__aside {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden; /* §5.3 guard — real fix is the tooltip wrap below */
  flex: none;
  /* §4 (Pack 6) — on short viewports the column overflows vertically. Flip the
     scrollbar to the LEFT edge (rtl on the container, ltr restored on children)
     and style it subtle: thin, hairline thumb, sharp corners, transparent track.
     Scoped to this element only — the page/global scrollbar is untouched. The
     bar only appears when content overflows (short screens). */
  direction: rtl;
  scrollbar-width: thin;
  scrollbar-color: rgba(25, 27, 29, 0.12) transparent;
}
.app__aside > * { direction: ltr; }
.app__aside::-webkit-scrollbar { width: 4px; }
.app__aside::-webkit-scrollbar-track { background: transparent; }
.app__aside::-webkit-scrollbar-thumb { background: rgba(25, 27, 29, 0.12); border-radius: 0; }
.app__aside::-webkit-scrollbar-thumb:hover { background: rgba(25, 27, 29, 0.22); }

/* Right canvas */
.canvas {
  flex: 1;
  min-width: 0;
  background: var(--bg-surface);
  padding: var(--canvas-pad-y) var(--canvas-pad-x) var(--space-10);
  border-left: var(--border-1) solid var(--border-hairline);
}
.canvas__inner { max-width: var(--content-max); margin: 0 auto; }
.canvas__inner--wide { max-width: 1560px; margin: 0 auto; height: 100%; }

/* Section transition — calm cross-fade on route change */
/* Section transition — calm slide-up on route change.
   NOTE: animate transform only, never opacity, so a throttled/frozen
   animation frame can never leave the screen invisible. */
@keyframes vk-screen-in {
  from { transform: translateY(8px); }
  to   { transform: none; }
}
.screen-anim { animation: vk-screen-in var(--dur) var(--ease); }
@media (prefers-reduced-motion: reduce) {
  .screen-anim { animation: none; }
}

/* ============================================================
   IDENTITY COLUMN — composed from DS primitives (mirrors the DS
   IdentityColumn layout; composed for string control + §1/§4 fixes).
   ============================================================ */
.id-col {
  width: var(--col-identity);
  min-height: 100%;
  background: var(--bg-muted);
  box-sizing: border-box;
  padding: 36px;
  display: flex;
  flex-direction: column;
}
.id-col__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}
.id-col__avatar {
  width: 36px; height: 36px;
  border-radius: 4px;
  object-fit: cover;
  filter: grayscale(1);
}
.id-col__name {
  font: var(--weight-mono-bold) 18px/1.2 var(--font-mono);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
/* §3d — quiet "for agents" signal under the wordmark */
.id-col__agents {
  display: inline-block;
  margin-top: 10px;
  font: var(--type-caption);
  letter-spacing: var(--ls-caption);
  text-transform: uppercase;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}
.id-col__agents:hover { color: var(--link); }
.id-col__statement {
  margin-top: 44px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* §1 — headline: Space Grotesk 500, brace terms in Space Mono ITALIC */
.id-statement {
  margin: 0;
  font: var(--weight-display) var(--text-statement, 28px) / 1.3 var(--font-display);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--text-primary);
}
.id-statement__term { font-family: var(--font-mono); font-weight: 700; font-style: italic; }
/* §3 — About bio highlight links: steel-blue, underlined, centered tooltip
   (the identity `.bio-link` is primary-ink + right-anchored; About prose is
   wide, so center the gloss above the link). */
.about__prose .bio-link { color: var(--link); }
.about__prose .bio-link::after {
  left: 50%; right: auto;
  transform: translateX(-50%);
}
/* §6 — the {curly braces} themselves go bold+italic too (BraceTerm sets an
   inline font-weight:400 on each brace span, so override needs !important). */
.id-statement > span > span { font-weight: 700 !important; font-style: italic; }

/* §1 — bio: Newsreader serif; key links underlined with micro-tooltips */
.id-bio {
  font: var(--type-body);
  color: var(--text-secondary);
  margin: 0;
}
.bio-link {
  position: relative;
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.bio-link:hover { color: var(--link); }
.bio-link::after {
  content: attr(data-tip);
  position: absolute;
  /* §5.3 — anchor to the link's right edge and grow LEFTward so a link deep
     in a line never pushes the tooltip past the column's right edge. */
  right: 0;
  left: auto;
  bottom: calc(100% + 6px);
  z-index: 30;
  /* §5.3 — the nowrap tooltip was the column's horizontal-overflow source;
     wrap it inside a constrained width instead. */
  white-space: normal;
  width: max-content;
  max-width: 220px;
  background: var(--text-primary);
  color: var(--bg-surface);
  font: 400 10px/1.5 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 8px;
  opacity: 0;
  transform: translateY(2px);
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.bio-link:hover::after,
.bio-link:focus-visible::after { opacity: 1; transform: none; }

.id-col__cta {
  margin-top: 40px;
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}
.id-col__nav {
  margin-top: 40px;
  border-bottom: var(--border-1) solid var(--border-hairline);
}

/* §3 — active nav row nudges right (in addition to rail + ink) */
.id-col__nav .vk-navitem,
.mobilebar__nav .vk-navitem { transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease); }
.id-col__nav .vk-navitem[aria-current="page"],
.mobilebar__nav .vk-navitem[aria-current="page"] { transform: translateX(7px); }

/* §4 — footer: label + bigger logo tiles, smaller { }, real social icons */
.id-col__foot {
  margin-top: auto;
  padding-top: 40px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.id-col__workedwith {
  font: var(--type-caption);
  letter-spacing: var(--ls-caption);
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.id-col__logos { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.id-col__footer {
  margin-top: 8px;
  padding-top: 20px;
  border-top: var(--border-1) solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.id-col__year {
  font: var(--type-label);
  letter-spacing: var(--ls-label);
  color: var(--text-secondary);
}
.id-col__mark {
  position: relative;
  font: var(--weight-mono-bold) 11px var(--font-mono);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.id-col__mark:hover { color: var(--link); }
/* §3c — machine-readable tooltip on the {} marker */
.id-col__mark::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font: var(--type-caption);
  letter-spacing: var(--ls-caption);
  text-transform: uppercase;
  color: var(--bg-surface);
  background: var(--text-primary);
  padding: 5px 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.id-col__mark:hover::after { opacity: 1; }
.id-col__social { display: flex; gap: var(--space-3); }
.id-col__social-icon {
  width: 16px; height: 16px;
  display: block;
  filter: grayscale(1);
  opacity: 0.65;
  transition: opacity var(--dur) var(--ease);
}
.vk-iconlink:hover .id-col__social-icon { opacity: 1; }

/* ---- Mobile top bar (hidden on desktop) ---- */
.mobilebar { display: none; }
.mobilebar__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-muted);
  border-bottom: var(--border-1) solid var(--border-hairline);
  position: sticky;
  top: 0;
  z-index: 20;
}
.mobilebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.mobilebar__avatar {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  object-fit: cover;
  filter: grayscale(1);
}
.mobilebar__name {
  font: var(--weight-mono-bold) 16px/1.2 var(--font-mono);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.mobilebar__menu {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: var(--border-1) solid var(--border-hairline);
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-primary);
  font: var(--type-label);
  letter-spacing: var(--ls-label);
}
.mobilebar__panel {
  background: var(--bg-muted);
  border-bottom: var(--border-1) solid var(--border-hairline);
  padding: 28px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: vk-screen-in var(--dur) var(--ease) both;
}
.mobilebar__statement .id-statement { font-size: 22px; }
.mobilebar__bio { margin: 0; }
.mobilebar__cta {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.mobilebar__nav { border-bottom: var(--border-1) solid var(--border-hairline); }
.mobilebar__logos { display: flex; gap: 12px; }

/* Tighten the canvas inset on mid-width desktops so the two-column
   content never gets crushed before the mobile collapse. */
@media (max-width: 1280px) {
  .canvas { padding: 36px 56px var(--space-9); }
}

/* ============================================================
   RESPONSIVE — collapse to a top bar + stacked content
   ============================================================ */
@media (max-width: 1024px) {
  .app { flex-direction: column; }

  /* IdentityColumn sets inline display:flex — override it. */
  .app__aside { display: none !important; }
  .mobilebar { display: block; }

  .canvas {
    padding: var(--space-6) var(--space-5) var(--space-9);
    border-left: none;
  }
  .canvas__inner,
  .canvas__inner--wide { max-width: none; }
}
