:root {
  --bg: #FEFAF5;
  --card: #FFFFFF;
  --blue: #0312C4;
  --blue-dark: #020D94;
  --ink: #111111;
  --muted: #56524C;
  --line: #E7E2D9;
  --err: #B3261E;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --display: 'Unbounded', system-ui, sans-serif;
  --body: 'Manrope', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/24px var(--body);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--blue); color: #fff; padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

.demo-bar { background: var(--ink); color: var(--bg); font-size: 12px; line-height: 16px; text-align: center; padding: 8px 16px; }

/* ---------- кнопки и ссылки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--blue); color: #fff;
  font: 500 12px/16px var(--display);
  padding: 16px 24px;
  transition: background-color .3s var(--ease), transform .3s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--blue-dark); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-wide { width: 100%; }
.btn-ghost { background: none; color: var(--ink); border: 1px solid var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
.btn-ghost.danger:hover { background: var(--err); border-color: var(--err); color: #fff; }

.ulink {
  display: inline-flex; align-items: center; gap: 12px;
  font: 500 12px/16px var(--display);
  padding-bottom: 4px; border-bottom: 1px solid var(--ink);
  text-decoration: none;
  transition: color .3s var(--ease), border-color .3s var(--ease);
}
.ulink:hover { color: var(--blue); border-color: var(--blue); }
.ulink i { transition: transform .5s var(--ease); }
.ulink:hover i { transform: translate(2px, -2px); }

/* ---------- шапка ---------- */
.nav { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.nav-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 80px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font: 600 14px/20px var(--display); text-decoration: none; letter-spacing: -0.02em; }
.logo i { color: var(--blue); }
.nav-links { display: flex; gap: 24px; }
.nav-links a { font-size: 14px; line-height: 20px; font-weight: 500; text-decoration: none; transition: color .3s var(--ease); }
.nav-links a:hover { color: var(--blue); }
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-user { font-size: 14px; line-height: 20px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.nav-user:hover { color: var(--blue); }

/* ---------- главный экран ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 56px; gap: 32px; padding-top: 64px; }
.mega {
  font: 500 100px/0.9 var(--display);
  color: var(--blue);
  letter-spacing: -0.045em;
  white-space: nowrap;
  overflow: hidden;
  padding-bottom: 0.06em;
}
.mega span { display: inline-block; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 390px); gap: 32px; align-items: end; }
.hero-copy { padding: 48px 0 48px; max-width: 480px; }
.h-wide { font: 500 24px/32px var(--display); letter-spacing: -0.03em; }
.h-big { font-size: 36px; line-height: 40px; }
.lead { color: var(--muted); font-size: 14px; line-height: 20px; margin: 16px 0 24px; max-width: 440px; }

.astro { width: 100%; }

.drop {
  display: flex; flex-direction: column; gap: 12px;
  width: 300px; max-width: 100%;
  margin-top: 48px; padding: 24px;
  background: var(--blue); color: #fff;
  transition: transform .5s var(--ease), background-color .3s var(--ease);
}
.drop:hover { transform: translateY(-4px); background: var(--blue-dark); }
.drop-top { display: flex; align-items: center; gap: 12px; }
.drop-top img { width: 24px; height: 24px; border-radius: 9999px; object-fit: cover; }
.drop-line { flex: 1; height: 1px; background: rgba(255, 255, 255, .4); }
.drop-cap { font: 400 12px/16px var(--display); opacity: .8; margin-top: 12px; }
.drop-title {
  font: 600 18px/28px var(--display); letter-spacing: -0.02em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.drop-stats { display: flex; align-items: flex-start; gap: 12px; }
.drop-stats span { display: flex; flex-direction: column; }
.drop-stats b { font: 400 24px/32px var(--display); }
.drop-stats small { font-size: 12px; line-height: 16px; opacity: .7; }
.drop-stats i { font-style: normal; opacity: .6; line-height: 32px; }

.club { display: flex; align-items: center; gap: 12px; margin-top: 48px; font-size: 14px; line-height: 20px; font-weight: 500; }
.club i { font-size: 20px; }

.rail { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-bottom: 48px; color: var(--ink); }
.rail > i { font-size: 24px; }
.rail-line { flex: 1; width: 1px; background: var(--line); }
.rail-tag { display: flex; flex-direction: column; align-items: center; gap: 12px; border: 1px solid var(--line); padding: 8px; background: var(--card); }
.rail-tag img { width: 20px; height: 80px; object-fit: cover; }
.rail-tag span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12px; line-height: 16px; font-weight: 500; }

/* ---------- три шага ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr) 140px; align-items: center; }
.steps::before { content: ''; grid-column: 1 / -1; height: 1px; background: var(--line); }
.steps::after { content: ''; grid-column: 1 / -1; height: 1px; background: var(--line); }
.step { display: flex; align-items: center; gap: 16px; padding: 32px 0; }
.step + .step { padding-left: 32px; position: relative; }
.step + .step::before { content: ''; position: absolute; left: 0; top: 32px; bottom: 32px; width: 1px; background: var(--line); }
.step b { font: 400 30px/36px var(--display); color: var(--blue); letter-spacing: -0.04em; }
.step span { font: 400 12px/20px var(--display); }
.steps img { width: 140px; height: 132px; object-fit: cover; }

/* ---------- миссия ---------- */
.mission { display: grid; grid-template-columns: minmax(0, 1fr) 310px minmax(0, 1fr); gap: 48px; padding-top: 64px; padding-bottom: 96px; }
.eyebrow { color: var(--blue); font-size: 12px; line-height: 16px; font-weight: 600; margin-bottom: 16px; }
.polaroid { margin: 64px 0 0; width: 204px; padding: 12px; border: 1px solid var(--line); background: var(--card); }
.polaroid img { width: 100%; }
.polaroid figcaption { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font: 400 12px/16px var(--display); letter-spacing: -0.03em; }
.polaroid figcaption i { background: var(--ink); color: #fff; padding: 4px 8px; }
.mission-earth { width: 100%; height: 100%; object-fit: cover; }
.mission-right { display: flex; flex-direction: column; }
.feat { display: flex; flex-direction: column; gap: 8px; padding: 24px 0; position: relative; }
.feat:first-child { padding-top: 0; }
.feat + .feat::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--line); }
.feat-ico { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--card); color: var(--blue); font-size: 20px; margin-bottom: 8px; transition: background-color .3s var(--ease), color .3s var(--ease); }
.feat:hover .feat-ico { background: var(--blue); color: #fff; }
.feat-t { font: 500 16px/24px var(--display); letter-spacing: -0.03em; }
.feat-d { color: var(--muted); font-size: 14px; line-height: 20px; }

/* ---------- слоган ---------- */
.tagline { background: var(--blue); color: #fff; padding: 96px 0; }
.tagline p { font: 500 36px/48px var(--display); letter-spacing: -0.03em; max-width: 960px; }
.tagline .w { opacity: .3; transition: opacity .5s var(--ease); }
.tagline .w.on { opacity: 1; }

/* ---------- библиотека ---------- */
.library { padding-top: 96px; padding-bottom: 96px; scroll-margin-top: 80px; }
.lib-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 40px; }
.controls { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 16px 0; }
.tabs { display: flex; gap: 24px; flex-wrap: wrap; }
.tabs button { font: 400 12px/16px var(--display); padding: 8px 0; border-bottom: 1px solid transparent; color: var(--muted); transition: color .3s var(--ease), border-color .3s var(--ease); }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--blue); border-color: var(--blue); }
.controls-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--ink); padding: 8px 0; }
.search input { border: 0; background: none; outline: 0; width: 180px; font-size: 14px; line-height: 20px; }
.search:focus-within { border-color: var(--blue); color: var(--blue); }
#sort { border: 1px solid var(--line); background: var(--card); padding: 8px 12px; font-size: 14px; line-height: 20px; border-radius: 0; }

