/* Jeeks OS — публичные страницы (jos.jeeksshire24.com).
   Токены — BRANDBOOK.md §3 (палитра) и §5 (радиусы 13/18/24, сетка 2pt).
   Стиль страницы держится ТОЛЬКО тут: CSP отдаёт `style-src 'self'`, инлайновых `style="..."`
   в разметке нет ВООБЩЕ (браузер их заблокировал бы) — это не косметика, а несущее ограничение.
   Шрифт — системный стек. brand-override: §4 просит в вебе Space Grotesk/Inter, но публичная
   страница обязана делать НОЛЬ внешних запросов (ни CDN, ни шрифтов), поэтому веб-шрифта нет. */

:root {
  --bg: #08080A;
  --ink: #E7E9EA;
  --muted: rgba(231, 233, 234, .56);
  --surface: rgba(255, 255, 255, .075);
  --surface2: rgba(255, 255, 255, .115);
  --line: rgba(255, 255, 255, .14);
  --line-strong: rgba(255, 255, 255, .22);
  --sapphire: #2E60E0;
  --gold: #C9A24E;
  --r-xs: 8px;
  --r-sm: 13px;
  --r: 18px;
  --r-lg: 24px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #F4F5F7;
    --ink: #14161B;
    --muted: rgba(20, 22, 27, .58);
    --surface: rgba(0, 0, 0, .04);
    --surface2: rgba(0, 0, 0, .06);
    --line: rgba(0, 0, 0, .10);
    --line-strong: rgba(0, 0, 0, .16);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
/* height:auto обязателен: у картинок стоят width/height из колонок вложения (это резерв места
   против «прыжка» вёрстки), и без него max-width сжимал бы ширину, оставляя высоту оригинала. */
img { display: block; max-width: 100%; height: auto; }

/* Колонка контента — 640 (BRANDBOOK: одна читаемая колонка, один брейкпоинт 700px) */
.page { max-width: 640px; margin: 0 auto; padding: 16px 16px 40px; }

/* ── Шапка: ТОЛЬКО знак JOS ───────────────────────────────────────────────
   Подписи графства справа от знака нет (убрана по просьбе владельца): чужая
   ссылка открывается знаком, а не пояснением к нему. Класс .eyebrow ниже жив —
   им набраны заголовки секций («ОТВЕТЫ», «ПУБЛИКАЦИИ»), см. .sec > .eyebrow. */
.top { display: flex; align-items: center; gap: 10px; padding: 6px 2px 16px; }
.brand { display: flex; align-items: center; }
.brand svg { height: 20px; width: auto; fill: var(--ink); }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--muted);
}

/* ── Карточка ─────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
}
.card + .card { margin-top: 10px; }

/* ── Автор ────────────────────────────────────────────────────────────── */
.who { display: flex; align-items: center; gap: 10px; }
.ava {
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 50%; overflow: hidden;
  background: var(--surface2); border: 1px solid var(--line);
}
.ava img { width: 100%; height: 100%; object-fit: cover; }
.who-t { min-width: 0; }
.name {
  display: flex; align-items: center; gap: 4px;
  font-size: 15px; font-weight: 700; line-height: 1.25;
}
.name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ver { width: 15px; height: 15px; flex: 0 0 15px; }
.handle { font-size: 13px; color: var(--muted); }

/* ── Название публикации (видеоплатформа) ─────────────────────────────── */
/* Появляется ТОЛЬКО у названной записи (feed_posts.title); у обычного поста узла нет вовсе,
   поэтому его разметка байт-в-байт прежняя. Кегль крупнее тела: имя работы — это заголовок
   карточки, а не первая строка описания. */
.ptitle { margin: 12px 0 0; font-size: 19px; line-height: 1.3; font-weight: 700; overflow-wrap: anywhere; }
.ptitle + .text { margin-top: 8px; }

/* ── Текст поста / статьи ─────────────────────────────────────────────── */
.text { margin-top: 12px; font-size: 16px; line-height: 1.55; overflow-wrap: anywhere; }
.text:empty { display: none; }

/* ── Фото ─────────────────────────────────────────────────────────────── */
.shots { margin-top: 12px; display: grid; gap: 6px; }
.shots.n2, .shots.n4 { grid-template-columns: 1fr 1fr; }
.shots.n3, .shots.nx { grid-template-columns: 1fr 1fr 1fr; }
.shot { border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface2); }
.shot img { width: 100%; height: auto; }
.shots.n2 .shot img, .shots.n3 .shot img, .shots.n4 .shot img, .shots.nx .shot img {
  aspect-ratio: 1 / 1; object-fit: cover; height: 100%;
}

/* ── Ролик: тот же кадр + значок «играть» ────────────────────────────────
   <video> странице запрещён (CSP default-src 'none', скриптов нет вовсе), поэтому ролик
   показывается ПОСТЕРОМ — а значок нужен, чтобы кадр не выглядел обычной фотографией.
   Смотреть — по кнопке «Открыть в Jeeks OS», она у страницы уже есть. */
