/* ═══ Liquid Glass theme ═══ */
:root {
  color-scheme: dark;
  --bg: #07090f;
  --text: #f2f5f9;
  --text-dim: #9aa3b2;
  --accent: #ff8a50;
  --accent-soft: rgba(255, 138, 80, 0.16);
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.35);
  --radius: 22px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* ═══ Custom scrollbar ═══ */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.32);
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-corner { background: transparent; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

main { flex: 1; position: relative; z-index: 1; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ═══ Animated background orbs ═══ */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.bg-orbs i {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}
.bg-orbs i:nth-child(1) {
  width: 520px; height: 520px;
  background: radial-gradient(circle, #ff7b42 0%, transparent 70%);
  top: -160px; left: -120px;
  animation: drift1 26s ease-in-out infinite alternate;
}
.bg-orbs i:nth-child(2) {
  width: 460px; height: 460px;
  background: radial-gradient(circle, #6a5cff 0%, transparent 70%);
  bottom: -140px; right: -100px;
  animation: drift2 32s ease-in-out infinite alternate;
}
.bg-orbs i:nth-child(3) {
  width: 380px; height: 380px;
  background: radial-gradient(circle, #00c8ff 0%, transparent 70%);
  top: 40%; left: 55%;
  opacity: 0.28;
  animation: drift3 38s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(140px, 100px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-120px, -90px) scale(1.1); } }
@keyframes drift3 { to { transform: translate(-160px, 80px) scale(0.9); } }

@media (prefers-reduced-motion: reduce) {
  .bg-orbs i { animation: none; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ═══ Glass header ═══ */
.site-header {
  position: sticky;
  top: 12px;
  z-index: 50;
  margin: 12px 16px 0;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  background: var(--glass-strong);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 0 26px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35),
              inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}
.logo span { color: var(--accent); }
.logo:hover { text-decoration: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links a {
  color: var(--text-dim);
  font-size: 0.95rem;
  padding: 6px 12px;
  border-radius: 999px;
  transition: color 0.2s, background 0.25s var(--spring);
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.lang-toggle {
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 0.3s var(--spring), border-color 0.2s, background 0.2s;
}
.lang-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.08);
}
.lang-toggle:active { transform: scale(0.95); }

/* ═══ Hero ═══ */
.hero {
  padding: 84px 20px 44px;
  text-align: center;
  animation: rise 0.7s var(--spring) both;
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.9rem);
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(120deg, var(--text) 35%, var(--accent) 75%, #ffd7a8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  margin-top: 14px;
  color: var(--text-dim);
  font-size: 1.1rem;
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

.section-title {
  font-size: 1.5rem;
  margin: 32px 0 22px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* ═══ Glass project cards ═══ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 22px;
  padding-bottom: 60px;
}

.project-card {
  cursor: pointer;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 0.45s var(--spring), border-color 0.25s, box-shadow 0.35s;
  animation: rise 0.6s var(--spring) both;
}
/* каскад появления: задержка ставится из JS (animation-delay), работает для любого числа карточек */

.project-card:hover {
  transform: translateY(-6px) scale(1.015);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-highlight);
}

/* shine sweep on hover (no reverse: transition only while hovered) */
.project-card::after {
  content: "";
  position: absolute;
  top: 0; left: -80%;
  width: 50%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
  transition: none;
}
.project-card:hover::after { left: 130%; transition: left 0.7s ease; }

.card-media {
  aspect-ratio: 16 / 9;
  background: rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-media img, .card-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s var(--spring);
}
.project-card:hover .card-media img,
.project-card:hover .card-media video { transform: scale(1.05); }
.card-media .placeholder {
  font-size: 2.5rem;
  opacity: 0.3;
  user-select: none;
  transition: transform 0.5s var(--spring);
}
.project-card:hover .placeholder { transform: scale(1.2) rotate(-6deg); }
.card-media .media-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-title h3 { font-size: 1.15rem; }
.card-lang {
  font-size: 0.75rem;
  color: var(--text-dim);
  border: 1px solid var(--glass-border);
  background: var(--glass);
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.card-desc { color: var(--text-dim); font-size: 0.92rem; flex: 1; }

.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(255, 138, 80, 0.25);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
}

.card-links { display: flex; gap: 14px; margin-top: 4px; }
.card-links a { font-size: 0.88rem; font-weight: 600; }

/* ═══ Guides ═══ */
.guides-list {
  display: grid;
  gap: 16px;
  padding-bottom: 60px;
}

.guide-card {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: block;
  color: var(--text);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 0.4s var(--spring), border-color 0.25s;
  animation: rise 0.6s var(--spring) both;
}
.guide-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.28);
  text-decoration: none;
}
.guide-card::after {
  content: "";
  position: absolute;
  top: 0; left: -80%;
  width: 50%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
  transition: none;
}
.guide-card:hover::after { left: 130%; transition: left 0.7s ease; }
.guide-card h3 { margin-bottom: 6px; }
.guide-card p { color: var(--text-dim); font-size: 0.92rem; }

/* ═══ Guide article (glass panel) ═══ */
.guide-article {
  max-width: 820px;
  margin: 32px auto 80px;
  padding: 36px 40px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  animation: rise 0.6s var(--spring) both;
}
.guide-article h1 { font-size: 2rem; margin-bottom: 8px; letter-spacing: -0.5px; }
.guide-article .guide-meta { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 28px; }
.guide-article h2 {
  font-size: 1.4rem;
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.guide-article h3 { font-size: 1.1rem; margin: 24px 0 10px; }
.guide-article p { margin-bottom: 14px; }
.guide-article ul, .guide-article ol { margin: 0 0 14px 24px; }
.guide-article li { margin-bottom: 6px; }
.guide-article img, .guide-article video {
  max-width: 100%;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  margin: 10px 0 18px;
  display: block;
}
.guide-article code {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  padding: 1px 6px;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 0.88em;
}
.guide-article pre {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 14px 18px;
  overflow-x: auto;
  margin-bottom: 18px;
}
.guide-article pre code { background: none; border: none; padding: 0; }

.callout {
  background: var(--accent-soft);
  border: 1px solid rgba(255, 138, 80, 0.3);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .guide-article { padding: 24px 20px; margin: 16px 12px 60px; }
}

/* ═══ Project page / modal content ═══ */
.project-banner {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  margin: 0 0 22px;
  display: block;
}

.project-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.project-head h1 { font-size: 2rem; letter-spacing: -0.5px; }

.project-about p { margin-bottom: 14px; color: var(--text); }

.project-actions { margin: 22px 0 8px; }

.project-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.gallery-cell {
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  transition: transform 0.35s var(--spring), border-color 0.2s;
}
.gallery-cell:hover { transform: scale(1.04); border-color: var(--accent); }
.gallery-cell img, .gallery-cell video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  margin: 0 !important; border: none !important; border-radius: 0 !important;
}

/* i18n visibility */
[lang="ru"] .only-en { display: none !important; }
[lang="en"] .only-ru { display: none !important; }

/* ═══ Lightbox (heavy glass) ═══ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(7, 9, 15, 0.7);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lbFade 0.25s ease both;
}
.lightbox[hidden] { display: none; }
@keyframes lbFade { from { opacity: 0; } }

.lb-content {
  max-width: 88vw;
  max-height: 86vh;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: rise 0.35s var(--spring) both;
}
.lb-content img, .lb-content video {
  max-width: 88vw;
  max-height: 86vh;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.lb-close, .lb-prev, .lb-next {
  position: absolute;
  background: var(--glass-strong);
  backdrop-filter: blur(12px);
  color: #fff;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 46px;
  height: 46px;
  font-size: 1.3rem;
  cursor: pointer;
  transition: transform 0.3s var(--spring), background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.1);
}
.lb-prev:hover { transform: scale(1.1) translateY(-50%); }
.lb-next:hover { transform: scale(1.1) translateY(-50%); }
.lb-close { top: 18px; right: 18px; }
.lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
.lb-counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ═══ Expanding project modal ═══ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(5, 7, 12, 0.55);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  opacity: 0;
  transition: opacity 0.55s ease, backdrop-filter 0.55s ease, -webkit-backdrop-filter 0.55s ease;
}
.modal-backdrop.show {
  opacity: 1;
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}

.modal-panel {
  position: fixed;
  z-index: 95;
  background: #10151d;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: top 0.6s cubic-bezier(0.32, 0.72, 0, 1),
              left 0.6s cubic-bezier(0.32, 0.72, 0, 1),
              width 0.6s cubic-bezier(0.32, 0.72, 0, 1),
              height 0.6s cubic-bezier(0.32, 0.72, 0, 1);
}

.modal-content {
  height: 100%;
  overflow-y: auto;
  padding: 30px 34px 34px;
  opacity: 0;
  transition: opacity 0.38s ease;
}
.modal-panel.ready .modal-content { opacity: 1; }
@media (max-width: 640px) {
  .modal-content { padding: 20px 18px; }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  color: var(--text);
  border: 1px solid var(--glass-border);
  font-size: 1.05rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.3s var(--spring), background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-panel.ready .modal-close { opacity: 1; }
.modal-close:hover { background: rgba(255, 255, 255, 0.18); transform: scale(1.1); }

/* ═══ Footer ═══ */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.88rem;
}

@media (max-width: 600px) {
  .site-header { margin: 8px 10px 0; top: 8px; }
  .nav { padding: 0 16px; }
  .nav-links { gap: 8px; }
  .nav-links a { padding: 6px 8px; }
  .hero { padding: 56px 20px 28px; }
  .lb-prev, .lb-next, .lb-close { width: 38px; height: 38px; font-size: 1.1rem; }
}

@media (max-width: 440px) {
  .logo { font-size: 1.05rem; }
  .nav { padding: 0 12px; }
  .nav-links { gap: 4px; }
  .nav-links a { padding: 5px 6px; font-size: 0.85rem; }
  .lang-toggle { padding: 5px 10px; font-size: 0.8rem; }
  .project-head h1 { font-size: 1.5rem; }
  .guide-article h1 { font-size: 1.5rem; }
}
