/* ============================================================
   ЧБ-портфолио — Telegram Mini App
   Токены тем: тёмная по умолчанию, светлая через media/data-theme
   ============================================================ */

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --line: #2a2a2a;
  --fg: #f4f4f4;
  --muted: #9a9a9a;
  --chip: #1c1c1c;
  --stage: #111111;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #fafafa;
    --surface: #ffffff;
    --line: #e2e2e2;
    --fg: #101010;
    --muted: #6b6b6b;
    --chip: #efefef;
    --stage: #e8e8e6;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a0a; --surface: #141414; --line: #2a2a2a;
  --fg: #f4f4f4; --muted: #9a9a9a; --chip: #1c1c1c; --stage: #111111;
}
:root[data-theme="light"] {
  --bg: #fafafa; --surface: #ffffff; --line: #e2e2e2;
  --fg: #101010; --muted: #6b6b6b; --chip: #efefef; --stage: #e8e8e6;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.mono {
  font-family: ui-monospace, "SF Mono", Consolas, "Cascadia Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

button { cursor: pointer; }
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}
img, video { display: block; max-width: 100%; }

/* Все фото — принудительно ч/б. Уберите строку, если нужны цветные. */
.cover img, .slide img, .slide video { filter: grayscale(1) contrast(1.05); }

/* ---------- Экран: список ---------- */

.screen { display: flex; flex-direction: column; flex: 1; }
.screen[hidden] { display: none; }

.hero { padding: 28px 20px 20px; border-bottom: 1px solid var(--line); }

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  margin-bottom: 18px;
}
.hero-top .count {
  background: var(--fg);
  color: var(--bg);
  padding: 4px 10px;
}

.hero h1 {
  font-size: clamp(42px, 13vw, 58px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  text-transform: uppercase;
  text-wrap: balance;
}

.hero .role {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.cards {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.card {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  color: inherit;
  font: inherit;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: background-color 0.15s ease;
}
.card:active { background: var(--surface); }
@media (hover: hover) {
  .card:hover { background: var(--surface); }
}

.cards li:last-child .card { border-bottom: none; }

.card .cover {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.card .cover img { width: 100%; height: 100%; object-fit: cover; }

.card .meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.card h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.card .tagline { color: var(--muted); font-size: 14px; line-height: 1.5; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span {
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 4px 9px;
}

/* ---------- Нижняя навигация ---------- */

.tabbar {
  position: sticky;
  bottom: 0;
  z-index: 6;
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.tabbar[hidden] { display: none; }
.tabbar button {
  background: none;
  border: none;
  border-left: 1px solid var(--line);
  color: var(--muted);
  padding: 17px 4px calc(17px + env(safe-area-inset-bottom, 0px));
  transition: background-color 0.15s ease, color 0.15s ease;
}
.tabbar button:first-child { border-left: none; }
.tabbar button.on {
  background: var(--fg);
  color: var(--bg);
}

/* ---------- Шапки разделов ---------- */

.tab-hero { padding: 28px 20px 22px; border-bottom: 1px solid var(--line); }
.tab-hero .eyebrow { display: block; color: var(--muted); margin-bottom: 12px; }
.tab-hero h1 {
  font-size: clamp(32px, 10vw, 44px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.95;
  text-transform: uppercase;
  text-wrap: balance;
}
.tab-hero .sub { margin-top: 12px; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* ---------- Секции: процесс, ТЗ, поддержка ---------- */

.section {
  padding: 26px 20px 30px;
  border-bottom: 1px solid var(--line);
}
.tab .section:last-child { border-bottom: none; }
.section-head {
  color: var(--muted);
  font-weight: 400;
  margin-bottom: 20px;
}

.steps { list-style: none; display: flex; flex-direction: column; }
.steps li {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.steps li:first-child { border-top: none; padding-top: 0; }
.step-num {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.steps h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.steps p { font-size: 14px; color: var(--muted); line-height: 1.55; }
.steps.compact .step-num { width: 26px; height: 26px; font-size: 10px; }
.steps.compact li { padding: 9px 0; }
.steps.compact p { padding-top: 3px; color: var(--fg); }

.nospec {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.nospec-intro { font-size: 14px; line-height: 1.55; }
.stamp {
  align-self: flex-start;
  background: var(--fg);
  color: var(--bg);
  padding: 8px 12px;
}

.support { list-style: none; display: flex; flex-direction: column; }
.support li { padding: 14px 0; border-top: 1px solid var(--line); }
.support li:first-child { border-top: none; padding-top: 0; }
.support h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 4px; }
.support p { font-size: 14px; color: var(--muted); line-height: 1.55; }

/* ---------- Экран: проект ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .back {
  background: none;
  border: 1px solid var(--line);
  color: var(--fg);
  width: 38px;
  height: 38px;
  font-size: 17px;
  line-height: 1;
  flex: none;
}
.topbar .back:active { background: var(--fg); color: var(--bg); }
.topbar .crumb { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.carousel-wrap { border-bottom: 1px solid var(--line); }
.carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }

.slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  aspect-ratio: 4 / 3;
  background: var(--surface);
}
.slide img, .slide video { width: 100%; height: 100%; object-fit: cover; }

.dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 0;
}
.dots i {
  width: 7px;
  height: 7px;
  background: var(--line);
  transition: background-color 0.2s ease;
}
.dots i.on { background: var(--fg); }

.detail-body { padding: 24px 20px 32px; display: flex; flex-direction: column; gap: 22px; }

.detail-body .meta { display: flex; justify-content: space-between; color: var(--muted); }

.detail-body h2 {
  font-size: clamp(30px, 8.5vw, 38px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.02;
  text-wrap: balance;
}

.detail-body .section-label { color: var(--muted); }
.detail-body .desc {
  font-size: 15px;
  line-height: 1.65;
  max-width: 65ch;
  margin-top: 8px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  text-decoration: none;
  font-size: 12px;
}
.btn:active { background: var(--bg); color: var(--fg); }
.btn.ghost { background: none; color: var(--fg); border-color: var(--line); }

/* ---------- Футер ---------- */

.footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 26px 20px 34px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.footer .cta-label { color: var(--muted); }
.footer .copy { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
