.job-layout {
  padding: 40px 0 96px;
}
/* Default size for contact telegram icon (SVG) */
.contact-top-btn .icon-telegram {
  width: 18px;
  height: 18px;
}
.job-layout .container {
  max-width: 880px;
  margin: 0 auto;
}
.job-hero {
  margin-bottom: 24px;
}
.job-badge {
  color: #cbd5e1;
  font-size: 14px;
  margin: 0 0 16px;
}
.job-title {
  margin: 0 0 12px;
  font-size: clamp(28px, 4.5vw, 44px);
  line-height: 1.15;
  font-weight: 700;
  color: #f1f5f9;
}
.job-actions {
  margin: 16px 0 28px;
}
.job-actions .btn {
  background: #38bdf8;
  color: #0b0b0b;
}
.job-section {
  margin: 28px 0;
}
.job-section h2 {
  margin: 0 0 10px;
  font-size: 18px;
  color: #cbd5e1;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.job-section ul {
  margin: 0;
  padding-left: 18px;
  color: #d1d5db;
}
.job-section li {
  margin: 8px 0;
}
/* Language badges */
.meta-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.language-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge-language {
  background: transparent;
  color: #e5e7eb;
  font-size: 11px;
  padding: 4px 10px;
  border: 0;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-language:hover {
  background: transparent;
}

/* Language-specific colors */
.badge-language.lang-js {
  color: #f7df1e;
}
.badge-language.lang-js {
  color: #f7df1e;
}
.badge-language.lang-node {
  color: #68a063;
}
.badge-language.lang-shell {
  color: #cdd5df;
}

/* New language colors */
.badge-language.lang-python {
  color: #3776ab; /* Python blue */
}
.badge-language.lang-php {
  color: #8892bf; /* PHP purple */
}
.badge-language.lang-kotlin {
  color: #7f52ff; /* Kotlin violet */
}

/* Hover: усиливаем только рамку конкретного языка */
/* hover отключен полностью */

.badge-language i {
  margin-right: 4px;
  font-size: 14px;
}
/* Новые локальные иконки */
.badge-language .lang-ico {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: -2px;
}

/* Base */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
/* Плавная прокрутка к якорям */
html {
  scroll-behavior: smooth;
}
/* Theme variables */
:root {
  --bg: hsl(222, 21%, 12%);
  --fg: #e5e7eb;
  --muted: #9ca3af;
  --card: rgba(229, 231, 235, 0.03);
  --card-border: rgba(229, 231, 235, 0.08);
  --accent: #38bdf8;
  --accent-600: #0ea5e9;
  --shadow: 0 8px 30px rgba(2, 6, 23, 0.25);
  --neon: #f59e0b; /* neon orange used for accents */
  /* Loader variables */
  --loader-bg: rgba(3, 7, 18, 0.85);
  --loader-caption: #d1d5db;
  --loader-c1: #19a68c;
  --loader-c2: #f63d3a;
  --loader-c3: #fda543;
  --loader-c4: #193b48;
  color-scheme: dark light;
  /* Global safe offset for top UI (language/contact/theme) */
  --top-safe: 56px; /* base phones */
}
html[data-theme='light']:root {
  --bg: #f7fafc;
  --fg: #0b1220;
  --muted: #64748b;
  --card: rgba(2, 6, 23, 0.02);
  --card-border: rgba(2, 6, 23, 0.08);
  --accent: #2563eb;
  --accent-600: #1d4ed8;
  --shadow: 0 8px 30px rgba(2, 6, 23, 0.08);
  /* Loader overrides for light theme */
  --loader-bg: rgba(255, 255, 255, 0.9);
  --loader-caption: #334155;
}
/* Scale safe area with viewport */
@media (min-width: 400px) { :root { --top-safe: 60px; } }
@media (min-width: 645px) { :root { --top-safe: 68px; } }
@media (min-width: 768px) { :root { --top-safe: 72px; } }
@media (min-width: 992px) { :root { --top-safe: 80px; } }

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    'Noto Sans',
    'Liberation Sans',
    Arial,
    sans-serif;
  background-color: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
}

/* Explicit heading sizing to avoid UA default changes for <h1> inside sectioning elements
   See: https://developer.mozilla.org/ru/docs/Web/HTML/Element/Heading_Elements#specifying_a_uniform_font_size_for_h1 */
h1,
section h1,
article h1,
aside h1,
nav h1 {
  font-size: 26px;
  line-height: 1.2;
  font-weight: 700;
}

.about-title {
  margin: 0 0 8px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #e2e8f0;
  text-wrap: balance;
  font-size: 26px; /* Explicit font size */
}

@media (min-width: 768px) {
  h1,
  section h1,
  article h1,
  aside h1,
  nav h1,
  .about-title { /* Grouping .about-title here */
    font-size: 32px;
  }
}

@media (min-width: 1200px) {
  h1,
  section h1,
  article h1,
  aside h1,
  nav h1,
  .about-title { /* Grouping .about-title here */
    font-size: 36px;
  }
}

html[data-theme='light'] .about-title {
  color: #0b1220;
}
/* Suppress click flash and accidental horizontal scroll */
a,
button {
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
a:focus,
button:focus {
  outline: none;
}
a:active,
button:active {
  background: transparent;
}
body {
  overflow-x: hidden;
}
/* Avoid repaints on fixed/top UI during navigation click */
.top-controls,
.top-left-controls,
.hero {
  backface-visibility: hidden;
  will-change: transform;
}
html[data-theme='light'] body {
  background-color: var(--bg);
  color: var(--fg);
}
/* Minimal page loader overlay */
.page-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--loader-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 1;
  transition: opacity 220ms ease;
  z-index: 2000;
}
html[data-theme='light'] .page-loader { background: var(--loader-bg); }
html.loading { overflow: hidden; }

.page-loader.is-hiding { opacity: 0; }

/* Custom 4-hr spinner + caption */
.page-loader .loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.page-loader .load {
  border: 1px solid transparent; /* keep box-size similar to provided snippet */
  padding: 5px;
  position: relative;
  top: 0;
  left: 0;
  transform-origin: center center;
  transform: rotate(135deg);
  width: 50px;
  height: 50px;
}
.page-loader .load hr {
  border: 0;
  margin: 0;
  width: 40%;
  height: 40%;
  position: absolute;
  border-radius: 50%;
  animation: orbit 2s ease infinite;
}
.page-loader .load :first-child { background: var(--loader-c1); animation-delay: -1.5s; }
.page-loader .load :nth-child(2) { background: var(--loader-c2); animation-delay: -1s; }
.page-loader .load :nth-child(3) { background: var(--loader-c3); animation-delay: -0.5s; }
.page-loader .load :last-child { background: var(--loader-c4); }
@keyframes orbit {
  0%,100% { transform: translateX(200%); }
  25% { transform: translateY(200%); }
  50% { transform: translateX(0); }
  75% { transform: translateY(0); }
}
.page-loader .loader-caption {
  margin-top: 12px;
  font-size: 12px;
  color: var(--loader-caption);
  opacity: 0.9;
}
html[data-theme='light'] .page-loader .loader-caption { color: var(--loader-caption); opacity: 0.9; }
.serif {
  font-family: ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;
}
.container {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Main layout */
main {
  flex: 1;
}

/* Prevent flash before JS-driven reveal */
html.js .about,
html.js .projects,
html.js .project-hero,
html.js .project-details,
html.js #prj-sections {
  opacity: 0;
  transform: translateY(20px);
}