.active-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 0; min-height: 0; }
.pill { display: inline-flex; align-items: center; gap: 8px; background: var(--blue); color: #fff; font-size: 12px; line-height: 16px; font-weight: 600; padding: 4px 8px; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 24px; }
.card {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--card); border: 1px solid var(--line); padding: 24px;
  cursor: pointer; min-height: 260px;
  transition: transform .5s var(--ease), border-color .3s var(--ease);
}
.card:hover { transform: translateY(-4px); border-color: var(--blue); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; line-height: 16px; }
.chip { display: inline-flex; align-items: center; gap: 8px; color: var(--blue); font: 500 12px/16px var(--display); }
.chip i { font-size: 16px; }
.card h3 { font: 500 16px/24px var(--display); letter-spacing: -0.03em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-text { color: var(--muted); font-size: 14px; line-height: 20px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--muted); transition: color .3s var(--ease); }
.tag:hover { color: var(--blue); }
.card-foot { margin-top: auto; padding-top: 12px; display: flex; justify-content: space-between; align-items: center; }
.author { font-size: 14px; line-height: 20px; font-weight: 600; }
.author:hover { color: var(--blue); }
.fire { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; line-height: 20px; font-weight: 600; padding: 4px 8px; border: 1px solid var(--line); transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease), transform .3s var(--ease); }
.fire:hover { border-color: var(--blue); color: var(--blue); }
.fire:active { transform: scale(0.96); }
.fire.on { background: var(--blue); border-color: var(--blue); color: #fff; }

.skel { min-height: 260px; border: 1px solid var(--line); background: var(--card); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.skel span { height: 16px; background: var(--line); animation: pulse 1.4s var(--ease) infinite alternate; }
.skel span:nth-child(1) { width: 30%; }
.skel span:nth-child(2) { width: 90%; height: 24px; }
.skel span:nth-child(3) { width: 70%; }
@keyframes pulse { from { opacity: 1; } to { opacity: .4; } }

.empty { grid-column: 1 / -1; border: 1px solid var(--line); background: var(--card); padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.empty i { font-size: 32px; color: var(--blue); }
.empty p { color: var(--muted); font-size: 14px; line-height: 20px; }

/* ---------- подвал ---------- */
.foot { border-top: 1px solid var(--line); }
.foot-in { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 32px; padding-bottom: 32px; font-size: 14px; line-height: 20px; color: var(--muted); }
.foot a { text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.foot a:hover { color: var(--blue); }
.foot .logo { color: var(--ink); }

/* ---------- окна ---------- */
.dlg { width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 1px solid var(--ink); background: var(--bg); color: var(--ink); padding: 32px; overflow: auto; }
.dlg-lg { width: min(720px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(17, 17, 17, .55); }
.dlg[open] { animation: dlg-in .5s var(--ease); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(24px); } }
.dlg-x { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; display: grid; place-items: center; font-size: 20px; }
.dlg-x:hover { color: var(--blue); }
.dlg-tabs { display: flex; gap: 24px; margin-bottom: 24px; }
.dlg-tabs button { font: 500 18px/28px var(--display); letter-spacing: -0.03em; color: var(--muted); border-bottom: 2px solid transparent; }
.dlg-tabs button.on { color: var(--blue); border-color: var(--blue); }
.dlg form { display: flex; flex-direction: column; gap: 16px; }
.dlg h2 { margin-bottom: 24px; padding-right: 32px; }
.field { display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 20px; font-weight: 600; }
.field[hidden] { display: none; }
.field input, .field textarea { border: 1px solid var(--line); background: var(--card); padding: 12px; font-size: 16px; line-height: 24px; font-weight: 400; border-radius: 0; width: 100%; transition: border-color .3s var(--ease); }
.field textarea { resize: vertical; min-height: 160px; }
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--blue); }
.form-err { color: var(--err); font-size: 14px; line-height: 20px; font-weight: 500; }
.form-err:empty { display: none; }

.type-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.type-pick input { position: absolute; opacity: 0; pointer-events: none; }
.type-pick span { display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--card); padding: 12px 8px; font-size: 14px; line-height: 20px; font-weight: 600; cursor: pointer; transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease); }
.type-pick input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }
.type-pick input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 3px; }

