/* Render-quality fixes for dark GitHub Pages view.
   Keeps the brutalist layout, but removes fullscreen noise/glow layers that
   make text and dark backgrounds look pixelated on GitHub Pages. */

body {
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  opacity: 0;
}

body::after {
  display: none;
  opacity: 0;
  mix-blend-mode: normal;
}

/*
  Keep localized landing-page copy hidden until the final copy layer has run.
  This prevents the static English HTML and the saved language from flashing
  one after another during a reload. Layout is preserved because visibility,
  rather than display, is used. The delayed animation is a no-JS fallback.
*/
@keyframes reveal-localized-copy-fallback {
  to {
    visibility: visible;
  }
}

html:not([data-landing-copy-ready]) body:has(.hero-title) [data-i18n],
html:not([data-landing-copy-ready]) body:has(.hero-title) [data-i18n-html] {
  visibility: hidden;
  animation: reveal-localized-copy-fallback 0s 1.5s forwards;
}

/* Critical Telegram geometry lives in the render-blocking stylesheet so that
   the controls cannot flash in an unstyled state while telegram.css loads. */
.header-socials {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.telegram-channel-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.13em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 220ms ease;
}

.telegram-channel-link:hover,
.telegram-channel-link:focus-visible {
  color: var(--fg);
}

.telegram-channel-link svg,
.telegram-action svg {
  display: block;
  flex: 0 0 auto;
  transition: transform 220ms ease;
}

.telegram-channel-link:hover svg,
.telegram-channel-link:focus-visible svg,
.telegram-action:hover svg,
.telegram-action:focus-visible svg {
  transform: translate(1px, -1px);
}

.telegram-action {
  gap: 10px;
}

.memory-hero {
  background: var(--bg) !important;
  box-shadow: none !important;
}

.memory-hero::before,
.memory-hero::after {
  display: none !important;
  opacity: 0 !important;
  background-image: none !important;
  mix-blend-mode: normal !important;
}

.memory-hero [filter],
.memory-hero * {
  filter: none !important;
}

.hero-line.fill {
  color: var(--fg);
  -webkit-text-stroke: 0;
}

.hero-line.outline {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--fg);
}

/*
  The original hover target covered the entire full-screen hero. A stationary
  cursor therefore inverted the heading while the page was still loading.
  Neutralize that broad hover and keep the effect only on the heading itself.
*/
.hero:hover .hero-line.fill {
  color: var(--fg);
  -webkit-text-stroke: 0;
  transform: none;
}

.hero:hover .hero-line.outline {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--fg);
  transform: none;
}

@media (hover: hover) and (pointer: fine) {
  .hero-title:hover .hero-line.fill {
    color: transparent;
    -webkit-text-stroke: 1.5px var(--fg);
    transform: translateX(-0.02em);
  }

  .hero-title:hover .hero-line.outline {
    color: var(--fg);
    -webkit-text-stroke: 0;
    transform: translateX(0.03em);
  }
}

/*
  Large Cyrillic headings need more vertical room than the original Latin-first
  typography. Do not split words at arbitrary letters: resize or move the
  surrounding layout instead.
*/
.section h2 {
  line-height: 1.02;
  letter-spacing: -0.04em;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  text-wrap: balance;
}

html[lang="ru"] .section h2 {
  line-height: 1.06;
  letter-spacing: -0.025em;
}

/*
  The engineering-approach heading shares its row with a fixed-width panel.
  Keep the type large, but cap it to the actual width of the text column so
  long Cyrillic words do not render underneath the neighbouring panel.
*/
.evidence-grid h2 {
  font-size: clamp(40px, 3.8vw, 58px);
}

/*
  Project cards live in a two-column grid, so viewport-based heading sizes can
  outgrow the actual card. Size titles from the card itself and only split a
  word when it genuinely cannot fit at the minimum display size.
*/
.project-card {
  container-type: inline-size;
}

.project-card h3,
.project-card.long-title h3 {
  max-width: 100%;
  font-size: clamp(34px, 10cqw, 56px);
  line-height: 0.96;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  word-break: normal;
  text-wrap: pretty;
}

/*
  At laptop and small desktop widths the project filters and evidence panel
  previously squeezed headings into a narrow column. Stack these areas before
  the text starts breaking inside words.
*/
@media (max-width: 1180px) {
  .section,
  .section-heading-row,
  .evidence-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .section-label {
    padding-top: 0;
  }

  .section-heading-row,
  .evidence-grid {
    align-items: start;
  }

  .filter-bar {
    justify-content: flex-start;
    max-width: none;
  }

  .section h2 {
    max-width: 100%;
    font-size: clamp(42px, 7.2vw, 76px);
  }
}

@media (max-width: 640px) {
  .header-socials {
    gap: 10px;
  }

  .telegram-channel-link span {
    display: none;
  }

  .telegram-channel-link {
    min-width: 20px;
    justify-content: center;
  }

  .section h2 {
    font-size: clamp(34px, 12.5vw, 58px);
    line-height: 1.04;
    letter-spacing: -0.03em;
    text-wrap: pretty;
  }

  html[lang="ru"] .section h2 {
    line-height: 1.08;
    letter-spacing: -0.015em;
  }
}
