/* PhotoMozg — общая тема сайта. Тетрадная клетка, маркер, ноль внешних запросов.
   Правится здесь, а не в HTML страниц: подключается как /assets/site.css */

:root{
  --paper:#f7f6f2;
  --grid:rgba(22,24,29,.055);
  --ink:#15171c;
  --muted:#5c6270;
  --rule:#e2e0d8;
  --card:#fffefb;
  --tg:#2aabee;
  --tg-ink:#fff;
  /* Фирменный градиент MAX: от голубого к фиолетовому. Значения сняты
     с логотипа max.ru; самый светлый край не берём — на нём не читается
     белый текст. */
  --max-a:#12a6ff;
  --max-b:#8419ff;
  --max-ink:#fff;
  --mark:#ffe27a;
  --mark-soft:rgba(255,226,122,.55);
  --shadow:0 1px 2px rgba(20,22,28,.05), 0 12px 32px -18px rgba(20,22,28,.35);
}
@media (prefers-color-scheme: dark){
  :root{
    --paper:#0f1116; --grid:rgba(255,255,255,.05); --ink:#e9ebf0; --muted:#98a0b0;
    --rule:#252932; --card:#161923; --tg:#38a9e8; --tg-ink:#06222f;
    --max-a:#3bb4ff; --max-b:#9436ff; --max-ink:#fff;
    --mark:#f0c64a; --mark-soft:rgba(240,198,74,.22);
    --shadow:0 1px 2px rgba(0,0,0,.4), 0 18px 40px -22px rgba(0,0,0,.9);
  }
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0; color:var(--ink); background:var(--paper);
  font:17px/1.62 "Inter","Segoe UI",Roboto,-apple-system,BlinkMacSystemFont,Arial,sans-serif;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size:26px 26px;
  background-position:-1px -1px;
}
.wrap{max-width:1060px;margin:0 auto;padding:0 20px}
a{color:inherit}

/* ── шапка ───────────────────────────────────────────── */
.top{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:22px 0 6px}
.brand{display:flex;align-items:center;gap:10px;font-weight:700;letter-spacing:-.01em;
  text-decoration:none}
/* знак — аватарка бота (assets/logo.png, собирается из _tools/brand-source.jpg).
   Файл на белом фоне, поэтому скругление режем здесь, а не в самой картинке:
   так угол попадает на цвет страницы и в тёмной теме тоже. */
.brand img{
  width:30px;height:30px;border-radius:9px;display:block;flex:none;background:#fff;
}
/* Меню росло с каждой новой страницей и дважды ломало вёрстку: на 13 пунктах строка
   перестала помещаться в 1060px (замер 15.08.2026: шапка 1037px при поле 1020px),
   на 18 — уехала за экран телефона. Лечили переносом и прокруткой, но причина была
   не в CSS: в шапку складывали весь сайт. С 16.08.2026 здесь только шесть корней
   разделов, полный перечень страниц живёт в подвале (.fgrid). Переносить и
   прокручивать больше нечего — но правила ниже оставлены, они дешёвые и страхуют,
   если пунктов снова станет больше. */
.top nav{display:flex;align-items:center;justify-content:flex-end;
  flex-wrap:wrap;gap:10px 18px;min-width:0}
.top .go, .top nav a{
  font-size:15px;font-weight:600;text-decoration:none;color:var(--muted);
  border-bottom:1px solid var(--rule);padding-bottom:2px;
}
/* page — сама страница, true — раздел, внутри которого мы находимся */
.top nav a[aria-current]{color:var(--ink)}
.top nav a[aria-current="page"]{border-bottom-color:var(--ink)}

/* хлебные крошки */
.crumbs{font-size:13px;color:var(--muted);padding:14px 0 0}
.crumbs a{text-decoration:none;border-bottom:1px solid var(--rule)}
.crumbs span{margin:0 7px;opacity:.6}

/* ── герой ───────────────────────────────────────────── */
.hero{display:grid;grid-template-columns:1.05fr .95fr;gap:46px;align-items:center;
      padding:44px 0 26px}
h1{
  font-size:clamp(30px,4.6vw,50px); line-height:1.06; letter-spacing:-.028em;
  font-weight:800; margin:0 0 20px;
}
/* Маркер по тексту. Раньше правило было привязано к h1, но приём тот же и в
   призыве над кнопками, поэтому селектор общий — в заголовках ничего не
   меняется. */