/* Hero image block */
.hero {
  position: relative;
  display: block;
  overflow: hidden;
  /* solid background to avoid any transparent flash under image */
  background-color: var(--bg);
}
/* Theme toggle button */
.theme-toggle {
  position: absolute;
  top: 24px;
  right: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(2, 6, 23, 0.35);
  color: #e6f9ff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
  z-index: 10;
  box-shadow: none;
}
.theme-toggle:hover {
  color: #ffffff;
  background: rgba(2, 6, 23, 0.5);
  border-color: rgba(255, 255, 255, 0.24);
  transform: none;
  box-shadow: none;
}
.theme-toggle:active {
  background: rgba(2, 6, 23, 0.65);
  border-color: rgba(255, 255, 255, 0.32);
  transform: none;
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.theme-icon {
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  /* SVG size for sun/moon */
  width: 20px;
  height: 20px;
  display: inline-block;
}
.theme-icon.sun {
  opacity: 1;
  transform: rotate(0deg);
  color: #f59e0b; /* жёлто-оранжевый для солнца */
}
.theme-icon.moon {
  opacity: 0;
  transform: rotate(-90deg);
  position: absolute;
  color: #3b82f6; /* синий для луны */
}
html[data-theme='light'] .theme-toggle {
  background: rgba(247, 250, 252, 0.6);
  color: #0b1220;
  border-color: rgba(2, 6, 23, 0.12);
}
html[data-theme='light'] .theme-toggle:hover {
  background: rgba(247, 250, 252, 0.8);
  border-color: rgba(2, 6, 23, 0.18);
}
html[data-theme='light'] .theme-toggle:active {
  background: rgba(247, 250, 252, 0.95);
  border-color: rgba(2, 6, 23, 0.24);
}
html[data-theme='light'] .theme-icon.sun {
  opacity: 0;
  transform: rotate(90deg);
}
html[data-theme='light'] .theme-icon.moon {
  opacity: 1;
  transform: rotate(0deg);
}
.top-controls,
.top-left-controls {
  transition: visibility 0s linear 0s;
}
/* Prevent initial left->right jump on mobile: hide controls until JS marks ready */
html.js:not(.top-ui-ready) .top-controls,
html.js:not(.top-ui-ready) .top-left-controls {
  visibility: hidden;
}

/* Smooth intro animation for top icons (Language, Contact, Theme) */
/* Initial state before UI is marked ready */
html.js:not(.top-ui-ready) .top-left-controls #langToggle,
html.js:not(.top-ui-ready) .top-controls .contact-top-btn,
html.js:not(.top-ui-ready) .top-controls #themeToggle {
  opacity: 0;
  transform: translateY(-8px);
}

/* Animated state once UI is ready */
html.js.top-ui-ready .top-left-controls #langToggle,
html.js.top-ui-ready .top-controls .contact-top-btn,
html.js.top-ui-ready .top-controls #themeToggle {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.28s ease,
    transform 0.28s ease;
}

