/* /icons/ — «Иконки для презентаций». Школьная тема (design-systems/school.md):
   SF Pro, акцент #ff383b, фон #f2f2fa, радиусы 8/14/20/28/pill.
   Иконочный @font-face живёт в <head> index.php (файл зависит от режима). */

@font-face {
  font-family: 'SF Pro';
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/SF-Pro-VF.woff2') format('woff2-variations'),
       url('/assets/fonts/SF-Pro-VF.woff2') format('woff2');
}

:root {
  --accent: #ff383b;
  --accent-text: #e0242a; /* акцент для ТЕКСТА на белом/светлом: ≥4.5:1 (WCAG AA) */
  --bg: #f2f2fa;
  --card-bg: #ffffff;
  --text-primary: #151515;
  --text-muted: #525252;
  --text-soft: #afafaf;
  --gutter: 32px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font: 'SF Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
@media (max-width: 640px) { :root { --gutter: 16px; } }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
}

/* Ширина и боковые поля — как у контейнера меню в header.html
   (max-width 1640 + 32px, на мобильных 16px): страница стоит вровень с шапкой. */
.ik-main {
  max-width: 1640px;
  margin: 0 auto;
  padding: 24px var(--gutter) 64px;
}

/* ---------------------------------------------------------------- герой */

/* Герой живёт в правой колонке (эксперимент 2026-09-11): верхний отступ не нужен,
   H1 стоит вровень с верхом панели настроек. */
.ik-hero { padding: 0 0 8px; }

.ik-hero h1 {
  font-size: clamp(28px, 4.4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 0 0 12px;
}

.ik-lead {
  max-width: 74ch;
  color: var(--text-muted);
  margin: 0 0 20px;
}

/* Поиск-пилюля по референсу Google Fonts: лупа слева, без кнопки (поиск живой),
   на всю ширину колонки иконок. */
.ik-searchrow { display: flex; gap: 10px; align-items: center; }

.ik-search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 58px;
  padding: 0 24px;
  background: var(--card-bg);
  border: 1.5px solid transparent;
  border-radius: 9999px;
}
.ik-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 6px 24px rgba(21, 21, 21, 0.06);
}

.ik-search__icon { flex: 0 0 auto; color: var(--text-soft); }
.ik-search:focus-within .ik-search__icon { color: var(--text-primary); }

.ik-search__input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 17px;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  outline: none;
  padding: 0;
  height: 100%;
}
.ik-search__input::placeholder { color: var(--text-soft); }
.ik-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }

.ik-badges {
  color: var(--text-muted); /* не text-soft: 14px-текст на --bg должен держать 4.5:1 */
  font-size: 14px;
  margin: 14px 0 0;
}

/* ---------------------------------------------------------------- секции */

.ik-section { margin-top: 40px; }
/* Офф-скрин секции хаба и SEO-блоки не считаем layout'ом до прокрутки:
   на хабе это ~-1.3 с Rendering-времени на мобильном. Размер-заглушка
   уточняется браузером после первого показа (auto). */
.ik-section, .ik-text { content-visibility: auto; contain-intrinsic-size: auto 520px; }
.ik-results { margin-top: 24px; }

.ik-h2 {
  font-size: clamp(21px, 2.6vw, 28px);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
}

.ik-intro {
  color: var(--text-muted);
  max-width: 78ch;
  margin: 0 0 16px;
}

/* ------------------------------------------------------------------ сетка */

.ik-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.ic {
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 6px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-primary);
  cursor: pointer;
  min-height: 112px;
}
.ic:hover { background: #fff; box-shadow: 0 6px 20px rgba(21, 21, 21, 0.07); }
.ic:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.ms {
  font-family: var(--ms-family, 'MS-sub');
  font-weight: normal;
  font-style: normal;
  font-size: var(--glyph-size, 48px);
  line-height: 1;
  color: var(--ic-color, var(--text-primary));
  font-variation-settings:
    'FILL' var(--fill, 0), 'wght' var(--wght, 400),
    'GRAD' var(--grad, 0), 'opsz' var(--opsz, 24);
  -webkit-font-smoothing: antialiased;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
}

/* Режим «значок»: цветная подложка под глифом (превью в сетке и панели).
   Глиф — текстовый узел, поэтому подложке нужен z-index:-1 внутри стекового
   контекста .ms (z-index:0), иначе она ляжет ПОВЕРХ глифа. */
.ms { z-index: 0; }
.ik-badged .ms::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--badge-color, #FF383B);
  border-radius: var(--badge-radius, 0);
}
.ik-badged .ms { font-size: calc(var(--glyph-size, 48px) * var(--badge-k, 0.6)); }