.mk{
  background:linear-gradient(transparent 62%, var(--mark) 62%);
  padding:0 .06em; box-decoration-break:clone; -webkit-box-decoration-break:clone;
}
.lead{font-size:18px;color:var(--muted);margin:0 0 28px;max-width:34em}
.cta-row{display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.btn{
  display:inline-flex;align-items:center;gap:10px;background:var(--tg);color:var(--tg-ink);
  text-decoration:none;font-weight:700;font-size:17px;padding:15px 24px;border-radius:12px;
  box-shadow:var(--shadow); transition:transform .12s ease;
}
.btn:hover{transform:translateY(-1px)}
.btn:active{transform:translateY(0)}
.btn svg{width:19px;height:19px;flex:none}
/* Вторая кнопка — тот же бот, но в MAX. Отличается только фирменным
   градиентом, чтобы мессенджер узнавался с первого взгляда. */
.btn-max{background:linear-gradient(135deg,var(--max-a) 0%,var(--max-b) 100%);color:var(--max-ink)}
/* Призыв над кнопками. Плашкой его делать нельзя: заливка со скруглением и
   тенью читается как кнопка, а нажать её нельзя — это раздражает. Поэтому
   обычный текст, выделенный маркером: заметно, но очевидно не элемент
   управления. order:-1 поднимает строку над кнопками, не трогая разметку. */
.cta-note{
  flex-basis:100%; order:-1; margin:0;
  font-size:21px; font-weight:800; line-height:1.2; letter-spacing:-.022em;
  color:var(--ink);
}
/* В заголовке маркер закрашивает только низ строки — на 50px это читается.
   На 21px так не работает: в тёмной теме светлый текст ложится на жёлтую
   полосу и превращается в кашу. Поэтому здесь маркер сплошной, а текст —
   тёмный в обеих темах (сам маркер светло-жёлтый и там, и там).
   Скругление почти нулевое и без тени: это выделенный текст, а не кнопка. */
.cta-note .mk{
  background:var(--mark); color:#15171c;
  padding:.1em .3em; border-radius:3px;
}

/* ── телефон с перепиской ────────────────────────────── */
.phone{
  justify-self:center;width:100%;max-width:320px;border:1px solid var(--rule);
  border-radius:26px;background:var(--card);padding:14px 12px 16px;box-shadow:var(--shadow);
}
.phone .bar{display:flex;align-items:center;gap:8px;padding:2px 6px 12px;
  border-bottom:1px solid var(--rule);margin-bottom:12px}
.phone .ava{width:26px;height:26px;border-radius:50%;background:var(--tg);flex:none}
.phone .who{font-size:14px;font-weight:700;line-height:1.2}
.phone .who span{display:block;font-size:11px;color:var(--muted);font-weight:500}
.msg{max-width:86%;padding:9px 12px;border-radius:14px;font-size:14px;line-height:1.5;margin-bottom:10px}
.msg.out{margin-left:auto;background:var(--tg);color:var(--tg-ink);border-bottom-right-radius:5px}
.msg.in{background:var(--paper);border:1px solid var(--rule);border-bottom-left-radius:5px}
.shot{
  border-radius:10px;overflow:hidden;border:1px solid rgba(255,255,255,.35);
  margin-bottom:6px;display:block;width:100%;
}
.msg.in b{display:block;font-size:11px;letter-spacing:.08em;text-transform:uppercase;
  color:var(--muted);margin-bottom:3px;font-weight:700}
.msg.in .step{margin:0 0 7px}
.msg.in .step:last-child{margin-bottom:0}
.fx{font-family:"Cambria Math",Georgia,serif;font-size:15px}

/* ── секции ──────────────────────────────────────────── */
section{padding:52px 0;border-top:1px solid var(--rule)}
.kicker{font-size:12px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);
  font-weight:700;margin:0 0 12px}
h2{font-size:clamp(23px,2.7vw,31px);line-height:1.15;letter-spacing:-.02em;font-weight:800;
   margin:0 0 26px;max-width:20em}
h3{font-size:18px;letter-spacing:-.01em;margin:0 0 8px}
p{margin:0 0 14px}
p:last-child{margin-bottom:0}