/* Stagger the appearance for a nicer effect */
html.js.top-ui-ready .top-left-controls #langToggle {
  transition-delay: 40ms;
}
html.js.top-ui-ready .top-controls .contact-top-btn {
  transition-delay: 90ms;
}
html.js.top-ui-ready .top-controls #themeToggle {
  transition-delay: 140ms;
}
.language-top-btn {
  position: absolute;
  top: 24px;
  right: 76px;
  height: 40px;
  padding: 0 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #e6f9ff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: none;
  box-shadow: none;
  transition: color 0.2s ease;
}
.language-top-btn:hover {
  background: transparent;
  transform: none;
  box-shadow: none;
}
.language-top-btn:active {
  transform: none;
}
.language-top-btn .lang-code {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
}
/* Size for translate (language) icon */
.language-top-btn .icon-translate {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: -2px;
}
html[data-theme='light'] .language-top-btn {
  background: transparent;
  color: #0b1220;
  border-color: transparent;
}
html[data-theme='light'] .language-top-btn:hover {
  background: transparent;
}
.contact-top-btn {
  position: absolute;
  top: 24px;
  right: 128px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  background: rgba(2, 6, 23, 0.35);
  color: #e6f9ff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(6px);
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
  box-shadow: none;
}
.contact-top-btn:hover {
  color: #ffffff;
  background: rgba(2, 6, 23, 0.5);
  border-color: rgba(255, 255, 255, 0.24);
  transform: none;
  box-shadow: none;
}
.contact-top-btn:active {
  background: rgba(2, 6, 23, 0.65);
  border-color: rgba(255, 255, 255, 0.32);
  transform: none;
}
html[data-theme='light'] .contact-top-btn {
  background: rgba(247, 250, 252, 0.6);
  color: #0b1220;
  border-color: rgba(2, 6, 23, 0.12);
}
html[data-theme='light'] .contact-top-btn:hover {
  background: rgba(247, 250, 252, 0.8);
  border-color: rgba(2, 6, 23, 0.18);
}
html[data-theme='light'] .contact-top-btn:active {
  background: rgba(247, 250, 252, 0.95);
  border-color: rgba(2, 6, 23, 0.24);
}
.hero-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--hero-ratio, 21 / 9);
  max-height: 62vh; /* limit image height to keep below content visible */
  object-fit: cover; /* fill width while respecting max-height */
  opacity: 0;
  transition:
    opacity 0.6s ease-in-out,
    transform 0.6s ease;
  transform: translateY(4px);
  will-change: transform, opacity;
  border-radius: 0;
}
.hero-img.is-visible {
  opacity: 1;
  transform: translateY(var(--hero-ty, 0px));
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.12) 0%,
    rgba(0, 0, 0, 0.45) 60%,
    var(--bg) 100%
  );
  pointer-events: none;
}
html[data-theme='light'] .hero::after {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(247, 250, 252, 0.85) 85%,
    #f7fafc 100%
  );
}
/* keep hero solid in light theme as well */
html[data-theme='light'] .hero {
  background-color: var(--bg);
}
/* Content overlay on hero (project page) */
.hero-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  padding: 0; /* padding handled by inner container to account for top-safe */
  pointer-events: none;
  z-index: 1;
}
/* Top controls: right group (Contact + Theme) */
.top-controls {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  pointer-events: auto;
  z-index: 10;
}
.top-controls .top-link {
  display: inline-block;
  padding: 8px 12px;
  color: #e6f9ff;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(2, 6, 23, 0.35);
  backdrop-filter: blur(6px);
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
}
.top-controls .top-link.icon-only {
  /* квадратная компактная кнопка под иконку: 40x40 */
  padding: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.top-controls .top-link .icon {
  width: 18px;
  height: 18px;
  display: block;
}
.top-controls .top-link:hover {
  color: #ffffff;
  text-decoration: none;
  background: rgba(2, 6, 23, 0.5);
  border-color: rgba(255, 255, 255, 0.24);
}
.top-controls .top-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.top-controls .top-link:active {
  background: rgba(2, 6, 23, 0.65);
  border-color: rgba(255, 255, 255, 0.32);
}
html[data-theme='light'] .top-controls .top-link {
  color: #0b1220;
  background: rgba(247, 250, 252, 0.6);
  border-color: rgba(2, 6, 23, 0.12);
}
html[data-theme='light'] .top-controls .top-link:hover {
  color: #0b1220;
  background: rgba(247, 250, 252, 0.8);
  border-color: rgba(2, 6, 23, 0.18);
}
html[data-theme='light'] .top-controls .top-link:active {
  background: rgba(247, 250, 252, 0.95);
  border-color: rgba(2, 6, 23, 0.24);
}
.top-controls .contact-top-btn,
.top-controls .theme-toggle {
  position: static;
}
.top-controls .language-top-btn {
  position: static;
}

/* Top controls: left group (Language) */
.top-left-controls {
  position: absolute;
  top: 24px;
  left: 24px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap; /* keep items in one row */
  gap: 12px; /* space between language and back-link */
  pointer-events: auto;
  z-index: 10;
}
.top-left-controls .language-top-btn {
  position: static;
}
/* Language dropdown */
.language-top-btn .lang-caret {
  margin-left: 6px;
  width: 10px;
  height: 10px;
  opacity: 0.8;
  display: inline-block;
  vertical-align: -1px;
}
.top-left-controls {
  position: absolute;
}
/* Back link next to language (keep inline on hero) */
.top-left-controls .back-link {
  margin: 0 0 0 8px; /* left indent from language button */
  white-space: nowrap; /* never wrap */
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  background: transparent;
  color: #e6f9ff;
  border: none;
  border-radius: 12px;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s ease;
}
.top-left-controls .back-link:hover {
  color: #ffffff;
}
html[data-theme='light'] .top-left-controls .back-link {
  color: #0b1220;
}
html[data-theme='light'] .top-left-controls .back-link:hover {
  color: #0b1220;
}

/* Back icon button (mobile): same style as .top-controls .top-link.icon-only */
.top-left-controls .top-link {
  display: inline-block;
  padding: 8px 12px;
  color: #e6f9ff;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(2, 6, 23, 0.35);
  backdrop-filter: blur(6px);
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
}
.top-left-controls .top-link.icon-only {
  padding: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.top-left-controls .top-link .icon { width: 18px; height: 18px; display: block; }
.top-left-controls .top-link:hover {
  color: #ffffff;
  text-decoration: none;
  background: rgba(2, 6, 23, 0.5);
  border-color: rgba(255, 255, 255, 0.24);
}
.top-left-controls .top-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.top-left-controls .top-link:active { background: rgba(2, 6, 23, 0.65); border-color: rgba(255, 255, 255, 0.32); }
html[data-theme='light'] .top-left-controls .top-link {
  color: #0b1220;
  background: rgba(247, 250, 252, 0.6);
  border-color: rgba(2, 6, 23, 0.12);
}
html[data-theme='light'] .top-left-controls .top-link:hover { color: #0b1220; background: rgba(247, 250, 252, 0.8); border-color: rgba(2, 6, 23, 0.18); }
html[data-theme='light'] .top-left-controls .top-link:active { background: rgba(247, 250, 252, 0.95); border-color: rgba(2, 6, 23, 0.24); }

/* Responsive toggle: desktop shows text back-link, mobile shows icon back-mobile */
.top-left-controls .back-mobile { display: none; }
@media (max-width: 767.98px) {
  .top-left-controls .back-link { display: none; }
  .top-left-controls .back-mobile { display: inline-flex; }
}
/* generic dropdown styles (work regardless of parent) */
.lang-menu {
  display: none;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.5);
}
.lang-menu.open {
  display: block;
}
.lang-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  color: #e2e8f0;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.lang-item:hover {
  background: transparent;
  color: inherit;
}
html[data-theme='light'] .lang-menu {
  background: rgba(247, 250, 252, 0.9);
  border-color: rgba(2, 6, 23, 0.08);
}
html[data-theme='light'] .lang-item {
  color: #0b1220;
}
html[data-theme='light'] .lang-item:hover {
  background: transparent;
  color: #0b1220;
}
.hero-content .container {
  /* Ensure content sits below the top controls across all viewports */
  padding-top: calc(var(--top-safe) + 8px);
  pointer-events: auto;
}
/* Page title in hero (used on donate page) */
.page-title {
  margin: 0 0 8px;
  font-weight: 700;
  line-height: 1.2;
  font-size: clamp(26px, 4.2vw, 36px);
  letter-spacing: 0.01em;
  color: #e2e8f0;
  text-wrap: balance;
}
html[data-theme='light'] .page-title { color: #0b1220; }
/* Donate page: multiline description in hero should honor \n breaks */
.hero .page-desc {
  white-space: pre-line;
  color: #ffffff;
  margin: 8px 0 22px; /* больше отступа от карточек на узких экранах */
  font-size: 14px;
  line-height: 1.85;
}
html[data-theme='light'] .hero .page-desc {
  color: #000000;
}
@media (min-width: 768px) {
  .hero .page-desc {
    font-size: 16px;
    margin: 8px 0 18px; /* десктоп ближе к герою */
  }
}
/* Узкие экраны: ещё больше воздуха под описанием, чтобы карточки не подходили близко */
@media (max-width: 699.98px) {
  .hero .page-desc { margin-bottom: 32px; }
}
/* Sitemap panel (uses existing list-head + lists) */
.sitemap {
  margin-top: -120px; /* нависаем на герое без исчезновения на десктопе */
  padding: 16px 18px;
  border-radius: 14px;
  background: transparent;
  backdrop-filter: none;
  border: none;
  box-shadow: none;
  position: relative; /* гарантируем корректный порядок наложения */
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    'head1 head2'
    'list1 list2';
  gap: 12px 24px;
}
.sitemap .list-head {
  margin: 0;
  padding-top: 4px;
}
.sitemap .head-title {
  display: inline-block;
  font-weight: 700;
  color: #e2e8f0;
  border-bottom: 1px solid rgba(229, 231, 235, 0.28);
  padding-bottom: 2px;
}
.sitemap .list {
  margin: 0;
  padding: 0;
  list-style: none; /* без маркеров */
  display: grid;
  grid-template-columns: 1fr; /* одна колонка внутри секции, чтобы карточки были одинаковой ширины */
  gap: 8px;
}
.sitemap .list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04); /* подложка */
  border: 1px solid var(--card-border);
  color: var(--fg); /* make text color explicit so links inheriting are visible */
}
.sitemap .list .item-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.sitemap .list a {
  color: inherit; /* inherit from theme context */
}
/* Dark theme: explicit light link color */
html[data-theme='dark'] .sitemap .list a {
  color: #e5e7eb;
}
html[data-theme='dark'] .sitemap .list a:hover {
  color: #fff;
}
.sitemap .platform-mini {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

/* Иконка проекта */
.sitemap .proj-item .proj-icon {
  font-size: 16px;
  line-height: 1;
  color: #93c5fd; /* светло-голубой акцент */
  opacity: 0.9;
}

/* Мини-бейджи языков */
.lang-badges-mini {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.lang-ico-mini {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
}
.lang-tag-mini {
  display: inline-block;
  padding: 2px 6px;
  font-size: 12px;
  line-height: 1;
  border-radius: 6px;
  color: #d1d5db;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
}

/* Grid placement by existing order */
.sitemap > .list-head:nth-of-type(1) {
  grid-area: head1;
}
.sitemap > .list-head:nth-of-type(2) {
  grid-area: head2;
}
.sitemap > #sitemap-pages {
  grid-area: list1;
}
.sitemap > #sitemap-projects {
  grid-area: list2;
}
.quick-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: flex-end;
  gap: 14px;
}
.quick-links a.link {
  border-bottom-color: rgba(229, 231, 235, 0.35);
}
html[data-theme='light'] .sitemap .head-title {
  color: #0b1220;
  border-bottom-color: rgba(2, 6, 23, 0.16);
}
html[data-theme='light'] .sitemap .list li {
  background: rgba(2, 6, 23, 0.04);
}
/* Light theme: enforce readable text color across sitemap section */
html[data-theme='light'] .sitemap {
  color: #0b1220;
}
html[data-theme='light'] .sitemap .list .item-left,
html[data-theme='light'] .sitemap .list .platform-mini {
  color: #0b1220;
}
/* Light theme: ensure high-contrast link text */
html[data-theme='light'] .sitemap .list a {
  color: #0b1220 !important;
}
html[data-theme='light'] .sitemap .list a:hover {
  color: #0b1220 !important;
}
html[data-theme='light'] .sitemap .list a:visited {
  color: #0b1220 !important;
}
.muted {
  color: var(--muted);
}
/* Projects page: distinct layout */
.projects .section-subtitle {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.projects .projects-toolbar {
  margin: 8px 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.projects .projects-toolbar .toolbar-label {
  font-size: 12px;
  color: var(--muted);
  margin-right: 8px;
}
.projects .projects-toolbar .toolbar-select,
.projects .projects-toolbar .toolbar-input {
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--fg);
}
.projects .projects-toolbar .toolbar-input::placeholder { color: var(--muted); }
.projects .projects-toolbar .toolbar-left,
.projects .projects-toolbar .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
@media (max-width: 640px) {
  .projects .projects-toolbar { flex-direction: column; align-items: stretch; }
  /* Строим группы столбцом для лучшей мобильной читаемости */
  .projects .projects-toolbar .toolbar-left,
  .projects .projects-toolbar .toolbar-right {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  /* Одинаковые размеры элементов управления */
  .projects .projects-toolbar .toolbar-select,
  .projects .projects-toolbar .toolbar-input {
    width: 100%;
  }
}

/* Projects grid list */
.projects .projects-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) { .projects .projects-list { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .projects .projects-list { grid-template-columns: 1fr 1fr; } }

.projects .projects-list .projects-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    'title meta'
    'langs updated';
  gap: 8px 10px;
  padding: 14px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
}
.projects .projects-list .projects-row > a.item-link { grid-area: title; font-weight: 700; color: inherit; text-decoration: none; }
.projects .projects-list .projects-row > a.item-link:hover { text-decoration: underline; }
.projects .projects-list .projects-row > .language-badges { grid-area: langs; }
.projects .projects-list .projects-row > .meta { grid-area: meta; justify-self: end; color: var(--muted); }
.projects .projects-list .projects-row > .updated-time { grid-area: updated; justify-self: end; color: var(--muted); font-size: 12px; }

/* Projects page: align language badges under title to the left and reduce extra spacing */
.projects .projects-list .projects-row > .language-badges {
  justify-content: flex-start; /* override global flex-end */
  justify-self: start; /* align the badges block to the left grid edge under the title */
}

/* Projects page: lift the section upward to overlap background (only on projects page) */
.projects-page .projects {
  margin-top: -140px; /* raised additional 80px */
  position: relative;
  z-index: 2;
}
@media (min-width: 768px) {
  .projects-page .projects { margin-top: -170px; /* raised additional 80px */ }
}
@media (min-width: 1200px) {
  .projects-page .projects { margin-top: -190px; /* raised additional 80px */ }
}

html[data-theme='light'] .projects .projects-toolbar { background: rgba(2, 6, 23, 0.02); }
html[data-theme='light'] .projects .projects-list .projects-row { background: rgba(2, 6, 23, 0.04); }
/* Utility */
.center { text-align: center; }
/* remove initial top offset of hero image on project page */
.project .hero-img {
  transform: translateY(0);
}

/* About (content under hero) */
.about {
  padding: 40px 0 52px;
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
  margin-top: -92px;
  position: relative;
  z-index: 2;
}
.about .container {
  position: relative;
}

/* Safe wrapping for values inside detail blocks (used on donate page too) */
.project-content .detail-item { min-width: 0; }
.project-content .detail-value {
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
}

/* Coffee page specific styles */
.coffee-page #donation.about {
  margin-top: 0;
  position: relative;
  z-index: 1;
}