.shot.vid { position: relative; }
.shot.vid .play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(8, 8, 10, .62); border: 1px solid rgba(255, 255, 255, .28);
  display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.shot.vid .play svg { width: 26px; height: 26px; fill: #fff; margin-left: 2px; }

/* ── Фото: КАРУСЕЛЬ (выбор автора, feed_posts.gallery_layout = carousel) ──
   Кадр целиком, листается вбок — БЕЗ ЕДИНОЙ СТРОКИ СКРИПТА: у страницы их нет вовсе (CSP
   default-src 'none'), поэтому листание — родное горизонтальное прокручивание + scroll-snap.
   Слайд ýже колонки (86%): край соседнего кадра ВИДЕН — это и есть подсказка «здесь листают»,
   которой без скрипта взять больше неоткуда (точек-страниц нам нечем зажигать).
   Квадратный кадр — как в приложении (FeedLayout.GalleryShape.carousel = 1:1): одна высота на все
   слайды, иначе лента прыгала бы на каждом фото. */
.shots.car {
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-padding: 0;
}
.shots.car .shot { flex: 0 0 86%; scroll-snap-align: start; }
.shots.car .shot img { width: 100%; height: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
/* Скроллер получает фокус с клавиатуры (tabindex в разметке) — фокус обязан быть виден. */
.shots.car:focus-visible { outline: 2px solid var(--sapphire); outline-offset: 2px; }

/* ── Приложенный инструмент ───────────────────────────────────────────────
   На месте служебной строки `jeeksapp://tool/<ключ>`, которую разбор вырезал из текста
   (api/lib/public_share_tools.php). Вид — та же карточка, что в приложении
   (Components/JToolCard.swift): квадрат-иконка, имя, подпись «Открыть», шеврон. Цвет инструмента
   на вебе НЕ повторяем: палитра и глиф живут в клиенте, и второй их список тут разъехался бы. */
.tools { margin-top: 12px; display: grid; gap: 6px; }
.tool {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.tool-i {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-xs); background: rgba(46, 96, 224, .20);
}
.tool-i svg { width: 18px; height: 18px; fill: var(--sapphire); }
.tool-t { min-width: 0; }
.tool-t b { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-t > span { font-size: 12px; color: var(--muted); }
.tool-c { width: 14px; height: 14px; flex: 0 0 14px; margin-left: auto; fill: var(--sapphire); }

/* ── Мета и счётчики ──────────────────────────────────────────────────── */
.meta { margin-top: 12px; font-size: 13px; color: var(--muted); }
.stats { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.stat { display: inline-flex; align-items: center; gap: 5px; }
.stat svg { width: 15px; height: 15px; fill: currentColor; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Бейдж «часть N из M» многочастной публикации: тише даты, но читается (это подсказка о структуре). */
.part { font-variant-numeric: tabular-nums; }

/* ── Кнопка «Открыть в Jeeks OS» ──────────────────────────────────────── */
.cta {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 16px; padding: 10px 18px;
  background: var(--sapphire); color: #FFFFFF;
  border-radius: 999px; font-size: 15px; font-weight: 600;
}
.cta svg { width: 16px; height: 16px; fill: #FFFFFF; }

/* ── Секции ───────────────────────────────────────────────────────────── */
.sec { margin-top: 24px; }
.sec > .eyebrow { display: block; margin: 0 0 10px 2px; }
.reply { background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 14px 2px; }
.reply + .reply { margin-top: 0; }

/* ── Профиль ──────────────────────────────────────────────────────────── */
.banner {
  height: 148px; border-radius: var(--r-lg); overflow: hidden;
  background: var(--surface2); border: 1px solid var(--line);
}
.banner img { width: 100%; height: 100%; object-fit: cover; }
.prof { margin-top: -38px; padding-top: 0; }
.pava {
  width: 88px; height: 88px; border-radius: 50%; overflow: hidden;
  border: 3px solid var(--bg); background: var(--surface2);
}
.pava img { width: 100%; height: 100%; object-fit: cover; }
.pname { margin: 10px 0 0; font-size: 24px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.pname .ver { width: 19px; height: 19px; flex: 0 0 19px; }
.bio { margin-top: 8px; font-size: 15px; overflow-wrap: anywhere; }
.nums { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 18px; }
.num { font-size: 13px; color: var(--muted); }
.num b { display: block; font-size: 17px; font-weight: 700; color: var(--ink); }

/* ── Статья ───────────────────────────────────────────────────────────── */
.art { border-color: var(--gold); }
.h1 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 700; overflow-wrap: anywhere; }
.art-img { margin-top: 14px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); }

/* ── Пустое состояние / ошибка ────────────────────────────────────────── */
.empty { text-align: center; padding: 40px 16px; }
.empty .seal { width: 56px; height: 56px; margin: 0 auto 14px; }
.empty .seal svg { width: 100%; height: 100%; fill: var(--gold); }
.empty h1 { margin: 0 0 6px; font-size: 20px; font-weight: 700; }
.empty p { margin: 0; color: var(--muted); font-size: 15px; }

/* ── Подвал ───────────────────────────────────────────────────────────── */
.foot {
  margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--muted);
}
.foot .seal { width: 18px; height: 18px; flex: 0 0 18px; }
.foot .seal svg { width: 100%; height: 100%; fill: var(--gold); }
.foot a { text-decoration: underline; text-underline-offset: 2px; }

/* ── Переключатель языка документа (политика конфиденциальности) ───────
   Тридцать языков = тридцать КНОПОК, а не абзац через «·» (просьба владельца 2026-08-12:
   «сделай тут нормальные синие кнопки у каждого языка»). Скриптов у домена нет вовсе
   (CSP default-src 'none'), поэтому кнопка — обычная ссылка <a> на ТОТ ЖЕ адрес с ?lang=.
   🔴 СИНИЙ ОДИН НА ВЕСЬ ДОМЕН — var(--sapphire) (#2E60E0, BRANDBOOK §3 Sapphire Spectrum; им же
   залита .cta и обведён фокус карусели). Второго синего тут нет: заливка и обводка — ТОТ ЖЕ цвет,
   только с прозрачностью (rgba пишется числами, потому что var() внутрь rgba() не подставляется).
   🔴 РИТМ ЗАДАЁТ gap, А НЕ ПРОБЕЛЫ РАЗМЕТКИ: flex-контейнер пробельные куски между элементами не
   рисует вовсе. Это несущая мелочь — те же пробелы держат страницу читаемой у человека со СТАРЫМ
   css (список подчёркнутых ссылок вместо слипшегося слова), см. api/public/privacy.php.
   RTL (ar/fa/ur/he) не разъезжается: направление ряда flex берёт из dir="rtl" на <html>, а каждая
   ссылка — сама себе bidi-изолят (атрибут dir печатается в разметке из признака оболочки). */
.langs { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.langs a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 34px;                       /* зона нажатия ПАЛЬЦЕМ, а не «строка текста» */
  padding: 6px 14px;
  border-radius: 999px;                   /* капсула (BRANDBOOK §5), а не радиус «на глаз» */
  border: 1px solid rgba(46, 96, 224, .55);
  background: rgba(46, 96, 224, .22);
  color: var(--ink);
  font-size: 13px; font-weight: 500; line-height: 1.2;
  text-decoration: none;
}
.langs a:hover { background: rgba(46, 96, 224, .40); border-color: var(--sapphire); }
.langs a:focus-visible { outline: 2px solid var(--sapphire); outline-offset: 2px; }
/* 🔴 ТЕКУЩИЙ ЯЗЫК — ЗАЛИТАЯ кнопка против контурных. Он не «ещё один выбор», а СОСТОЯНИЕ страницы:
   в ряду из тридцати одинаковых пилюль различие обязано читаться с одного взгляда и БЕЗ цвета тоже
   (жирнее + инверсия), поэтому заливка, а не оттенок. Ссылкой он остаётся намеренно — см. разметку. */
.langs a.on { background: var(--sapphire); border-color: var(--sapphire); color: #FFFFFF; font-weight: 600; }
.langs a.on:hover { background: var(--sapphire); }

/* ── Витрина / index ──────────────────────────────────────────────────── */
.lead { margin-top: 24px; font-size: 17px; color: var(--muted); }
.hero { margin-top: 24px; text-align: center; }
.hero svg { height: 44px; width: auto; fill: var(--ink); }
.hero h1 { margin: 18px 0 0; font-size: 26px; font-weight: 700; }

/* ── Сетка хаба «Видеоплатформа» (api/public/video.php) ──────────────────
   Плитка ролика переиспользует .shot/.play страницы поста (значок «играть», рамку и фон), поэтому
   своей «второй ячейки с видео» у домена не появляется. Колонок ровно столько, сколько влезает;
   auto-fill (а не auto-fit) — чтобы две плитки не растягивались во всю ширину экрана. */
.vgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.vcard { display: block; text-decoration: none; color: inherit; }
.vcard .shot { display: block; aspect-ratio: 16 / 9; }
.vcard .shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vcard .shot.nofr { background: var(--surface2); }
.vtitle { display: block; margin-top: 8px; font-size: 14px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.vby { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.vcard:hover .vtitle { text-decoration: underline; }

/* ── Единственный брейкпоинт ──────────────────────────────────────────── */
@media (max-width: 700px) {
  .page { padding: 12px 12px 32px; }
  .card { padding: 14px; border-radius: var(--r-sm); }
  .banner { height: 112px; border-radius: var(--r); }
  .prof { margin-top: -30px; }
  .pava { width: 72px; height: 72px; }
  .pname { font-size: 21px; }
  .h1 { font-size: 22px; }
  .nums { gap: 14px; }
  /* Тридцать кнопок на узком экране — это высокий блок ПЕРЕД текстом документа. Ужимаем пилюлю,
     но не ниже пальца: 32px по высоте — пол зоны нажатия, ниже опускаться нельзя. */
  .langs { gap: 6px; }
  .langs a { min-height: 32px; padding: 5px 11px; font-size: 12px; }
}