/* Светлая иконка без подложки — тёмные карточки, иначе её не видно (§6.3) */
.ik-dark-cells .ic, .ik-dark-cells .ik-text .ic { background: #151515; }
.ik-dark-cells .ic:hover { background: #1e1e1e; }
.ik-dark-cells .ic__t { color: #9a9a9a; }
.ik-dark-cells .ik-p-preview { background: #151515; }

.ic.is-sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.ik-fontwait .ik-grid { opacity: 0.4; transition: opacity 0.2s; }

.ic__t {
  font-size: 12px;
  line-height: 1.25;
  color: var(--text-muted);
  text-align: center;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.ik-more { margin: 14px 0 0; }
.ik-more__link {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-text);
  text-decoration: none;
  background: var(--card-bg);
  border-radius: 9999px;
  padding: 10px 20px;
}
.ik-more__link:hover { box-shadow: 0 6px 20px rgba(21, 21, 21, 0.07); }

.ik-zero { color: var(--text-muted); max-width: 70ch; }
.ik-back { margin-top: 20px; }
.ik-back a { color: var(--text-muted); }

/* -------------------------------------------------------------- SEO-блоки */

.ik-seo { margin-top: 56px; }

.ik-text {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 28px clamp(20px, 3vw, 36px);
  margin-top: 20px;
}

.ik-text h2 {
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}
.ik-text h3 { font-size: 18px; margin: 20px 0 8px; }
.ik-text p { margin: 0 0 12px; max-width: 84ch; }
.ik-text ol { margin: 0 0 12px; padding-left: 22px; }
.ik-text li { margin-bottom: 6px; }
.ik-text a { color: var(--accent-text); }
.ik-text .ik-grid { margin: 14px 0 18px; }
.ik-text .ic { background: var(--bg); }
.ik-text .ic:hover { background: var(--bg); }

.ik-tablewrap { overflow-x: auto; }
.ik-table { border-collapse: collapse; min-width: 480px; font-size: 15px; }
.ik-table th, .ik-table td {
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid #ececf4;
}
.ik-table th { color: var(--text-muted); font-weight: 600; }

.ik-faq {
  border-bottom: 1px solid #ececf4;
  padding: 4px 0;
}
.ik-faq summary {
  font-weight: 600;
  padding: 10px 0;
  cursor: pointer;
  list-style-position: inside;
}
.ik-faq summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ik-faq p { padding: 0 0 12px; color: var(--text-muted); }

.ik-links ul { margin: 0; padding-left: 22px; }
.ik-links li { margin-bottom: 8px; }

/* --------------------------------------------------------------- адаптив */

@media (max-width: 640px) {
  body { font-size: 16px; }
  .ik-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
  .ic { min-height: 100px; padding: 10px 4px 8px; }
  .ms { font-size: 40px; }
  .ik-searchrow { flex-wrap: wrap; }
  .ik-search { height: 52px; padding: 0 18px; }
}

/* ================================================================ M3–M4:
   раскладка с левой панелью, панели, контролы, тосты. */

.ik-layout { display: flex; gap: 24px; align-items: flex-start; }
.ik-content { flex: 1; min-width: 0; }

.ik-sort {
  font: inherit;
  padding: 12px 14px;
  border: 1.5px solid #e2e2ee;
  border-radius: var(--radius-md);
  background: var(--card-bg);
  color: var(--text-primary);
}
.ik-open-settings {
  display: none;
  font: inherit; font-weight: 600;
  padding: 12px 18px;
  border: 1.5px solid #e2e2ee;
  border-radius: 9999px;
  background: var(--card-bg);
  cursor: pointer;
}
.ik-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.ik-noscript { color: var(--text-muted); background: var(--card-bg); border-radius: var(--radius-md); padding: 10px 14px; }

/* --------------------------------------------------------- левая панель */

.ik-settings {
  width: 300px;
  flex: 0 0 300px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}
.ik-s-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ik-s-head strong { font-size: 17px; flex: 1; }
.ik-s-reset {
  font: 600 13px var(--font); color: var(--accent-text);
  background: none; border: 0; cursor: pointer; padding: 4px 0;
}
.ik-s-close { display: none; font: 16px var(--font); background: none; border: 0; cursor: pointer; color: var(--text-muted); }

.ik-ctl { padding: 10px 0; border-top: 1px solid #f0f0f6; position: relative; }
.ik-ctl:first-of-type { border-top: 0; }
.ik-row { display: flex; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.ik-row output { font-weight: 600; color: var(--text-muted); font-size: 14px; }
.ik-note { font-size: 12px; color: var(--text-soft); margin: 6px 0 0; }

.ik-hint {
  display: inline-block; cursor: help; color: var(--text-soft);
  font-weight: 400; margin-left: 2px;
}
/* Подсказка (JS вставляет .ik-tip внутрь .ik-ctl): на всю ширину блока,
   чтобы панель настроек не резала её своим overflow. */
.ik-tip {
  position: absolute; left: 0; right: 0; z-index: 40;
  padding: 10px 12px;
  background: #151515; color: #fff;
  font: 400 13px/1.4 var(--font);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 28px rgba(21,21,21,0.25);
}

/* ползунки */
input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; }

/* переключатель-чекбокс */
.ik-toggle { appearance: none; width: 44px; height: 26px; border-radius: 9999px; background: #e2e2ee; position: relative; cursor: pointer; transition: background 0.15s; }
.ik-toggle:checked { background: var(--accent); }
.ik-toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.ik-toggle:checked::after { left: 21px; }
.ik-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* сегменты (стиль, форма подложки) */
.ik-seg { display: flex; gap: 6px; flex-wrap: wrap; }
.ik-seg button {
  font: 600 13px var(--font); color: var(--text-muted);
  background: var(--bg); border: 0; border-radius: 9999px;
  padding: 8px 12px; cursor: pointer;
}
.ik-seg button.is-on { background: var(--accent); color: #fff; }
.ik-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* доп-блок подложки: цвет и «иконка внутри» не должны липнуть к кнопкам форм.
   display:grid перебивал бы атрибут hidden — возвращаем ему силу явно. */
/* minmax(0,1fr): без явного трека grid растягивался по max-content детей
   и распирал панель вширь (скролл влево-вправо на мобильном) */
#ik-bg-extra { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 12px; }
#ik-bg-extra[hidden] { display: none; }
#ik-bg-extra .ik-row { margin-bottom: 0; }

/* цвет: круглая кнопка-пипетка + HEX-поле (свотчи-пресеты убраны — решение Миши) */
.ik-colorline { display: flex; gap: 10px; align-items: center; }
.ik-colorline input[type="color"] {
  width: 38px; height: 38px; flex: 0 0 38px;
  border: 1.5px solid #e2e2ee; border-radius: 50%;
  background: var(--card-bg); padding: 0; cursor: pointer;
  appearance: none; -webkit-appearance: none; overflow: hidden;
}
.ik-colorline input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.ik-colorline input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.ik-colorline input[type="color"]::-moz-color-swatch { border: 0; border-radius: 50%; }
.ik-colorline input[type="text"] { flex: 1; min-width: 0; font: 14px var(--font); padding: 8px 10px; border: 1.5px solid #e2e2ee; border-radius: var(--radius-sm); text-transform: uppercase; }

/* чипы категорий в панели: по одному на строку, ширина — по содержимому */
.ik-cats { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.ik-cat {
  font: 500 13px var(--font); color: var(--text-primary);
  background: var(--bg); border: 0; border-radius: 9999px;
  padding: 7px 11px; cursor: pointer;
}
.ik-cat i { font-style: normal; color: var(--text-soft); font-size: 11px; }
.ik-cat.is-on { background: var(--accent); color: #fff; }
.ik-cat.is-on i { color: rgba(255,255,255,0.75); }

/* --------------------------------------------------------- панель иконки */

.ik-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1300;
  width: min(400px, 100vw);
  background: var(--card-bg);
  box-shadow: -12px 0 40px rgba(21,21,21,0.12);
  padding: 16px 20px 24px;
  overflow-y: auto;
  transform: translateX(105%);
  transition: transform 0.2s ease;
}
.ik-panel.is-open { transform: none; }
.ik-p-head { display: flex; justify-content: flex-end; gap: 6px; }
.ik-p-ico { font: 15px var(--font); background: var(--bg); border: 0; border-radius: 50%; width: 34px; height: 34px; cursor: pointer; }
.ik-p-titlerow { display: flex; align-items: center; gap: 8px; }
.ik-p-titlerow h2 { font-size: 22px; margin: 4px 0 0; flex: 1; }
.ik-p-name { color: var(--text-soft); font-size: 13px; margin: 2px 0 12px; }
.ik-p-preview {
  display: flex; align-items: center; justify-content: center;
  background: conic-gradient(#f4f4fa 25%, #fff 0 50%, #f4f4fa 0 75%, #fff 0) 0 0/24px 24px;
  border: 1.5px solid #ececf4; border-radius: var(--radius-md);
  height: 220px; margin-bottom: 8px;
}
.ik-p-preview .ms { --glyph-size: 160px; width: 180px; height: 180px; }
.ik-sizes { display: flex; gap: 8px; }
.ik-sizes button { width: 40px; font: 18px var(--font); border: 1.5px solid #e2e2ee; background: var(--card-bg); border-radius: var(--radius-sm); cursor: pointer; }
.ik-sizes input { flex: 1; min-width: 0; font: 16px var(--font); text-align: center; padding: 9px; border: 1.5px solid #e2e2ee; border-radius: var(--radius-sm); }
.ik-presets { display: flex; gap: 6px; margin-top: 8px; }
.ik-presets button { font: 13px var(--font); background: var(--bg); border: 0; border-radius: 9999px; padding: 6px 11px; cursor: pointer; }

.ik-p-actions { margin: 14px 0 6px; display: grid; gap: 8px; }
.ik-p-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ik-btn {
  font: 600 16px var(--font); color: #fff;
  background: var(--accent); border: 0; border-radius: 9999px;
  padding: 13px 16px; cursor: pointer; min-height: 48px;
}
.ik-btn:hover { filter: brightness(0.94); }
.ik-btn small { display: block; font: 400 11px var(--font); opacity: 0.85; margin-top: 2px; }
.ik-btn--ghost { background: var(--card-bg); color: var(--text-primary); border: 1.5px solid #e2e2ee; }
.ik-btn--ghost small { color: var(--text-muted); }
.ik-btn.is-busy { opacity: 0.5; pointer-events: none; }
.ik-btn:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }

.ik-p-when { color: var(--text-muted); font-size: 14px; margin: 10px 0; }
.ik-p-syn { display: flex; flex-wrap: wrap; gap: 6px; }
.ik-syn { font: 500 13px var(--font); background: var(--bg); border: 0; border-radius: 9999px; padding: 6px 11px; cursor: pointer; color: var(--text-primary); }
.ik-syn:hover { background: #e9e9f2; }
.ik-p-catrow { font-size: 14px; color: var(--text-muted); margin: 12px 0; }
.ik-p-simwrap .ik-row { margin: 6px 0; }
.ik-p-sim { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.ik-p-sim .ic { min-height: 92px; background: var(--bg); }
.ik-p-note { font-size: 12px; color: var(--text-soft); margin-top: 16px; }

/* --------------------------------------------------------------- прочее */

.ik-overlay {
  position: fixed; inset: 0; z-index: 1250;
  background: rgba(21,21,21,0.35);
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.ik-overlay.is-show { opacity: 1; pointer-events: auto; }

.ik-toasts { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 1400; display: grid; gap: 8px; justify-items: center; }
.ik-toast {
  background: #151515; color: #fff;
  font: 500 14px var(--font);
  padding: 12px 18px; border-radius: 9999px;
  box-shadow: 0 8px 32px rgba(21,21,21,0.25);
  opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s;
  max-width: min(90vw, 60ch); text-align: center;
}
.ik-toast.is-show { opacity: 1; transform: none; }
.ik-toast.is-err { background: var(--accent); }

#ik-sentinel { height: 1px; }

/* --------------------------------------------------- адаптив панелей */

@media (max-width: 1199px) {
  .ik-open-settings { display: inline-block; }
  .ik-settings {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1300;
    width: min(340px, 92vw); max-height: none; border-radius: 0;
    transform: translateX(-105%); transition: transform 0.2s ease;
  }
  .ik-settings.is-open { transform: none; }
  .ik-s-close { display: block; }
}

@media (max-width: 640px) {
  .ik-settings {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%;
    max-height: 82vh; border-radius: 28px 28px 0 0;
    transform: translateY(105%);
  }
  .ik-settings.is-open { transform: none; }
  .ik-panel {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%;
    max-height: 88vh; border-radius: 28px 28px 0 0;
    transform: translateY(105%);
  }
  .ik-panel.is-open { transform: none; }
  .ik-sort, .ik-open-settings { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .ik-panel, .ik-settings, .ik-overlay, .ik-toast, .ik-toggle, .ik-toggle::after { transition: none; }
}