/* Coffee page animations */
.coffee-page .page-title {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.8s ease-out 0.2s forwards;
}

.coffee-page .page-desc {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.8s ease-out 0.5s forwards;
}

.coffee-page #donation.about {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.8s ease-out 0.8s forwards;
}

.coffee-page .project-content section:nth-child(1) {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.6s ease-out 1.1s forwards;
}

.coffee-page .project-content section:nth-child(2) {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.6s ease-out 1.3s forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hide content initially until i18n is ready */
.coffee-page:not(.i18n-ready) [data-i18n] {
  visibility: hidden;
}
.coffee-page #donation .details-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.coffee-page .detail-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.coffee-page .detail-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.3px;
}
.coffee-page .project-content section h3 {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--fg);
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
}
.coffee-page .qr { margin-top: 10px; }
.coffee-page .qr img {
  display: block;
  width: 180px;
  height: 180px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
}
.coffee-page .qr p { margin: 8px 0 0; }

/* Button copied state */
.btn.copied {
  background: #10b981 !important;
  border-color: #10b981 !important;
  color: white !important;
  transition: all 0.3s ease;
}

/* Mobile fixes for coffee page */
@media (max-width: 700px) {
  .coffee-page .hero-content {
    position: absolute !important;
    top: 60px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    margin-top: 0 !important;
    padding: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }
  
  .coffee-page .hero-content .container {
    padding: 20px !important;
  }
  
  .coffee-page .page-title {
    font-size: 24px !important;
    margin-bottom: 12px !important;
  }
  
  .coffee-page .page-desc {
    font-size: 14px !important;
    line-height: 1.4 !important;
    display: block !important;
    overflow: visible !important;
    white-space: normal !important;
    text-overflow: clip !important;
  }

  /* Выравнивание кнопок в мобильной версии */
  .coffee-page .top-left-controls {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .coffee-page .top-left-controls .back-link {
    margin: 0;
  }
}

@media (max-width: 480px) {
  .coffee-page .hero-content .container {
    padding: 16px !important;
  }
  
  .coffee-page .page-title {
    font-size: 20px !important;
  }
  
  .coffee-page .page-desc {
    font-size: 11px !important;
  }
  
  .coffee-page .hero-content {
    top: 50px !important;
  }
}

@media (max-width: 400px) {
  .coffee-page .hero-content .container {
    padding: 12px !important;
  }
  
  .coffee-page .page-title {
    font-size: 18px !important;
    margin-bottom: 8px !important;
  }
  
  .coffee-page .page-desc {
    font-size: 12px !important;
  }
  
  .coffee-page .hero-content {
    top: 45px !important;
  }
}

/* Desktop layout */
@media (min-width: 1025px) {
  .coffee-page #donation .details-grid { grid-template-columns: 1fr 1fr; }
  .coffee-page #donation.about { margin-top: 28px; }
}
/* Phones/Tablets: ensure gap under hero so text isn't clipped (400–768px) */
@media (min-width: 400px) and (max-width: 767.98px) {
  /* Bigger, adaptive separation between hero overlay and donation block */
  .coffee-page #donation.about { margin-top: clamp(180px, 10svh, 180px); }
  .coffee-page .hero { overflow: visible; }
  /* Extra space to avoid any visual seam on small tablets */
  .coffee-page .hero-content { padding-bottom: 36px !important; }
}
/* Portrait override: reduce gap so it's not too large on tall phones */
@media (min-width: 400px) and (max-width: 767.98px) and (orientation: portrait) {
  .coffee-page #donation.about { margin-top: clamp(88px, 8svh, 140px); }
}
@media (max-width: 399.98px) {
  .coffee-page #donation.about { margin-top: 24px; }
}
/* Project page: raise hero overlay into image and hide seam (400–768px) */
@media (min-width: 400px) and (max-width: 767.98px) {
  /* Pull overlay up a bit */
  .project .hero-content .container {
    /* Keep safe top offset even on small tablets */
    padding-top: calc(var(--top-safe) + 4px) !important;
  }
  .project .hero-content .project-hero {
    margin-top: clamp(-70px, -16vh, -220px); /* adaptive lift into the hero */
  }
  /* Ensure overlay can extend beyond image crop if needed */
  .project .hero { overflow: visible; }
  /* Strengthen gradient to cover image edge line */
  .project .hero::after {
    background: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0) 0%,
      rgba(0, 0, 0, 0.55) 52%,
      var(--bg) 100%
    );
  }
}
/* Reduce negative overlap below hero on phones/tablets */
@media (min-width: 400px) and (max-width: 991.98px) {
  .about { margin-top: -56px; }
  .hero-img { max-height: 58vh; }
}
/* Tight mid-range where overlaps were reported (global tune) */
@media (min-width: 645px) and (max-width: 766.98px) {
  .about { margin-top: -32px; }
  .hero-img { max-height: 52vh; }
}

/* Project page only: fix container overlap in 645–855px range */
@media (min-width: 645px) and (max-width: 855.98px) {
  /* Keep overlay in normal flow to avoid overlapping the below container */
  .project .hero-content {
    position: static !important;
    padding: 12px 0 8px !important;
  }
  /* Cancel negative lift on this range */
  .project .hero-content .project-hero {
    margin-top: 0 !important;
  }
  /* Ensure safe gap from top controls */
  .project .hero-content .container {
    padding-top: calc(var(--top-safe) + 8px) !important;
  }
  /* Allow hero to extend if needed without clipping */
  .project .hero {
    overflow: visible !important;
  }
}
@media (min-width: 992px) {
  .about {
    margin-top: -120px;
  }
  .sitemap .platform-mini {
    font-size: 12px;
  }
  /* Desktop: keep top controls visible while scrolling */
  .top-controls {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 24px);
    right: 24px;
    z-index: 1000;
    transition:
      transform 0.25s ease,
      opacity 0.25s ease;
  }
  .top-left-controls {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 24px);
    left: 24px;
    z-index: 1000;
    transition:
      transform 0.25s ease,
      opacity 0.25s ease;
  }
  /* Hidden state when scrolling down */
  html.top-ui-hidden .top-controls,
  body.top-ui-hidden .top-controls,
  html.top-ui-hidden .top-left-controls,
  body.top-ui-hidden .top-left-controls {
    transform: translateY(-80px);
    opacity: 0;
    pointer-events: none;
  }
  /* Project page: tighten gap between hero and details */
  .project-hero {
    margin-bottom: 48px;
  }
  .project-details {
    margin-top: -72px;
  }
}

/* Project page: lower hero overlay to avoid excess empty space on mid/desktop */
@media (min-width: 856px) and (max-width: 1199.98px) {
  .project .hero-content .project-hero {
    margin-top: clamp(56px, 0vh, 180px);
  }
}
@media (min-width: 1200px) {
  .project .hero-content .project-hero {
    margin-top: clamp(64px, 0vh, 220px);
  }
}