.feats{display:grid;grid-template-columns:repeat(2,1fr);gap:30px 40px}
.feat{position:relative;padding-top:16px;border-top:2px solid var(--ink)}
.feat .n{font-family:ui-monospace,"SF Mono",Consolas,monospace;font-size:12px;color:var(--muted);
  letter-spacing:.06em;display:block;margin-bottom:7px}
.feat b{display:block;font-size:18px;letter-spacing:-.01em;margin-bottom:6px}
.feat span.t{color:var(--muted);font-size:16px}

.chips{display:flex;flex-wrap:wrap;gap:9px;margin:0 0 22px}
.chip{border:1px solid var(--rule);background:var(--card);border-radius:999px;
  padding:7px 14px;font-size:15px;font-weight:600}
.hi{background:var(--mark-soft);padding:.05em .25em;border-radius:3px;font-weight:700}

.steps{list-style:none;margin:0;padding:0;position:relative;counter-reset:s}
.steps::before{content:"";position:absolute;left:17px;top:12px;bottom:12px;width:2px;
  background:var(--rule)}
.steps li{position:relative;padding:0 0 26px 54px}
.steps li:last-child{padding-bottom:0}
.steps li::before{
  content:counter(s);counter-increment:s;position:absolute;left:0;top:-2px;
  width:36px;height:36px;border-radius:50%;background:var(--ink);color:var(--paper);
  display:grid;place-items:center;font-weight:800;font-size:15px;
}
.steps b{display:block;margin-bottom:3px;font-size:17px}
.steps span{color:var(--muted)}

.note{
  border-left:3px solid var(--mark);background:var(--card);border-radius:0 14px 14px 0;
  padding:22px 24px;box-shadow:var(--shadow);
}
.pkgs{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px}
.pkg{border:1px solid var(--rule);background:var(--card);border-radius:12px;padding:12px 16px;
  min-width:112px}
.pkg b{display:block;font-size:19px;letter-spacing:-.01em}
.pkg span{font-size:13px;color:var(--muted)}

