/* apps.rgbee.ru — оформление «Цвет приложения» (вариант B, design/moodboards/parts/b.html).
   Политика — по правилам варианта D: строка до 68 знаков, интерлиньяж 1,7, оглавление, дата под заголовком.
   Шрифт один на весь сайт — Onest. Цвет приложения приходит переменными --app… из app/apps.php. */

@font-face { font-family: 'Onest'; font-weight: 400; font-display: swap; src: url('../fonts/Onest-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Onest'; font-weight: 500; font-display: swap; src: url('../fonts/Onest-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Onest'; font-weight: 600; font-display: swap; src: url('../fonts/Onest-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'Onest'; font-weight: 700; font-display: swap; src: url('../fonts/Onest-Bold.woff2') format('woff2'); }

:root {
  --bg: #FFFFFF;
  --surface: #F4F6F9;
  --text: #1B2230;
  --muted: #5B6576;
  --line: #E3E7ED;
  --ghost: #C3CAD4;
  --focus: #1B2230;
  /* цвет приложения по умолчанию (главная, 404) — нейтральный */
  --app: #1B2230; --app2: #2A3344; --link-app: #1B2230; --tint-app: #F4F6F9; --soft: #9AA4B2; --tint-dark: #181C23;
  color-scheme: light;
}
/* Тёмная тема: по настройке телефона, пока посетитель не выбрал сам (data-theme на <html>, assets/js/theme.js) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1217;
    --surface: #181C23;
    --text: #E8ECF2;
    --muted: #9AA4B2;
    --line: #2A303A;
    --ghost: #3A414D;
    --focus: #E8ECF2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1217;
  --surface: #181C23;
  --text: #E8ECF2;
  --muted: #9AA4B2;
  --line: #2A303A;
  --ghost: #3A414D;
  --focus: #E8ECF2;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow-wrap: break-word;
  min-width: 320px;
  --link: var(--link-app);
  --tint: var(--tint-app);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body { --link: var(--soft); --tint: var(--tint-dark); }
}
:root[data-theme="dark"] body { --link: var(--soft); --tint: var(--tint-dark); }
img { display: block; max-width: 100%; height: auto; }
picture { display: contents; }
h1, h2, h3, p, ul, ol, dl { margin: 0; }
a { color: inherit; }
a:focus-visible, .shots:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.hero a:focus-visible, .head--app a:focus-visible, .band a:focus-visible, .tile__link:focus-visible { outline-color: #FFFFFF; }

.skip { position: absolute; left: 16px; top: -100px; z-index: 10; padding: 8px 14px; border-radius: 8px; background: var(--text); color: var(--bg); font-weight: 600; text-decoration: none; }
.skip:focus { top: 8px; }

.wrap { max-width: 1184px; margin: 0 auto; padding: 0 16px; }
.link { color: var(--link); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.link:hover { text-decoration-thickness: 2px; }

/* ---------- шапка ---------- */
.head { background: var(--bg); border-bottom: 1px solid var(--line); }
.head__in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; line-height: 1.25; font-weight: 700; letter-spacing: -.005em; text-decoration: none; padding: 8px 0; }
/* знак RGBee Apps: знак студии на «иконке приложения», в центре — плитка (design/logo-apps/) */
.brand__mark { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 22%; }
.head--app .brand__mark, :root[data-theme="dark"] .brand__mark { box-shadow: 0 0 0 1px rgba(255, 255, 255, .18); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand__mark { box-shadow: 0 0 0 1px rgba(255, 255, 255, .18); }
}
.head__nav { display: none; gap: 28px; font-size: 15px; font-weight: 500; color: var(--muted); }
.head__nav a { text-decoration: none; }
.head__nav a:hover, .head__nav a[aria-current] { color: var(--text); }
.head__tools { display: flex; align-items: center; gap: 28px; }

/* переключатель темы: луна — в светлой теме, солнце — в тёмной; без JS не показывается */
.theme {
  display: none; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 40px; height: 40px; margin-right: -8px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: inherit; cursor: pointer;
}
.js .theme { display: inline-flex; }
.theme:hover { background: var(--surface); }
.head--app .theme:hover { background: rgba(255, 255, 255, .12); }
.theme:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.head--app .theme:focus-visible { outline-color: #FFFFFF; }
.theme svg { width: 20px; height: 20px; }
.theme__sun { display: none; }
:root[data-theme="dark"] .theme__sun { display: block; }
:root[data-theme="dark"] .theme__moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme__sun { display: block; }
  :root:not([data-theme="light"]) .theme__moon { display: none; }
}

.head--app { background: var(--app); color: #FFFFFF; border-bottom-color: rgba(255, 255, 255, .12); }
.head--app .head__nav { color: rgba(255, 255, 255, .8); }
.head--app .head__nav a:hover { color: #FFFFFF; }

/* ---------- главная ---------- */
.intro { padding: 28px 0 4px; font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
.tiles { display: grid; gap: 12px; list-style: none; margin: 0; padding: 20px 0 40px; }
.tile__link {
  position: relative; display: flex; gap: 24px; overflow: hidden; height: 100%;
  padding: 20px; border-radius: 20px; color: #FFFFFF; text-decoration: none;
  background: linear-gradient(160deg, var(--app2), var(--app) 75%);
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile__link:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(16, 24, 40, .22); }
.tile__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.tile__icon { width: 72px; height: 72px; border-radius: 17px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .16); }
.tile__body { display: block; }
.tile__name { display: block; font-size: 20px; line-height: 1.25; font-weight: 700; }
.tile__desc { display: block; margin-top: 6px; font-size: 15px; line-height: 1.5; color: rgba(255, 255, 255, .86); }
.tile__go { margin-top: auto; font-size: 14px; font-weight: 600; }
.tile__shot { display: none; }

/* метки */
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 14px 0 0; }
.chip { padding: 6px 10px; border-radius: 999px; font-size: 12.5px; line-height: 1; font-weight: 600; color: #FFFFFF; background: rgba(255, 255, 255, .15); }

/* ---------- страница приложения ---------- */
.hero { color: #FFFFFF; background: linear-gradient(170deg, var(--app2) 0%, var(--app) 70%); padding: 14px 0 150px; }
.back { display: inline-block; padding: 4px 0; font-size: 14px; font-weight: 500; color: rgba(255, 255, 255, .82); text-decoration: none; }
.back:hover { color: #FFFFFF; }
.hero__icon { width: 96px; height: 96px; margin: 18px 0 16px; border-radius: 22px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .16), 0 8px 24px rgba(0, 0, 0, .28); }
.hero h1 { font-size: 30px; line-height: 1.12; font-weight: 700; letter-spacing: -.01em; }
.hero__sub { margin-top: 10px; font-size: 16px; line-height: 1.5; color: rgba(255, 255, 255, .88); }
.facts { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; padding: 0; margin: 14px 0 0; font-size: 14px; font-weight: 500; }
.facts li::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: var(--soft); vertical-align: middle; }
/* кнопки скачивания: на первом экране — белая на цвете приложения, в боковой колонке — цвета приложения */
.get { display: flex; flex-wrap: wrap; gap: 10px; }
.get--hero { margin-top: 22px; }
.get__btn {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 20px 10px 16px;
  border-radius: 14px; text-decoration: none; transition: background-color .15s ease, box-shadow .15s ease;
}
.get__icon { flex: 0 0 auto; width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.get__text b { display: block; font-size: 17px; line-height: 1.2; font-weight: 700; }
.get__text small { display: block; margin-top: 3px; font-size: 13px; line-height: 1.3; font-weight: 500; opacity: .78; }
.get--hero .get__btn { background: #FFFFFF; color: var(--app); box-shadow: 0 6px 20px rgba(0, 0, 0, .22); }
.get--hero .get__btn:hover { background: #EEF1F6; }
.get--hero .get__btn--alt { background: transparent; color: #FFFFFF; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .55); }
.get--hero .get__btn--alt:hover { background: rgba(255, 255, 255, .1); }
.get--side .get__btn { background: var(--app); color: #FFFFFF; }
.get--side .get__btn:hover { background: var(--app2); }
.get--side .get__btn--alt { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.get--side .get__btn--alt:hover { background: var(--surface); }
.get__soon { width: 100%; margin: 4px 0 0; padding: 10px 16px; border: 1.5px dashed var(--muted); border-radius: 14px; }
.get__soon b { display: block; font-size: 15px; line-height: 1.3; font-weight: 600; }
.get__soon small { display: block; margin-top: 2px; font-size: 13px; line-height: 1.3; color: var(--muted); }
.get__note { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.card--get { background: var(--surface); }
.card--get h2 { margin-bottom: 12px; }

/* лента скриншотов: листается внутри себя, страница вбок не двигается */
.shots {
  display: flex; gap: 10px; max-width: 1184px; margin: -136px auto 0; padding: 6px 16px 10px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding: 0 16px; scrollbar-width: thin;
}
.shots__item { flex: 0 0 auto; display: block; border-radius: 14px; scroll-snap-align: start; cursor: zoom-in; }
.shots__item:focus-visible { outline-offset: 2px; border-radius: 16px; }
.shots img {
  width: 150px; height: 267px; border-radius: 14px;
  background: var(--surface); box-shadow: 0 0 0 1px rgba(16, 24, 40, .08), 0 6px 18px rgba(16, 24, 40, .18);
  transition: transform .15s ease;
}
.shots__item:hover img { transform: translateY(-2px); }
.shots::after { content: ""; flex: 0 0 6px; }

/* окно галереи: слайды листаются свайпом (горизонтальная прокрутка с привязкой), кнопками и стрелками */
.is-gallery { overflow: hidden; }
.gallery {
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(9, 11, 15, .97); color: #FFFFFF; overflow: hidden;
}
.gallery::backdrop { background: transparent; }
.gallery__track {
  display: flex; height: 100%; overflow-x: auto; overscroll-behavior: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.gallery__track::-webkit-scrollbar { display: none; }
.gallery__slide {
  flex: 0 0 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  margin: 0; padding: 64px 16px 72px; scroll-snap-align: center; scroll-snap-stop: always;
}
.gallery__img {
  width: auto; height: auto; max-width: 100%; min-height: 0;
  max-height: calc(100vh - 176px); max-height: calc(100dvh - 176px); /* поля окна и подпись */
  border-radius: 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); background: #181C23;
}
.gallery__slide picture { display: contents; }
.gallery__slide figcaption { font-size: 15px; line-height: 1.4; color: rgba(255, 255, 255, .85); text-align: center; }
.gallery__btn {
  position: absolute; display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .14); color: #FFFFFF; cursor: pointer;
}
.gallery__btn:hover { background: rgba(255, 255, 255, .24); }
.gallery__btn:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }
.gallery__btn:disabled { opacity: .3; cursor: default; }
.gallery__btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.gallery__close { top: 12px; right: 12px; }
.gallery__prev, .gallery__next { bottom: 14px; }
.gallery__prev { left: 16px; }
.gallery__next { right: 16px; }
.gallery__count { position: absolute; left: 50%; bottom: 26px; margin: 0; transform: translateX(-50%); font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, .8); }

.body { padding-top: 8px; padding-bottom: 48px; }
.sec { padding-top: 28px; }
.sec h2 { margin-bottom: 10px; font-size: 20px; line-height: 1.3; font-weight: 700; }
.sec p + p, .sec ul + p, .sec p + ul { margin-top: 10px; }
.list { display: grid; gap: 10px; list-style: none; padding: 0; }
.list li { position: relative; padding-left: 20px; }
.list li::before { content: ""; position: absolute; left: 0; top: .62em; width: 8px; height: 8px; border-radius: 2px; background: var(--link); }
.body__side { display: grid; gap: 12px; align-content: start; padding-top: 28px; }
.card { padding: 18px; border-radius: 16px; background: var(--tint); }
.card--plain { background: var(--surface); }
.card h2 { margin-bottom: 8px; font-size: 17px; line-height: 1.3; font-weight: 700; }
.card p { font-size: 15px; line-height: 1.55; }
.card p + p { margin-top: 8px; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 15px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }

/* ---------- политика ---------- */
.band { color: #FFFFFF; background: var(--app); }
.band__in { display: flex; align-items: center; gap: 12px; min-height: 60px; padding-top: 10px; padding-bottom: 10px; }
.band__icon { width: 36px; height: 36px; border-radius: 9px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .16); }
.band b { flex: 1 1 auto; font-size: 15px; font-weight: 600; }
.band a { font-size: 14px; color: rgba(255, 255, 255, .85); text-decoration: none; }
.band a:hover { color: #FFFFFF; }

.pol { padding-top: 24px; padding-bottom: 48px; }
.switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.switch a { padding: 6px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; }
.switch a:hover { color: var(--text); }
.switch a.is-on { color: #FFFFFF; background: var(--app); }
.toc { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; }
.toc summary { padding: 10px 14px; font-size: 15px; font-weight: 600; cursor: pointer; }
.toc ol { padding: 0 14px 12px 34px; font-size: 14px; line-height: 1.8; color: var(--muted); }
.toc a { text-decoration: none; }
.toc a:hover { color: var(--text); text-decoration: underline; }

.prose { max-width: 68ch; font-size: 16.5px; line-height: 1.7; }
.prose h1 { font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: -.005em; }
.prose .meta { margin-top: 8px; font-size: 15px; line-height: 1.6; color: var(--muted); }
.prose .meta + .meta { margin-top: 12px; }
.prose h2 { margin: 28px 0 8px; font-size: 19px; line-height: 1.3; font-weight: 700; scroll-margin-top: 16px; }
.prose p + p, .prose ul + p, .prose p + ul { margin-top: 10px; }
.prose ul { padding-left: 22px; }
.prose li + li { margin-top: 4px; }
.prose strong { font-weight: 600; }
.prose a { color: var(--link); text-underline-offset: 3px; }
.prose code { padding: 1px 5px; border-radius: 5px; background: var(--surface); font: 400 .82em/1.4 ui-monospace, 'Cascadia Mono', Consolas, monospace; overflow-wrap: anywhere; }
#ru, #en { scroll-margin-top: 16px; }
.pol__text { margin-top: 24px; }
.lang-sep { max-width: 68ch; margin: 40px 0 20px; padding-top: 18px; border-top: 2px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }

/* ---------- 404 ---------- */
.notfound { padding-bottom: 56px; }
.notfound p { margin-top: 12px; color: var(--muted); }
.notfound__list { display: grid; gap: 8px; margin-top: 20px; padding-left: 20px; }

/* ---------- подвал ---------- */
.foot { padding: 24px 0 28px; border-top: 1px solid var(--line); background: var(--surface); font-size: 13px; line-height: 1.6; color: var(--muted); }
.foot__in { display: grid; gap: 8px; }
.foot strong { color: var(--text); font-weight: 700; }
.foot a { color: var(--text); font-weight: 600; text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* ---------- планшет и компьютер ---------- */
@media (min-width: 720px) {
  .head__nav { display: flex; }
  .get--hero .get__btn { width: auto; }
  .brand { font-size: 15px; gap: 10px; }
  .brand__mark { width: 32px; height: 32px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 20px; }
  .foot__in { grid-template-columns: 1.2fr 2fr 1fr; gap: 32px; }
}

@media (min-width: 960px) {
  .wrap { padding: 0 48px; }
  .head__in { min-height: 68px; }
  .brand { font-size: 17px; gap: 12px; }
  .brand__mark { width: 36px; height: 36px; }

  .intro { padding: 64px 0 8px; font-size: 48px; }
  .tiles { gap: 24px; padding: 36px 0 72px; }
  .tile__link { min-height: 300px; padding: 32px 32px 0; }
  .tile__main { gap: 18px; padding-bottom: 32px; }
  .tile__icon { width: 96px; height: 96px; border-radius: 22px; }
  .tile__name { font-size: 24px; }
  .tile__shot { display: block; flex: 0 0 auto; align-self: flex-end; width: 150px; height: 267px; margin-top: 8px; border-radius: 14px 14px 0 0; box-shadow: 0 0 0 1px rgba(255, 255, 255, .18); }

  .hero { padding: 40px 0 190px; }
  .back { margin-bottom: 24px; }
  .hero__row { display: flex; align-items: center; gap: 36px; }
  .hero__icon { flex: 0 0 auto; width: 140px; height: 140px; margin: 0; border-radius: 32px; }
  .hero h1 { font-size: 52px; letter-spacing: -.02em; }
  .hero__sub { font-size: 19px; max-width: 640px; }
  .hero__tags { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 18px; }
  .hero__tags .chips, .hero__tags .facts { margin: 0; }

  .shots { margin-top: -166px; padding: 6px 48px 12px; gap: 16px; scroll-padding: 0 48px; }
  .shots img { width: 166px; height: 295px; border-radius: 16px; }

  .gallery__slide { padding: 56px 96px 40px; }
  .gallery__img { max-height: calc(100vh - 136px); max-height: calc(100dvh - 136px); }
  .gallery__prev, .gallery__next { top: 50%; bottom: auto; transform: translateY(-50%); width: 56px; height: 56px; }
  .gallery__prev { left: 24px; }
  .gallery__next { right: 24px; }
  .gallery__close { top: 16px; right: 24px; }
  .gallery__count { top: 28px; bottom: auto; }

  .body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 56px; padding-top: 32px; padding-bottom: 64px; }
  .body__main > .sec:first-child { padding-top: 0; }
  .body__main p, .body__main .list { font-size: 17px; line-height: 1.65; }
  .body__side { padding-top: 0; }

  .pol { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 72px; padding-top: 48px; padding-bottom: 72px; }
  .pol__side { position: sticky; top: 24px; align-self: start; }
  .pol__side .toc { border: 0; margin-top: 24px; }
  .pol__side .toc summary { padding: 0 0 8px; font-size: 13px; color: var(--muted); list-style: none; cursor: default; pointer-events: none; }
  .pol__side .toc summary::-webkit-details-marker { display: none; }
  .pol__side .toc ol { padding: 0 0 0 20px; font-size: 14.5px; line-height: 2; }
  .pol__text { margin-top: 0; }
  .prose { font-size: 17px; }
  .prose h1 { font-size: 36px; line-height: 1.2; }
  .prose .meta:first-of-type { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tile__link, .shots img { transition: none; }
  .tile__link:hover, .shots__item:hover img { transform: none; }
}