/* Mobile/tablet adjustments to avoid overlaps */
@media (max-width: 991.98px) {
  .top-controls {
    top: 12px;
    right: 12px;
    display: flex;
    flex-wrap: nowrap;
  }
  .top-left-controls {
    top: 12px;
    left: 12px;
  }

  .language-top-btn {
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
  }
  .language-top-btn .lang-code {
    font-size: 13px;
  }
  .language-top-btn .icon-translate {
    width: 14px;
    height: 14px;
  }
  .language-top-btn .lang-caret {
    display: none; /* hide caret on mobile */
  }

  .contact-top-btn {
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    gap: 6px;
  }
  .contact-top-btn span {
    display: none;
  }

  .theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  .theme-toggle .theme-icon {
    width: 18px;
    height: 18px;
  }
  /* Компактная иконка-ссылка (например, кофе) */
  .top-controls .top-link.icon-only {
    padding: 0;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .top-controls .top-link.icon-only .icon {
    width: 18px;
    height: 18px;
  }
  .contact-top-btn .icon-telegram {
    width: 20px;
    height: 20px;
  }
  /* spacing handled by .top-controls gap */
  /* when moved to left on mobile, keep gaps between items */
  .top-left-controls .contact-top-btn {
    margin-left: 8px;
  }
  .top-left-controls .theme-toggle {
    margin-left: 8px;
  }

  /* Ensure hero content (back link) doesn't collide with top controls */
  .hero-content .container {
    padding-top: 84px;
  }
  /* Sitemap: 1 колонка на планшетах */
  .sitemap {
    margin-top: -80px;
    grid-template-columns: 1fr;
    grid-template-areas:
      'head1'
      'list1'
      'head2'
      'list2';
    gap: 10px 14px;
    padding: 12px 14px;
    border-radius: 12px;
  }
}
.about .container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px;
}

.about .about-inner {
  max-width: 980px; /* расширяем под 2 колонки */
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.about h1 {
  margin: 0 0 8px;
  font-weight: 700;
  line-height: 1.2;
  font-size: 26px;
  letter-spacing: 0.01em;
  color: #e2e8f0;
  text-wrap: balance;
}
.about p {
  margin: 0;
  color: #d1d5db;
  font-size: 16px;
  line-height: 1.85;
}
html[data-theme='light'] .about h1 {
  color: #0b1220;
}
html[data-theme='light'] .about p {
  color: #334155;
}
.about p + p {
  margin-top: 16px;
}
.about p:first-of-type {
  color: #e5e7eb;
  font-size: 16px;
}
.about p.signature {
  margin-top: 20px;
  color: #cbd5e1;
}
.about hr {
  height: 2px;
  border: none;
  margin: 28px 0 0;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #ff0040 0%,
    #ff8c00 12%,
    #fffb00 24%,
    #00ff85 36%,
    #00e1ff 48%,
    #0066ff 60%,
    #7a00ff 72%,
    #ff00e6 84%,
    #ff0040 100%
  );
  background-size: 300% 100%;
  /* плавное движение без рывка на цикле */
  animation: neon-rainbow 6s linear infinite alternate;
  /* затухание по краям */
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 10%, #000 90%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 10%, #000 90%, transparent 100%);
  box-shadow:
    0 0 10px rgba(255, 105, 0, 0.35),
    0 0 18px rgba(255, 105, 0, 0.25);
}
html[data-theme='light'] .about hr {
  box-shadow:
    0 0 8px rgba(255, 105, 0, 0.25),
    0 0 14px rgba(255, 105, 0, 0.18);
}

/* About: двухколоночная сетка */
.about-grid {
  display: grid;
  gap: 20px;
}
@media (min-width: 992px) {
  .about-grid {
    grid-template-columns: 1fr 1fr;
    align-items: stretch; /* растягиваем обе колонки по одной высоте */
  }
}
.about-col {
  min-width: 0;
}

/* Skills блок справа */
.skills-col h2 {
  margin: 0 0 10px;
  font-size: 18px;
  color: var(--fg);
  font-weight: 600;
}
.skills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.skills li {
  display: grid;
  grid-template-columns: auto auto 1fr auto; /* icon | label | bar | % */
  align-items: center;
  gap: 10px;
}
.skills li .skill-ico {
  width: 16px;
  height: 16px;
  display: inline-block;
  border-radius: 3px;
  color: var(--fg);
}
.skills li .skill-ico svg {
  width: 100%;
  height: 100%;
  display: block;
  color: inherit;
}
.skills li span {
  white-space: nowrap;
  color: var(--fg);
  font-weight: 600;
}
.skills li .pct {
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.skills li i {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  overflow: hidden;
}
.skills li i::after {
  content: '';
  position: absolute;
  inset: 0;
  width: calc(var(--p, 0) * 1%);
  background: linear-gradient(90deg, var(--accent), var(--accent-600)); /* fallback: accent */
  border-radius: inherit;
}
html[data-theme='light'] .skills li i {
  background: rgba(2, 6, 23, 0.12);
}

/* Стартовое состояние до появления: ширина 0 */
.skills.pending li i::after {
  width: 0 !important;
}

/* Анимация запускается только при добавлении класса */
.skills.animating li i::after {
  animation: skill-fill 4s ease forwards;
}

@keyframes skill-fill {
  from {
    width: 0;
  }
  to {
    width: calc(var(--p, 0) * 1%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skills li i::after,
  .skills.animating li i::after {
    animation: none;
    width: calc(var(--p, 0) * 1%);
  }
}

/* Цвета прогресс-бара по уровню */
.skills li i.lvl-high::after {
  background: linear-gradient(90deg, #22c55e, #16a34a); /* green */
}
.skills li i.lvl-mid::after {
  background: linear-gradient(90deg, #f59e0b, #d97706); /* orange */
}
.skills li i.lvl-low::after {
  background: linear-gradient(90deg, #ef4444, #dc2626); /* red */
}

/* Mini Terminal */
.mini-terminal {
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(2, 6, 23, 0.55);
  overflow: hidden;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
    monospace;
}
html[data-theme='light'] .mini-terminal {
  border-color: rgba(2, 6, 23, 0.12);
  background: rgba(241, 245, 249, 0.8);
}
.mini-terminal .term-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.15);
}
html[data-theme='light'] .mini-terminal .term-head {
  background: rgba(0, 0, 0, 0.05);
}
.mini-terminal .term-head .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.mini-terminal .term-head .dot.red {
  background: #ef4444;
}
.mini-terminal .term-head .dot.yellow {
  background: #f59e0b;
}
.mini-terminal .term-head .dot.green {
  background: #22c55e;
}
.mini-terminal .term-head .title {
  margin-left: auto;
  color: #9ca3af;
  font-size: 12px;
}
.mini-terminal .term-body {
  margin: 0;
  padding: 8px 10px 10px;
  max-height: 110px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.4;
  color: #e5e7eb;
}
html[data-theme='light'] .mini-terminal .term-body {
  color: #111827;
}
.mini-terminal .prompt {
  color: #60a5fa;
}
.mini-terminal .cmd {
  color: #fde68a;
}
.mini-terminal .out {
  color: #a7f3d0;
}
.mini-terminal .dim {
  color: #9ca3af;
}

/* Всегда тёмная тема для мини-терминала (даже в светлой теме сайта) */
html[data-theme='light'] .mini-terminal {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(2, 6, 23, 0.55);
}
html[data-theme='light'] .mini-terminal .term-head {
  background: rgba(0, 0, 0, 0.15);
}
html[data-theme='light'] .mini-terminal .term-body {
  color: #e5e7eb;
}

/* Выровнять терминал по началу полосы (3-я колонка сетки .skills) */
.skills li.terminal-row > .mini-terminal {
  grid-column: 3 / 4;
}

/* Скрыть терминал на экранах < 900px */
@media (max-width: 899.98px) {
  .skills li.terminal-row,
  .skills li.terminal-row > .mini-terminal,
  .skills .mini-terminal {
    display: none !important;
  }
}

/* Глобальный тонкий скроллбар */
html {
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: rgba(148, 163, 184, 0.6) transparent;
}
/* WebKit */
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.6);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(148, 163, 184, 0.8);
}

@keyframes neon-rainbow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

/* Projects section */
.projects {
  padding: 28px 0 96px;
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}
.projects .container {
  max-width: 980px;
  margin: 0 auto;
}
.projects .section-title {
  margin: 0 0 24px;
  font-weight: 600;
  line-height: 1.1;
  font-size: clamp(24px, 3.5vw, 36px);
}
.projects .list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.projects .projects-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px 260px minmax(0, 1fr);
  align-items: center;
  gap: 12px 16px;
  padding: 0 6px 6px;
  color: #9ca3af;
  font-size: 12px;
  line-height: 1.2;
  text-transform: none;
  user-select: none;
}
.projects .projects-head > span {
  position: relative;
}
.projects .projects-head > span::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -6px;
  width: 80%;
  max-width: 160px;
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0) 0%,
    rgba(148, 163, 184, 0.35) 50%,
    rgba(148, 163, 184, 0) 100%
  );
  pointer-events: none;
}
.projects .projects-head .head-title {
  justify-self: start;
}
.projects .projects-head .head-langs {
  justify-self: center;
}
.projects .projects-head .head-updated {
  justify-self: center;
}
.projects .projects-head .head-meta {
  justify-self: end;
}
.projects .row {
  /* Ровная четырёхколоночная сетка: title | badges | meta | updated */
  display: grid;
  /* Фиксируем ширины 2-й и 3-й колонок для стабильного выравнивания */
  grid-template-columns: minmax(0, 1fr) 200px 260px minmax(0, 1fr);
  align-items: center;
  gap: 12px 16px;
  padding: 12px 6px;
  border-radius: 10px;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  contain: paint;
}
.projects .row:hover {
  background: transparent;
  transform: none;
  box-shadow: none;
}
.projects .item-link {
  position: relative;
  color: #e5e7eb;
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(229, 231, 235, 0.3);
  padding-right: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  justify-self: start;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  backface-visibility: hidden;
  transform: translateZ(0);
  will-change: transform;
}
/* Updated time (4-я колонка) */
.projects .updated-time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
html[data-theme='light'] .projects .updated-time {
  color: #475569;
}
.projects .item-link::after {
  /* remove external-link arrow */
  content: none;
}
.projects .item-link {
  position: relative;
  border-bottom-color: transparent; /* disable default underline color */
}
.projects .item-link::before {
  content: '';
  position: absolute;
  left: 0;
  transform: none;
  bottom: -1px;
  height: 2px;
  width: 100%;
  background: linear-gradient(
    90deg,
    #ff0040 0%,
    #ff8c00 12%,
    #fffb00 24%,
    #00ff85 36%,
    #00e1ff 48%,
    #0066ff 60%,
    #7a00ff 72%,
    #ff00e6 84%,
    #ff0040 100%
  );
  background-size: 300% 100%;
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 90%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 0%, #000 90%, transparent 100%);
}
.projects .item-link:hover {
  color: inherit; /* keep text color */
  border-bottom-color: transparent; /* no default border on hover */
}
.projects .item-link:hover::before {
  opacity: 1;
  animation: neon-rainbow 6s linear infinite;
}
.projects .meta {
  color: #9ca3af;
  white-space: nowrap;
}