/* ── сравнение «решебник vs разбор» ──────────────────── */
.cmp{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.cmp > div{border:1px solid var(--rule);background:var(--card);border-radius:14px;padding:20px 22px}
.cmp .this{border-color:var(--ink);box-shadow:var(--shadow)}
.cmp .tag{font-size:12px;letter-spacing:.1em;text-transform:uppercase;font-weight:700;
  color:var(--muted);margin:0 0 10px}
.cmp .this .tag{color:var(--ink)}
.cmp ul{margin:0;padding-left:18px;color:var(--muted);font-size:16px}
.cmp li{margin-bottom:7px}
.cmp li:last-child{margin-bottom:0}

/* ── вопросы и ответы ────────────────────────────────── */
.faq{border-top:1px solid var(--rule)}
.faq details{border-bottom:1px solid var(--rule);padding:16px 0}
.faq summary{
  cursor:pointer;font-weight:700;font-size:17px;list-style:none;
  display:flex;justify-content:space-between;align-items:flex-start;gap:16px;
}
.faq summary::-webkit-details-marker{display:none}
.faq summary::after{content:"+";color:var(--muted);font-weight:400;font-size:22px;line-height:1}
.faq details[open] summary::after{content:"–"}
.faq .a{color:var(--muted);padding-top:10px;max-width:52em}

/* ── финальный призыв и подвал ───────────────────────── */
.final{
  margin:52px 0;background:var(--ink);color:var(--paper);border-radius:20px;
  padding:44px 34px;text-align:center;
}
/* В тёмной теме .final меняет фон на светлый --card, а цвет текста остаётся
   var(--paper) — который в тёмной теме сам тёмный. Заголовок и подпись
   получались почти невидимыми, поэтому здесь цвет переопределяется явно. */
@media (prefers-color-scheme: dark){
  .final{background:var(--card);border:1px solid var(--rule);color:var(--ink)}
}
.final h2{margin:0 auto 20px;max-width:16em;color:inherit}
.final .btn{background:var(--tg);color:#fff;margin:6px}
.final .btn-max{background:linear-gradient(135deg,var(--max-a) 0%,var(--max-b) 100%)}
.final .sub{font-size:14px;opacity:.7;margin-top:14px}

/* Подвал — карта сайта, а не строка ссылок. До 16.08.2026 здесь лежал тот же
   плоский список, что и в шапке: 18 верхних страниц получали по 42 внутренние
   ссылки каждая, а таблицы справочника, разборы и статьи — от одной до шести,
   то есть за пределы своего раздела не выходили вовсе. Теперь колонка на раздел
   и все страницы раздела внутри: единственное место, откуда на глубокие страницы
   идут сквозные ссылки. Собирается из _tools/pages.py, руками не правится. */
footer{border-top:1px solid var(--rule);padding:34px 0 40px;color:var(--muted);font-size:14px}
/* шесть колонок обязаны поместиться в одну строку при поле 1020px:
   (1020 − 5×20) / 6 = 153px, поэтому минимум 150px, не больше */
.fgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:26px 20px}
.fcol .fh{
  font-size:12px;letter-spacing:.1em;text-transform:uppercase;font-weight:700;
  color:var(--ink);margin:0 0 11px;
}
.fcol .fh a{text-decoration:none;border-bottom:1px solid var(--rule)}
.fcol ul{list-style:none;margin:0;padding:0}
.fcol li{margin:0 0 7px;line-height:1.35}
.fcol a{text-decoration:none;border-bottom:1px solid transparent}
.fcol a:hover{border-bottom-color:var(--rule)}
.fcol a[aria-current="page"]{color:var(--ink);font-weight:600}
.fbot{
  display:flex;justify-content:space-between;align-items:center;gap:14px;flex-wrap:wrap;
  margin-top:30px;padding-top:18px;border-top:1px solid var(--rule);
}
.fbot a{text-decoration:none;border-bottom:1px solid var(--rule)}
.fbrand a{font-weight:700;color:var(--ink);border-bottom-color:var(--rule)}

/* ссылка для клавиатуры и скринридера: видна только при фокусе */
.skip{
  position:absolute;left:-9999px;top:0;z-index:10;
  background:var(--ink);color:var(--paper);padding:10px 16px;border-radius:0 0 10px 0;
  text-decoration:none;font-weight:700;font-size:15px;
}
.skip:focus{left:0}

/* ---- справочные таблицы -------------------------------------------------
   Появились со страницами-справочниками (таблица квадратов и др.). Главное
   требование: таблица 11 колонок должна помещаться в телефон. Решение —
   собственная горизонтальная прокрутка у обёртки, а не у всей страницы,
   плюс липкий первый столбец, чтобы не терять, в какой ты строке. */
.tbl-wrap{
  overflow-x:auto; -webkit-overflow-scrolling:touch;
  border:1px solid var(--rule); border-radius:14px; background:var(--card);
  box-shadow:var(--shadow); margin:0 0 14px;
}
.tbl{border-collapse:collapse; width:100%; font-variant-numeric:tabular-nums}
.tbl caption{
  caption-side:top; text-align:left; padding:14px 18px 10px;
  color:var(--muted); font-size:14px;
}
.tbl th,.tbl td{
  padding:9px 10px; text-align:center; border-top:1px solid var(--rule);
  font-family:ui-monospace,"SF Mono",Consolas,monospace; font-size:15px; white-space:nowrap;
}
.tbl th{font-weight:700; color:var(--muted); background:var(--paper)}
.tbl tr:first-child th{border-top:0}
.tbl td{color:var(--ink)}
.tbl tbody tr:hover td{background:var(--mark-soft)}
/* первый столбец — десятки: держим его на месте при горизонтальной прокрутке */
.tbl-sq th:first-child{position:sticky; left:0; z-index:1; border-right:1px solid var(--rule)}

/* формульная таблица в два столбца (производные, интегралы). Отличие от числовой:
   формулы читаются слева направо, поэтому выравнивание по левому краю, а не по центру,
   и колонки фиксированной ширины — иначе первая схлопывается до «x» и таблица едет. */
.tbl-fx th,.tbl-fx td{text-align:left; padding:9px 16px; width:50%}
.tbl-fx td:first-child{color:var(--muted)}
.tbl-fx sup,.tbl-fx sub{font-size:11px}

/* Текстовая таблица: правило и примеры к нему, условие задачи и её разбор.
   Отличие от числовой и формульной — содержимое длинное и состоит из слов, а не
   из символов. У .tbl стоит white-space:nowrap (иначе формула рвётся посередине),
   и на длинной строке это уводило вторую колонку за край экрана: на десктопе было
   видно «ошибка…», «плать…», остальное пряталось в горизонтальную прокрутку.
   Поймано глазами в браузере 16.08.2026 — замеры страницы этого не показывали,
   потому что формально прокрутка есть и переполнения страницы нет. */
.tbl-txt th,.tbl-txt td{
  white-space:normal; text-align:left; padding:10px 16px;
  font-family:inherit; font-size:16px; line-height:1.5;
}
.tbl-txt td:first-child{width:42%; color:var(--ink)}
.tbl-txt td:last-child{color:var(--muted)}
@media (max-width:860px){
  .tbl-txt th,.tbl-txt td{padding:9px 12px; font-size:15px}
  .tbl-txt td:first-child{width:38%}
}
/* Многоколоночная текстовая таблица: таблица Менделеева, гнёзда разбора, разборы формул.
   У .tbl-txt первая колонка занимает 42% — это верно для двухколоночной пары
   «правило → примеры», но на семи-восьми колонках первая раздувается на треть ширины,
   а остальные жмутся. Поймано глазами в браузере 16.08.2026: номер элемента занимал
   столько же места, сколько название и масса вместе. */
.tbl-grid td:first-child,.tbl-grid th:first-child{width:auto}
.tbl-grid th,.tbl-grid td{padding:8px 12px}
@media (max-width:860px){
  .tbl-grid td:first-child{width:auto}
}

/* компактная сетка «число → квадрат» для тех значений, что учат наизусть */
.sqgrid{
  display:grid; grid-template-columns:repeat(auto-fill,minmax(84px,1fr)); gap:8px; margin:0 0 14px;
}
.sqgrid > div{
  border:1px solid var(--rule); background:var(--card); border-radius:10px;
  padding:9px 10px; display:flex; align-items:baseline; justify-content:space-between; gap:8px;
}
.sqgrid b{font-size:14px; color:var(--muted); font-weight:600}
.sqgrid span{
  font-family:ui-monospace,"SF Mono",Consolas,monospace; font-size:16px; font-weight:700;
}
/* сетка словарных слов: те же карточки, что у квадратов, но ячейка под слово, а не под
   число — шире по минимуму и без выключки по краям */
.sqgrid-w{grid-template-columns:repeat(auto-fill,minmax(150px,1fr))}
.sqgrid-w > div{justify-content:flex-start}
.sqgrid-w span{font-family:inherit; font-size:16px; font-weight:600}

.tbl-note{color:var(--muted); font-size:14px; margin:0 0 26px}

@media (max-width:860px){
  body{font-size:16px}
  /* Меню на телефоне: своя строка во всю ширину и выключка влево.

     Почему именно так, чтобы не сломать это снова. Пока меню стояло на одной
     строке с логотипом (182px на ленту) и наследовало justify-content:flex-end,
     переполнение у флекса уходило за НАЧАЛО строки: ссылки стояли на x от −1026
     до −70, scrollWidth равнялся clientWidth — прокручивать было нечего, и часть
     пунктов оказывалась недостижима. Замеры высоты шапки этого не ловили: 58px,
     всё «в порядке»; поймано глазами в браузере 16.08.2026.

     Сейчас пунктов шесть и они помещаются, но правило оставлено: оно и есть
     страховка на случай, если разделов снова станет больше. */
  .top{flex-wrap:wrap;gap:4px 12px;padding:16px 0 6px}
  .top nav{
    width:100%;justify-content:flex-start;
    gap:16px;flex-wrap:nowrap;overflow-x:auto;max-width:100%;padding-bottom:2px;
    scrollbar-width:none;-ms-overflow-style:none;
  }
  .top nav::-webkit-scrollbar{display:none}
  .top nav a{white-space:nowrap}
  .hero{grid-template-columns:1fr;gap:34px;padding:30px 0 8px}
  .phone{max-width:300px;order:2}
  .feats{grid-template-columns:1fr;gap:26px}
  .cmp{grid-template-columns:1fr}
  section{padding:40px 0}
  .final{padding:34px 22px;border-radius:16px}
  .tbl th,.tbl td{padding:7px 8px; font-size:14px}
  .tbl caption{padding:12px 14px 8px; font-size:13px}
  .sqgrid{grid-template-columns:repeat(auto-fill,minmax(76px,1fr)); gap:6px}
}
/* на узком экране ссылка на бота в шапке дублирует кнопку первого экрана — прячем,
   иначе меню из трёх разделов + @photomozgbot не помещается в строку */
@media (max-width:560px){
  .top .go{display:none}
}