.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; color: var(--muted); font-size: 14px; line-height: 20px; margin-bottom: 16px; padding-right: 32px; }
.post-title { font: 500 24px/32px var(--display); letter-spacing: -0.03em; margin-bottom: 16px; }
.post-body { margin: 0 0 24px; white-space: pre-wrap; overflow-wrap: anywhere; font: 400 16px/24px var(--body); }
.post-body.code { font: 400 14px/20px ui-monospace, 'SF Mono', Menlo, monospace; background: var(--card); border: 1px solid var(--line); padding: 16px; max-height: 360px; overflow: auto; }
.post-link { display: inline-flex; margin-bottom: 24px; overflow-wrap: anywhere; }
.post-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.post-actions .btn { padding: 12px 16px; }
.post-actions .fire { padding: 12px 16px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 24px); background: var(--ink); color: var(--bg); padding: 12px 16px; font-size: 14px; line-height: 20px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .3s var(--ease), transform .5s var(--ease); z-index: 100; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- появление при скролле ---------- */
.reveal { opacity: 0; transform: translateY(32px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- больше синего: рамки, плашки, полосы ---------- */
.demo-bar { background: var(--blue); color: #fff; }
.nav { border-bottom-color: var(--blue); }
.eyebrow { display: inline-block; background: var(--blue); color: #fff; padding: 4px 8px; }
.club i, .rail > i { color: var(--blue); }
.rail-line { background: var(--blue); }
.rail-tag { border-color: var(--blue); }
.drop { outline: 1px solid var(--blue); outline-offset: 8px; }

.steps::before, .steps::after { background: var(--blue); }
.step + .step::before { background: var(--blue); }
.step b { background: var(--blue); color: #fff; padding: 8px 12px; }
.steps img { outline: 1px solid var(--blue); outline-offset: -8px; }

.mission-earth { outline: 1px solid var(--blue); outline-offset: 12px; }
.polaroid { border-color: var(--blue); box-shadow: 8px 8px 0 var(--blue); }
.polaroid figcaption i { background: var(--blue); }
.feat-ico { border-color: var(--blue); }
.feat + .feat::before { background: var(--blue); opacity: .25; }

.lib-head { background: var(--blue); color: #fff; padding: 40px; align-items: center; }
.lib-head .eyebrow { background: #fff; color: var(--blue); }
.lib-head .btn { background: #fff; color: var(--blue); }
.lib-head .btn:hover { background: var(--bg); }
.controls { border-color: var(--blue); }
.tabs { gap: 8px; }
.tabs button { border: 1px solid var(--blue); padding: 8px 12px; color: var(--blue); }
.tabs button:hover { color: var(--blue); background: rgba(3, 18, 196, .08); }
.tabs button.on { background: var(--blue); color: #fff; }
.search { border-color: var(--blue); }
.search i { color: var(--blue); }
#sort { border-color: var(--blue); }

.card { border-color: var(--blue); transition: transform .5s var(--ease), box-shadow .5s var(--ease); }
.card:hover { box-shadow: 8px 8px 0 var(--blue); border-color: var(--blue); }
.card .chip, .post-meta .chip { background: var(--blue); color: #fff; padding: 4px 8px; }
.fire { border-color: var(--blue); color: var(--blue); }
.tag { color: var(--blue); }
.tag:hover { text-decoration: underline; }
.empty, .skel { border-color: var(--blue); }

.dlg { border: 2px solid var(--blue); box-shadow: 12px 12px 0 var(--blue); }
.dlg::backdrop { background: rgba(2, 13, 148, .6); }
.post-body.code { border-color: var(--blue); }
.post-actions { border-top-color: var(--blue); }
.toast { background: var(--blue); color: #fff; }

.foot { background: var(--blue); border-top: 0; }
.foot-in, .foot .logo, .foot .logo i { color: #fff; }
.foot a:hover { color: #fff; text-decoration: underline; }

/* бегущая строка */
.marquee { background: var(--blue); color: #fff; overflow: hidden; padding: 16px 0; }
.marquee-track { display: flex; width: max-content; animation: marquee 32s linear infinite; }
.marquee-group { display: flex; align-items: center; gap: 32px; padding-right: 32px; font: 500 14px/20px var(--display); white-space: nowrap; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- 3D ---------- */
.astro-wrap { position: relative; z-index: 2; margin-top: -8%; justify-self: center; width: 100%; perspective: 900px; }
.astro { margin-top: 0; translate: var(--px, 0px) var(--py, 0px); animation: float 6s ease-in-out infinite alternate; transition: translate .5s var(--ease); }
.mega span { translate: calc(var(--px, 0px) * -0.5) 0; transition: translate .5s var(--ease); }
@keyframes float { from { transform: translateY(0); } to { transform: translateY(-14px); } }

.orbit {
  position: absolute; z-index: -1; left: -15%; top: 26%; width: 130%; aspect-ratio: 1;
  border: 2px solid var(--blue); border-radius: 9999px;
  transform: rotateX(74deg) rotateY(-10deg);
  animation: orbit 16s linear infinite;
}
.orbit::after { content: ''; position: absolute; top: -12px; left: 50%; width: 24px; height: 24px; margin-left: -12px; background: var(--blue); border-radius: 9999px; }
.orbit-2 { left: -5%; top: 34%; width: 110%; border-width: 1px; opacity: .5; animation-duration: 24s; animation-direction: reverse; }
.orbit-2::after { width: 14px; height: 14px; top: -7px; margin-left: -7px; }
@keyframes orbit { to { transform: rotateX(74deg) rotateY(-10deg) rotateZ(360deg); } }

.tilt { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transform-style: preserve-3d; will-change: transform; }
.card.tilt:hover, .drop.tilt:hover { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(12px); }

.tagline-in { display: flex; align-items: center; justify-content: space-between; gap: 64px; }
.tagline-in p { flex: 1; }
.cube-scene { width: 160px; height: 160px; perspective: 700px; flex: none; margin-right: 40px; }
.cube { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; animation: cube 18s linear infinite; }
.cube span { position: absolute; inset: 0; display: grid; place-items: center; border: 2px solid #fff; background: rgba(255, 255, 255, .08); color: #fff; font-size: 48px; }
.cube span:nth-child(1) { transform: translateZ(80px); }
.cube span:nth-child(2) { transform: rotateY(90deg) translateZ(80px); }
.cube span:nth-child(3) { transform: rotateY(180deg) translateZ(80px); }
.cube span:nth-child(4) { transform: rotateY(270deg) translateZ(80px); }
.cube span:nth-child(5) { transform: rotateX(90deg) translateZ(80px); }
.cube span:nth-child(6) { transform: rotateX(-90deg) translateZ(80px); }
@keyframes cube { from { transform: rotateX(-18deg) rotateY(0deg); } to { transform: rotateX(-18deg) rotateY(360deg); } }

@media (max-width: 720px) {
  .astro-wrap { margin-top: 0; max-width: 280px; }
  .lib-head { padding: 24px 16px; }
  .tagline-in { flex-direction: column; align-items: flex-start; gap: 48px; }
  .cube-scene { width: 96px; height: 96px; margin: 0 0 16px 24px; }
  .cube span { font-size: 32px; }
  .cube span:nth-child(1) { transform: translateZ(48px); }
  .cube span:nth-child(2) { transform: rotateY(90deg) translateZ(48px); }
  .cube span:nth-child(3) { transform: rotateY(180deg) translateZ(48px); }
  .cube span:nth-child(4) { transform: rotateY(270deg) translateZ(48px); }
  .cube span:nth-child(5) { transform: rotateX(90deg) translateZ(48px); }
  .cube span:nth-child(6) { transform: rotateX(-90deg) translateZ(48px); }
  .mission-earth { outline-offset: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .astro, .orbit, .cube, .marquee-track { animation: none; }
  .tilt { transform: none !important; }
}

/* ---------- адаптив ---------- */
@media (max-width: 980px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mission { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .mission-earth { grid-row: 1 / 3; grid-column: 2; max-height: 640px; }
  .nav-links { display: none; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .nav-in { height: 64px; }
  .nav-right .btn { padding: 12px 16px; }
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: 32px; }
  .rail { display: none; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .hero-copy { padding: 32px 0; }

  .drop { margin-top: 32px; }
  .club { margin-top: 32px; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .steps img { display: none; }
  .step { padding: 16px 0; }
  .step + .step { padding-left: 0; }
  .step + .step::before { display: none; }
  .mission { grid-template-columns: minmax(0, 1fr); gap: 40px; padding-top: 48px; padding-bottom: 64px; }
  .mission-earth { grid-row: auto; grid-column: auto; max-height: 360px; }
  .polaroid { margin-top: 40px; }
  .tagline { padding: 64px 0; }
  .tagline p { font-size: 24px; line-height: 32px; }
  .library { padding-top: 64px; padding-bottom: 64px; scroll-margin-top: 64px; }
  .h-big { font-size: 24px; line-height: 32px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .tabs { gap: 16px; }
  .controls-right, .search { width: 100%; }
  .search input { width: 100%; }
  .dlg { padding: 24px 16px; }
  .type-pick { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { transform: none; }
  .tagline .w { opacity: 1; transition: none; }
  .card:hover, .drop:hover { transform: none; }
  .dlg[open] { animation: none; }
}

/* ---------- правки после проверки ---------- */
main { overflow-x: clip; }
.mega { line-height: 1.02; padding-top: 0.08em; }
@media (max-width: 480px) {
  .nav-in { gap: 8px; }
  .nav-right { gap: 12px; }
  .logo { font-size: 12px; }
  .nav-right .btn { padding: 12px; }
  .nav-right .btn i { display: none; }
}
@media (min-width: 721px) { .astro-wrap { margin-top: -19%; } }
@media (min-width: 981px) { .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 450px); } }

/* ---------- чёрная дыра вместо луны ---------- */
.bh { position: relative; overflow: hidden; min-height: 520px; background: #000 url(assets/blackhole.jpg) center / cover no-repeat; }
.bh canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
@media (min-width: 721px) { .steps { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px) { .bh { max-height: none; min-height: 0; height: 480px; } }
@media (min-width: 981px) { .mission { grid-template-columns: minmax(0, 1fr) 420px minmax(0, 1fr); } .bh { min-height: 640px; } }