/* Three-column alignment for project rows */
.projects .row > .language-badges {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center; /* надёжное центрирование в сетке */
  /* убираем обрезание, чтобы не резало иконки/текст */
  overflow: visible;
  text-overflow: initial;
  max-width: none;
  padding: 0 4px;
}
.projects .row > .meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: end; /* правый край колонки */
}
.projects .row > .updated-time {
  justify-self: center; /* выравнивание под заголовком "Обновление" */
}
.projects .meta a {
  color: inherit;
  text-decoration: none;
}
.projects .meta a:hover {
  color: #e5e7eb;
}
/* Size for GitHub SVG icon next to text */
.projects .meta .icon-github {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: -3px;
}

/* Mobile: начиная от 700px и ниже скрываем языковые бейджи */
@media (max-width: 700px) {
  .projects .row {
    gap: 8px;
    grid-template-columns: 1fr auto; /* две колонки: название + мета */
  }
  .projects .projects-head {
    grid-template-columns: 1fr auto;
    padding-bottom: 4px;
  }
  /* Скрываем иконки и названия языков на мобильных */
  .projects .row > .language-badges {
    display: none;
  }
  /* Скрываем колонку с датой обновления на мобильных */
  .projects .row > .updated-time {
    display: none;
  }
  /* Скрываем заголовки скрытых колонок на мобильных */
  .projects .projects-head .head-langs,
  .projects .projects-head .head-updated {
    display: none;
  }
}
html[data-theme='light'] .projects .item-link {
  color: #0b1220;
  border-bottom-color: transparent; /* disable default underline */
}
html[data-theme='light'] .projects .item-link:hover {
  border-bottom-color: transparent;
  color: inherit;
}

/* Projects page only: remove link underline and show card outline on hover/focus */
.projects-page .projects .projects-list .projects-row .item-link {
  padding-bottom: 0;
  border-bottom: 0;
}
.projects-page .projects .projects-list .projects-row .item-link::before { content: none; }

.projects-page .projects .projects-list .projects-row.clickable-card {
  position: relative;
  cursor: pointer;
}
.projects-page .projects .projects-list .projects-row.clickable-card::after {
  content: '';
  position: absolute;
  inset: 0; /* cover the card */
  border-radius: inherit; /* follow card radius */
  padding: 1px; /* thickness of the ring (1-2px) */
  background: linear-gradient(
    90deg,
    #ff0040 0%,
    #ff8c00 12%,
    #fffb00 24%,
    #00ff85 36%,
    #00e1ff 48%,
    #0066ff 60%,
    #7a00ff 72%,
    #ff00e6 84%,
    #ff0040 100%
  );
  background-size: 300% 100%;
  /* create a ring by excluding the inner box */
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: none;
}
.projects-page .projects .projects-list .projects-row.clickable-card:hover::after,
.projects-page .projects .projects-list .projects-row.clickable-card:focus::after,
.projects-page .projects .projects-list .projects-row.clickable-card:focus-within::after {
  opacity: 1;
  animation: neon-rainbow 6s linear infinite;
}

/* Buttons (if later used) */
.btn {
  background-color: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: 0 6px 24px rgba(56, 189, 248, 0.25);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.2s ease;
}
.btn:hover {
  background-color: var(--accent-600);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(56, 189, 248, 0.35);
}
.btn:active {
  transform: translateY(0);
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.link {
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  padding-bottom: 2px;
}
.link:hover {
  border-bottom-color: #fff;
}

/* Text selection */
::selection {
  background: rgba(56, 189, 248, 0.35);
  color: #0b1220;
}
html[data-theme='light'] ::selection {
  background: rgba(37, 99, 235, 0.25);
  color: #0b1220;
}

/* Mobile adjustments */

@media (max-width: 645px) {
  .container {
    padding: 0 16px;
  }
  /* Stack hero content safely on mobile */
  .hero {
    min-height: auto;
  }
  .hero-img {
    width: 100%;
    height: auto;
    object-fit: cover;
  }
  /* Project page: avoid overlap between description and details */
  .project .hero-content {
    position: static;
    padding: 12px 0 8px;
    pointer-events: auto;
  }
  .project .project-hero {
    margin-bottom: 12px;
  }
  .hero-content .container {
    padding-top: 0;
  }
  .hero::after {
    background: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.18) 0%,
      rgba(0, 0, 0, 0.52) 65%,
      hsl(222, 21%, 12%) 100%
    );
  }
  .theme-toggle {
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
  .language-top-btn {
    top: 16px;
    right: 64px;
    height: 40px;
    padding: 0 10px;
  }
  .contact-top-btn {
    top: 16px;
    right: 112px;
    height: 40px;
    padding: 0 12px;
  }
  /* Back link inline with theme toggle at the very top */
  .hero .back-link {
    position: absolute;
    top: 16px;
    left: 16px;
    margin: 0;
    z-index: 11;
    height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
  }
  /* Hero overlay spacing and readability on small screens */
  .hero-content {
    padding: calc(env(safe-area-inset-top) + 64px) 0 16px;
  }
  .hero-content .container {
    padding-top: 0;
  }
  /* Mobile: компактнее панель */
  .sitemap {
    margin-top: -56px;
    gap: 8px;
    padding: 10px 12px;
  }
  .sitemap .list li {
    flex-wrap: wrap;
  }
  .sitemap .platform-mini {
    width: 100%;
    text-align: left;
    margin-left: 24px;
    opacity: 0.9;
  }
}
.hero-content .project-hero {
  padding: 12px 14px;
  border-radius: 10px;
}
html[data-theme='light'] .hero-content .project-hero {
  background: rgba(255, 255, 255, 0.65);
}
/* Dark theme overlay for hero content (used by donate page too) */
html[data-theme='dark'] .hero-content .project-hero {
  background: rgba(0, 0, 0, 0.35);
}

