/* Editors Haven — раскладка сайта. Компоненты и цвета — в base.css. */
:root {
  --container: 1120px;
  --header-h: 72px;
  --tabbar-h: 64px;
  --card-media: 272px; /* высота картинки сверху у карточек проектов и инструментов — чтобы карточки были одного размера */
  --band: #070707; /* фон выделенного раздела: светлее страницы, темнее карточек (--surface) */
  --band-line: var(--line-strip); /* граница полосы — на всю ширину окна */
}

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* ---------- шапка ---------- */
/* Липкая, с размытием под собой; навигация — та же капсула, что нижняя панель в ботах.
   Размытие — на ::before: backdrop-filter на самой шапке сделал бы её опорой для position: fixed,
   и на телефоне капсула прилипла бы к шапке, а не к низу экрана */
.site-header {
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
/* Пока страница наверху, шапка прозрачная и фон первого экрана идёт под ней без шва;
   подложка с размытием проявляется, только когда страницу прокрутили */
.site-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: rgba(0, 0, 0, .72); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  opacity: 0; transition: opacity .25s;
}
.site-header.is-scrolled::before { opacity: 1; }
.site-header.is-scrolled { border-bottom-color: var(--line); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: var(--header-h); }
.site-nav { --n: 3; width: 380px; height: 48px; }
.site-nav .ic { width: 18px; height: 18px; display: none; }

/* ---------- секции ---------- */
.section { position: relative; padding: 112px 0; scroll-margin-top: var(--header-h); }
/* Разделы чередуются: чёрный и чуть светлее (полоса). Сверху и снизу полоса отчерчена линией во всю ширину,
   под ней мягкий свет сверху и редкая сетка из точек — продолжение сетки первого экрана */
.section--band { background: var(--band); border-block: 1px solid var(--band-line); }
.section--band::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 50% 160px at 50% 0, rgba(255, 255, 255, .05), transparent),
    radial-gradient(circle, rgba(255, 255, 255, .07) 1px, transparent 1.5px) center / 24px 24px;
  -webkit-mask-image: linear-gradient(#000, transparent 420px);
  mask-image: linear-gradient(#000, transparent 420px);
}
.section--band > .container { position: relative; z-index: 1; }
.section__head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 32px; max-width: 640px; }
.section__title { font: 700 clamp(28px, 4vw, 40px)/1.08 var(--f-display); letter-spacing: -.02em; }
.section__lead { color: var(--text-2); font-size: 16px; line-height: 1.55; }
/* Раздел с заголовком по центру */
.section--center .section__head { margin-left: auto; margin-right: auto; align-items: center; text-align: center; }

/* ---------- инструменты ---------- */
/* Пока заготовки: пунктирные карточки с номером в углу, по ним понятно, сколько мест готово */
.tool-soon { position: relative; min-height: 220px; gap: 10px; }
.tool-soon__num { position: absolute; top: 16px; left: 18px; font-size: 11px; color: var(--index); }

/* Карточка инструмента. Превью — «созвездие», как связи звёзд на первом экране: белая плитка
   со значком ссылки в центре и соцсети вокруг. Узлы и звёзды ставятся по --x/--y в процентах;
   при наведении линии и плитка разгораются, узлы чуть приподнимаются */