/* Donate page: make overlay appear together with text */
.coffee-page .hero-content .project-hero {
  transition: background-color 300ms ease, backdrop-filter 300ms ease,
    opacity 320ms ease, transform 320ms ease;
  position: relative; /* allow z-index to take effect */
  z-index: 3; /* above #donation (z-index:1) */
}
.coffee-page:not(.i18n-ready) .hero-content .project-hero {
  /* start transparent and slightly shifted, reveal with text */
  background-color: transparent !important;
  opacity: 0;
  transform: translateY(8px);
}
.coffee-page.i18n-ready .hero-content .project-hero {
  opacity: 1;
  transform: translateY(0);
}
/* Nudge donate hero block down a bit to clear top menu */
.coffee-page .hero-content .project-hero {
  margin-top: 20px;
}
@media (max-width: 700px) {
  .coffee-page .hero-content .project-hero { margin-top: 16px; }
}
.project .back-link {
  margin-bottom: 12px;
  font-size: 13px;
}
.project-title {
  font-size: clamp(22px, 6vw, 28px);
}
.project-description {
  font-size: 15px;
  line-height: 1.6;
}
.details-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}
.project-content section {
  padding: 16px;
}
/* Ensure hero overlay content doesn't collide with theme toggle */
.hero-content {
  padding: 80px 0 12px;
}
.hero-content .container {
  padding-top: 0;
}
/* Tighter spacing and type scaling on project page */
.project .back-link {
  margin-bottom: 16px;
  font-size: 13px;
}
.project-badge {
  padding: 5px 12px;
  font-size: 12px;
}
.project-description {
  font-size: 16px;
  line-height: 1.6;
}
/* Single column details to avoid cramped layout */
.details-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}
.project-content section {
  padding: 16px;
}
.about {
  padding: 22px 0 40px;
  margin-top: 0;
}

.about p {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 10px;
}
.projects {
  padding: 20px 0 72px;
}
.projects .row {
  padding: 8px 0;
}
.projects .meta {
  font-size: 14px;
}
.site-footer .footer-grid {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
/* Mobile: lift project hero over the image */
.hero-content {
  position: absolute;
  inset: 0;
  padding: calc(env(safe-area-inset-top) + 56px) 0 16px;
  pointer-events: none;
}
.hero-content .container {
  padding-top: 0;
  pointer-events: auto;
}
.project-hero {
  margin-bottom: 16px;
}

/* Compact Footer */
.site-footer {
  border-top: 1px solid rgba(229, 231, 235, 0.12);
  padding: 14px 0;
  margin-top: auto;
}
.site-footer .footer-grid {
  display: grid;
  grid-auto-flow: column;
  justify-content: center;
  align-items: center;
  gap: 24px;
}
.site-footer a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 12px;
  opacity: 0.9;
  transition:
    color 0.2s ease,
    opacity 0.2s ease;
}
.site-footer a:hover {
  color: #e5e7eb;
  opacity: 1;
}
.site-footer .brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 12px;
  color: #e5e7eb;
}
/* Footer icon-only link and icon sizing */
.site-footer a.icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
}
.site-footer .icon {
  width: 16px;
  height: 16px;
  display: block;
}
/* Utility: visually hidden (for a11y) */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
html[data-theme='light'] .site-footer {
  border-top-color: rgba(2, 6, 23, 0.08);
}
html[data-theme='light'] .site-footer a {
  color: #334155;
}
html[data-theme='light'] .site-footer a:hover {
  color: #0b1220;
}
html[data-theme='light'] .site-footer .brand {
  color: #0b1220;
}

@media (max-width: 645px) {
  .site-footer .footer-grid {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
  }
}

/* Project detail - Main page style */
.project {
  padding: 0 0 80px;
}
.project .container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Back link */
.project .back-link,
.hero .back-link {
  display: inline-block;
  margin-bottom: 32px;
  color: #9ca3af;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap; /* keep in one line */
  transition: color 0.2s ease;

}
.project .back-link:hover,
.hero .back-link:hover {
  color: #f59e0b;
  border-bottom-color: #f59e0b;
}

/* Precise alignment when back-link placed near language in hero (sitemap.html) */
.hero .top-left-controls .back-link {
  line-height: 1; /* avoid baseline drift */
  padding-bottom: 0; /* no underline offset when inline */
  border-bottom-width: 0; /* remove underline in header area */
}

/* Desktop: keep inline-flex for proper alignment */
@media (min-width: 646px) {
  .hero .top-left-controls .back-link {
    display: inline-flex; /* align icon/text neatly */
    align-items: center;
    margin: 0 0 0 8px; /* no bottom margin, keep in one row */
  }
}

/* Ensure no double back buttons around 646–768px: mobile wins under 768px */
@media (max-width: 767.98px) {
  .hero .top-left-controls .back-link { display: none !important; }
  .top-left-controls .back-mobile { display: inline-flex !important; }
}
@media (min-width: 768px) {
  .top-left-controls .back-mobile { display: none !important; }
}

/* Project Hero */
.project-hero {
  margin-bottom: 48px;
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(8px);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
}
.project-badge {
  display: inline-block;
  margin-bottom: 16px;
  padding: 6px 16px;
  background: rgba(56, 191, 248, 0.187);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
}
.project-title {
  margin: 0 0 20px;
  font-weight: 700;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.1;
  color: #f1f5f9;
}
.project-description {
  margin: 0 0 28px;
  color: #d1d5db;
  font-size: 18px;
  line-height: 1.7;
}
.project-actions {
  margin-bottom: 40px;
}
.btn-primary {
  display: inline-block;
  padding: 14px 28px;
  background: var(--accent);
  color: #0b0b0b;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  border-radius: 12px;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.2s ease;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.btn-primary:hover {
  background: var(--accent-600);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(56, 189, 248, 0.45);
}
.btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Project Details */
.project-details {
  margin-bottom: 48px;
  padding: 24px;
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  z-index: 2;
}
.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.detail-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.detail-label {
  color: #9ca3af;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.detail-value {
  color: #e5e7eb;
  font-size: 15px;
  font-weight: 600;
}

/* Project Content */
.project-content {
  min-width: 0;
}
.project-content section {
  margin: 0 0 32px;
  padding: 24px;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
}
.project-content section:last-child {
  margin-bottom: 0;
}
.project-content h2,
.project-content h3 {
  position: relative;
  margin: 0 0 16px;
  font-size: 18px;
  color: #e2e8f0;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
}
.project-content h2::before,
.project-content h3::before {
  content: '';
  width: 3px;
  height: 16px;
  background: linear-gradient(180deg, var(--accent), var(--accent-600));
  border-radius: 2px;
  margin-right: 12px;
}
.project-content p {
  margin: 0 0 12px;
  color: #d1d5db;
  line-height: 1.6;
  font-size: 14px;
}
.project-content p:last-child {
  margin-bottom: 0;
}
.project-content ul {
  margin: 0;
  padding-left: 18px;
  color: #d1d5db;
}
.project-content li {
  margin: 6px 0;
  line-height: 1.5;
  font-size: 14px;
}

/* Light theme for project and sitemap back link */
html[data-theme='light'] .project .back-link,
html[data-theme='light'] .hero .back-link {
  color: #64748b;
  border-bottom-color: rgba(2, 6, 23, 0.3);
}
html[data-theme='light'] .project .back-link:hover,
html[data-theme='light'] .hero .back-link:hover {
  color: #f59e0b;
  border-bottom-color: #f59e0b;
}
html[data-theme='light'] .project-title {
  color: #0b1220;
}
html[data-theme='light'] .project-description {
  color: #334155;
}
html[data-theme='light'] .detail-value {
  color: #0b1220;
}
html[data-theme='light'] .detail-label {
  color: #64748b;
}
html[data-theme='light'] .project-details {
  background: var(--card);
  border-color: var(--card-border);
}
html[data-theme='light'] .project-content section {
  background: var(--card);
  border-color: var(--card-border);
}
html[data-theme='light'] .project-content h2 {
  color: #334155;
}
html[data-theme='light'] .project-content p {
  color: #334155;
}
html[data-theme='light'] .project-content ul {
  color: #334155;
}

/* Focus styles for links */
.item-link:focus-visible,
.back-link:focus-visible,
.site-footer a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}
/* Remove focus outline for mouse clicks, keep keyboard via :focus-visible */
:focus:not(:focus-visible) {
  outline: none !important;
  box-shadow: none !important;
}

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 768px) {
  .project {
    padding: 0 0 60px;
  }
  .project .container {
    padding: 0 16px;
  }
  .project-hero {
    margin-bottom: 32px;
  }
  .project-details {
    padding: 20px;
    margin-bottom: 32px;
  }
  .details-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  .project-content section {
    padding: 20px;
    margin-bottom: 24px;
  }
  .project-title {
    font-size: clamp(24px, 5vw, 32px);
  }
}