.tool__preview {
  position: relative; height: var(--card-media); border-radius: 16px; overflow: hidden;
  background: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(255, 255, 255, .07), transparent 70%), #050505;
  border: 1px solid #161616;
}
.tool__lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.tool__lines line {
  stroke: #fff; stroke-opacity: .35; stroke-width: 1; vector-effect: non-scaling-stroke;
  transition: stroke-opacity .4s;
}
.tool__lines line.is-faint { stroke-opacity: .15; }
.tool__star, .tool__hub, .tool__node { position: absolute; left: var(--x, 50%); top: var(--y, 50%); transform: translate(-50%, -50%); }
.tool__star { width: 3px; height: 3px; border-radius: 50%; background: rgba(255, 255, 255, .7); }
.tool__star.is-dim { width: 2px; height: 2px; background: rgba(255, 255, 255, .45); }
.tool__hub {
  width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center;
  background: #fff; color: #000; box-shadow: 0 0 36px rgba(255, 255, 255, .28);
  transition: box-shadow .4s;
}
.tool__hub .ic { width: 28px; height: 28px; stroke-width: 2.2; }
.tool__node {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: #000; border: 1px solid var(--line-strong); color: #fff;
  transition: transform .4s var(--ease-out), border-color .4s;
}
.tool__node .ic { width: 18px; height: 18px; }
.tool:hover .tool__lines line { stroke-opacity: .6; }
.tool:hover .tool__lines line.is-faint { stroke-opacity: .3; }
.tool:hover .tool__hub { box-shadow: 0 0 48px rgba(255, 255, 255, .42); }
.tool:hover .tool__node { border-color: #555; }
/* Наклон: всё созвездие сдвигается к курсору, как рендер в карточках проектов, плитка в центре чуть растёт */
.tool__lines { transform: translate(var(--px), var(--py)); transition: transform .6s var(--ease-out); }
.tool__star, .tool__node { transform: translate(calc(-50% + var(--px)), calc(-50% + var(--py))); }
.tool__star { transition: transform .6s var(--ease-out); }
.tool__hub { transform: translate(calc(-50% + var(--px)), calc(-50% + var(--py))); transition: box-shadow .4s, transform .6s var(--ease-out); }
.tool.is-tilting .tool__hub { transform: translate(calc(-50% + var(--px)), calc(-50% + var(--py))) scale(1.08); }
.tool.is-tilting :is(.tool__lines, .tool__star, .tool__node, .tool__hub) { transition-duration: .12s; transition-timing-function: ease-out; }

/* ---------- первый экран ---------- */
/* Первый экран на всю высоту окна, всё по центру, как на баннерах ботов: название, под ним девиз.
   Заходит под липкую шапку (отрицательный отступ), чтобы пылинки и сетка начинались от самого верха */
.hero {
  position: relative; overflow: hidden;
  min-height: 100svh; display: flex; align-items: center;
  margin-top: calc(-1 * var(--header-h));
  padding: calc(var(--header-h) + 48px) 0 96px; scroll-margin-top: var(--header-h);
}
.hero__inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; }
.hero__text { display: flex; flex-direction: column; align-items: center; gap: 28px; }
.hero__name { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.hero__title {
  font: 700 clamp(40px, 6.6vw, 108px)/1 var(--f-display); letter-spacing: -.03em; text-transform: uppercase;
  text-shadow: 0 0 60px rgba(255, 255, 255, .12);
}
.hero__lead { color: var(--text-2); font-size: clamp(15px, 1.1vw, 19px); line-height: 1.55; max-width: 34em; }
/* Кнопки рядом, одной ширины (на телефоне — друг под другом). Устроены как строки в ботах:
   плитка со значком, название с моноширинной подписью и стрелка, которая при наведении сдвигается */
.hero__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 4px; }
.hero__actions > .hero-btn { width: 300px; }
.hero-btn {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 14px;
  min-height: 64px; padding: 8px 18px 8px 8px; border-radius: 20px; text-align: left;
  transition: transform .15s, box-shadow .25s, border-color .2s, background .2s;
}
.hero-btn:active { transform: scale(.98); }
.hero-btn__icon { width: 48px; height: 48px; flex: none; border-radius: 14px; display: grid; place-items: center; }
.hero-btn__icon .ic { width: 20px; height: 20px; stroke-width: 2.2; }
.hero-btn__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hero-btn__title { font: 600 15px/1.25 var(--f-body); }
.hero-btn__meta { font: 500 11px var(--f-mono); letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-btn__arrow { width: 18px; height: 18px; transition: transform .25s var(--ease-out); }
.hero-btn:hover .hero-btn__arrow { transform: translate(2px, -2px); }
.hero-btn:hover .hero-btn__arrow--down { transform: translateY(3px); }

/* Главная — белая, значок на чёрной плитке; при наведении светится и по ней пробегает блик */
.hero-btn--primary { background: #fff; color: #000; border: 1px solid #fff; }
.hero-btn--primary .hero-btn__icon { background: #000; color: #fff; }
.hero-btn--primary .hero-btn__meta { color: #6a6a6a; }
.hero-btn--primary:hover { box-shadow: 0 0 32px rgba(255, 255, 255, .22); }
.hero-btn--primary::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%); pointer-events: none;
  background: linear-gradient(100deg, transparent 20%, rgba(0, 0, 0, .08) 50%, transparent 80%);
}
.hero-btn--primary:hover::after { animation: pill-shine .7s ease-out; }

/* Вторая — тёмное стекло поверх звёзд, значок на белой плитке, как в Events Hub */
.hero-btn--ghost {
  background: rgba(11, 11, 11, .72); border: 1px solid var(--line-chip);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.hero-btn--ghost .hero-btn__icon { background: #fff; color: #000; }
.hero-btn--ghost .hero-btn__meta { color: var(--faint); }
.hero-btn--ghost .hero-btn__arrow { color: var(--muted); }
.hero-btn--ghost:hover { border-color: var(--line-strong); background: rgba(20, 20, 20, .82); }
.hero-btn--ghost:hover .hero-btn__arrow { color: var(--text); }

/* Фон первого экрана: сетка, тающая к краям, мягкий свет за названием и пылинки (canvas, js/main.js) —
   те же пылинки, что вокруг стеклянных рендеров ботов */
.hero__bg { position: absolute; inset: 0; pointer-events: none; }
.hero__bg::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px; background-position: center;
  -webkit-mask-image: radial-gradient(ellipse 85% 80% at 50% 50%, #000 30%, transparent 85%);
  mask-image: radial-gradient(ellipse 85% 80% at 50% 50%, #000 30%, transparent 85%);
  opacity: .7;
}
.hero__bg::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 38% 30% at 50% 48%, rgba(255, 255, 255, .07), transparent 70%);
}
.hero__dust { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Звёздочки по углам — как на баннерах ботов */
.hero__frame {
  position: absolute; z-index: 1; inset: calc(var(--header-h) + 28px) 24px 32px; max-width: calc(var(--container) - 48px); margin: 0 auto;
  pointer-events: none;
}
.hero__corner { position: absolute; font: 500 18px/1 var(--f-mono); color: var(--muted); }
.hero__corner--tl { top: 0; left: 0; }
.hero__corner--tr { top: 0; right: 0; }
.hero__corner--bl { bottom: 0; left: 0; }
.hero__corner--br { bottom: 0; right: 0; }

/* Подсказка прокрутки: по линии бежит светлая капля */
.hero__scroll {
  position: absolute; z-index: 1; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.hero__scroll .kicker { font-size: 10px; transition: color .2s; }
.hero__scroll:hover .kicker { color: var(--text); }
.hero__scroll-line { position: relative; width: 1px; height: 40px; overflow: hidden; background: var(--line-strong); }
.hero__scroll-line::after {
  content: ""; position: absolute; left: 0; top: -40%; width: 100%; height: 40%;
  background: linear-gradient(transparent, #fff); animation: scroll-drop 2.2s ease-in-out infinite;
}
@keyframes scroll-drop { to { top: 100%; } }

/* ---------- проекты ---------- */
/* Все ряды одной высоты: карточка, оставшаяся одна в ряду (планшет), не становится ниже остальных */
.projects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 12px; }
.project {
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px 16px 18px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--line-row);
  transition: border-color .2s, transform .2s var(--ease-out);
}
/* Поворот в 3D за курсором — карточки проектов и инструментов (initTilt в js/main.js): --rx/--ry — наклон, --gx/--gy — где блик.
   Пока курсор над карточкой, она следует за ним быстро; ушёл — плавно возвращается */
:is(a.project, .tool) {
  --rx: 0deg; --ry: 0deg; --lift: 0px; --gx: 50%; --gy: 50%; --px: 0px; --py: 0px;
  position: relative;
  transform: perspective(900px) translateY(var(--lift)) rotateX(var(--rx)) rotateY(var(--ry));
  transition: border-color .2s, transform .6s var(--ease-out);
}
:is(a.project, .tool).is-tilting { --lift: -4px; transition: border-color .2s, transform .12s ease-out; }
:is(a.project, .tool):hover { border-color: var(--line-strong); }
:is(a.project, .tool):active { --lift: 0px; }
/* Блик — светлое пятно под курсором, как отражение на стекле */
:is(a.project, .tool)::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at var(--gx) var(--gy), rgba(255, 255, 255, .09), transparent 50%);
  opacity: 0; transition: opacity .4s;
}
:is(a.project, .tool).is-tilting::after { opacity: 1; }
/* Рендер лежит прямо на карточке, без рамки: чёрный фон рендера растворяется в фоне карточки (screen),
   а края, где обрезаны пылинки и свечение, гаснут маской */
.project__cover { height: var(--card-media); }
.project__cover img {
  width: 100%; height: 100%; object-fit: cover; mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(ellipse closest-side, #000 74%, transparent);
  mask-image: radial-gradient(ellipse closest-side, #000 74%, transparent);
  transition: transform .6s var(--ease-out);
}
/* Рендер чуть сдвигается к курсору — будто парит над карточкой */
a.project .project__cover img { transform: translate(var(--px), var(--py)); }
a.project.is-tilting .project__cover img { transform: translate(var(--px), var(--py)) scale(1.06); transition: transform .12s ease-out; }
.project__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.project__name { font: 700 19px/1.2 var(--f-display); letter-spacing: -.01em; }
.project__name i { font-style: normal; color: var(--index); }
/* Под описание всегда место на четыре строки: карточка с коротким текстом не становится ниже соседних,
   даже когда стоит одна в ряду (телефон) */
.project__text { color: var(--text-2); font-size: 14px; line-height: 1.55; flex: 1; min-height: calc(1.55em * 4); }
.project__tags { display: flex; gap: 6px; flex-wrap: wrap; }
.project__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 14px; border-top: 1px solid var(--line);
  font: 500 11px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
a.project:hover .project__foot { color: var(--text); }
/* Место под следующий проект */
.project--soon {
  justify-content: center; align-items: center; text-align: center; min-height: 320px;
  background: none; border: 1px dashed var(--line-btn); color: var(--faint);
}
.project--soon .thumb { margin-bottom: 4px; }

/* ---------- подвал ---------- */
.site-footer { position: relative; background: var(--band); border-top: 1px solid var(--band-line); }
.site-footer__inner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-top: 28px; padding-bottom: 40px;
}
/* Ссылки сообщества — строкой: значок и короткое название, при наведении светлеют */
.site-footer__links { display: flex; flex-wrap: wrap; gap: 6px; }
.site-footer__links a {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 999px;
  font: 500 12px var(--f-mono); color: var(--muted); border: 1px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.site-footer__links a:hover { color: var(--text); border-color: var(--line-chip); background: var(--surface); }
.site-footer__links .ic { width: 16px; height: 16px; }
.site-footer .kicker { font-size: 11px; }
.site-footer__mail { font-size: 12px; text-transform: none; letter-spacing: .04em; transition: color .15s; }
.site-footer__mail:hover { color: var(--text); }

/* ---------- 404 ---------- */
.not-found {
  min-height: calc(100vh - var(--header-h)); display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center; gap: 20px; padding-bottom: 80px;
}
.not-found__code { font: 700 clamp(96px, 20vw, 200px)/.9 var(--f-display); letter-spacing: -.04em; color: var(--index); }

/* ---------- планшет ---------- */
@media (max-width: 960px) {
  .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- телефон: навигация уезжает вниз и становится панелью из ботов ---------- */
@media (max-width: 720px) {
  .container { padding: 0 var(--pad); }
  :root { --header-h: 64px; }
  .site-nav {
    position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: calc(100% - 2 * var(--pad)); max-width: calc(480px - 2 * var(--pad)); height: var(--tabbar-h);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
  }
  .site-nav > a { flex-direction: column; gap: 3px; font-size: 10px; }
  .site-nav .ic { display: block; }
  .site-nav > [aria-current="true"] .ic { stroke-width: 2.3; }
  .toast { bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }

  .hero { padding: calc(var(--header-h) + 24px) 0 calc(var(--tabbar-h) + 32px); }
  .hero__lead { font-size: 15px; }
  .hero__actions { flex-direction: column; width: 100%; }
  .hero__actions > .hero-btn { width: 100%; }
  .hero__bg::before { background-size: 48px 48px; }
  /* Внизу экрана уже панель разделов — подсказка прокрутки и нижние звёздочки ей мешали бы */
  .hero__scroll, .hero__corner--bl, .hero__corner--br { display: none; }
  .hero__frame { inset: calc(var(--header-h) + 16px) var(--pad) 16px; }
  .section { padding: 72px 0; }
  .section__head { margin-bottom: 20px; }
  /* На телефоне карточки по одной: заготовкам «Скоро» хватает своей невысокой высоты */
  .projects { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; }
  .project--soon { min-height: 160px; }

  .site-footer__inner {
    flex-direction: column; align-items: flex-start; gap: 20px;
    padding-bottom: calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom));
  }
  .site-footer__links { margin-left: -12px; }
}