/* Contact modal (centered overlay) */
.cm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 1000;
}
.cm-box {
  width: min(92vw, 440px);
  background: #0b1220; /* сплошной фон в тёмной теме */
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px 14px 12px;
  color: var(--fg);
  backdrop-filter: none; /* без blur, чтобы не просвечивало */
  max-height: calc(100dvh - 32px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.cm-title {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cm-desc {
  color: #cbd5e1;
  font-size: 13px;
  margin-bottom: 12px;
}
.cm-form {
  display: grid;
  gap: 10px;
}
.cm-field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: #cbd5e1;
  position: relative;
}
.cm-field::before {
  content: attr(data-label);
  position: absolute;
  left: 12px;
  top: 10px;
  transform: translateY(0);
  font-size: 12px;
  line-height: 1;
  color: #94a3b8;
  background: var(--bg);
  padding: 0 6px;
  border-radius: 6px;
  opacity: 0;
  transition: all 0.15s ease;
  pointer-events: none;
}
.cm-field.has-value::before,
.cm-field:focus-within::before {
  opacity: 1;
  top: -8px;
  color: var(--accent);
}
.cm-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px; /* предотвращает зум на iOS при фокусе */
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  outline: none;
}
.cm-textarea {
  resize: vertical;
  min-height: 110px;
  font-size: 16px; /* консистентно с input */
}
.cm-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}
.cm-cap {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: max-content;
  row-gap: 8px;
  align-items: start;
}
.cm-cap-q {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cm-cap-speak {
  appearance: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  color: inherit;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}
.cm-cap-speak:hover {
  background: rgba(255, 255, 255, 0.12);
}
.cm-cap-speak svg {
  width: 20px;
  height: 20px;
  display: block;
}
.cm-cap-speak svg use {
  fill: currentColor;
}
.cm-cap-bottom {
  display: grid;
  grid-template-columns: max-content 1fr auto; /* input | hint | submit */
  align-items: center;
  column-gap: 10px;
}
.cm-cap-bottom .cm-cap-input {
  justify-self: start;
}
.cm-cap-bottom .cm-actions {
  justify-self: end;
}
.cm-cap-input {
  width: 64px; /* 3 цифры */
  padding: 6px 8px;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
@media (min-width: 480px) {
  .cm-cap-input {
    width: 72px;
  }
}
.cm-cap-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
  background-color: rgba(56, 189, 248, 0.08);
}
.cm-cap-input:not(:placeholder-shown) {
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2) inset;
}
.cm-err {
  color: #fca5a5;
  font-size: 12px;
  min-height: 16px;
}
.cm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}
.cm-cancel {
  background: rgba(255, 255, 255, 0.08);
}
.cm-cancel:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* Light theme adjustments for new elements */
html[data-theme='light'] .cm-cap-speak,
html[data-theme='light'] .cm-key {
  background: rgba(2, 6, 23, 0.03);
  border-color: var(--card-border);
}
html[data-theme='light'] .cm-key:hover,
html[data-theme='light'] .cm-cap-speak:hover {
  background: rgba(2, 6, 23, 0.06);
}

/* NEW: shake animation on validation error */
.shake {
  animation: cm-shake 0.28s ease-in-out;
}
@keyframes cm-shake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}
/* Contact button icon */
.contact-top-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.contact-top-btn .icon-telegram {
  display: inline-block;
  vertical-align: -2px;
}
/* hover не меняет цвет и не создает подложку */

/* --- Scoped fixes for project.html (safe, non-destructive) --- */
/* Слой контента героя ниже деталей */
.project .hero-content {
  z-index: 1;
}

/* --- Scoped fix for coffee.html --- */
/* Ensure donate hero overlay stays above hero image/gradient */
.coffee-page .hero-content {
  z-index: 2;
  pointer-events: auto;
}

/* Детали всегда поверх. Наезд только до 1024px */
@media (max-width: 1024px) {
  .project .project-details {
    position: relative;
    z-index: 2;
    /* помягче величины, чтобы не налезало на текст героя */
    margin-top: clamp(-40px, -6vw, -72px);
  }
}

/* Десктопы >1025px: без наезда вовсе */
@media (min-width: 1025px) {
  .project .project-details {
    position: relative;
    z-index: 2;
    margin-top: 24px;
  }
}

/* Планшеты: ослабляем наезд */
@media (max-width: 991.98px) {
  .project .project-details {
    margin-top: -40px;
  }
}

/* Мобилки: без наезда вообще */
@media (max-width: 767.98px) {
  .project .project-details {
    margin-top: 0;
  }
}

/* Removed redundant mid-range overrides for project-details to rely on unified rules */

/* Landscape: push project-details down to avoid overlap with hero on short viewports */
@media (max-width: 1024px) and (orientation: landscape) {
  .project .project-details {
    margin-top: clamp(24px, 8svh, 96px);
  }
}
/* Narrow landscape (where overlap was observed): push a bit more */
@media (min-width: 645px) and (max-width: 766.98px) and (orientation: landscape) {
  .project .project-details {
    margin-top: clamp(190px, 10svh, 120px);
  }
}

/* Toasts */
.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 10px;
  z-index: 4000; /* above .page-loader (2000) */
}
.toast {
  min-width: 240px;
  max-width: min(92vw, 360px);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.06));
  color: var(--fg);
  backdrop-filter: blur(8px) saturate(120%);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast-info {
  border-color: rgba(56, 189, 248, 0.35);
}
.toast-success {
  border-color: rgba(34, 197, 94, 0.45);
}
.toast-error {
  border-color: rgba(239, 68, 68, 0.45);
}

/* Tooltip */


/* Blur-to-reveal for sensitive values (donation addresses, card numbers) */
.blur-reveal {
  filter: blur(6px);
  transition: filter 160ms ease;
  cursor: pointer;
}
.blur-reveal.revealed {
  filter: none;
  cursor: text;
}
.ui-tooltip {
  position: fixed;
  z-index: 3000;
  color: #e5e7eb;
  background: rgba(17, 24, 39, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 10px 12px 12px;
  line-height: 1.35;
  font-size: 12.5px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.ui-tooltip::after {
  content: none;
}

html[data-theme='light'] .ui-tooltip {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(30, 41, 59, 0.2);
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.12);
}

/* Тонкая линия 1px под фразой «человек + ИИ» */
.about [data-tooltip-key='tooltips.about.human_ai'] {
  position: relative;
  display: inline-block;
  padding-bottom: 1px; /* меньше отступ под линию */
  text-decoration: none;
}
.about [data-tooltip-key='tooltips.about.human_ai']::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background-color: currentColor;
  opacity: 0.7;
  /* плавное затухание слева и справа */
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
}

/* Prevent background scroll when modal open */
html.modal-open,
body.modal-open {
  overflow: hidden;
}

/* Captcha image inside question block */
.cm-cap-img {
  height: 28px;
  width: auto;
  display: block;
}

/* Cooldown state: visually disabled but tooltip still works */
.cm-cap-speak.is-cooldown,
.cm-cap-speak[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.3);
}
.cm-cap-speak.is-cooldown:hover,
.cm-cap-speak[aria-disabled='true']:hover {
  background: rgba(255, 255, 255, 0.08); /* lock hover */
}
html[data-theme='light'] .cm-cap-speak.is-cooldown,
html[data-theme='light'] .cm-cap-speak[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.2);
}
html[data-theme='light'] .cm-cap-speak.is-cooldown:hover,
html[data-theme='light'] .cm-cap-speak[aria-disabled='true']:hover {
  background: rgba(2, 6, 23, 0.03);
}

/* Captcha input live hint */
.cm-cap-hint {
  margin-top: 0; /* inline with the input */
  font-size: 12px;
  color: var(--muted);
  user-select: none;
  grid-column: 1;
  grid-row: 2;
  white-space: nowrap;
}

/* Error pulse animation */
@keyframes fieldErrorPulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
  100% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}
.cm-field.is-error .cm-input,
.cm-input.is-error {
  border-color: #ef4444 !important;
  animation: fieldErrorPulse 0.6s ease-out;
}
.cm-field.is-error::before {
  color: #ef4444;
}
html[data-theme='light'] .cm-field.is-error .cm-input,
html[data-theme='light'] .cm-input.is-error {
  border-color: #ef4444 !important;
}

/* Close (X) button */
.cm-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 6px;
}
.cm-close:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
html[data-theme='light'] .cm-close:hover {
  background: rgba(2,6,23,0.06);
  color: var(--text);
}
